diff mbox

[4/4] ASoC: amd: enabling bt i2s config after acp reset

Message ID 1523941201-15665-5-git-send-email-Vijendar.Mukunda@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vijendar Mukunda April 17, 2018, 4:59 a.m. UTC
On ST/CZ based platforms, for specific platform bt uart
mux to be defined for bt i2s.
By default, these pins will be used for uart.
After acp reset , it requires to reprogram bt i2s config
mux pins to enable bt i2s instance.
added bt i2s enablement sequence during acp init.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
 sound/soc/amd/acp-da7219-max98357a.c | 2 ++
 sound/soc/amd/acp-pcm-dma.c          | 9 +++++++++
 sound/soc/amd/acp.h                  | 1 +
 3 files changed, 12 insertions(+)

Comments

Akshu Agrawal April 17, 2018, 10:42 a.m. UTC | #1
On 4/17/2018 10:29 AM, Vijendar Mukunda wrote:
> On ST/CZ based platforms, for specific platform bt uart
> mux to be defined for bt i2s.
> By default, these pins will be used for uart.
> After acp reset , it requires to reprogram bt i2s config
> mux pins to enable bt i2s instance.
> added bt i2s enablement sequence during acp init.
> 
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
> ---
>   sound/soc/amd/acp-da7219-max98357a.c | 2 ++
>   sound/soc/amd/acp-pcm-dma.c          | 9 +++++++++
>   sound/soc/amd/acp.h                  | 1 +
>   3 files changed, 12 insertions(+)
> 
> diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
> index b205c78..6dad0cb 100644
> --- a/sound/soc/amd/acp-da7219-max98357a.c
> +++ b/sound/soc/amd/acp-da7219-max98357a.c
> @@ -44,6 +44,7 @@
>   
>   static struct snd_soc_jack cz_jack;
>   struct clk *da7219_dai_clk;
> +extern int bt_pad_enable;
>   
>   static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
>   {
> @@ -81,6 +82,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
>   	}
>   
>   	da7219_aad_jack_det(component, &cz_jack);
> +	bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");

This is to be done in probe.

>   
>   	return 0;
>   }
> diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
> index 7c392fe..b52c660 100644
> --- a/sound/soc/amd/acp-pcm-dma.c
> +++ b/sound/soc/amd/acp-pcm-dma.c
> @@ -46,6 +46,8 @@
>   
>   #define DRV_NAME "acp_audio_dma"
>   
> +bool bt_pad_enable = false;
> +EXPORT_SYMBOL(bt_pad_enable);
>   
>   static const struct snd_pcm_hardware acp_pcm_hardware_playback = {
>   	.info = SNDRV_PCM_INFO_INTERLEAVED |
> @@ -525,6 +527,13 @@ static int acp_init(void __iomem *acp_mmio, u32 asic_type)
>   	val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
>   	acp_reg_write(val, acp_mmio, mmACP_SOFT_RESET);
>   
> +	/* For BT instance change pins from UART to BT */
> +	if (bt_pad_enable) {
> +		val = acp_reg_read(acp_mmio, mmACP_BT_UART_PAD_SEL);
> +		val |= ACP_BT_UART_PAD_SELECT_MASK;
> +		acp_reg_write(val, acp_mmio, mmACP_BT_UART_PAD_SEL);
> +	}
> +
>   	/* initiailize Onion control DAGB register */
>   	acp_reg_write(ACP_ONION_CNTL_DEFAULT, acp_mmio,
>   		      mmACP_AXI2DAGB_ONION_CNTL);
> diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h
> index 460365c..6b43144 100644
> --- a/sound/soc/amd/acp.h
> +++ b/sound/soc/amd/acp.h
> @@ -107,6 +107,7 @@
>   #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01
>   #define ACP_I2S_SP_16BIT_RESOLUTION_EN	0x02
>   #define ACP_I2S_BT_16BIT_RESOLUTION_EN	0x04
> +#define ACP_BT_UART_PAD_SELECT_MASK	0x1
>   
>   enum acp_dma_priority_level {
>   	/* 0x0 Specifies the DMA channel is given normal priority */
>
kernel test robot April 17, 2018, 11:17 a.m. UTC | #2
Hi Vijendar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sound/for-next]
[also build test ERROR on v4.17-rc1 next-20180417]
[cannot apply to asoc/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vijendar-Mukunda/ASoC-dwc-I2S-Controller-instance-param-added/20180417-175408
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: i386-randconfig-x015-201815 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   sound/soc/amd/acp-da7219-max98357a.c: In function 'cz_da7219_init':
>> sound/soc/amd/acp-da7219-max98357a.c:85:45: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'?
     bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
                                                ^~~~
                                                cdev
   sound/soc/amd/acp-da7219-max98357a.c:85:45: note: each undeclared identifier is reported only once for each function it appears in

vim +85 sound/soc/amd/acp-da7219-max98357a.c

    48	
    49	static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
    50	{
    51		int ret;
    52		struct snd_soc_card *card = rtd->card;
    53		struct snd_soc_dai *codec_dai = rtd->codec_dai;
    54		struct snd_soc_component *component = codec_dai->component;
    55	
    56		dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
    57	
    58		ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,
    59					     CZ_PLAT_CLK, SND_SOC_CLOCK_IN);
    60		if (ret < 0) {
    61			dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret);
    62			return ret;
    63		}
    64	
    65		ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL,
    66					  CZ_PLAT_CLK, MCLK_RATE);
    67		if (ret < 0) {
    68			dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
    69			return ret;
    70		}
    71	
    72		da7219_dai_clk = clk_get(component->dev, "da7219-dai-clks");
    73	
    74		ret = snd_soc_card_jack_new(card, "Headset Jack",
    75					SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
    76					SND_JACK_BTN_0 | SND_JACK_BTN_1 |
    77					SND_JACK_BTN_2 | SND_JACK_BTN_3,
    78					&cz_jack, NULL, 0);
    79		if (ret) {
    80			dev_err(card->dev, "HP jack creation failed %d\n", ret);
    81			return ret;
    82		}
    83	
    84		da7219_aad_jack_det(component, &cz_jack);
  > 85		bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
    86	
    87		return 0;
    88	}
    89	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Vijendar Mukunda April 17, 2018, 11:41 a.m. UTC | #3
