Browse Source

asoc: audio-ext-clk: Add support for multiple lpass clock nodes

In bolero, for VA and WSA macros require multiple
lpass clock sources. Update audio clock driver
to support lpass clocks instances as required for
VA and WSA.

Change-Id: I7bb676dcbd5c0db09079dd73a30d1b47ce0f8ace
Signed-off-by: Laxminath Kasam <[email protected]>
Laxminath Kasam 6 years ago
parent
commit
d712cc7c15
1 changed files with 30 additions and 3 deletions
  1. 30 3
      asoc/codecs/audio-ext-clk-up.c

+ 30 - 3
asoc/codecs/audio-ext-clk-up.c

@@ -27,7 +27,10 @@ enum {
 	AUDIO_EXT_CLK_PMI,
 	AUDIO_EXT_CLK_LNBB2,
 	AUDIO_EXT_CLK_LPASS,
-	AUDIO_EXT_CLK_MAX,
+	AUDIO_EXT_CLK_LPASS2,
+	AUDIO_EXT_CLK_LPASS3,
+	AUDIO_EXT_CLK_LPASS_MAX,
+	AUDIO_EXT_CLK_MAX = AUDIO_EXT_CLK_LPASS_MAX,
 };
 
 struct pinctrl_info {
@@ -60,7 +63,8 @@ static int audio_ext_clk_prepare(struct clk_hw *hw)
 	struct pinctrl_info *pnctrl_info = &clk_priv->audio_clk.pnctrl_info;
 	int ret;
 
-	if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS) {
+	if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
+		(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX))  {
 		clk_priv->clk_cfg.enable = 1;
 		ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
 		if (ret < 0) {
@@ -101,7 +105,8 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
 		}
 	}
 
-	if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS) {
+	if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
+		(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX))  {
 		clk_priv->clk_cfg.enable = 0;
 		ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
 		if (ret < 0)
@@ -158,6 +163,28 @@ static struct audio_ext_clk audio_clk_array[] = {
 			},
 		},
 	},
+	{
+		.pnctrl_info = {NULL},
+		.fact = {
+			.mult = 1,
+			.div = 1,
+			.hw.init = &(struct clk_init_data){
+				.name = "audio_lpass_mclk2",
+				.ops = &audio_ext_clk_ops,
+			},
+		},
+	},
+	{
+		.pnctrl_info = {NULL},
+		.fact = {
+			.mult = 1,
+			.div = 1,
+			.hw.init = &(struct clk_init_data){
+				.name = "audio_lpass_mclk3",
+				.ops = &audio_ext_clk_ops,
+			},
+		},
+	},
 };
 
 static int audio_get_pinctrl(struct platform_device *pdev)