Message ID | 20190207170028.720-5-s.nawrocki@samsung.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | ASoC: dmaengine updates, secondary CPU DAI for Odroid boards | expand |
On Thu, 7 Feb 2019 at 18:01, Sylwester Nawrocki <s.nawrocki@samsung.com> wrote: > > Make sure i2s->rclk_srcrate is properly initialized also during > playback through the secondary DAI. > > Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> > --- > sound/soc/samsung/i2s.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c > index 9d3dcb2204fe..d5ddad23d5e5 100644 > --- a/sound/soc/samsung/i2s.c > +++ b/sound/soc/samsung/i2s.c > @@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, > unsigned int fmt) > { > struct i2s_dai *i2s = to_info(dai); > + struct i2s_dai *other = get_other_dai(i2s); > int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; > u32 mod, tmp = 0; > unsigned long flags; > @@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, > * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any > * clock configuration assigned in DT is not overwritten. > */ > - if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) > + if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL && > + other->clk_data.clks == NULL) > i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, > 0, SND_SOC_CLOCK_IN); > break; > @@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, > struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) > { > struct i2s_dai *i2s = to_info(dai); > + struct i2s_dai *other = get_other_dai(i2s); > u32 mod, mask = 0, val = 0; > struct clk *rclksrc; > unsigned long flags; > @@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, > i2s->frmclk = params_rate(params); > > rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; > + if (!rclksrc || IS_ERR(rclksrc)) IS_ERR_OR_NULL Best regards, Krzysztof > + rclksrc = other->clk_table[CLK_I2S_RCLK_SRC]; > + > if (rclksrc && !IS_ERR(rclksrc)) > i2s->rclk_srcrate = clk_get_rate(rclksrc); > > -- > 2.20.1 >
On 2/11/19 14:37, Krzysztof Kozlowski wrote: >> @@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, >> i2s->frmclk = params_rate(params); >> >> rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; >> + if (!rclksrc || IS_ERR(rclksrc)) > IS_ERR_OR_NULL Thanks for your review! That line will be removed by subsequent patch (7/22) so I'd say such a change wouldn't make a difference anyway. Besides not using IS_ERR_OR_NULL() was intentional.
On Mon, 11 Feb 2019 at 15:32, Sylwester Nawrocki <s.nawrocki@samsung.com> wrote: > > On 2/11/19 14:37, Krzysztof Kozlowski wrote: > >> @@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, > >> i2s->frmclk = params_rate(params); > >> > >> rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; > >> + if (!rclksrc || IS_ERR(rclksrc)) > > > IS_ERR_OR_NULL > > Thanks for your review! That line will be removed by subsequent patch > (7/22) so I'd say such a change wouldn't make a difference anyway. Then let's skip it: Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Best regards, Krzysztof
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 9d3dcb2204fe..d5ddad23d5e5 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct i2s_dai *i2s = to_info(dai); + struct i2s_dai *other = get_other_dai(i2s); int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; u32 mod, tmp = 0; unsigned long flags; @@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any * clock configuration assigned in DT is not overwritten. */ - if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) + if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL && + other->clk_data.clks == NULL) i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 0, SND_SOC_CLOCK_IN); break; @@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); + struct i2s_dai *other = get_other_dai(i2s); u32 mod, mask = 0, val = 0; struct clk *rclksrc; unsigned long flags; @@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, i2s->frmclk = params_rate(params); rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; + if (!rclksrc || IS_ERR(rclksrc)) + rclksrc = other->clk_table[CLK_I2S_RCLK_SRC]; + if (rclksrc && !IS_ERR(rclksrc)) i2s->rclk_srcrate = clk_get_rate(rclksrc);
Make sure i2s->rclk_srcrate is properly initialized also during playback through the secondary DAI. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- sound/soc/samsung/i2s.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)