diff options
author | Inha Song <ideal.song@samsung.com> | 2014-10-23 17:13:19 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 12:01:04 +0900 |
commit | 4baa28ed25bf2cefc4bdd527b57d31c25a3c21b1 (patch) | |
tree | cdb2de86aa7d85dce04539a13ea458042985db2b | |
parent | 93f6ea8d828456704d7889dd2b6088804dbb6ece (diff) | |
download | linux-3.10-4baa28ed25bf2cefc4bdd527b57d31c25a3c21b1.tar.gz linux-3.10-4baa28ed25bf2cefc4bdd527b57d31c25a3c21b1.tar.bz2 linux-3.10-4baa28ed25bf2cefc4bdd527b57d31c25a3c21b1.zip |
ASoC: samsung: Add XUSBXTI power state control function for BT call when sleep state
This patch add XUSBXTI power-state control function for BT call when sleep state.
When sound codec is enabled and entering sleep mode, XUSBXTI_SYS_PWR_REG must be
set to enables for BT call.
Change-Id: I5b385aad102e19c38d048609d99736ba13336253
Signed-off-by: Inha Song <ideal.song@samsung.com>
-rw-r--r-- | sound/soc/samsung/rinato_ymu831.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sound/soc/samsung/rinato_ymu831.c b/sound/soc/samsung/rinato_ymu831.c index 08bd8bfd44e..dbbadaaabc3 100644 --- a/sound/soc/samsung/rinato_ymu831.c +++ b/sound/soc/samsung/rinato_ymu831.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__ #include <linux/clk.h> +#include <linux/mfd/syscon.h> #include <linux/delay.h> #include <linux/gpio.h> #include <linux/input.h> @@ -32,15 +33,13 @@ #include <sound/pcm_params.h> #include "../codecs/ymu831/ymu831.h" -#ifdef CONFIG_TIZEN_WIP -/* - * FIXME: This function maintain power-on state of XUSBXTI clock - * to operate sound codec for BT call when sleep state . - */ -extern void exynos_sys_powerdown_xusbxti_control(bool enable); -#else -static void exynos_sys_powerdown_xusbxti_control(bool enable) {} -#endif +#define EXYNOS3_XUSBXTI_SYS_PWR_REG_OFFSET 0x1280 +#define EXYNOS3_XUSBXTI_SYS_PWR_CFG_MASK (1 << 0) + +enum { + DISABLE, + ENABLE +}; #define SND_SOC_DAPM_SPKMODE(wname, wevent) \ { .id = snd_soc_dapm_spk, .name = wname, .kcontrol_news = NULL, \ @@ -56,6 +55,8 @@ enum { struct rinato_ymu831 { struct snd_soc_jack jack; struct snd_soc_codec *codec; + struct regmap *reg_pmu; + struct clk *codec_mclk; struct clk *clk_32kHz; int gpio_mic_bias[MIC_MAX]; @@ -64,6 +65,18 @@ struct rinato_ymu831 { u32 mic_avail[MIC_MAX]; }; +/* + * This function maintain power-on state of XUSBXTI clock to operate + * sound codec for BT call when sleep state. + */ +static void exynos_sys_powerdown_xusbxti_control(struct rinato_ymu831 *machine, + bool enable) +{ + regmap_update_bits(machine->reg_pmu, EXYNOS3_XUSBXTI_SYS_PWR_REG_OFFSET, + EXYNOS3_XUSBXTI_SYS_PWR_CFG_MASK, + enable ? ENABLE : DISABLE); +} + static int rinato_hifi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -120,11 +133,12 @@ static struct snd_soc_dai_link machine_dai[] = { static int machine_card_suspend_post(struct snd_soc_card *card) { struct snd_soc_codec *codec = card->rtd->codec; + struct rinato_ymu831 *machine = snd_soc_card_get_drvdata(card); int suspended; suspended = ymu831_get_codec_suspended(codec); if (!suspended) - exynos_sys_powerdown_xusbxti_control(true); + exynos_sys_powerdown_xusbxti_control(machine, true); return 0; } @@ -132,11 +146,12 @@ static int machine_card_suspend_post(struct snd_soc_card *card) static int machine_card_resume_pre(struct snd_soc_card *card) { struct snd_soc_codec *codec = card->rtd->codec; + struct rinato_ymu831 *machine = snd_soc_card_get_drvdata(card); int suspended; suspended = ymu831_get_codec_suspended(codec); if (!suspended) - exynos_sys_powerdown_xusbxti_control(false); + exynos_sys_powerdown_xusbxti_control(machine, false); return 0; } @@ -202,6 +217,13 @@ static int rinato_ymu831_probe(struct platform_device *pdev) return -EINVAL; } + machine->reg_pmu = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, + "samsung,pmureg-phandle"); + if (IS_ERR(machine->reg_pmu)) { + dev_err(&pdev->dev, "failed to map PMU registers\n"); + return PTR_ERR(machine->reg_pmu); + } + machine->clk_32kHz = clk_get(&pdev->dev, "clk_32k"); if (IS_ERR(machine->clk_32kHz)) { dev_err(&pdev->dev, "failed to get codec 32k clock\n"); |