diff options
| author | Satish Kodishala <skodisha@codeaurora.org> | 2017-05-18 19:19:30 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-20 22:48:27 -0700 |
| commit | 4907cf0953c352ba23517ee51160263b39aa3940 (patch) | |
| tree | c383e1a470dd78804426879009256cda9d12af06 | |
| parent | 560a996da5c0bf398d2fba51e9909cd7323afea8 (diff) | |
btfm: provide a way to query wcn3990 status
provide a way to query wcn3990 status. Audio hal
uses this to cleanup its stack when BT is turned off
or SCO is disconnected during SCO devices selection.
CRs-Fixed: 2061191
Change-Id: I3c10559c6ca34692c7f147b5cc2f0101b0bfbbf9
Signed-off-by: Satish Kodishala <skodisha@codeaurora.org>
| -rw-r--r-- | drivers/bluetooth/btfm_slim_codec.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/bluetooth/btfm_slim_codec.c b/drivers/bluetooth/btfm_slim_codec.c index 1faebb1759e2..96be0e2f9183 100644 --- a/drivers/bluetooth/btfm_slim_codec.c +++ b/drivers/bluetooth/btfm_slim_codec.c @@ -26,6 +26,9 @@ #include <sound/tlv.h> #include <btfm_slim.h> +static int bt_soc_enable_status; + + static int btfm_slim_codec_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { @@ -38,8 +41,31 @@ static unsigned int btfm_slim_codec_read(struct snd_soc_codec *codec, return 0; } +static int bt_soc_status_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = bt_soc_enable_status; + return 1; +} + +static int bt_soc_status_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + 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) + +}; + + static int btfm_slim_codec_probe(struct snd_soc_codec *codec) { + snd_soc_add_codec_controls(codec, status_controls, + ARRAY_SIZE(status_controls)); return 0; } @@ -130,6 +156,7 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream, struct btfmslim *btfmslim = dai->dev->platform_data; struct btfmslim_ch *ch; uint8_t rxport, grp = false, nchan = 1; + bt_soc_enable_status = 0; BTFMSLIM_DBG("dai->name: %s, dai->id: %d, dai->rate: %d", dai->name, dai->id, dai->rate); @@ -171,6 +198,10 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream, } ret = btfm_slim_enable_ch(btfmslim, ch, rxport, dai->rate, grp, nchan); + + /* save the enable channel status */ + if (ret == 0) + bt_soc_enable_status = 1; return ret; } |
