Message ID | 1513702819-42310-2-git-send-email-nicoleotsuka@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 09947634829ccc5568a80ac02c3395a8b77276c1 |
Headers | show |
On 19.12.2017 18:00, Nicolin Chen wrote: > This patch replaces the register read with ssi->i2s_net for > simplification. It also removes masking SSIEN from scr value > since it's handled later by regmap_update_bits() to set this > scr value back. > > Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> > --- > sound/soc/fsl/fsl_ssi.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c > index aecd00f..ed2712b 100644 > --- a/sound/soc/fsl/fsl_ssi.c > +++ b/sound/soc/fsl/fsl_ssi.c > @@ -1051,9 +1051,7 @@ static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, > } > > /* The slot number should be >= 2 if using Network mode or I2S mode */ > - regmap_read(regs, REG_SSI_SCR, &val); > - val &= SSI_SCR_I2S_MODE_MASK | SSI_SCR_NET; > - if (val && slots < 2) { > + if (ssi->i2s_net && slots < 2) { > dev_err(dai->dev, "slot number should be >= 2 in I2S or NET\n"); > return -EINVAL; > } Are you sure that ssi->i2s_net SSI_SCR_I2S_MODE_MASK | SSI_SCR_NET bits (also known as SSI_SCR_I2S_NET_MASK) zero or non-zero status is always consistent with that in the SCR register? I can see that in fsl_ssi_hw_params() these bits in SCR are zeroed in a one special case and in the second special case they are hardcoded to SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET, in both cases regardless of what is currently in ssi->i2s_net. Maciej
On Mon, Jan 01, 2018 at 07:39:52PM +0100, Maciej S. Szmigiero wrote: > > /* The slot number should be >= 2 if using Network mode or I2S mode */ > > - regmap_read(regs, REG_SSI_SCR, &val); > > - val &= SSI_SCR_I2S_MODE_MASK | SSI_SCR_NET; > > - if (val && slots < 2) { > > + if (ssi->i2s_net && slots < 2) { > > dev_err(dai->dev, "slot number should be >= 2 in I2S or NET\n"); > > return -EINVAL; > > } > > Are you sure that ssi->i2s_net SSI_SCR_I2S_MODE_MASK | SSI_SCR_NET bits > (also known as SSI_SCR_I2S_NET_MASK) zero or non-zero status is always > consistent with that in the SCR register? > > I can see that in fsl_ssi_hw_params() these bits in SCR are zeroed in > a one special case and in the second special case they are hardcoded > to SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET, in both cases regardless of > what is currently in ssi->i2s_net. You are right. I should update the i2s_net in hw_params() too. Thanks!
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index aecd00f..ed2712b 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1051,9 +1051,7 @@ static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, } /* The slot number should be >= 2 if using Network mode or I2S mode */ - regmap_read(regs, REG_SSI_SCR, &val); - val &= SSI_SCR_I2S_MODE_MASK | SSI_SCR_NET; - if (val && slots < 2) { + if (ssi->i2s_net && slots < 2) { dev_err(dai->dev, "slot number should be >= 2 in I2S or NET\n"); return -EINVAL; } @@ -1063,9 +1061,8 @@ static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, regmap_update_bits(regs, REG_SSI_SRCCR, SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots)); - /* Save SSIEN bit of the SCR register */ + /* Save the SCR register value */ regmap_read(regs, REG_SSI_SCR, &val); - val &= SSI_SCR_SSIEN; /* Temporarily enable SSI to allow SxMSKs to be configurable */ regmap_update_bits(regs, REG_SSI_SCR, SSI_SCR_SSIEN, SSI_SCR_SSIEN);
This patch replaces the register read with ssi->i2s_net for simplification. It also removes masking SSIEN from scr value since it's handled later by regmap_update_bits() to set this scr value back. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> --- sound/soc/fsl/fsl_ssi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)