Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f291c054 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 14eeb025 cf096160
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -137,6 +137,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);
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -78,6 +78,8 @@ struct btfmslim {
		uint8_t rxport, uint8_t enable);
};

extern int btfm_feedback_ch_setting;

/**
 * btfm_slim_hw_init: Initialize slimbus slave device
 * Returns:
+24 −5
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -27,7 +27,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_codec *codec, unsigned int reg,
	unsigned int value)
@@ -54,10 +54,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)

};

@@ -372,9 +389,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,