Skip to contentSkip to conversation

ASoC: qcom: apq8016_sbc: Fix second argument of apq8016_dai_init()

PATCH In review Bert Karwatzki 4 participants 6 messages Nov 17, 2024 – Nov 22, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: qcom: apq8016_sbc: Fix second argument of apq8016_dai_init()

Since commit a78a42fb48b8 the second argument of apq8016_dai_init() has to be an lpass id returned by qdsp6_dai_get_lpass_id().

Fixes a78a42fb48b8 ("ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6")
---
 sound/soc/qcom/apq8016_sbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/qcom/apq8016_sbc.c +1 -1
index 3023cf180a75..ddfcd4616895 100644
@@ -150,7 +150,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 
-	return apq8016_dai_init(rtd, cpu_dai->id);
+	return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
 }
 
 static void apq8016_sbc_add_ops(struct snd_soc_card *card)

--
2.45.2

I came across this while I was trying to adapt this driver to another sound card.

Bert Karwatzki

maintainer
#1 lore raw
Quoted 2 lines · Bert Karwatzki

Since commit a78a42fb48b8 the second argument of apq8016_dai_init() has to be an lpass id returned by qdsp6_dai_get_lpass_id().

This breaks the build:

/build/stage/linux/sound/soc/qcom/apq8016_sbc.c: In function ‘apq8016_sbc_dai_in it’:
/build/stage/linux/sound/soc/qcom/apq8016_sbc.c:153:38: error: implicit declarat ion of function ‘qdsp6_dai_get_lpass_id’ [-Werror=implicit-function-declaration]

  153 |         return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
      |                                      ^~~~~~~~~~~~~~~~~~~~~~

/build/stage/linux/sound/soc/qcom/apq8016_sbc.c: At top level:
/build/stage/linux/sound/soc/qcom/apq8016_sbc.c:165:12: error: static declaratio n of ‘qdsp6_dai_get_lpass_id’ follows non-static declaration
165 | static int qdsp6_dai_get_lpass_id(struct snd_soc_dai *cpu_dai)

      |            ^~~~~~~~~~~~~~~~~~~~~~
/build/stage/linux/sound/soc/qcom/apq8016_sbc.c:153:38: note: previous implicit 
declaration of ‘qdsp6_dai_get_lpass_id’ with type ‘int()’
  153 |         return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
      |                                      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

#2 lore raw
In reply to Bert Karwatzki

Hi,

Quoted 15 lines · Bert Karwatzki

Since commit a78a42fb48b8 the second argument of apq8016_dai_init() has to be an lpass id returned by qdsp6_dai_get_lpass_id().

Fixes a78a42fb48b8 ("ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6")
---
 sound/soc/qcom/apq8016_sbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/qcom/apq8016_sbc.c +0 -0
index 3023cf180a75..ddfcd4616895 100644

sound/soc/qcom/apq8016_sbc.c static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) · line 155

Quoted 7 lines
sound/soc/qcom/apq8016_sbc.c +1 -1
@@ -150,7 +150,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 
-	return apq8016_dai_init(rtd, cpu_dai->id);
+	return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
 }
 

Hm no, the code is correct the way it is. There are two cases handled by this driver:

- ADSP bypass (lpass-* drivers, qcom,apq8016-sbc-sndcard): This one uses the LPASS IDs as DAI IDs, so cpu_dai->id already contains the correct value.

- ADSP (qdsp6 drivers, qcom,msm8916-qdsp6-sndcard): This one uses the QDSP6 IDs (e.g. PRIMARY_MI2S_RX/TX instead of MI2S_PRIMARY), so qdsp6_dai_get_lpass_id() is used to translate that to the LPASS IDs.

The code you are changing here handles the first case (ADSP bypass), the DAI IDs do not need any translation there.

Thanks,
Stephan

#3 lore raw

Am Donnerstag, dem 21.11.2024 um 15:11 +0100 schrieb Stephan Gerhold:

Quoted 37 lines

Hi,

Quoted 15 lines · Bert Karwatzki

Since commit a78a42fb48b8 the second argument of apq8016_dai_init() has to be an lpass id returned by qdsp6_dai_get_lpass_id().

Fixes a78a42fb48b8 ("ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6")
---
 sound/soc/qcom/apq8016_sbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/qcom/apq8016_sbc.c +0 -0
