Add support for 44.1/48/88.1/96KHz for Tx channel

Added support for 44.1/48/88.1/96KHz sample rates
for Tx channel to use for feedback. Set data format
to LPCM only for SCO Tx use case. Audio hal will
provide the information of feedback channel before
opening the slimbus port.

CRs-Fixed: 2205755
Change-Id: I122f1bf729de5f0f83607778d5dee4380baf94fc
Signed-off-by: Satish Kodishala <skodisha@codeaurora.org>
This commit is contained in:
Satish Kodishala 2019-03-20 19:03:39 -07:00 committed by Gerrit - the friendly Code Review server
parent cc7a8b2dc4
commit c685521b64
3 changed files with 33 additions and 5 deletions

View file

@ -131,6 +131,14 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
prop.dataf = ((rates == 48000) || (rates == 44100) ||
(rates == 88200) || (rates == 96000)) ?
SLIM_CH_DATAF_NOT_DEFINED : SLIM_CH_DATAF_LPCM_AUDIO;
/* for feedback channel, PCM bit should not be set */
if (btfm_feedback_ch_setting) {
BTFMSLIM_DBG("port open for feedback ch, not setting PCM bit");
prop.dataf = SLIM_CH_DATAF_NOT_DEFINED;
/* reset so that next port open sets the data format properly */
btfm_feedback_ch_setting = 0;
}
prop.auxf = SLIM_CH_AUXF_NOT_APPLICABLE;
prop.ratem = ((rates == 44100) || (rates == 88200)) ?
(rates/11025) : (rates/4000);

View file

@ -72,6 +72,8 @@ struct btfmslim {
uint8_t rxport, uint8_t enable);
};
extern int btfm_feedback_ch_setting;
/**
* btfm_slim_hw_init: Initialize slimbus slave device
* Returns:

View file

@ -21,7 +21,7 @@
#include <btfm_slim.h>
static int bt_soc_enable_status;
int btfm_feedback_ch_setting;
static int btfm_slim_codec_write(struct snd_soc_component *codec,
unsigned int reg, unsigned int value)
@ -48,11 +48,27 @@ static int bt_soc_status_put(struct snd_kcontrol *kcontrol,
return 1;
}
static int btfm_get_feedback_ch_setting(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = btfm_feedback_ch_setting;
return 1;
}
static int btfm_put_feedback_ch_setting(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
btfm_feedback_ch_setting = ucontrol->value.integer.value[0];
return 1;
}
static const struct snd_kcontrol_new status_controls[] = {
SOC_SINGLE_EXT("BT SOC status", 0, 0, 1, 0,
bt_soc_status_get,
bt_soc_status_put)
bt_soc_status_put),
SOC_SINGLE_EXT("BT set feedback channel", 0, 0, 1, 0,
btfm_get_feedback_ch_setting,
btfm_put_feedback_ch_setting)
};
@ -366,9 +382,11 @@ static struct snd_soc_dai_driver btfmslim_dai[] = {
.capture = {
.stream_name = "SCO TX Capture",
/* 8 KHz or 16 KHz */
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000
| SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000
| SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, /* 16 bits */
.rate_max = 16000,
.rate_max = 96000,
.rate_min = 8000,
.channels_min = 1,
.channels_max = 1,