Ejemplo n.º 1
0
static int wcd9xxx_configure_ports(struct wcd9xxx *wcd9xxx)
{
	int i;
	u32 id;
	for (i = 0; i < 4; i++)
		((u8 *)&id)[i] = wcd9xxx_reg_read(wcd9xxx,
						  WCD9XXX_A_CHIP_ID_BYTE_0 + i);
	id = cpu_to_be32(id);
	pr_debug("%s: chip id 0x%08x\n", __func__, id);
	if (id != WCD9XXX_CHIP_ID_TAIKO) {
		sh_ch.rx_port_start_offset =
		    TABLA_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS;
		sh_ch.num_rx_slave_port =
		    TABLA_SB_PGD_MAX_NUMBER_OF_RX_SLAVE_DEV_PORTS;
		sh_ch.port_ch_0_start_port_id =
		    TABLA_SB_PGD_RX_PORT_MULTI_CHANNEL_0_START_PORT_ID;
		sh_ch.port_ch_0_end_port_id =
		    TABLA_SB_PGD_RX_PORT_MULTI_CHANNEL_0_END_PORT_ID;
		sh_ch.pgd_tx_port_ch_1_end_port_id =
		    TABLA_SB_PGD_TX_PORT_MULTI_CHANNEL_1_END_PORT_ID;

		sh_ch.rx_port_ch_reg_base =
		    0x180 + (TABLA_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS * 4);
		sh_ch.port_rx_cfg_reg_base =
		    0x040 + (TABLA_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS);
		sh_ch.port_tx_cfg_reg_base = 0x040;

		sh_ch.number_of_tx_slave_dev_ports =
		    TABLA_SB_PGD_MAX_NUMBER_OF_TX_SLAVE_DEV_PORTS;
		sh_ch.number_of_rx_slave_dev_ports =
		    TABLA_SB_PGD_MAX_NUMBER_OF_RX_SLAVE_DEV_PORTS;
	} else {
		sh_ch.rx_port_start_offset =
		    TAIKO_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS;
		sh_ch.num_rx_slave_port =
		    TAIKO_SB_PGD_MAX_NUMBER_OF_RX_SLAVE_DEV_PORTS;
		sh_ch.port_ch_0_start_port_id =
		    TAIKO_SB_PGD_RX_PORT_MULTI_CHANNEL_0_START_PORT_ID;
		sh_ch.port_ch_0_end_port_id =
		    TAIKO_SB_PGD_RX_PORT_MULTI_CHANNEL_0_END_PORT_ID;
		sh_ch.pgd_tx_port_ch_1_end_port_id =
		    TAIKO_SB_PGD_TX_PORT_MULTI_CHANNEL_1_END_PORT_ID;

		sh_ch.rx_port_ch_reg_base = 0x180;
		sh_ch.port_rx_cfg_reg_base = 0x040;
		sh_ch.port_tx_cfg_reg_base = 0x050;

		sh_ch.number_of_tx_slave_dev_ports =
		    TAIKO_SB_PGD_MAX_NUMBER_OF_TX_SLAVE_DEV_PORTS;
		sh_ch.number_of_rx_slave_dev_ports =
		    TAIKO_SB_PGD_MAX_NUMBER_OF_RX_SLAVE_DEV_PORTS;
	}

	return 0;
}
Ejemplo n.º 2
0
static int wcd_resmgr_codec_reg_read(struct wcd9xxx_resmgr_v2 *resmgr,
				     unsigned int reg)
{
	int val;

	if (resmgr->codec)
		val = snd_soc_read(resmgr->codec, reg);
	else
		val = wcd9xxx_reg_read(resmgr->core_res, reg);

	return val;
}
static int wcd9xxx_configure_ports(struct wcd9xxx *wcd9xxx)
{
	int i;
	u32 id;
	for (i = 0; i < 4; i++)
		((u8 *)&id)[i] = wcd9xxx_reg_read(wcd9xxx,
						  WCD9XXX_A_CHIP_ID_BYTE_0 + i);
	id = cpu_to_be32(id);
	pr_debug("%s: chip id 0x%08x\n", __func__, id);
	if (id != WCD9XXX_CHIP_ID_TAIKO) {
		sh_ch.rx_port_ch_reg_base = 0x180 ;
		sh_ch.port_rx_cfg_reg_base = 0x040;
		sh_ch.port_tx_cfg_reg_base = 0x040;
	} else {
		sh_ch.rx_port_ch_reg_base =
			0x180 - (TAIKO_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS * 4);
		sh_ch.port_rx_cfg_reg_base =
			0x040 - TAIKO_SB_PGD_OFFSET_OF_RX_SLAVE_DEV_PORTS ;
		sh_ch.port_tx_cfg_reg_base = 0x050;
	}

	return 0;
}