From 747080a2aaacfbf54f591646fbcf3bca04b268bc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 Mar 2024 12:23:43 +0000 Subject: [PATCH 0951/1085] ASoC: dwc: Correct channel count reporting The DWC I2S driver treats the channel count register values as if they encode a power of two (2, 4, 8, 16), but they actually encode a multiple of 2 (2, 4, 6, 8). Also improve the error message when asked for an unsupported number of channels. Signed-off-by: Phil Elwell --- sound/soc/dwc/dwc-i2s.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -320,7 +320,7 @@ static int dw_i2s_hw_params(struct snd_p case TWO_CHANNEL_SUPPORT: break; default: - dev_err(dev->dev, "channel not supported\n"); + dev_err(dev->dev, "channel count %d not supported\n", config->chan_nr); return -EINVAL; } @@ -708,7 +708,7 @@ static int dw_configure_dai(struct dw_i2 idx = 1; dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM; dw_i2s_dai->playback.channels_max = - 1 << (COMP1_TX_CHANNELS(comp1) + 1); + 2 * (COMP1_TX_CHANNELS(comp1) + 1); dw_i2s_dai->playback.formats = formats[idx]; dw_i2s_dai->playback.rates = rates; } @@ -722,7 +722,7 @@ static int dw_configure_dai(struct dw_i2 idx = 1; dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM; dw_i2s_dai->capture.channels_max = - 1 << (COMP1_RX_CHANNELS(comp1) + 1); + 2 * (COMP1_RX_CHANNELS(comp1) + 1); dw_i2s_dai->capture.formats = formats[idx]; dw_i2s_dai->capture.rates = rates; }