Commit c1d70dd9 authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

ALSA: asihpi - Use valid channel count in format enumeration.

Since introduction of mono and low latency modes, fixed channel count of 2
is not always valid.  Use reported max_channels instead.
Signed-off-by: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8637bc94
...@@ -961,14 +961,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, ...@@ -961,14 +961,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi,
for (format = HPI_FORMAT_PCM8_UNSIGNED; for (format = HPI_FORMAT_PCM8_UNSIGNED;
format <= HPI_FORMAT_PCM24_SIGNED; format++) { format <= HPI_FORMAT_PCM24_SIGNED; format++) {
err = hpi_format_create(&hpi_format, err = hpi_format_create(&hpi_format, asihpi->out_max_chans,
2, format, sample_rate, 128000, 0); format, sample_rate, 128000, 0);
if (!err) if (!err)
err = hpi_outstream_query_format(h_stream, err = hpi_outstream_query_format(h_stream, &hpi_format);
&hpi_format);
if (!err && (hpi_to_alsa_formats[format] != -1)) if (!err && (hpi_to_alsa_formats[format] != -1))
pcmhw->formats |= pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]);
(1ULL << hpi_to_alsa_formats[format]);
} }
} }
...@@ -1141,14 +1139,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, ...@@ -1141,14 +1139,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi,
for (format = HPI_FORMAT_PCM8_UNSIGNED; for (format = HPI_FORMAT_PCM8_UNSIGNED;
format <= HPI_FORMAT_PCM24_SIGNED; format++) { format <= HPI_FORMAT_PCM24_SIGNED; format++) {
err = hpi_format_create(&hpi_format, 2, format, err = hpi_format_create(&hpi_format, asihpi->in_max_chans,
sample_rate, 128000, 0); format, sample_rate, 128000, 0);
if (!err) if (!err)
err = hpi_instream_query_format(h_stream, err = hpi_instream_query_format(h_stream, &hpi_format);
&hpi_format);
if (!err) if (!err)
pcmhw->formats |= pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]);
(1ULL << hpi_to_alsa_formats[format]);
} }
} }
......
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