On Tuesday 17 April 2018 04:47 PM, kbuild test robot wrote:
> Hi Vijendar,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on sound/for-next]
> [also build test ERROR on v4.17-rc1 next-20180417]
> [cannot apply to asoc/for-next]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Vijendar-Mukunda/ASoC-dwc-I2S-Controller-instance-param-added/20180417-175408
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
> config: i386-randconfig-x015-201815 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=i386
> 
> All errors (new ones prefixed by >>):
> 
>     sound/soc/amd/acp-da7219-max98357a.c: In function 'cz_da7219_init':
>>> sound/soc/amd/acp-da7219-max98357a.c:85:45: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'?
>       bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
>                                                  ^~~~
>                                                  cdev
>     sound/soc/amd/acp-da7219-max98357a.c:85:45: note: each undeclared identifier is reported only once for each function it appears in
> 
> vim +85 sound/soc/amd/acp-da7219-max98357a.c
> 
>      48	
>      49	static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
>      50	{
>      51		int ret;
>      52		struct snd_soc_card *card = rtd->card;
>      53		struct snd_soc_dai *codec_dai = rtd->codec_dai;
>      54		struct snd_soc_component *component = codec_dai->component;
>      55	
>      56		dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
>      57	
>      58		ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,
>      59					     CZ_PLAT_CLK, SND_SOC_CLOCK_IN);
>      60		if (ret < 0) {
>      61			dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret);
>      62			return ret;
>      63		}
>      64	
>      65		ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL,
>      66					  CZ_PLAT_CLK, MCLK_RATE);
>      67		if (ret < 0) {
>      68			dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
>      69			return ret;
>      70		}
>      71	
>      72		da7219_dai_clk = clk_get(component->dev, "da7219-dai-clks");
>      73	
>      74		ret = snd_soc_card_jack_new(card, "Headset Jack",
>      75					SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
>      76					SND_JACK_BTN_0 | SND_JACK_BTN_1 |
>      77					SND_JACK_BTN_2 | SND_JACK_BTN_3,
>      78					&cz_jack, NULL, 0);
>      79		if (ret) {
>      80			dev_err(card->dev, "HP jack creation failed %d\n", ret);
>      81			return ret;
>      82		}
>      83	
>      84		da7219_aad_jack_det(component, &cz_jack);
>    > 85		bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
>      86	
>      87		return 0;
>      88	}
>      89	
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 

