Commit b735662f authored by Jiada Wang's avatar Jiada Wang Committed by Mark Brown

ASoC: rsnd: remove is_play parameter from hw_rule function

Currently rsnd_dai_stream *io is set to either &rdai->playback or
&rdai->capture based on whether it is a playback or capture stream,
in __rsnd_soc_hw_rule_* functions, but this is not necessary,
rsnd_dai_stream *io handler can be get from rule->private.

This patch removes 'is_play' parameter from hw_rule function.
Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
Signed-off-by: default avatarTimo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ba5d553b
......@@ -819,16 +819,14 @@ static int rsnd_soc_hw_rule(struct rsnd_dai *rdai,
return snd_interval_refine(iv, &p);
}
static int __rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule,
int is_play)
static int rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
struct snd_interval *ic_ = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
struct snd_interval *ir = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval ic;
struct snd_soc_dai *dai = rule->private;
struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture;
struct rsnd_dai_stream *io = rule->private;
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
/*
* possible sampling rate limitation is same as
......@@ -844,28 +842,14 @@ static int __rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params,
&ic, ir);
}
static int rsnd_soc_hw_rule_rate_playback(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
return __rsnd_soc_hw_rule_rate(params, rule, 1);
}
static int rsnd_soc_hw_rule_rate_capture(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
return __rsnd_soc_hw_rule_rate(params, rule, 0);
}
static int __rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule,
int is_play)
static int rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
struct snd_interval *ic_ = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
struct snd_interval *ir = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval ic;
struct snd_soc_dai *dai = rule->private;
struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture;
struct rsnd_dai_stream *io = rule->private;
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
/*
* possible sampling rate limitation is same as
......@@ -881,18 +865,6 @@ static int __rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params,
ir, &ic);
}
static int rsnd_soc_hw_rule_channels_playback(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
return __rsnd_soc_hw_rule_channels(params, rule, 1);
}
static int rsnd_soc_hw_rule_channels_capture(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
return __rsnd_soc_hw_rule_channels(params, rule, 0);
}
static const struct snd_pcm_hardware rsnd_pcm_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP |
......@@ -949,14 +921,12 @@ static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream,
int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
is_play ? rsnd_soc_hw_rule_rate_playback :
rsnd_soc_hw_rule_rate_capture,
dai,
rsnd_soc_hw_rule_rate,
is_play ? &rdai->playback : &rdai->capture,
SNDRV_PCM_HW_PARAM_CHANNELS, -1);
snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
is_play ? rsnd_soc_hw_rule_channels_playback :
rsnd_soc_hw_rule_channels_capture,
dai,
rsnd_soc_hw_rule_channels,
is_play ? &rdai->playback : &rdai->capture,
SNDRV_PCM_HW_PARAM_RATE, -1);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment