Commit d2b9b96c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ctxfi - Fix supported PCM formats

The device seems supporting only U8, S16, S24_3LE, S32.  Other linear
formats result in bad outputs.

Also, added the support for 32bit float format, which wasn't listed
in the original code.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8372d498
...@@ -170,16 +170,15 @@ static unsigned int convert_format(snd_pcm_format_t snd_format) ...@@ -170,16 +170,15 @@ static unsigned int convert_format(snd_pcm_format_t snd_format)
{ {
switch (snd_format) { switch (snd_format) {
case SNDRV_PCM_FORMAT_U8: case SNDRV_PCM_FORMAT_U8:
case SNDRV_PCM_FORMAT_S8:
return SRC_SF_U8; return SRC_SF_U8;
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
case SNDRV_PCM_FORMAT_U16_LE:
return SRC_SF_S16; return SRC_SF_S16;
case SNDRV_PCM_FORMAT_S24_3LE: case SNDRV_PCM_FORMAT_S24_3LE:
return SRC_SF_S24; return SRC_SF_S24;
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
return SRC_SF_S32; return SRC_SF_S32;
case SNDRV_PCM_FORMAT_FLOAT_LE:
return SRC_SF_F32;
default: default:
printk(KERN_ERR "ctxfi: not recognized snd format is %d \n", printk(KERN_ERR "ctxfi: not recognized snd format is %d \n",
snd_format); snd_format);
......
...@@ -26,12 +26,10 @@ static struct snd_pcm_hardware ct_pcm_playback_hw = { ...@@ -26,12 +26,10 @@ static struct snd_pcm_hardware ct_pcm_playback_hw = {
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE), SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_U8 | .formats = (SNDRV_PCM_FMTBIT_U8 |
SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_U16_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3LE |
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S32_LE), SNDRV_PCM_FMTBIT_FLOAT_LE),
.rates = (SNDRV_PCM_RATE_CONTINUOUS | .rates = (SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_8000_192000), SNDRV_PCM_RATE_8000_192000),
.rate_min = 8000, .rate_min = 8000,
...@@ -52,8 +50,7 @@ static struct snd_pcm_hardware ct_spdif_passthru_playback_hw = { ...@@ -52,8 +50,7 @@ static struct snd_pcm_hardware ct_spdif_passthru_playback_hw = {
SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE), SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = SNDRV_PCM_FMTBIT_S16_LE,
SNDRV_PCM_FMTBIT_U16_LE),
.rates = (SNDRV_PCM_RATE_48000 | .rates = (SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_32000), SNDRV_PCM_RATE_32000),
...@@ -77,12 +74,10 @@ static struct snd_pcm_hardware ct_pcm_capture_hw = { ...@@ -77,12 +74,10 @@ static struct snd_pcm_hardware ct_pcm_capture_hw = {
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_U8 | .formats = (SNDRV_PCM_FMTBIT_U8 |
SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_U16_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3LE |
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S32_LE), SNDRV_PCM_FMTBIT_FLOAT_LE),
.rates = (SNDRV_PCM_RATE_CONTINUOUS | .rates = (SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_8000_96000), SNDRV_PCM_RATE_8000_96000),
.rate_min = 8000, .rate_min = 8000,
......
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