From: Kuninori Morimoto Date: Thu, 20 Jan 2011 02:45:34 +0000 (+0900) Subject: ASoC: ak4642: add SND_SOC_DAIFMT_FORMAT support X-Git-Tag: MMI-PSA29.97-13-9~16612^2~1226^2~48 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cb9c130aa97bd41887a0a391388ef4070caab4d9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ASoC: ak4642: add SND_SOC_DAIFMT_FORMAT support This patch support LEFT_J / I2S only for now Signed-off-by: Kuninori Morimoto Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index f00eba313dfd..4be0570e3f1f 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -116,6 +116,12 @@ #define BCKO_MASK (1 << 3) #define BCKO_64 BCKO_MASK +#define DIF_MASK (3 << 0) +#define DSP (0 << 0) +#define RIGHT_J (1 << 0) +#define LEFT_J (2 << 0) +#define I2S (3 << 0) + /* MD_CTL2 */ #define FS0 (1 << 0) #define FS1 (1 << 1) @@ -354,6 +360,24 @@ static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) snd_soc_update_bits(codec, PW_MGMT2, MS, data); snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko); + /* format type */ + data = 0; + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_LEFT_J: + data = LEFT_J; + break; + case SND_SOC_DAIFMT_I2S: + data = I2S; + break; + /* FIXME + * Please add RIGHT_J / DSP support here + */ + default: + return -EINVAL; + break; + } + snd_soc_update_bits(codec, MD_CTL1, DIF_MASK, data); + return 0; } diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index 56cd34223100..a722a4c661ff 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -26,7 +26,8 @@ static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dai *dai = rtd->codec_dai; int ret; - ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM); + ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_LEFT_J | + SND_SOC_DAIFMT_CBM_CFM); if (ret < 0) return ret;