From: Srinivas Kandagatla <[email protected]>
This patchset adds support for.
1. parse Display Port module tokens from ASoC topology
2. add support to DP/HDMI Jack events.
3. fixes a typo in function name in sm8250
Verified these patches on X13s along with changes to tplg in
https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
and ucm chagnes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
Thanks,
Srini
Srinivas Kandagatla (4):
ASoC: qcom: q6dsp: parse Display port tokens
ASoC: qcom: common: add Display port Jack function
ASoC: qcom: sc8280xp: add Display port Jack
ASoC: qcom: sm8250: fix a typo in function name
sound/soc/qcom/common.c | 30 ++++++++++++++++++++++++++++++
sound/soc/qcom/common.h | 3 +++
sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
sound/soc/qcom/sc8280xp.c | 13 +++++++++++++
sound/soc/qcom/sm8250.c | 4 ++--
5 files changed, 74 insertions(+), 2 deletions(-)
--
2.43.0
From: Srinivas Kandagatla <[email protected]>
Add a common function to add Display port jack, this can be used by
multiple board files and avoid any code duplication.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/common.c | 30 ++++++++++++++++++++++++++++++
sound/soc/qcom/common.h | 3 +++
2 files changed, 33 insertions(+)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 747041fa7866..50abd4acaa3e 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -7,10 +7,14 @@
#include <sound/jack.h>
#include <linux/input-event-codes.h>
#include "common.h"
+#define NAME_SIZE 32
static const struct snd_soc_dapm_widget qcom_jack_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
+ SND_SOC_DAPM_SPK("HDMI/DP0 Jack", NULL),
+ SND_SOC_DAPM_SPK("HDMI/DP1 Jack", NULL),
+ SND_SOC_DAPM_SPK("HDMI/DP2 Jack", NULL),
};
int qcom_snd_parse_of(struct snd_soc_card *card)
@@ -239,4 +243,30 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_wcd_jack_setup);
+
+int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *hdmi_jack, int hdmi_pcm_id)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ struct snd_soc_card *card = rtd->card;
+ char jack_name[NAME_SIZE];
+ int rval, i;
+
+ snprintf(jack_name, sizeof(jack_name), "HDMI/DP%d Jack", hdmi_pcm_id);
+ rval = snd_soc_card_jack_new(card, jack_name, SND_JACK_AVOUT, hdmi_jack);
+ if (rval)
+ return rval;
+
+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
+ rval = snd_soc_component_set_jack(codec_dai->component, hdmi_jack, NULL);
+ if (rval != 0 && rval != -ENOTSUPP) {
+ dev_warn(card->dev, "Failed to set jack: %d\n", rval);
+ return rval;
+ }
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_snd_dp_jack_setup);
MODULE_LICENSE("GPL");
diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
index d7f80ee5ae26..3675d72c5285 100644
--- a/sound/soc/qcom/common.h
+++ b/sound/soc/qcom/common.h
@@ -9,5 +9,8 @@
int qcom_snd_parse_of(struct snd_soc_card *card);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
+int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *jack, int id);
+
#endif
--
2.43.0
From: Srinivas Kandagatla <[email protected]>
Fix a small type in the function name as its confusing to see a SoC name
that does not exist.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/sm8250.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
index d70df72c0160..9bd159b81d69 100644
--- a/sound/soc/qcom/sm8250.c
+++ b/sound/soc/qcom/sm8250.c
@@ -70,7 +70,7 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
return qcom_snd_sdw_startup(substream);
}
-static void sm2450_snd_shutdown(struct snd_pcm_substream *substream)
+static void sm8250_snd_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
@@ -115,7 +115,7 @@ static int sm8250_snd_hw_free(struct snd_pcm_substream *substream)
static const struct snd_soc_ops sm8250_be_ops = {
.startup = sm8250_snd_startup,
- .shutdown = sm2450_snd_shutdown,
+ .shutdown = sm8250_snd_shutdown,
.hw_params = sm8250_snd_hw_params,
.hw_free = sm8250_snd_hw_free,
.prepare = sm8250_snd_prepare,
--
2.43.0
From: Srinivas Kandagatla <[email protected]>
Add support to Display Port Jack events, by making use of common helper
function.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/sc8280xp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
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);
}
--
2.43.0
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-3-srinivas.kandagatla%40linaro.org
patch subject: [PATCH 2/4] ASoC: qcom: common: add Display port Jack function
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240420/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240420/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> sound/soc/qcom/common.c:250:22: warning: unused variable 'cpu_dai' [-Wunused-variable]
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
^
1 warning generated.
vim +/cpu_dai +250 sound/soc/qcom/common.c
246
247 int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
248 struct snd_soc_jack *hdmi_jack, int hdmi_pcm_id)
249 {
> 250 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki