ASoC: rockchip: add format and rate constraints on rk3399
diff mbox series

Message ID 20200630091615.4020059-1-yuhsuan@chromium.org
State New
Headers show
Series
  • ASoC: rockchip: add format and rate constraints on rk3399
Related show

Commit Message

Yu-Hsuan Hsu June 30, 2020, 9:16 a.m. UTC
S8 and S24 formats does not work on this machine driver so force to use
S16_LE instead.

In addition, add constraint to limit the max value of rate because the
rate higher than 96000(172000, 192000) is not stable either.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
---
 sound/soc/rockchip/rk3399_gru_sound.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Mark Brown June 30, 2020, 10:40 a.m. UTC | #1
On Tue, Jun 30, 2020 at 05:16:15PM +0800, Yu-Hsuan Hsu wrote:
> S8 and S24 formats does not work on this machine driver so force to use
> S16_LE instead.

> In addition, add constraint to limit the max value of rate because the
> rate higher than 96000(172000, 192000) is not stable either.

What is the source of these restrictions - are they due to the component
devices?  If they are then the component devices ought to be setting
suitable constraints themselves.
Yu-Hsuan Hsu June 30, 2020, 12:25 p.m. UTC | #2
Mark Brown <broonie@kernel.org> 於 2020年6月30日 週二 下午6:40寫道:
>
> On Tue, Jun 30, 2020 at 05:16:15PM +0800, Yu-Hsuan Hsu wrote:
> > S8 and S24 formats does not work on this machine driver so force to use
> > S16_LE instead.
>
> > In addition, add constraint to limit the max value of rate because the
> > rate higher than 96000(172000, 192000) is not stable either.
>
> What is the source of these restrictions - are they due to the component
> devices?  If they are then the component devices ought to be setting
> suitable constraints themselves.

I'm not sure why it happened. But I guess it is not the issues on those
components because they work normally on other machine drivers.
Because this driver is old and lacks maintenance, I think we can just
filter some unstable formats. Actually, those formats are very rarely
used as well.
Mark Brown July 1, 2020, 10:22 p.m. UTC | #3
On Tue, 30 Jun 2020 17:16:15 +0800, Yu-Hsuan Hsu wrote:
> S8 and S24 formats does not work on this machine driver so force to use
> S16_LE instead.
> 
> In addition, add constraint to limit the max value of rate because the
> rate higher than 96000(172000, 192000) is not stable either.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rockchip: add format and rate constraints on rk3399
      commit: 1eb96c198aff13162de4857e19f9488d59c4acb1

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

Patch
diff mbox series

diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c
index f45e5aaa4b302..9539b0d024fed 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -219,19 +219,32 @@  static int rockchip_sound_dmic_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
+static int rockchip_sound_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+	return snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
+			8000, 96000);
+}
+
 static const struct snd_soc_ops rockchip_sound_max98357a_ops = {
+	.startup = rockchip_sound_startup,
 	.hw_params = rockchip_sound_max98357a_hw_params,
 };
 
 static const struct snd_soc_ops rockchip_sound_rt5514_ops = {
+	.startup = rockchip_sound_startup,
 	.hw_params = rockchip_sound_rt5514_hw_params,
 };
 
 static const struct snd_soc_ops rockchip_sound_da7219_ops = {
+	.startup = rockchip_sound_startup,
 	.hw_params = rockchip_sound_da7219_hw_params,
 };
 
 static const struct snd_soc_ops rockchip_sound_dmic_ops = {
+	.startup = rockchip_sound_startup,
 	.hw_params = rockchip_sound_dmic_hw_params,
 };