diff mbox series

[3/4] ASoC: qcom: sc8280xp: add Display port Jack

Message ID 20240419150140.92527-4-srinivas.kandagatla@linaro.org
State Superseded
Headers show
Series ASoC: qcom: display port changes | expand

Commit Message

Srinivas Kandagatla April 19, 2024, 3:01 p.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Add support to Display Port Jack events, by making use of common helper
function.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/sc8280xp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

kernel test robot April 20, 2024, 12:35 a.m. UTC | #1
Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.9-rc4 next-20240419]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/srinivas-kandagatla-linaro-org/ASoC-qcom-q6dsp-parse-Display-port-tokens/20240419-230514
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20240419150140.92527-4-srinivas.kandagatla%40linaro.org
patch subject: [PATCH 3/4] ASoC: qcom: sc8280xp: add Display port Jack
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240420/202404200850.ZXhk0PO1-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 7089c359a3845323f6f30c44a47dd901f2edfe63)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240420/202404200850.ZXhk0PO1-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404200850.ZXhk0PO1-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from sound/soc/qcom/sc8280xp.c:7:
   In file included from include/sound/soc.h:19:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from sound/soc/qcom/sc8280xp.c:7:
   In file included from include/sound/soc.h:19:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from sound/soc/qcom/sc8280xp.c:7:
   In file included from include/sound/soc.h:19:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   In file included from sound/soc/qcom/sc8280xp.c:7:
   In file included from include/sound/soc.h:24:
   In file included from include/sound/pcm.h:15:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> sound/soc/qcom/sc8280xp.c:54:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      54 |         default:
         |         ^
   sound/soc/qcom/sc8280xp.c:54:2: note: insert 'break;' to avoid fall-through
      54 |         default:
         |         ^
         |         break; 
   8 warnings generated.


vim +54 sound/soc/qcom/sc8280xp.c

295aeea6646ad6 Srinivas Kandagatla 2022-09-16  25  
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  26  static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  27  {
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  28  	struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  29  	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  30  	struct snd_soc_card *card = rtd->card;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  31  	struct snd_soc_jack *hdmi_jack  = NULL;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  32  	int hdmi_pcm_id = 0;
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  33  
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  34  	switch (cpu_dai->id) {
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  35  	case WSA_CODEC_DMA_RX_0:
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  36  	case WSA_CODEC_DMA_RX_1:
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  37  		/*
c481016bb4f8a9 Johan Hovold        2024-01-22  38  		 * Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
c481016bb4f8a9 Johan Hovold        2024-01-22  39  		 * to reduce the risk of speaker damage until we have active
c481016bb4f8a9 Johan Hovold        2024-01-22  40  		 * speaker protection in place.
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  41  		 */
c481016bb4f8a9 Johan Hovold        2024-01-22  42  		snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 81);
c481016bb4f8a9 Johan Hovold        2024-01-22  43  		snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 81);
c481016bb4f8a9 Johan Hovold        2024-01-22  44  		snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
c481016bb4f8a9 Johan Hovold        2024-01-22  45  		snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  46  		break;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  47  	case DISPLAY_PORT_RX_0:
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  48  		hdmi_pcm_id = 0;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  49  		hdmi_jack = &data->hdmi_jack[hdmi_pcm_id];
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  50  		break;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  51  	case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  52  		hdmi_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  53  		hdmi_jack = &data->hdmi_jack[hdmi_pcm_id];
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04 @54  	default:
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  55  		break;
716d4e5373e9d1 Srinivas Kandagatla 2023-12-04  56  	}
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  57  
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  58  	if (hdmi_jack)
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  59  		return qcom_snd_dp_jack_setup(rtd, hdmi_jack, hdmi_pcm_id);
8dd5623cc9d92b Srinivas Kandagatla 2024-04-19  60  
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  61  	return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  62  }
295aeea6646ad6 Srinivas Kandagatla 2022-09-16  63
diff mbox series

Patch

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index b7fd503a1666..ced89cf65b5b 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -19,6 +19,7 @@  struct sc8280xp_snd_data {
 	struct snd_soc_card *card;
 	struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
 	struct snd_soc_jack jack;
+	struct snd_soc_jack hdmi_jack[8];
 	bool jack_setup;
 };
 
@@ -27,6 +28,8 @@  static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
 	struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 	struct snd_soc_card *card = rtd->card;
+	struct snd_soc_jack *hdmi_jack  = NULL;
+	int hdmi_pcm_id = 0;
 
 	switch (cpu_dai->id) {
 	case WSA_CODEC_DMA_RX_0:
@@ -41,10 +44,20 @@  static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
 		snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
 		snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
 		break;
+	case DISPLAY_PORT_RX_0:
+		hdmi_pcm_id = 0;
+		hdmi_jack = &data->hdmi_jack[hdmi_pcm_id];
+		break;
+	case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
+		hdmi_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
+		hdmi_jack = &data->hdmi_jack[hdmi_pcm_id];
 	default:
 		break;
 	}
 
+	if (hdmi_jack)
+		return qcom_snd_dp_jack_setup(rtd, hdmi_jack, hdmi_pcm_id);
+
 	return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
 }