Skip to content

Commit 747080a

Browse files
committed
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 <[email protected]>
1 parent 88a681d commit 747080a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/soc/dwc/dwc-i2s.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
320320
case TWO_CHANNEL_SUPPORT:
321321
break;
322322
default:
323-
dev_err(dev->dev, "channel not supported\n");
323+
dev_err(dev->dev, "channel count %d not supported\n", config->chan_nr);
324324
return -EINVAL;
325325
}
326326

@@ -708,7 +708,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
708708
idx = 1;
709709
dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM;
710710
dw_i2s_dai->playback.channels_max =
711-
1 << (COMP1_TX_CHANNELS(comp1) + 1);
711+
2 * (COMP1_TX_CHANNELS(comp1) + 1);
712712
dw_i2s_dai->playback.formats = formats[idx];
713713
dw_i2s_dai->playback.rates = rates;
714714
}
@@ -722,7 +722,7 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
722722
idx = 1;
723723
dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM;
724724
dw_i2s_dai->capture.channels_max =
725-
1 << (COMP1_RX_CHANNELS(comp1) + 1);
725+
2 * (COMP1_RX_CHANNELS(comp1) + 1);
726726
dw_i2s_dai->capture.formats = formats[idx];
727727
dw_i2s_dai->capture.rates = rates;
728728
}

0 commit comments

Comments
 (0)