I will fix it and post the patch as V2 version.
kernel test robot April 17, 2018, 1:46 p.m. UTC | #4
Hi Vijendar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sound/for-next]
[also build test ERROR on v4.17-rc1 next-20180417]
[cannot apply to asoc/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vijendar-Mukunda/ASoC-dwc-I2S-Controller-instance-param-added/20180417-175408
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: x86_64-randconfig-g0-04170933 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   sound/soc/amd/acp-da7219-max98357a.c: In function 'cz_da7219_init':
>> sound/soc/amd/acp-da7219-max98357a.c:85:45: error: 'pdev' undeclared (first use in this function)
     bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
                                                ^
   sound/soc/amd/acp-da7219-max98357a.c:85:45: note: each undeclared identifier is reported only once for each function it appears in

vim +/pdev +85 sound/soc/amd/acp-da7219-max98357a.c

    48	
    49	static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
    50	{
    51		int ret;
    52		struct snd_soc_card *card = rtd->card;
    53		struct snd_soc_dai *codec_dai = rtd->codec_dai;
    54		struct snd_soc_component *component = codec_dai->component;
    55	
    56		dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
    57	
    58		ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,
    59					     CZ_PLAT_CLK, SND_SOC_CLOCK_IN);
    60		if (ret < 0) {
    61			dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret);
    62			return ret;
    63		}
    64	
    65		ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL,
    66					  CZ_PLAT_CLK, MCLK_RATE);
    67		if (ret < 0) {
    68			dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
    69			return ret;
    70		}
    71	
    72		da7219_dai_clk = clk_get(component->dev, "da7219-dai-clks");
    73	
    74		ret = snd_soc_card_jack_new(card, "Headset Jack",
    75					SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
    76					SND_JACK_BTN_0 | SND_JACK_BTN_1 |
    77					SND_JACK_BTN_2 | SND_JACK_BTN_3,
    78					&cz_jack, NULL, 0);
    79		if (ret) {
    80			dev_err(card->dev, "HP jack creation failed %d\n", ret);
    81			return ret;
    82		}
    83	
    84		da7219_aad_jack_det(component, &cz_jack);
  > 85		bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
    86	
    87		return 0;
    88	}
    89	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index b205c78..6dad0cb 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -44,6 +44,7 @@ 
 
 static struct snd_soc_jack cz_jack;
 struct clk *da7219_dai_clk;
+extern int bt_pad_enable;
 
 static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 {
@@ -81,6 +82,7 @@  static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 	}
 
 	da7219_aad_jack_det(component, &cz_jack);
+	bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable");
 
 	return 0;
 }
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 7c392fe..b52c660 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -46,6 +46,8 @@ 
 
 #define DRV_NAME "acp_audio_dma"
 
+bool bt_pad_enable = false;
+EXPORT_SYMBOL(bt_pad_enable);
 
 static const struct snd_pcm_hardware acp_pcm_hardware_playback = {
 	.info = SNDRV_PCM_INFO_INTERLEAVED |
@@ -525,6 +527,13 @@  static int acp_init(void __iomem *acp_mmio, u32 asic_type)
 	val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
 	acp_reg_write(val, acp_mmio, mmACP_SOFT_RESET);
 
+	/* For BT instance change pins from UART to BT */
+	if (bt_pad_enable) {
+		val = acp_reg_read(acp_mmio, mmACP_BT_UART_PAD_SEL);
+		val |= ACP_BT_UART_PAD_SELECT_MASK;
+		acp_reg_write(val, acp_mmio, mmACP_BT_UART_PAD_SEL);
+	}
+
 	/* initiailize Onion control DAGB register */
 	acp_reg_write(ACP_ONION_CNTL_DEFAULT, acp_mmio,
 		      mmACP_AXI2DAGB_ONION_CNTL);
diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h
index 460365c..6b43144 100644
--- a/sound/soc/amd/acp.h
+++ b/sound/soc/amd/acp.h
@@ -107,6 +107,7 @@ 
 #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01
 #define ACP_I2S_SP_16BIT_RESOLUTION_EN	0x02
 #define ACP_I2S_BT_16BIT_RESOLUTION_EN	0x04
+#define ACP_BT_UART_PAD_SELECT_MASK	0x1
 
 enum acp_dma_priority_level {
 	/* 0x0 Specifies the DMA channel is given normal priority */