From: Naveen Manohar naveen.m@intel.com
Update dmic fixup params to always expose QUAD channel capture device, enabling User-space to control channel count. Assign min and max channel only based on input hw_params.
Signed-off-by: Naveen Manohar naveen.m@intel.com Acked-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Vamshi Krishna Gopal vamshi.krishna.gopal@intel.com --- sound/soc/intel/boards/kbl_rt5663_max98927.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c index adfa2c044aed..a1bcde7851b7 100644 --- a/sound/soc/intel/boards/kbl_rt5663_max98927.c +++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c @@ -29,9 +29,9 @@ #define DMIC_CH(p) p->list[p->count-1] #define MAXIM_DEV0_NAME "i2c-MX98927:00" #define MAXIM_DEV1_NAME "i2c-MX98927:01" +#define QUAD_CHANNEL 4
static struct snd_soc_card *kabylake_audio_card; -static const struct snd_pcm_hw_constraint_list *dmic_constraints; static struct snd_soc_jack skylake_hdmi[3];
struct kbl_hdmi_pcm { @@ -365,6 +365,16 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = { .mask = 0, };
+static const unsigned int channels_quad[] = { + QUAD_CHANNEL, +}; + +static const struct snd_pcm_hw_constraint_list constraints_channels_quad = { + .count = ARRAY_SIZE(channels_quad), + .list = channels_quad, + .mask = 0, +}; + static int kbl_fe_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; @@ -480,7 +490,7 @@ static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_interval *chan = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
- if (params_channels(params) == 2 || DMIC_CH(dmic_constraints) == 2) + if (params_channels(params) == 2) chan->min = chan->max = 2; else chan->min = chan->max = 4; @@ -528,9 +538,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime;
- runtime->hw.channels_max = DMIC_CH(dmic_constraints); + runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, - dmic_constraints); + &constraints_channels_quad);
return snd_pcm_hw_constraint_list(substream->runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);