浏览代码

ASoC: Add support for tx data lane3 for lito v2

Lito has three data lanes for tx swr. As gpio support
for swr tx data3 is present for lito v2, enable data
lane for lito v2.

Change-Id: I56faee1974f59e0a506fc74f2dadb95a52071907
Signed-off-by: Vatsal Bucha <[email protected]>
Vatsal Bucha 5 年之前
父节点
当前提交
71e0b484a1
共有 2 个文件被更改,包括 32 次插入2 次删除
  1. 16 0
      asoc/kona-port-config.h
  2. 16 2
      asoc/kona.c

+ 16 - 0
asoc/kona-port-config.h

@@ -50,6 +50,15 @@ static struct port_params tx_frame_params_default[SWR_MSTR_PORT_LEN] = {
 	{3,  0,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1},  /* TX4 */
 };
 
+/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
+static struct port_params tx_frame_params_v2[SWR_MSTR_PORT_LEN] = {
+	{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},/* PCM OUT */
+	{1,  0,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1},  /* TX1 */
+	{1,  0,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2},  /* TX2 */
+	{3,  2,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},  /* TX3 */
+	{3,  0,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2},  /* TX4 */
+};
+
 static struct swr_mstr_port_map sm_port_map[] = {
 	{TX_MACRO, SWR_UC0, tx_frame_params_default},
 	{RX_MACRO, SWR_UC0, rx_frame_params_default},
@@ -57,4 +66,11 @@ static struct swr_mstr_port_map sm_port_map[] = {
 	{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
 };
 
+static struct swr_mstr_port_map sm_port_map_v2[] = {
+	{TX_MACRO, SWR_UC0, tx_frame_params_v2},
+	{RX_MACRO, SWR_UC0, rx_frame_params_default},
+	{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
+	{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
+};
+
 #endif /* _KONA_PORT_CONFIG */

+ 16 - 2
asoc/kona.c

@@ -167,6 +167,7 @@ enum {
 struct msm_asoc_mach_data {
 	struct snd_info_entry *codec_root;
 	int usbc_en2_gpio; /* used by gpio driver API */
+	int lito_v2_enabled;
 	struct device_node *dmic01_gpio_p; /* used by pinctrl API */
 	struct device_node *dmic23_gpio_p; /* used by pinctrl API */
 	struct device_node *dmic45_gpio_p; /* used by pinctrl API */
@@ -5288,8 +5289,17 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
 						WSA_MACRO_GAIN_OFFSET_M1P5_DB);
 			}
 		}
-		bolero_set_port_map(component, ARRAY_SIZE(sm_port_map),
-				    sm_port_map);
+		if (pdata->lito_v2_enabled) {
+			/*
+			 * Enable tx data line3 for saipan version v2 amd
+			 * write corresponding lpi register.
+			 */
+			bolero_set_port_map(component, ARRAY_SIZE(sm_port_map_v2),
+					sm_port_map_v2);
+		} else {
+			bolero_set_port_map(component, ARRAY_SIZE(sm_port_map),
+					sm_port_map);
+		}
 	}
 	card = rtd->card->snd_card;
 	if (!pdata->codec_root) {
@@ -7898,6 +7908,10 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 	if (!pdata)
 		return -ENOMEM;
 
+	of_property_read_u32(pdev->dev.of_node,
+				"qcom,lito-is-v2-enabled",
+				&pdata->lito_v2_enabled);
+
 	card = populate_snd_card_dailinks(&pdev->dev);
 	if (!card) {
 		dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);