index 3023cf180a75..ddfcd4616895 100644

sound/soc/qcom/apq8016_sbc.c static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) · line 155

Quoted 7 lines
sound/soc/qcom/apq8016_sbc.c +1 -1
@@ -150,7 +150,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 
-	return apq8016_dai_init(rtd, cpu_dai->id);
+	return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
 }
 

Hm no, the code is correct the way it is. There are two cases handled by this driver:

- ADSP bypass (lpass-* drivers, qcom,apq8016-sbc-sndcard): This one uses the LPASS IDs as DAI IDs, so cpu_dai->id already contains the correct value.

- ADSP (qdsp6 drivers, qcom,msm8916-qdsp6-sndcard): This one uses the QDSP6 IDs (e.g. PRIMARY_MI2S_RX/TX instead of MI2S_PRIMARY), so qdsp6_dai_get_lpass_id() is used to translate that to the LPASS IDs.

Quoted 5 lines

The code you are changing here handles the first case (ADSP bypass), the DAI IDs do not need any translation there.

Thanks,
Stephan

Thank you for explaining this, and sorry for causing trouble with my "fix".

Bert Karwatzki

#4 lore raw
In reply to Bert Karwatzki
kernel test robot noticed the following build errors:

Hi Bert,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.12 next-20241121] [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/Bert-Karwatzki/ASoC-qcom-apq8016_sbc-Fix-second-argument-of-apq8016_dai_init/20241121-111313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20241117232100.23760-1-spasswolf%40web.de
patch subject: [PATCH] ASoC: qcom: apq8016_sbc: Fix second argument of apq8016_dai_init()
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20241121/[email protected]/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241121/[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 errors (new ones prefixed by >>):

In file included from sound/soc/qcom/apq8016_sbc.c:6:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:181:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]

     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   In file included from sound/soc/qcom/apq8016_sbc.c:9:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:95:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
         |                                                           ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
     102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
         |                                                      ^
   In file included from sound/soc/qcom/apq8016_sbc.c:9:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:95:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   In file included from sound/soc/qcom/apq8016_sbc.c:9:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:95:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     693 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     701 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     709 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     718 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     727 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     736 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> sound/soc/qcom/apq8016_sbc.c:153:31: error: call to undeclared function 'qdsp6_dai_get_lpass_id'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     153 |         return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
         |                                      ^
   sound/soc/qcom/apq8016_sbc.c:165:12: error: static declaration of 'qdsp6_dai_get_lpass_id' follows non-static declaration
     165 | static int qdsp6_dai_get_lpass_id(struct snd_soc_dai *cpu_dai)
         |            ^
   sound/soc/qcom/apq8016_sbc.c:153:31: note: previous implicit declaration is here
     153 |         return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
         |                                      ^

16 warnings and 2 errors generated.

vim +/qdsp6_dai_get_lpass_id +153 sound/soc/qcom/apq8016_sbc.c

148
149 static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
150 {
151 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
152

 > 153		return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));

154 }
155

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw
In reply to Bert Karwatzki
kernel test robot noticed the following build errors:

Hi Bert,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.12 next-20241121] [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/Bert-Karwatzki/ASoC-qcom-apq8016_sbc-Fix-second-argument-of-apq8016_dai_init/20241121-111313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20241117232100.23760-1-spasswolf%40web.de
patch subject: [PATCH] ASoC: qcom: apq8016_sbc: Fix second argument of apq8016_dai_init()
config: arm-defconfig (https://download.01.org/0day-ci/archive/20241122/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/[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 errors (new ones prefixed by >>):

>> sound/soc/qcom/apq8016_sbc.c:153:31: error: implicit declaration of function 'qdsp6_dai_get_lpass_id' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
                                        ^
   sound/soc/qcom/apq8016_sbc.c:165:12: error: static declaration of 'qdsp6_dai_get_lpass_id' follows non-static declaration
   static int qdsp6_dai_get_lpass_id(struct snd_soc_dai *cpu_dai)
              ^
   sound/soc/qcom/apq8016_sbc.c:153:31: note: previous implicit declaration is here
           return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
                                        ^

2 errors generated.

vim +/qdsp6_dai_get_lpass_id +153 sound/soc/qcom/apq8016_sbc.c

148
149 static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
150 {
151 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
152

 > 153		return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));

154 }
155

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki