diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-11-16 01:17:43 -0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-20 15:11:21 +0900 |
commit | 3449f5fab8c51e37a8a48bc2516588c615373191 (patch) | |
tree | e329930dc4dca151a94f1f9ffde41a6446fa9f8b /sound/soc/sh/fsi.c | |
parent | 2522acd28a8558d53f5404054d256c3dbf00b6d2 (diff) | |
download | talos-obmc-linux-3449f5fab8c51e37a8a48bc2516588c615373191.tar.gz talos-obmc-linux-3449f5fab8c51e37a8a48bc2516588c615373191.zip |
ASoC: fsi: add SND_SOC_DAIFMT_INV_xxx support
Current FSI driver is using platform information pointer,
but it is not good design for DT support.
This patch adds SND_SOC_DAIFMT_INV_xxx support,
and it is possible to independent from platform information pointer.
Old type SH_FSI_xxx_INV is still supported,
but it will be removed soon.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh/fsi.c')
-rw-r--r-- | sound/soc/sh/fsi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 22037f1c76fb..e74c4ebc957a 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -267,6 +267,8 @@ struct fsi_priv { int clk_cpg:1; int spdif:1; int enable_stream:1; + int bit_clk_inv:1; + int lr_clk_inv:1; long rate; }; @@ -1645,6 +1647,16 @@ static int fsi_hw_startup(struct fsi_priv *fsi, /* clock inversion (CKG2) */ data = 0; + if (fsi->bit_clk_inv) + data |= (1 << 0); + if (fsi->lr_clk_inv) + data |= (1 << 4); + if (fsi_is_clk_master(fsi)) + data <<= 8; + /* FIXME + * + * SH_FSI_xxx_INV style will be removed + */ if (SH_FSI_LRM_INV & flags) data |= 1 << 12; if (SH_FSI_BRM_INV & flags) @@ -1796,6 +1808,27 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } + /* set clock inversion */ + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_IF: + fsi->bit_clk_inv = 0; + fsi->lr_clk_inv = 1; + break; + case SND_SOC_DAIFMT_IB_NF: + fsi->bit_clk_inv = 1; + fsi->lr_clk_inv = 0; + break; + case SND_SOC_DAIFMT_IB_IF: + fsi->bit_clk_inv = 1; + fsi->lr_clk_inv = 1; + break; + case SND_SOC_DAIFMT_NB_NF: + default: + fsi->bit_clk_inv = 0; + fsi->lr_clk_inv = 0; + break; + } + if (fsi_is_clk_master(fsi)) { /* * CAUTION |