Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: rsnd: indicate warning once if it can't handle requested rule

Some SoC can't handle all requested hw rule. In such case, it will indicate
like below, but it is unclear why it didn't work to user.
This patch indicates warning in such case once, because player will try to
similar rule many times.

# aplay sound.wav
Playing WAVE 'sound.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: aplay.c: 1359: set_params: Assertion `err >= 0' failed.
Aborted by signal Aborted...

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87357q6t7b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
6d612f67 c12dc0f6

+17 -3
+16 -3
sound/soc/sh/rcar/core.c
··· 869 869 870 870 static int rsnd_soc_hw_rule(struct rsnd_dai *rdai, 871 871 unsigned int *list, int list_num, 872 - struct snd_interval *baseline, struct snd_interval *iv) 872 + struct snd_interval *baseline, struct snd_interval *iv, 873 + struct rsnd_dai_stream *io, char *unit) 873 874 { 874 875 struct snd_interval p; 875 876 unsigned int rate; ··· 900 899 } 901 900 } 902 901 902 + /* Indicate error once if it can't handle */ 903 + if (!rsnd_flags_has(io, RSND_HW_RULE_ERR) && (p.min > p.max)) { 904 + struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai); 905 + struct device *dev = rsnd_priv_to_dev(priv); 906 + 907 + dev_warn(dev, "It can't handle %d %s <-> %d %s\n", 908 + baseline->min, unit, baseline->max, unit); 909 + rsnd_flags_set(io, RSND_HW_RULE_ERR); 910 + } 911 + 903 912 return snd_interval_refine(iv, &p); 904 913 } 905 914 ··· 933 922 934 923 return rsnd_soc_hw_rule(rdai, rsnd_soc_hw_rate_list, 935 924 ARRAY_SIZE(rsnd_soc_hw_rate_list), 936 - &ic, ir); 925 + &ic, ir, io, "ch"); 937 926 } 938 927 939 928 static int rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params, ··· 956 945 957 946 return rsnd_soc_hw_rule(rdai, rsnd_soc_hw_channels_list, 958 947 ARRAY_SIZE(rsnd_soc_hw_channels_list), 959 - ir, &ic); 948 + ir, &ic, io, "Hz"); 960 949 } 961 950 962 951 static const struct snd_pcm_hardware rsnd_pcm_hardware = { ··· 980 969 struct snd_pcm_runtime *runtime = substream->runtime; 981 970 unsigned int max_channels = rsnd_rdai_channels_get(rdai); 982 971 int i; 972 + 973 + rsnd_flags_del(io, RSND_HW_RULE_ERR); 983 974 984 975 rsnd_dai_stream_init(io, substream); 985 976
+1
sound/soc/sh/rcar/rsnd.h
··· 513 513 #define RSND_STREAM_HDMI0 (1 << 0) /* for HDMI0 */ 514 514 #define RSND_STREAM_HDMI1 (1 << 1) /* for HDMI1 */ 515 515 #define RSND_STREAM_TDM_SPLIT (1 << 2) /* for TDM split mode */ 516 + #define RSND_HW_RULE_ERR (1 << 3) /* hw_rule error */ 516 517 517 518 #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL) 518 519 #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)