From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH v2 2/3] ASoC: sh: fsi: Fix clock inversion Date: Fri, 29 Jan 2016 16:52:06 +0100 Message-ID: References: <1421847492-8857-1-git-send-email-lars@metafoo.de> <1421847492-8857-2-git-send-email-lars@metafoo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <1421847492-8857-2-git-send-email-lars@metafoo.de> Sender: linux-renesas-soc-owner@vger.kernel.org To: Lars-Peter Clausen Cc: Mark Brown , Liam Girdwood , Kuninori Morimoto , Simon Horman , Magnus Damm , "linux-arm-kernel@lists.infradead.org" , ALSA Development Mailing List , linux-renesas-soc@vger.kernel.org List-Id: alsa-devel@alsa-project.org On Wed, Jan 21, 2015 at 2:38 PM, Lars-Peter Clausen wrote: > According to the sh7724 hardware user manual (Rev.2.00 Jan 2013) page 1851 > to 1856 the FSI bit-clock is inverted to the bit-clock as specified by the > I2S standard. This means the bit clock inversion bit should be set for a > normal I2S clock and should not be set for an inverted I2S clock. > > Similarly when operating in left-justfied mode both the frame-clock and the > bit-clock need to be inverted to be standards compliant. > > This means also that the exta clock inversion setting in the armadillo800eva > machine driver for CPU component should now be removed. > > Signed-off-by: Lars-Peter Clausen > --- > I don't have the hardware but I'd like to get rid of the extra > SND_SOC_DAIFMT_IB_NF in simple-card platform data, so we can remove the fmt > field. Kuninori can you check if this works? > > Changes since v1: > * Fix whitespace > --- > arch/arm/mach-shmobile/board-armadillo800eva.c | 1 - The board files are gone by now. > sound/soc/sh/fsi.c | 7 +++++++ Is this part still applicable? > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c > index 75de26c..36aaeb1 100644 > --- a/arch/arm/mach-shmobile/board-armadillo800eva.c > +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c > @@ -1015,7 +1015,6 @@ static struct asoc_simple_card_info fsi_wm8978_info = { > .platform = "sh_fsi2", > .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, > .cpu_dai = { > - .fmt = SND_SOC_DAIFMT_IB_NF, > .name = "fsia-dai", > }, > .codec_dai = { > diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c > index b87b22e..6783d3f 100644 > --- a/sound/soc/sh/fsi.c > +++ b/sound/soc/sh/fsi.c > @@ -1594,6 +1594,12 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd, > > static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) > { > + /* > + * FSI bit clock is inverted to the I2S specification, so we invert it > + * when a non-inverted I2S clock was requested and vice versa. > + */ > + fsi->bit_clk_inv = !fsi->bit_clk_inv; > + > switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { > case SND_SOC_DAIFMT_I2S: > fsi->fmt = CR_I2S; > @@ -1602,6 +1608,7 @@ static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) > case SND_SOC_DAIFMT_LEFT_J: > fsi->fmt = CR_PCM; > fsi->chan_num = 2; > + fsi->lr_clk_inv = !fsi->lr_clk_inv; > break; > default: > return -EINVAL; > -- > 1.8.0 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: geert@linux-m68k.org (Geert Uytterhoeven) Date: Fri, 29 Jan 2016 16:52:06 +0100 Subject: [PATCH v2 2/3] ASoC: sh: fsi: Fix clock inversion In-Reply-To: <1421847492-8857-2-git-send-email-lars@metafoo.de> References: <1421847492-8857-1-git-send-email-lars@metafoo.de> <1421847492-8857-2-git-send-email-lars@metafoo.de> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Jan 21, 2015 at 2:38 PM, Lars-Peter Clausen wrote: > According to the sh7724 hardware user manual (Rev.2.00 Jan 2013) page 1851 > to 1856 the FSI bit-clock is inverted to the bit-clock as specified by the > I2S standard. This means the bit clock inversion bit should be set for a > normal I2S clock and should not be set for an inverted I2S clock. > > Similarly when operating in left-justfied mode both the frame-clock and the > bit-clock need to be inverted to be standards compliant. > > This means also that the exta clock inversion setting in the armadillo800eva > machine driver for CPU component should now be removed. > > Signed-off-by: Lars-Peter Clausen > --- > I don't have the hardware but I'd like to get rid of the extra > SND_SOC_DAIFMT_IB_NF in simple-card platform data, so we can remove the fmt > field. Kuninori can you check if this works? > > Changes since v1: > * Fix whitespace > --- > arch/arm/mach-shmobile/board-armadillo800eva.c | 1 - The board files are gone by now. > sound/soc/sh/fsi.c | 7 +++++++ Is this part still applicable? > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c > index 75de26c..36aaeb1 100644 > --- a/arch/arm/mach-shmobile/board-armadillo800eva.c > +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c > @@ -1015,7 +1015,6 @@ static struct asoc_simple_card_info fsi_wm8978_info = { > .platform = "sh_fsi2", > .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, > .cpu_dai = { > - .fmt = SND_SOC_DAIFMT_IB_NF, > .name = "fsia-dai", > }, > .codec_dai = { > diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c > index b87b22e..6783d3f 100644 > --- a/sound/soc/sh/fsi.c > +++ b/sound/soc/sh/fsi.c > @@ -1594,6 +1594,12 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd, > > static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) > { > + /* > + * FSI bit clock is inverted to the I2S specification, so we invert it > + * when a non-inverted I2S clock was requested and vice versa. > + */ > + fsi->bit_clk_inv = !fsi->bit_clk_inv; > + > switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { > case SND_SOC_DAIFMT_I2S: > fsi->fmt = CR_I2S; > @@ -1602,6 +1608,7 @@ static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) > case SND_SOC_DAIFMT_LEFT_J: > fsi->fmt = CR_PCM; > fsi->chan_num = 2; > + fsi->lr_clk_inv = !fsi->lr_clk_inv; > break; > default: > return -EINVAL; > -- > 1.8.0 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds