ASoC: msm: add support for packed 24 bit

Changes to support packed 24 bit (SNDRV_PCM_FORMAT_S24_3LE).

CRs-Fixed: 1011048
Change-Id: I5c49091d6bbff98ed8665446fffdba08446073cd
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
This commit is contained in:
Manish Dewangan 2016-05-05 12:27:40 +05:30 committed by Kyle Yan
parent bd8f954881
commit ba2ec87dad
5 changed files with 97 additions and 41 deletions

View file

@ -93,7 +93,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000| .rates = (SNDRV_PCM_RATE_8000_192000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -105,7 +106,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000| .rates = (SNDRV_PCM_RATE_8000_192000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE|
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 4, .channels_max = 4,
.rate_min = 8000, .rate_min = 8000,
@ -122,7 +124,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000| .rates = (SNDRV_PCM_RATE_8000_192000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -134,7 +137,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000| .rates = (SNDRV_PCM_RATE_8000_192000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -203,7 +207,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 6, .channels_max = 6,
.rate_min = 8000, .rate_min = 8000,
@ -232,7 +237,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -250,7 +256,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -262,7 +269,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_48000| .rates = (SNDRV_PCM_RATE_8000_48000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE|
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -279,7 +287,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -291,7 +300,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_48000| .rates = (SNDRV_PCM_RATE_8000_48000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -308,7 +318,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -326,7 +337,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -338,7 +350,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_48000| .rates = (SNDRV_PCM_RATE_8000_48000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2004,7 +2017,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000| .rates = (SNDRV_PCM_RATE_8000_192000|
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2203,7 +2217,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2221,7 +2236,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2239,7 +2255,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2257,7 +2274,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2275,7 +2293,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2293,7 +2312,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2311,7 +2331,8 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.rates = (SNDRV_PCM_RATE_8000_192000 | .rates = (SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_KNOT), SNDRV_PCM_RATE_KNOT),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,

View file

@ -710,6 +710,10 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
bit_width = 24; bit_width = 24;
sample_word_size = 32; sample_word_size = 32;
break; break;
case SNDRV_PCM_FORMAT_S24_3LE:
bit_width = 24;
sample_word_size = 24;
break;
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
default: default:
bit_width = 16; bit_width = 16;

View file

@ -1151,6 +1151,7 @@ static int msm_dai_q6_spdif_hw_params(struct snd_pcm_substream *substream,
dai_data->spdif_port.cfg.bit_width = 16; dai_data->spdif_port.cfg.bit_width = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
dai_data->spdif_port.cfg.bit_width = 24; dai_data->spdif_port.cfg.bit_width = 24;
break; break;
default: default:
@ -1368,6 +1369,7 @@ static int msm_dai_q6_cdc_hw_params(struct snd_pcm_hw_params *params,
dai_data->port_config.i2s.bit_width = 16; dai_data->port_config.i2s.bit_width = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
dai_data->port_config.i2s.bit_width = 24; dai_data->port_config.i2s.bit_width = 24;
break; break;
default: default:
@ -1447,6 +1449,7 @@ static int msm_dai_q6_slim_bus_hw_params(struct snd_pcm_hw_params *params,
dai_data->port_config.slim_sch.bit_width = 16; dai_data->port_config.slim_sch.bit_width = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
dai_data->port_config.slim_sch.bit_width = 24; dai_data->port_config.slim_sch.bit_width = 24;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
@ -2799,7 +2802,8 @@ static struct snd_soc_dai_driver msm_dai_q6_slimbus_tx_dai[] = {
SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
SNDRV_PCM_RATE_192000, SNDRV_PCM_RATE_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | .formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE, SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE,
.channels_min = 1, .channels_min = 1,
.channels_max = 8, .channels_max = 8,
.rate_min = 8000, .rate_min = 8000,
@ -2818,7 +2822,8 @@ static struct snd_soc_dai_driver msm_dai_q6_slimbus_tx_dai[] = {
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
SNDRV_PCM_RATE_192000, SNDRV_PCM_RATE_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | .formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE, SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE,
.channels_min = 1, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
.rate_min = 8000, .rate_min = 8000,
@ -3324,6 +3329,7 @@ static int msm_dai_q6_mi2s_hw_params(struct snd_pcm_substream *substream,
dai_data->bitwidth = 16; dai_data->bitwidth = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
dai_data->port_config.i2s.bit_width = 24; dai_data->port_config.i2s.bit_width = 24;
dai_data->bitwidth = 24; dai_data->bitwidth = 24;
break; break;
@ -3475,7 +3481,8 @@ static struct snd_soc_dai_driver msm_dai_q6_mi2s_dai[] = {
.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
SNDRV_PCM_RATE_16000, SNDRV_PCM_RATE_16000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | .formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE, SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE,
.rate_min = 8000, .rate_min = 8000,
.rate_max = 48000, .rate_max = 48000,
}, },
@ -5567,6 +5574,7 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream,
dai_data->bitwidth = 16; dai_data->bitwidth = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
dai_data->bitwidth = 24; dai_data->bitwidth = 24;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:

View file

@ -65,7 +65,8 @@ static struct snd_pcm_hardware msm_pcm_hardware_capture = {
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.rates = SNDRV_PCM_RATE_8000_48000, .rates = SNDRV_PCM_RATE_8000_48000,
.rate_min = 8000, .rate_min = 8000,
.rate_max = 48000, .rate_max = 48000,
@ -87,7 +88,8 @@ static struct snd_pcm_hardware msm_pcm_hardware_playback = {
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE | .formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE), SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE),
.rates = SNDRV_PCM_RATE_8000_192000, .rates = SNDRV_PCM_RATE_8000_192000,
.rate_min = 8000, .rate_min = 8000,
.rate_max = 192000, .rate_max = 192000,
@ -314,6 +316,10 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
bits_per_sample = 24; bits_per_sample = 24;
sample_word_size = 32; sample_word_size = 32;
break; break;
case SNDRV_PCM_FORMAT_S24_3LE:
bits_per_sample = 24;
sample_word_size = 24;
break;
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
default: default:
bits_per_sample = 16; bits_per_sample = 16;
@ -392,7 +398,8 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
pr_debug("%s:perf_mode=%d periods=%d\n", __func__, pr_debug("%s:perf_mode=%d periods=%d\n", __func__,
pdata->perf_mode, runtime->periods); pdata->perf_mode, runtime->periods);
params = &soc_prtd->dpcm[substream->stream].hw_params; params = &soc_prtd->dpcm[substream->stream].hw_params;
if (params_format(params) == SNDRV_PCM_FORMAT_S24_LE) if ((params_format(params) == SNDRV_PCM_FORMAT_S24_LE) ||
(params_format(params) == SNDRV_PCM_FORMAT_S24_3LE))
bits_per_sample = 24; bits_per_sample = 24;
/* ULL mode is not supported in capture path */ /* ULL mode is not supported in capture path */
@ -455,6 +462,10 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
bits_per_sample = 24; bits_per_sample = 24;
sample_word_size = 32; sample_word_size = 32;
break; break;
case SNDRV_PCM_FORMAT_S24_3LE:
bits_per_sample = 24;
sample_word_size = 24;
break;
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
default: default:
bits_per_sample = 16; bits_per_sample = 16;

View file

@ -104,6 +104,22 @@ static struct msm_pcm_route_bdai_pp_params
static int msm_routing_send_device_pp_params(int port_id, int copp_idx); static int msm_routing_send_device_pp_params(int port_id, int copp_idx);
static int msm_routing_get_bit_width(unsigned int format)
{
int bit_width;
switch (format) {
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE:
bit_width = 24;
break;
case SNDRV_PCM_FORMAT_S16_LE:
default:
bit_width = 16;
}
return bit_width;
}
static bool msm_is_fractional_resample_needed(int input_sr, int output_sr) static bool msm_is_fractional_resample_needed(int input_sr, int output_sr)
{ {
bool rc = false; bool rc = false;
@ -769,11 +785,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
int app_type, app_type_idx, copp_idx, acdb_dev_id; int app_type, app_type_idx, copp_idx, acdb_dev_id;
channels = msm_bedais[i].channel; channels = msm_bedais[i].channel;
if (msm_bedais[i].format == SNDRV_PCM_FORMAT_S16_LE) bit_width = msm_routing_get_bit_width(
bit_width = 16; msm_bedais[i].format);
else if (msm_bedais[i].format ==
SNDRV_PCM_FORMAT_S24_LE)
bit_width = 24;
app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ?
fe_dai_app_type_cfg[fe_id].app_type : 0; fe_dai_app_type_cfg[fe_id].app_type : 0;
if (app_type) { if (app_type) {
@ -921,11 +934,9 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
channels = msm_bedais[i].channel; channels = msm_bedais[i].channel;
msm_bedais[i].compr_passthr_mode = msm_bedais[i].compr_passthr_mode =
LEGACY_PCM; LEGACY_PCM;
if (msm_bedais[i].format == SNDRV_PCM_FORMAT_S16_LE)
bits_per_sample = 16; bits_per_sample = msm_routing_get_bit_width(
else if (msm_bedais[i].format == msm_bedais[i].format);
SNDRV_PCM_FORMAT_S24_LE)
bits_per_sample = 24;
app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ?
fe_dai_app_type_cfg[fedai_id].app_type : 0; fe_dai_app_type_cfg[fedai_id].app_type : 0;
@ -1145,8 +1156,9 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
fdai->event_info.priv_data); fdai->event_info.priv_data);
fdai->be_srate = 0; /* might not need it */ fdai->be_srate = 0; /* might not need it */
} }
if (msm_bedais[reg].format == SNDRV_PCM_FORMAT_S24_LE)
bits_per_sample = 24; bits_per_sample = msm_routing_get_bit_width(
msm_bedais[reg].format);
app_type = (session_type == SESSION_TYPE_RX) ? app_type = (session_type == SESSION_TYPE_RX) ?
fe_dai_app_type_cfg[val].app_type : 0; fe_dai_app_type_cfg[val].app_type : 0;
@ -9562,8 +9574,8 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
fdai->event_info.priv_data); fdai->event_info.priv_data);
fdai->be_srate = 0; /* might not need it */ fdai->be_srate = 0; /* might not need it */
} }
if (bedai->format == SNDRV_PCM_FORMAT_S24_LE) bits_per_sample = msm_routing_get_bit_width(
bits_per_sample = 24; bedai->format);
app_type = playback ? app_type = playback ?
fe_dai_app_type_cfg[i].app_type : 0; fe_dai_app_type_cfg[i].app_type : 0;