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

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

Merge "Add support for newer BT chips"

parents 3895b01c 378a7467
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ static bool previous;
static int pwr_state;
struct class *bt_class;
static int bt_major;
static int soc_id;

static int bt_vreg_init(struct bt_power_vreg_data *vreg)
{
@@ -742,9 +743,16 @@ int bt_register_slimdev(struct device *dev)
	return 0;
}

int get_chipset_version(void)
{
	BT_PWR_DBG("");
	return soc_id;
}

static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int ret = 0, pwr_cntrl = 0;
	int chipset_version = 0;

	switch (cmd) {
	case BT_CMD_SLIM_TEST:
@@ -771,6 +779,16 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
			ret = 0;
		}
		break;
	case BT_CMD_CHIPSET_VERS:
		chipset_version = (int)arg;
		BT_PWR_ERR("BT_CMD_CHIP_VERS soc_version:%x", chipset_version);
		if (chipset_version) {
			soc_id = chipset_version;
		} else {
			BT_PWR_ERR("got invalid soc version");
			soc_id = 0;
		}
		break;
	default:
		return -EINVAL;
	}
+16 −1
Original line number Diff line number Diff line
@@ -301,15 +301,30 @@ static int btfm_slim_get_logical_addr(struct slim_device *slim)
static int btfm_slim_alloc_port(struct btfmslim *btfmslim)
{
	int ret = -EINVAL, i;
	int  chipset_ver;
	struct btfmslim_ch *rx_chs;
	struct btfmslim_ch *tx_chs;

	if (!btfmslim)
		return ret;

	chipset_ver = get_chipset_version();
	BTFMSLIM_INFO("chipset soc version:%x", chipset_ver);

	rx_chs = btfmslim->rx_chs;
	tx_chs = btfmslim->tx_chs;

	if ((chipset_ver >=  QCA_CHEROKEE_SOC_ID_0300) &&
		(chipset_ver <=  QCA_CHEROKEE_SOC_ID_0320)) {
		for (i = 0; (tx_chs->port != BTFM_SLIM_PGD_PORT_LAST) &&
		(i < BTFM_SLIM_NUM_CODEC_DAIS); i++, tx_chs++) {
			if (tx_chs->port == SLAVE_SB_PGD_PORT_TX1_FM)
				tx_chs->port = CHRKVER3_SB_PGD_PORT_TX1_FM;
			else if (tx_chs->port == SLAVE_SB_PGD_PORT_TX2_FM)
				tx_chs->port = CHRKVER3_SB_PGD_PORT_TX2_FM;
			BTFMSLIM_INFO("Tx port:%d", tx_chs->port);
		}
		tx_chs = btfmslim->tx_chs;
	}
	if (!rx_chs || !tx_chs)
		return ret;

+10 −2
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ int btfm_slim_slave_hw_init(struct btfmslim *btfmslim)
static inline int is_fm_port(uint8_t port_num)
{
	if (port_num == SLAVE_SB_PGD_PORT_TX1_FM ||
		port_num == CHRKVER3_SB_PGD_PORT_TX1_FM ||
		port_num == CHRKVER3_SB_PGD_PORT_TX2_FM ||
		port_num == SLAVE_SB_PGD_PORT_TX2_FM)
		return 1;
	else
@@ -119,9 +121,15 @@ int btfm_slim_slave_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
	/* txport */
	/* Multiple Channel Setting */
	if (is_fm_port(port_num)) {
		if (port_num == CHRKVER3_SB_PGD_PORT_TX1_FM)
			reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX1_FM);
		else if (port_num == CHRKVER3_SB_PGD_PORT_TX2_FM)
			reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX2_FM);
		else
			reg_val = (0x1 << SLAVE_SB_PGD_PORT_TX1_FM) |
					(0x1 << SLAVE_SB_PGD_PORT_TX2_FM);
		reg = SLAVE_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num);
		BTFMSLIM_INFO("writing reg_val (%d) to reg(%x)", reg_val, reg);
		ret = btfm_slim_write(btfmslim, reg, 1, &reg_val, IFD);
		if (ret) {
			BTFMSLIM_ERR("failed to write (%d) reg 0x%x", ret, reg);
+37 −0
Original line number Diff line number Diff line
@@ -71,9 +71,46 @@
#define SLAVE_SB_PGD_PORT_TX_SCO			0
#define SLAVE_SB_PGD_PORT_TX1_FM			1
#define SLAVE_SB_PGD_PORT_TX2_FM			2
#define CHRKVER3_SB_PGD_PORT_TX1_FM			4
#define CHRKVER3_SB_PGD_PORT_TX2_FM			5
#define SLAVE_SB_PGD_PORT_RX_SCO			16
#define SLAVE_SB_PGD_PORT_RX_A2P			17

enum {
	QCA_CHEROKEE_SOC_ID_0100  = 0x40010100,
	QCA_CHEROKEE_SOC_ID_0200  = 0x40010200,
	QCA_CHEROKEE_SOC_ID_0201  = 0x40010201,
	QCA_CHEROKEE_SOC_ID_0210  = 0x40010214,
	QCA_CHEROKEE_SOC_ID_0211  = 0x40010224,
	QCA_CHEROKEE_SOC_ID_0300  = 0x40010300,
	QCA_CHEROKEE_SOC_ID_0310  = 0x40010310,
	QCA_CHEROKEE_SOC_ID_0320  = 0x40010320,
};

enum {
	QCA_APACHE_SOC_ID_0005  = 0x40020100,
	QCA_APACHE_SOC_ID_0006  = 0x40020110,
	QCA_APACHE_SOC_ID_0100  = 0x40020120,
	QCA_APACHE_SOC_ID_0101  = 0x40020121,
	QCA_APACHE_SOC_ID_0102  = 0x40020122,
	QCA_APACHE_SOC_ID_0103  = 0x40020123,
	QCA_APACHE_SOC_ID_0110  = 0x40020130,
	QCA_APACHE_SOC_ID_0111  = 0x40020140,
	QCA_APACHE_SOC_ID_0120  = 0x40020240,
};

enum {
	QCA_COMANCHE_SOC_ID_0100  = 0x40070100,
	QCA_COMANCHE_SOC_ID_0101  = 0x40070101,
	QCA_COMANCHE_SOC_ID_0110  = 0x40070110,
};

enum {
	QCA_HASTINGS_SOC_ID_0100 = 0x400A0100,
	QCA_HASTINGS_SOC_ID_0101 = 0x40040101,
	QCA_HASTINGS_SOC_ID_0110 = 0x400A0110,
	QCA_HASTINGS_SOC_ID_0200 = 0x400A0200,
};

/* Function Prototype */

+2 −0
Original line number Diff line number Diff line
@@ -82,7 +82,9 @@ struct bluetooth_power_platform_data {
};

int bt_register_slimdev(struct device *dev);
int get_chipset_version(void);

#define BT_CMD_SLIM_TEST		0xbfac
#define BT_CMD_PWR_CTRL			0xbfad
#define BT_CMD_CHIPSET_VERS		0xbfae
#endif /* __LINUX_BLUETOOTH_POWER_H */