History

Merge tag 'sound-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai: "It's a relatively calm development cycle, but still lots of updates in the driver side like Intel SOF. Below are some highlights: ALSA / ASoC core: - A new kselftest for ALSA control API - PCM NO_REWINDS support - Potential race fixes around control removals - Unify x86 SG-buffer memory allocation code - Cleanups and race fixes for ASoC DPCM locking ASoC: - Refinements and cleanups around the delay() APIs - Wider use of dev_err_probe(). - Continuing cleanups and improvements to the SOF code - Support for pin switches in simple-card derived cards - Support for AMD Renoir ACP, Asahi Kasei Microdevices AKM4375, Intel systems using NAU8825 and MAX98390, Mediatek MT8915, nVidia Tegra20 S/PDIF, Qualcomm systems using ALC5682I-VS and Texas Instruments TLV320ADC3xxx HD-audio / USB-audio: - Fix deadlock at HD-audio codec unbinding - Fixes for Tegra194 HD-audio, new HDA support for CS35L41 codec - Quirks for Lenovo and HP machines, Gigabyte mobo, Bose device Misc: - Fix virmidi drain behavior Note that the merge of CS35L41 codec support is still half-baked, and at least one ACPI change is missing. Although this won't hinder the kernel build itself, we're going to catch up before RC1" * tag 'sound-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (415 commits) ALSA: hda: intel-dsp-config: reorder the config table ALSA: hda: intel-dsp-config: add JasperLake support ALSA: hda: cs35l41: fix double free on error in probe() ALSA: hda: Fix dependencies of CS35L41 on SPI/I2C buses ALSA: hda: Fix dependency on ASoC cs35l41 codec ASoC: cs35l41: Add support for hibernate memory retention mode ASoC: cs35l41: Update handling of test key registers ALSA: intel_hdmi: Check for error num after setting mask ASoC: wcd9335: Keep a RX port value for each SLIM RX mux ASoC: amd: acp: acp-mach: Change default RT1019 amp dev id ALSA: virmidi: Remove duplicated code ALSA: seq: virmidi: Add a drain operation ASoC: topology: Fix typo ASoC: fsl_asrc: refine the check of available clock divider ASoC: Intel: bytcr_rt5640: Add support for external GPIO jack-detect ASoC: Intel: bytcr_rt5640: Support retrieving the codec IRQ from the AMCR0F28 ACPI dev ASoC: rt5640: Add support for boards with an external jack-detect GPIO ASoC: rt5640: Allow snd_soc_component_set_jack() to override the codec IRQ ASoC: rt5640: Change jack_work to a delayed_work ASoC: rt5640: Fix possible NULL pointer deref on resume ...

Linus Torvalds committed 4 years ago

Commit 3ceff4e2 parents e1a7aa2 081c737414 files · +17555 −5674Browse files

Unified · Split

414 files
  1. Documentation/devicetree/bindings/sound/ak4375.yaml +57 −0
  2. Documentation/devicetree/bindings/sound/amlogic,aiu.yaml +5 −0
  3. Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml +5 −0
  4. Documentation/devicetree/bindings/sound/amlogic,t9015.yaml +5 −0
  5. Documentation/devicetree/bindings/sound/audio-graph-port.yaml +7 −2
  6. Documentation/devicetree/bindings/sound/cirrus,cs42l42.yaml +225 −0
  7. Documentation/devicetree/bindings/sound/cs42l42.txt +0 −115
  8. Documentation/devicetree/bindings/sound/linux,spdif-dit.yaml +5 −0
  9. Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml +8 −0
  10. Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml +4 −0
  11. Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml +14 −0
  12. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt +0 −48
  13. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.yaml +74 −0
  14. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-common.yaml +83 −0
  15. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml +10 −0
  16. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.txt +0 −53
  17. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.yaml +97 −0
  18. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt +0 −52
  19. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.yaml +85 −0
  20. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5677.txt +0 −67
  21. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5677.yaml +100 −0
  22. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-sgtl5000.txt +0 −42
  23. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-sgtl5000.yaml +67 −0
  24. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-trimslice.txt +0 −21
  25. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-trimslice.yaml +33 −0
  26. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt +0 −40
  27. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.yaml +79 −0
  28. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt +0 −62
  29. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.yaml +93 −0
  30. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt +0 −60
  31. Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.yaml +76 −0
  32. Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt +0 −30
  33. Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml +77 −0
  34. Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml +85 −0
  35. Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml +2 −0
  36. Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml +41 −0
  37. Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt +0 −96
  38. Documentation/devicetree/bindings/sound/qcom,sm8250.yaml +146 −6
  39. Documentation/devicetree/bindings/sound/realtek,rt5682s.yaml +4 −0
  40. Documentation/devicetree/bindings/sound/simple-audio-amplifier.yaml +4 −4
  41. Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml +137 −0
  42. Documentation/devicetree/bindings/sound/wlf,wm8903.yaml +116 −0
  43. Documentation/devicetree/bindings/sound/wm8903.txt +0 −82
  44. MAINTAINERS +11 −0
  45. arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 −3
  46. drivers/dma/mmp_pdma.c +0 −6
  47. drivers/dma/pxa_dma.c +0 −7
  48. drivers/dma/qcom/qcom_adm.c +49 −7
  49. drivers/dma/sh/shdma-base.c +0 −8
  50. drivers/dma/sprd-dma.c +0 −3
  51. drivers/dma/tegra20-apb-dma.c +0 −6
  52. drivers/dma/xilinx/xilinx_dpdma.c +11 −6
  53. drivers/firmware/cirrus/cs_dsp.c +115 −41
  54. drivers/gpu/drm/xlnx/zynqmp_disp.c +7 −2
  55. drivers/mmc/host/bcm2835.c +0 −2
  56. drivers/mtd/nand/raw/qcom_nandc.c +12 −2
  57. drivers/soc/mediatek/mtk-scpsys.c +11 −4
  58. drivers/soundwire/cadence_master.c +2 −34
  59. drivers/soundwire/cadence_master.h +4 −10
  60. drivers/soundwire/intel.c +124 −129
  61. drivers/soundwire/qcom.c +4 −4
  62. drivers/soundwire/stream.c +2 −2
  63. drivers/spi/spi-pic32.c +0 −2
  64. drivers/tty/serial/msm_serial.c +13 −2
  65. include/dt-bindings/sound/rt5640.h +1 −0
  66. include/dt-bindings/sound/tlv320adc3xxx.h +28 −0
  67. include/linux/dma/qcom_adm.h +12 −0
  68. include/linux/dma/xilinx_dpdma.h +11 −0
  69. include/linux/dmaengine.h +0 −4
  70. include/linux/firmware/cirrus/cs_dsp.h +16 −5
  71. include/linux/firmware/cirrus/wmfw.h +1 −0
  72. include/linux/soundwire/sdw_intel.h +2 −2
  73. include/sound/cs35l41.h +746 −0
  74. include/sound/dmaengine_pcm.h +0 −2
  75. include/sound/hda_codec.h +5 −3
  76. include/sound/hdaudio.h +1 −0
  77. include/sound/hdaudio_ext.h +13 −14
  78. include/sound/intel-nhlt.h +29 −8
  79. include/sound/memalloc.h +7 −7
  80. include/sound/pcm.h +3 −0
  81. include/sound/rt5682s.h +1 −0
  82. include/sound/soc-component.h +4 −0
  83. include/sound/soc-dai.h +18 −18
  84. include/sound/soc-dpcm.h +2 −0
  85. include/sound/soc.h +1 −2
  86. include/sound/sof.h +22 −0
  87. include/sound/sof/dai-amd.h +21 −0
  88. include/sound/sof/dai-mediatek.h +23 −0
  89. include/sound/sof/dai.h +29 −6
  90. include/sound/sof/debug.h +2 −0
  91. include/sound/sof/header.h +1 −0
  92. include/uapi/sound/asound.h +6 −1
  93. include/uapi/sound/sof/tokens.h +5 −0
  94. sound/core/Makefile +0 −1
  95. sound/core/control_led.c +1 −1
  96. sound/core/info_oss.c +2 −4
  97. sound/core/jack.c +3 −0
  98. sound/core/memalloc.c +49 −4
  99. sound/core/oss/pcm_oss.c +1 −1
  100. sound/core/pcm.c +5 −1
  101. sound/core/pcm_dmaengine.c +2 −3
  102. sound/core/pcm_lib.c +17 −0
  103. sound/core/seq/seq_queue.c +12 −2
  104. sound/core/seq/seq_virmidi.c +11 −0
  105. sound/core/sgbuf.c +0 −201
  106. sound/drivers/virmidi.c +0 −3
  107. sound/hda/ext/hdac_ext_stream.c +100 −116
  108. sound/hda/hdac_stream.c +20 −10
  109. sound/hda/intel-dsp-config.c +39 −14
  110. sound/hda/intel-nhlt.c +102 −0
  111. sound/isa/gus/gus_mem.c +13 −9
  112. sound/pci/ac97/ac97_pcm.c +1 −1
  113. sound/pci/hda/Kconfig +33 −0
  114. sound/pci/hda/Makefile +10 −0
  115. sound/pci/hda/cs35l41_hda.c +528 −0
  116. sound/pci/hda/cs35l41_hda.h +69 −0
  117. sound/pci/hda/cs35l41_hda_i2c.c +66 −0
  118. sound/pci/hda/cs35l41_hda_spi.c +63 −0
  119. sound/pci/hda/hda_auto_parser.c +1 −5
  120. sound/pci/hda/hda_bind.c +7 −0
  121. sound/pci/hda/hda_codec.c +29 −16
  122. sound/pci/hda/hda_component.h +20 −0
  123. sound/pci/hda/hda_controller.c +0 −1
  124. sound/pci/hda/hda_generic.h +1 −1
  125. sound/pci/hda/hda_intel.c +10 −1
  126. sound/pci/hda/hda_jack.c +11 −0
  127. sound/pci/hda/hda_jack.h +1 −0
  128. sound/pci/hda/hda_local.h +1 −0
  129. sound/pci/hda/hda_tegra.c +34 −9
  130. sound/pci/hda/patch_cs8409-tables.c +3 −0
  131. sound/pci/hda/patch_cs8409.c +6 −3
  132. sound/pci/hda/patch_cs8409.h +1 −0
  133. sound/pci/hda/patch_hdmi.c +1 −1
  134. sound/pci/hda/patch_realtek.c +195 −3
  135. sound/pci/mixart/mixart_core.c +3 −2
  136. sound/pci/mixart/mixart_core.h +9 −1
  137. sound/ppc/beep.c +1 −1
  138. sound/soc/amd/Kconfig +8 −1
  139. sound/soc/amd/Makefile +2 −0
  140. sound/soc/amd/acp-config.c +124 −0
  141. sound/soc/amd/acp-da7219-max98357a.c +10 −10
  142. sound/soc/amd/acp-pcm-dma.c +14 −1
  143. sound/soc/amd/acp-rt5645.c +2 −2
  144. sound/soc/amd/acp.h +1 −0
  145. sound/soc/amd/acp/Kconfig +3 −5
  146. sound/soc/amd/acp/acp-legacy-mach.c +16 −3
  147. sound/soc/amd/acp/acp-mach-common.c +29 −4
  148. sound/soc/amd/acp/acp-mach.h +9 −1
  149. sound/soc/amd/acp/acp-sof-mach.c +18 −3
  150. sound/soc/amd/acp3x-rt5682-max9836.c +4 −4
  151. sound/soc/amd/mach-config.h +28 −0
  152. sound/soc/amd/yc/acp6x-pdm-dma.c +1 −1
  153. sound/soc/atmel/mikroe-proto.c +3 −3
  154. sound/soc/atmel/tse850-pcm5142.c +12 −20
  155. sound/soc/bcm/bcm63xx-i2s.h +0 −1
  156. sound/soc/bcm/bcm63xx-pcm-whistler.c +6 −7
  157. sound/soc/codecs/Kconfig +34 −2
  158. sound/soc/codecs/Makefile +10 −2
  159. sound/soc/codecs/adau1701.c +31 −63
  160. sound/soc/codecs/ak4118.c +6 −12
  161. sound/soc/codecs/ak4375.c +610 −0
  162. sound/soc/codecs/cs35l35.c +1 −1
  163. sound/soc/codecs/cs35l41-i2c.c +3 −16
  164. sound/soc/codecs/cs35l41-lib.c +512 −66
  165. sound/soc/codecs/cs35l41-spi.c +3 −17
  166. sound/soc/codecs/cs35l41.c +526 −367
  167. sound/soc/codecs/cs35l41.h +18 −731
  168. sound/soc/codecs/cs4265.c +13 −2
  169. sound/soc/codecs/cs42l42.c +58 −36
  170. sound/soc/codecs/cs42l42.h +5 −1
  171. sound/soc/codecs/es7241.c +9 −19
  172. sound/soc/codecs/hdac_hda.c +11 −11
  173. sound/soc/codecs/jz4770.c +9 −0
  174. sound/soc/codecs/max9759.c +9 −19
  175. sound/soc/codecs/max98373-sdw.c +1 −1
  176. sound/soc/codecs/max9860.c +4 −8
  177. sound/soc/codecs/msm8916-wcd-analog.c +4 −3
  178. sound/soc/codecs/mt6660.c +2 −3
  179. sound/soc/codecs/pcm3168a.c +7 −15
  180. sound/soc/codecs/rt1308-sdw.c +1 −1
  181. sound/soc/codecs/rt1316-sdw.c +1 −1
  182. sound/soc/codecs/rt5640.c +152 −17
  183. sound/soc/codecs/rt5640.h +10 −1
  184. sound/soc/codecs/rt5663.c +9 −3
  185. sound/soc/codecs/rt5682-sdw.c +1 −1
  186. sound/soc/codecs/rt5682.c +2 −5
  187. sound/soc/codecs/rt5682s.c +31 −3
  188. sound/soc/codecs/rt700.c +1 −1
  189. sound/soc/codecs/rt711-sdca.c +1 −1
  190. sound/soc/codecs/rt711.c +1 −1
  191. sound/soc/codecs/rt715-sdca.c +1 −1
  192. sound/soc/codecs/rt715.c +1 −1
  193. sound/soc/codecs/sdw-mockup.c +1 −1
  194. sound/soc/codecs/sgtl5000.c +2 −3
  195. sound/soc/codecs/simple-amplifier.c +3 −7
  196. sound/soc/codecs/simple-mux.c +3 −7
  197. sound/soc/codecs/ssm2305.c +3 −8
  198. sound/soc/codecs/sta350.h +1 −1
  199. sound/soc/codecs/tfa989x.c +19 −1
  200. sound/soc/codecs/tlv320adc3xxx.c +1317 −0
  201. sound/soc/codecs/tlv320aic26.h +3 −3
  202. sound/soc/codecs/tlv320aic31xx.c +75 −46
  203. sound/soc/codecs/tlv320aic31xx.h +1 −1
  204. sound/soc/codecs/wcd-mbhc-v2.c +67 −9
  205. sound/soc/codecs/wcd9335.c +9 −8
  206. sound/soc/codecs/wcd934x.c +2 −4
  207. sound/soc/codecs/wcd938x.c +3 −5
  208. sound/soc/codecs/wm_adsp.c +27 −34
  209. sound/soc/codecs/wm_adsp.h +8 −0
  210. sound/soc/codecs/wsa881x.c +1 −1
  211. sound/soc/codecs/zl38060.c +1 −3
  212. sound/soc/fsl/Kconfig +1 −0
  213. sound/soc/fsl/fsl-asoc-card.c +13 −2
  214. sound/soc/fsl/fsl_asrc.c +58 −11
  215. sound/soc/fsl/fsl_mqs.c +1 −1
  216. sound/soc/fsl/imx-card.c +30 −19
  217. sound/soc/fsl/imx-hdmi.c +2 −0
  218. sound/soc/fsl/imx-sgtl5000.c +1 −3
  219. sound/soc/fsl/imx-spdif.c +2 −2
  220. sound/soc/generic/audio-graph-card.c +1 −4
  221. sound/soc/generic/audio-graph-card2.c +2 −2
  222. sound/soc/generic/simple-card-utils.c +1 −44
  223. sound/soc/generic/simple-card.c +1 −2
  224. sound/soc/generic/test-component.c +2 −3
  225. sound/soc/img/img-i2s-in.c +3 −5
  226. sound/soc/img/img-i2s-out.c +9 −15
  227. sound/soc/img/img-parallel-out.c +9 −15
  228. sound/soc/img/img-spdif-in.c +3 −5
  229. sound/soc/img/img-spdif-out.c +9 −15
  230. sound/soc/img/pistachio-internal-dac.c +3 −6
  231. sound/soc/intel/atom/sst-mfld-platform-pcm.c +13 −1
  232. sound/soc/intel/boards/Kconfig +20 −0
  233. sound/soc/intel/boards/Makefile +2 −0
  234. sound/soc/intel/boards/bytcht_cx2072x.c +1 −1
  235. sound/soc/intel/boards/bytcht_nocodec.c +1 −1
  236. sound/soc/intel/boards/bytcr_rt5640.c +80 −6
  237. sound/soc/intel/boards/hda_dsp_common.c +1 −1
  238. sound/soc/intel/boards/sof_maxim_common.c +180 −0
  239. sound/soc/intel/boards/sof_maxim_common.h +16 −0
  240. sound/soc/intel/boards/sof_nau8825.c +651 −0
  241. sound/soc/intel/boards/sof_realtek_common.c +116 −3
  242. sound/soc/intel/boards/sof_realtek_common.h +7 −0
  243. sound/soc/intel/boards/sof_rt5682.c +76 −103
  244. sound/soc/intel/boards/sof_sdw.c +82 −76
  245. sound/soc/intel/boards/sof_sdw_common.h +6 −1
  246. sound/soc/intel/boards/sof_sdw_rt715.c +0 −7
  247. sound/soc/intel/boards/sof_sdw_rt715_sdca.c +0 −7
  248. sound/soc/intel/catpt/dsp.c +12 −2
  249. sound/soc/intel/catpt/pcm.c +18 −19
  250. sound/soc/intel/common/soc-acpi-intel-adl-match.c +48 −0
  251. sound/soc/intel/skylake/skl-nhlt.c +0 −102
  252. sound/soc/intel/skylake/skl-pcm.c +5 −6
  253. sound/soc/intel/skylake/skl-topology.c +17 −12
  254. sound/soc/intel/skylake/skl-topology.h +1 −0
  255. sound/soc/intel/skylake/skl.c +2 −2
  256. sound/soc/intel/skylake/skl.h +0 −4
  257. sound/soc/mediatek/Kconfig +2 −0
  258. sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +0 −2
  259. sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +0 −2
  260. sound/soc/mediatek/mt8173/mt8173-max98090.c +3 −5
  261. sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +2 −5
  262. sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +2 −5
  263. sound/soc/mediatek/mt8173/mt8173-rt5650.c +2 −5
  264. sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +0 −2
  265. sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +11 −10
  266. sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +14 −12
  267. sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +0 −2
  268. sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +9 −8
  269. sound/soc/mediatek/mt8195/mt8195-afe-clk.c +6 −6
  270. sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +8 −1
  271. sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +21 −52
  272. sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c +95 −52
  273. sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +400 −70
  274. sound/soc/mediatek/mt8195/mt8195-reg.h +1 −0
  275. sound/soc/meson/aiu.c +11 −25
  276. sound/soc/meson/axg-fifo.c +4 −12
  277. sound/soc/meson/axg-pdm.c +6 −19
  278. sound/soc/meson/axg-spdifin.c +4 −13
  279. sound/soc/meson/axg-spdifout.c +4 −13
  280. sound/soc/meson/axg-tdm-formatter.c +13 −37
  281. sound/soc/meson/axg-tdm-interface.c +7 −18
  282. sound/soc/meson/meson-card-utils.c +3 −5
  283. sound/soc/meson/t9015.c +4 −10
  284. sound/soc/mxs/mxs-sgtl5000.c +2 −6
  285. sound/soc/qcom/Kconfig +1 −0
  286. sound/soc/qcom/apq8016_sbc.c +129 −5
  287. sound/soc/qcom/common.c +14 −6
  288. sound/soc/qcom/qdsp6/q6apm.c +8 −6
  289. sound/soc/qcom/sc7180.c +19 −5
  290. sound/soc/qcom/sdm845.c +11 −3
  291. sound/soc/qcom/sm8250.c +2 −2
  292. sound/soc/rockchip/rk3288_hdmi_analog.c +3 −7
  293. sound/soc/samsung/aries_wm8994.c +7 −10
  294. sound/soc/samsung/arndale.c +2 −3
  295. sound/soc/samsung/idma.c +2 −0
  296. sound/soc/samsung/littlemill.c +2 −3
  297. sound/soc/samsung/lowland.c +2 −3
  298. sound/soc/samsung/odroid.c +1 −3
  299. sound/soc/samsung/smdk_wm8994.c +2 −2
  300. sound/soc/samsung/smdk_wm8994pcm.c +2 −2
  301. sound/soc/samsung/snow.c +3 −6
  302. sound/soc/samsung/speyside.c +2 −3
  303. sound/soc/samsung/tm2_wm5110.c +1 −2
  304. sound/soc/samsung/tobermory.c +2 −3
  305. sound/soc/sh/rz-ssi.c +6 −1
  306. sound/soc/soc-component.c +28 −0
  307. sound/soc/soc-core.c +50 −1
  308. sound/soc/soc-dai.c +28 −12
  309. sound/soc/soc-pcm.c +249 −131
  310. sound/soc/soc-topology.c +1 −1
  311. sound/soc/sof/Kconfig +15 −3
  312. sound/soc/sof/Makefile +3 −1
  313. sound/soc/sof/amd/Kconfig +33 −0
  314. sound/soc/sof/amd/Makefile +11 −0
  315. sound/soc/sof/amd/acp-dsp-offset.h +78 −0
  316. sound/soc/sof/amd/acp-ipc.c +187 −0
  317. sound/soc/sof/amd/acp-loader.c +199 −0
  318. sound/soc/sof/amd/acp-pcm.c +82 −0
  319. sound/soc/sof/amd/acp-stream.c +181 −0
  320. sound/soc/sof/amd/acp-trace.c +84 −0
  321. sound/soc/sof/amd/acp.c +446 −0
  322. sound/soc/sof/amd/acp.h +226 −0
  323. sound/soc/sof/amd/pci-rn.c +165 −0
  324. sound/soc/sof/amd/renoir.c +186 −0
  325. sound/soc/sof/control.c +17 −44
  326. sound/soc/sof/core.c +82 −53
  327. sound/soc/sof/debug.c +130 −12
  328. sound/soc/sof/imx/Kconfig +13 −33
  329. sound/soc/sof/imx/imx-common.c +26 −2
  330. sound/soc/sof/imx/imx-common.h +11 −0
  331. sound/soc/sof/imx/imx-ops.h +0 −10
  332. sound/soc/sof/imx/imx8.c +178 −42
  333. sound/soc/sof/imx/imx8m.c +220 −40
  334. sound/soc/sof/intel/apl.c +4 −3
  335. sound/soc/sof/intel/atom.c +12 −52
  336. sound/soc/sof/intel/atom.h +2 −2
  337. sound/soc/sof/intel/bdw.c +20 −51
  338. sound/soc/sof/intel/byt.c +9 −0
  339. sound/soc/sof/intel/cnl.c +28 −6
  340. sound/soc/sof/intel/hda-codec.c +2 −1
  341. sound/soc/sof/intel/hda-ctrl.c +1 −1
  342. sound/soc/sof/intel/hda-dai.c +47 −50
  343. sound/soc/sof/intel/hda-dsp.c +50 −2
  344. sound/soc/sof/intel/hda-ipc.c +19 −29
  345. sound/soc/sof/intel/hda-loader.c +28 −76
  346. sound/soc/sof/intel/hda-pcm.c +100 −27
  347. sound/soc/sof/intel/hda-stream.c +67 −42
  348. sound/soc/sof/intel/hda.c +66 −73
  349. sound/soc/sof/intel/hda.h +15 −7
  350. sound/soc/sof/intel/icl.c +68 −5
  351. sound/soc/sof/intel/pci-tng.c +9 −0
  352. sound/soc/sof/intel/shim.h +11 −0
  353. sound/soc/sof/intel/tgl.c +44 −3
  354. sound/soc/sof/ipc.c +105 −29
  355. sound/soc/sof/loader.c +8 −8
  356. sound/soc/sof/mediatek/Kconfig +33 −0
  357. sound/soc/sof/mediatek/Makefile +2 −0
  358. sound/soc/sof/mediatek/adsp_helper.h +49 −0
  359. sound/soc/sof/mediatek/mt8195/Makefile +3 −0
  360. sound/soc/sof/mediatek/mt8195/mt8195-clk.c +158 −0
  361. sound/soc/sof/mediatek/mt8195/mt8195-clk.h +28 −0
  362. sound/soc/sof/mediatek/mt8195/mt8195-loader.c +56 −0
  363. sound/soc/sof/mediatek/mt8195/mt8195.c +463 −0
  364. sound/soc/sof/mediatek/mt8195/mt8195.h +158 −0
  365. sound/soc/sof/ops.c +34 −13
  366. sound/soc/sof/ops.h +69 −24
  367. sound/soc/sof/pcm.c +77 −41
  368. sound/soc/sof/pm.c +10 −0
  369. sound/soc/sof/sof-audio.c +195 −44
  370. sound/soc/sof/sof-audio.h +5 −12
  371. sound/soc/sof/sof-of-dev.c +8 −60
  372. sound/soc/sof/sof-of-dev.h +17 −0
  373. sound/soc/sof/sof-pci-dev.c +10 −9
  374. sound/soc/sof/sof-priv.h +51 −31
  375. sound/soc/sof/sof-probes.c +1 −1
  376. sound/soc/sof/sof-probes.h +1 −1
  377. sound/soc/sof/topology.c +180 −112
  378. sound/soc/sof/trace.c +18 −0
  379. sound/soc/sof/xtensa/core.c +25 −19
  380. sound/soc/stm/stm32_adfsdm.c +4 −1
  381. sound/soc/stm/stm32_i2s.c +25 −41
  382. sound/soc/stm/stm32_sai.c +13 −24
  383. sound/soc/stm/stm32_sai_sub.c +10 −19
  384. sound/soc/stm/stm32_spdifrx.c +19 −29
  385. sound/soc/sunxi/sun4i-codec.c +1 −2
  386. sound/soc/sunxi/sun4i-spdif.c +115 −0
  387. sound/soc/sunxi/sun8i-codec.c +56 −0
  388. sound/soc/tegra/tegra20_i2s.c +49 −0
  389. sound/soc/tegra/tegra20_spdif.c +139 −58
  390. sound/soc/tegra/tegra20_spdif.h +1 −0
  391. sound/soc/tegra/tegra210_mvc.c +164 −45
  392. sound/soc/tegra/tegra210_mvc.h +5 −0
  393. sound/soc/tegra/tegra_pcm.c +6 −0
  394. sound/soc/tegra/tegra_pcm.h +1 −0
  395. sound/soc/ti/davinci-mcasp.c +6 −15
  396. sound/soc/ti/j721e-evm.c +3 −7
  397. sound/soc/uniphier/Kconfig +0 −2
  398. sound/soc/xilinx/xlnx_spdif.c +3 −7
  399. sound/sparc/dbri.c +3 −3
  400. sound/usb/card.c +0 −7
  401. sound/usb/format.c +1 −1
  402. sound/usb/mixer.c +1 −4
  403. sound/usb/mixer.h +0 −2
  404. sound/usb/mixer_maps.c +15 −2
  405. sound/usb/mixer_quirks.c +1 −3
  406. sound/usb/mixer_quirks.h +0 −2
  407. sound/usb/power.h +0 −10
  408. sound/usb/quirks.c +1 −1
  409. sound/usb/usx2y/usbusx2y.c +1 −1
  410. sound/x86/intel_hdmi_audio.c +3 −1
  411. tools/testing/selftests/Makefile +2 −1
  412. tools/testing/selftests/alsa/.gitignore +1 −0
  413. tools/testing/selftests/alsa/Makefile +9 −0
  414. tools/testing/selftests/alsa/mixer-test.c +705 −0
Documentation/devicetree/bindings/sound/ak4375.yaml+57−0
@@ -0,0 +1,57 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/ak4375.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: AK4375 DAC and headphones amplifier Device Tree Bindings
8+
9+maintainers:
10+ - Vincent Knecht <vincent.knecht@mailoo.org>
11+
12+properties:
13+ compatible:
14+ const: asahi-kasei,ak4375
15+
16+ reg:
17+ maxItems: 1
18+
19+ '#sound-dai-cells':
20+ const: 0
21+
22+ avdd-supply:
23+ description: regulator phandle for the AVDD power supply.
24+
25+ tvdd-supply:
26+ description: regulator phandle for the TVDD power supply.
27+
28+ pdn-gpios:
29+ description: optional GPIO to set the PDN pin.
30+
31+required:
32+ - compatible
33+ - reg
34+ - '#sound-dai-cells'
35+ - avdd-supply
36+ - tvdd-supply
37+
38+additionalProperties: false
39+
40+examples:
41+ - |
42+ #include <dt-bindings/gpio/gpio.h>
43+ i2c {
44+ #address-cells = <1>;
45+ #size-cells = <0>;
46+
47+ headphones: audio-codec@10 {
48+ compatible = "asahi-kasei,ak4375";
49+ reg = <0x10>;
50+ avdd-supply = <&reg_headphones_avdd>;
51+ tvdd-supply = <&pm8916_l6>;
52+ pdn-gpios = <&msmgpio 114 GPIO_ACTIVE_HIGH>;
53+ pinctrl-names = "default";
54+ pinctrl-0 = <&headphones_pdn_default>;
55+ #sound-dai-cells = <0>;
56+ };
57+ };
Documentation/devicetree/bindings/sound/amlogic,aiu.yaml+5−0
@@ -9,6 +9,9 @@ title: Amlogic AIU audio output controller · 8 unmodified lines
99 maintainers:
1010 - Jerome Brunet <jbrunet@baylibre.com>
1111
12+allOf:
13+ - $ref: name-prefix.yaml#
14+
1215 properties:
1316 $nodename:
1417 pattern: "^audio-controller@.*"
@@ -65,6 +68,8 @@ properties: · 50 unmodified lines
6568 resets:
6669 maxItems: 1
6770
71+ sound-name-prefix: true
72+
6873 required:
6974 - "#sound-dai-cells"
7075 - compatible
Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml+5−0
@@ -9,6 +9,9 @@ title: Amlogic G12a Internal DAC Control Glue · 8 unmodified lines
99 maintainers:
1010 - Jerome Brunet <jbrunet@baylibre.com>
1111
12+allOf:
13+ - $ref: name-prefix.yaml#
14+
1215 properties:
1316 $nodename:
1417 pattern: "^audio-controller@.*"
@@ -31,6 +34,8 @@ properties: · 16 unmodified lines
3134 resets:
3235 maxItems: 1
3336
37+ sound-name-prefix: true
38+
3439 required:
3540 - "#sound-dai-cells"
3641 - compatible
Documentation/devicetree/bindings/sound/amlogic,t9015.yaml+5−0
@@ -9,6 +9,9 @@ title: Amlogic T9015 Internal Audio DAC · 8 unmodified lines
99 maintainers:
1010 - Jerome Brunet <jbrunet@baylibre.com>
1111
12+allOf:
13+ - $ref: name-prefix.yaml#
14+
1215 properties:
1316 $nodename:
1417 pattern: "^audio-controller@.*"
@@ -38,6 +41,8 @@ properties: · 23 unmodified lines
3841 description:
3942 Analogue power supply.
4043
44+ sound-name-prefix: true
45+
4146 required:
4247 - "#sound-dai-cells"
4348 - compatible
Documentation/devicetree/bindings/sound/audio-graph-port.yaml+7−2
@@ -42,10 +42,15 @@ patternProperties: · 41 unmodified lines
4242 $ref: /schemas/types.yaml#/definitions/flag
4343 frame-master:
4444 description: Indicates dai-link frame master.
45− $ref: /schemas/types.yaml#/definitions/phandle
45+ oneOf:
46+ - $ref: /schemas/types.yaml#/definitions/flag
47+ - $ref: /schemas/types.yaml#/definitions/phandle
4648 bitclock-master:
4749 description: Indicates dai-link bit clock master
48− $ref: /schemas/types.yaml#/definitions/phandle
50+ oneOf:
51+ - $ref: /schemas/types.yaml#/definitions/flag
52+ - $ref: /schemas/types.yaml#/definitions/phandle
53+
4954 dai-format:
5055 description: audio format.
5156 items:
Documentation/devicetree/bindings/sound/cirrus,cs42l42.yaml+225−0
@@ -0,0 +1,225 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/cirrus,cs42l42.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Cirrus Logic CS42L42 audio CODEC
8+
9+maintainers:
10+ - patches@opensource.cirrus.com
11+
12+description:
13+ The CS42L42 is a low-power audio codec designed for portable applications.
14+ It provides a high-dynamic range, stereo DAC for audio playback and a mono
15+ high-dynamic-range ADC for audio capture. There is an integrated headset
16+ detection block.
17+
18+properties:
19+ compatible:
20+ enum:
21+ - cirrus,cs42l42
22+
23+ reg:
24+ description:
25+ The I2C address of the CS42L42.
26+ maxItems: 1
27+
28+ VP-supply:
29+ description:
30+ VP power supply.
31+
32+ VCP-supply:
33+ description:
34+ Charge pump power supply.
35+
36+ VD_FILT-supply:
37+ description:
38+ FILT+ power supply.
39+
40+ VL-supply:
41+ description:
42+ Logic power supply.
43+
44+ VA-supply:
45+ description:
46+ Analog power supply.
47+
48+ reset-gpios:
49+ description:
50+ This pin will be asserted and then deasserted to reset the
51+ CS42L42 before communication starts.
52+ maxItems: 1
53+
54+ interrupts:
55+ description:
56+ Interrupt for CS42L42 IRQ line.
57+ maxItems: 1
58+
59+ cirrus,ts-inv:
60+ description: |
61+ Sets the behaviour of the jack plug detect switch.
62+
63+ 0 - (Default) Shorted to tip when unplugged, open when plugged.
64+ This is "inverted tip sense (ITS)" in the datasheet.
65+
66+ 1 - Open when unplugged, shorted to tip when plugged.
67+ This is "normal tip sense (TS)" in the datasheet.
68+
69+ The CS42L42_TS_INV_* defines are available for this.
70+ $ref: "/schemas/types.yaml#/definitions/uint32"
71+ minimum: 0
72+ maximum: 1
73+
74+ cirrus,ts-dbnc-rise:
75+ description: |
76+ Debounce the rising edge of TIP_SENSE_PLUG. With no
77+ debounce, the tip sense pin might be noisy on a plug event.
78+
79+ 0 - 0ms
80+ 1 - 125ms
81+ 2 - 250ms
82+ 3 - 500ms
83+ 4 - 750ms
84+ 5 - 1s (Default)
85+ 6 - 1.25s
86+ 7 - 1.5s
87+
88+ The CS42L42_TS_DBNCE_* defines are available for this.
89+ $ref: "/schemas/types.yaml#/definitions/uint32"
90+ minimum: 0
91+ maximum: 7
92+
93+ cirrus,ts-dbnc-fall:
94+ description: |
95+ Debounce the falling edge of TIP_SENSE_UNPLUG. With no
96+ debounce, the tip sense pin might be noisy on an unplug event.
97+
98+ 0 - 0ms
99+ 1 - 125ms
100+ 2 - 250ms
101+ 3 - 500ms
102+ 4 - 750ms
103+ 5 - 1s (Default)
104+ 6 - 1.25s
105+ 7 - 1.5s
106+
107+ The CS42L42_TS_DBNCE_* defines are available for this.
108+ $ref: "/schemas/types.yaml#/definitions/uint32"
109+ minimum: 0
110+ maximum: 7
111+
112+ cirrus,btn-det-init-dbnce:
113+ description: |
114+ This sets how long to wait after enabling button detection
115+ interrupts before servicing button interrupts, to allow the
116+ HS bias time to settle. Value is in milliseconds.
117+ There may be erroneous button interrupts if this debounce time
118+ is too short.
119+
120+ 0ms - 200ms,
121+ Default = 100ms
122+ $ref: "/schemas/types.yaml#/definitions/uint32"
123+ minimum: 0
124+ maximum: 200
125+
126+ cirrus,btn-det-event-dbnce:
127+ description: |
128+ This sets how long to wait after receiving a button press
129+ interrupt before processing it. Allows time for the button
130+ press to make a clean connection with the bias resistors.
131+ Value is in milliseconds.
132+
133+ 0ms - 20ms,
134+ Default = 10ms
135+ $ref: "/schemas/types.yaml#/definitions/uint32"
136+ minimum: 0
137+ maximum: 20
138+
139+ cirrus,bias-lvls:
140+ description: |
141+ For a level-detect headset button scheme, each button will bias
142+ the mic pin to a certain voltage. To determine which button was
143+ pressed, the voltage is compared to sequential, decreasing
144+ voltages, until the compared voltage < bias voltage.
145+ For different hardware setups, a designer might want to tweak this.
146+ This is an array of descending values for the comparator voltage,
147+ given as percent of the HSBIAS voltage.
148+
149+ Array of 4 values, each 0-63
150+ < x1 x2 x3 x4 >
151+ Default = < 15 8 4 1 >
152+ $ref: /schemas/types.yaml#/definitions/uint32-array
153+ minItems: 4
154+ maxItems: 4
155+ items:
156+ minimum: 0
157+ maximum: 63
158+
159+ cirrus,hs-bias-ramp-rate:
160+ description: |
161+ If present this sets the rate that the HS bias should rise and fall.
162+ The actual rise and fall times depend on external hardware (the
163+ datasheet gives several rise and fall time examples).
164+
165+ 0 - Fast rise time; slow, load-dependent fall time
166+ 1 - Fast
167+ 2 - Slow (default)
168+ 3 - Slowest
169+
170+ The CS42L42_HSBIAS_RAMP_* defines are available for this.
171+ $ref: "/schemas/types.yaml#/definitions/uint32"
172+ minimum: 0
173+ maximum: 3
174+
175+ cirrus,hs-bias-sense-disable:
176+ description: |
177+ If present the HSBIAS sense is disabled. Configures HSBIAS output
178+ current sense through the external 2.21-k resistor. HSBIAS_SENSE
179+ is a hardware feature to reduce the potential pop noise when the
180+ headset plug is removed slowly. But on some platforms ESD voltage
181+ will affect it causing plug detection to fail, especially with CTIA
182+ headset type. For different hardware setups, a designer might want
183+ to tweak default behavior.
184+ type: boolean
185+
186+required:
187+ - compatible
188+ - reg
189+ - VP-supply
190+ - VCP-supply
191+ - VD_FILT-supply
192+ - VL-supply
193+ - VA-supply
194+
195+additionalProperties: false
196+
197+examples:
198+ - |
199+ #include <dt-bindings/sound/cs42l42.h>
200+ i2c {
201+ #address-cells = <1>;
202+ #size-cells = <0>;
203+
204+ cs42l42: cs42l42@48 {
205+ compatible = "cirrus,cs42l42";
206+ reg = <0x48>;
207+ VA-supply = <&dummy_vreg>;
208+ VP-supply = <&dummy_vreg>;
209+ VCP-supply = <&dummy_vreg>;
210+ VD_FILT-supply = <&dummy_vreg>;
211+ VL-supply = <&dummy_vreg>;
212+
213+ reset-gpios = <&axi_gpio_0 1 0>;
214+ interrupt-parent = <&gpio0>;
215+ interrupts = <55 8>;
216+
217+ cirrus,ts-inv = <CS42L42_TS_INV_DIS>;
218+ cirrus,ts-dbnc-rise = <CS42L42_TS_DBNCE_1000>;
219+ cirrus,ts-dbnc-fall = <CS42L42_TS_DBNCE_0>;
220+ cirrus,btn-det-init-dbnce = <100>;
221+ cirrus,btn-det-event-dbnce = <10>;
222+ cirrus,bias-lvls = <0x0F 0x08 0x04 0x01>;
223+ cirrus,hs-bias-ramp-rate = <CS42L42_HSBIAS_RAMP_SLOW>;
224+ };
225+ };
Documentation/devicetree/bindings/sound/cs42l42.txt+0−115
@@ -1,115 +0,0 @@
1−CS42L42 audio CODEC
2−
3−Required properties:
4−
5− - compatible : "cirrus,cs42l42"
6−
7− - reg : the I2C address of the device for I2C.
8−
9− - VP-supply, VCP-supply, VD_FILT-supply, VL-supply, VA-supply :
10− power supplies for the device, as covered in
11− Documentation/devicetree/bindings/regulator/regulator.txt.
12−
13−Optional properties:
14−
15− - reset-gpios : a GPIO spec for the reset pin. If specified, it will be
16− deasserted before communication to the codec starts.
17−
18− - interrupts : IRQ line info CS42L42.
19− (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
20− for further information relating to interrupt properties)
21−
22− - cirrus,ts-inv : Boolean property. Sets the behaviour of the jack plug
23− detect switch.
24−
25− 0 = (Default) Shorted to tip when unplugged, open when plugged.
26− This is "inverted tip sense (ITS)" in the datasheet.
27−
28− 1 = Open when unplugged, shorted to tip when plugged.
29− This is "normal tip sense (TS)" in the datasheet.
30−
31− - cirrus,ts-dbnc-rise : Debounce the rising edge of TIP_SENSE_PLUG. With no
32− debounce, the tip sense pin might be noisy on a plug event.
33−
34− 0 - 0ms,
35− 1 - 125ms,
36− 2 - 250ms,
37− 3 - 500ms,
38− 4 - 750ms,
39− 5 - (Default) 1s,
40− 6 - 1.25s,
41− 7 - 1.5s,
42−
43− - cirrus,ts-dbnc-fall : Debounce the falling edge of TIP_SENSE_UNPLUG.
44− With no debounce, the tip sense pin might be noisy on an unplug event.
45−
46− 0 - 0ms,
47− 1 - 125ms,
48− 2 - 250ms,
49− 3 - 500ms,
50− 4 - 750ms,
51− 5 - (Default) 1s,
52− 6 - 1.25s,
53− 7 - 1.5s,
54−
55− - cirrus,btn-det-init-dbnce : This sets how long the driver sleeps after
56− enabling button detection interrupts. After auto-detection and before
57− servicing button interrupts, the HS bias needs time to settle. If you
58− don't wait, there is possibility for erroneous button interrupt.
59−
60− 0ms - 200ms,
61− Default = 100ms
62−
63− - cirrus,btn-det-event-dbnce : This sets how long the driver delays after
64− receiving a button press interrupt. With level detect interrupts, you want
65− to wait a small amount of time to make sure the button press is making a
66− clean connection with the bias resistors.
67−
68− 0ms - 20ms,
69− Default = 10ms
70−
71− - cirrus,bias-lvls : For a level-detect headset button scheme, each button
72− will bias the mic pin to a certain voltage. To determine which button was
73− pressed, the driver will compare this biased voltage to sequential,
74− decreasing voltages and will stop when a comparator is tripped,
75− indicating a comparator voltage < bias voltage. This value represents a
76− percentage of the internally generated HS bias voltage. For different
77− hardware setups, a designer might want to tweak this. This is an array of
78− descending values for the comparator voltage.
79−
80− Array of 4 values
81− Each 0-63
82− < x1 x2 x3 x4 >
83− Default = < 15 8 4 1>
84−
85− - cirrus,hs-bias-sense-disable: This is boolean property. If present the
86− HSBIAS sense is disabled. Configures HSBIAS output current sense through
87− the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
88− the potential pop noise during the headset plug out slowly. But on some
89− platforms ESD voltage will affect it causing test to fail, especially
90− with CTIA headset type. For different hardware setups, a designer might
91− want to tweak default behavior.
92−
93−Example:
94−
95−cs42l42: cs42l42@48 {
96− compatible = "cirrus,cs42l42";
97− reg = <0x48>;
98− VA-supply = <&dummy_vreg>;
99− VP-supply = <&dummy_vreg>;
100− VCP-supply = <&dummy_vreg>;
101− VD_FILT-supply = <&dummy_vreg>;
102− VL-supply = <&dummy_vreg>;
103−
104− reset-gpios = <&axi_gpio_0 1 0>;
105− interrupt-parent = <&gpio0>;
106− interrupts = <55 8>
107−
108− cirrus,ts-inv = <0x00>;
109− cirrus,ts-dbnc-rise = <0x05>;
110− cirrus,ts-dbnc-fall = <0x00>;
111− cirrus,btn-det-init-dbnce = <100>;
112− cirrus,btn-det-event-dbnce = <10>;
113− cirrus,bias-lvls = <0x0F 0x08 0x04 0x01>;
114− cirrus,hs-bias-ramp-rate = <0x02>;
115−};
Documentation/devicetree/bindings/sound/linux,spdif-dit.yaml+5−0
@@ -9,6 +9,9 @@ title: Dummy SPDIF Transmitter Device Tree Bindings · 8 unmodified lines
99 maintainers:
1010 - Mark Brown <broonie@kernel.org>
1111
12+allOf:
13+ - $ref: name-prefix.yaml#
14+
1215 properties:
1316 compatible:
1417 const: linux,spdif-dit
@@ -16,6 +19,8 @@ properties: · 1 unmodified line
1619 "#sound-dai-cells":
1720 const: 0
1821
22+ sound-name-prefix: true
23+
1924 required:
2025 - "#sound-dai-cells"
2126 - compatible
Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml+8−0
@@ -19,6 +19,12 @@ properties: · 18 unmodified lines
1919 interrupts:
2020 maxItems: 1
2121
22+ memory-region:
23+ maxItems: 1
24+ description: |
25+ Shared memory region for AFE memif. A "shared-dma-pool".
26+ See ../reserved-memory/reserved-memory.txt for details.
27+
2228 mediatek,topckgen:
2329 $ref: "/schemas/types.yaml#/definitions/phandle"
2430 description: The phandle of the mediatek topckgen controller
@@ -125,6 +131,7 @@ required: · 100 unmodified lines
125131 - power-domains
126132 - clocks
127133 - clock-names
134+ - memory-region
128135
129136 additionalProperties: false
130137
@@ -139,6 +146,7 @@ examples: · 8 unmodified lines
139146 interrupts = <GIC_SPI 822 IRQ_TYPE_LEVEL_HIGH 0>;
140147 mediatek,topckgen = <&topckgen>;
141148 power-domains = <&spm 7>; //MT8195_POWER_DOMAIN_AUDIO
149+ memory-region = <&snd_dma_mem_reserved>;
142150 clocks = <&clk26m>,
143151 <&topckgen 163>, //CLK_TOP_APLL1
144152 <&topckgen 166>, //CLK_TOP_APLL2
Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml+4−0
@@ -16,6 +16,10 @@ properties: · 15 unmodified lines
1616 compatible:
1717 const: mediatek,mt8195_mt6359_rt1011_rt5682
1818
19+ model:
20+ $ref: /schemas/types.yaml#/definitions/string
21+ description: User specified audio sound card name
22+
1923 mediatek,platform:
2024 $ref: "/schemas/types.yaml#/definitions/phandle"
2125 description: The phandle of MT8195 ASoC platform.
Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml+14−0
@@ -16,6 +16,10 @@ properties: · 15 unmodified lines
1616 compatible:
1717 const: mediatek,mt8195_mt6359_rt1019_rt5682
1818
19+ model:
20+ $ref: /schemas/types.yaml#/definitions/string
21+ description: User specified audio sound card name
22+
1923 mediatek,platform:
2024 $ref: "/schemas/types.yaml#/definitions/phandle"
2125 description: The phandle of MT8195 ASoC platform.
@@ -28,6 +32,16 @@ properties: · 6 unmodified lines
2832 $ref: "/schemas/types.yaml#/definitions/phandle"
2933 description: The phandle of MT8195 HDMI codec node.
3034
35+ mediatek,adsp:
36+ $ref: "/schemas/types.yaml#/definitions/phandle"
37+ description: The phandle of MT8195 ADSP platform.
38+
39+ mediatek,dai-link:
40+ $ref: /schemas/types.yaml#/definitions/string-array
41+ description:
42+ A list of the desired dai-links in the sound card. Each entry is a
43+ name defined in the machine driver.
44+
3145 additionalProperties: false
3246
3347 required:
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt+0−48
@@ -1,48 +0,0 @@
1−NVIDIA Tegra audio complex
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-alc5632"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the ALC5632's pins as documented in the binding for the device
16− and:
17−
18− * Headset Stereophone
19− * Int Spk
20− * Headset Mic
21− * Digital Mic
22−
23−- nvidia,i2s-controller : The phandle of the Tegra I2S controller
24−- nvidia,audio-codec : The phandle of the ALC5632 audio codec
25−
26−Example:
27−
28−sound {
29− compatible = "nvidia,tegra-audio-alc5632-paz00",
30− "nvidia,tegra-audio-alc5632";
31−
32− nvidia,model = "Compal PAZ00";
33−
34− nvidia,audio-routing =
35− "Int Spk", "SPK_OUTP",
36− "Int Spk", "SPK_OUTN",
37− "Headset Mic","MICBIAS1",
38− "MIC1_N", "Headset Mic",
39− "MIC1_P", "Headset Mic",
40− "Headset Stereophone", "HP_OUT_R",
41− "Headset Stereophone", "HP_OUT_L";
42−
43− nvidia,i2s-controller = <&tegra_i2s1>;
44− nvidia,audio-codec = <&alc5632>;
45−
46− clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
47− clock-names = "pll_a", "pll_a_out0", "mclk";
48−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.yaml+74−0
@@ -0,0 +1,74 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-alc5632.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with ALC5632 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-alc5632(-[a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-alc5632
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headset Stereophone"
35+ - "Int Spk"
36+ - "Headset Mic"
37+ - "Digital Mic"
38+
39+ # CODEC Pins
40+ - SPKOUT
41+ - SPKOUTN
42+ - MICBIAS1
43+ - MIC1
44+ - HPR
45+ - HPL
46+ - DMICDAT
47+
48+required:
49+ - nvidia,i2s-controller
50+
51+unevaluatedProperties: false
52+
53+examples:
54+ - |
55+ sound {
56+ compatible = "nvidia,tegra-audio-alc5632-paz00",
57+ "nvidia,tegra-audio-alc5632";
58+
59+ nvidia,model = "Compal PAZ00";
60+
61+ nvidia,audio-routing = "Int Spk", "SPKOUT",
62+ "Int Spk", "SPKOUTN",
63+ "Headset Mic", "MICBIAS1",
64+ "MIC1", "Headset Mic",
65+ "Headset Stereophone", "HPR",
66+ "Headset Stereophone", "HPL",
67+ "DMICDAT", "Digital Mic";
68+
69+ nvidia,i2s-controller = <&i2s>;
70+ nvidia,audio-codec = <&codec>;
71+
72+ clocks = <&clk 112>, <&clk 113>, <&clk 93>;
73+ clock-names = "pll_a", "pll_a_out0", "mclk";
74+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-common.yaml+83−0
@@ -0,0 +1,83 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: "http://devicetree.org/schemas/sound/nvidia,tegra-audio-common.yaml#"
5+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6+
7+title: Common properties for NVIDIA Tegra audio complexes
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+properties:
14+ clocks:
15+ items:
16+ - description: PLL A clock
17+ - description: PLL A OUT0 clock
18+ - description: The Tegra cdev1/extern1 clock, which feeds the card's mclk
19+
20+ clock-names:
21+ items:
22+ - const: pll_a
23+ - const: pll_a_out0
24+ - const: mclk
25+
26+ nvidia,model:
27+ $ref: /schemas/types.yaml#/definitions/string
28+ description: The user-visible name of this sound complex.
29+
30+ nvidia,audio-routing:
31+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
32+ description: |
33+ A list of the connections between audio components.
34+ Each entry is a pair of strings, the first being the connection's sink,
35+ the second being the connection's source. Valid names for sources and
36+ sinks are the pins (documented in the binding document),
37+ and the jacks on the board.
38+
39+ nvidia,ac97-controller:
40+ $ref: /schemas/types.yaml#/definitions/phandle
41+ description: The phandle of the AC97 controller
42+
43+ nvidia,i2s-controller:
44+ $ref: /schemas/types.yaml#/definitions/phandle
45+ description: The phandle of the Tegra I2S controller
46+
47+ nvidia,audio-codec:
48+ $ref: /schemas/types.yaml#/definitions/phandle
49+ description: The phandle of audio codec
50+
51+ nvidia,spkr-en-gpios:
52+ maxItems: 1
53+ description: The GPIO that enables the speakers
54+
55+ nvidia,hp-mute-gpios:
56+ maxItems: 1
57+ description: The GPIO that mutes the headphones
58+
59+ nvidia,hp-det-gpios:
60+ maxItems: 1
61+ description: The GPIO that detect headphones are plugged in
62+
63+ nvidia,mic-det-gpios:
64+ maxItems: 1
65+ description: The GPIO that detect microphone is plugged in
66+
67+ nvidia,ear-sel-gpios:
68+ maxItems: 1
69+ description: The GPIO that switch between the microphones
70+
71+ nvidia,int-mic-en-gpios:
72+ maxItems: 1
73+ description: The GPIO that enables the internal microphone
74+
75+ nvidia,ext-mic-en-gpios:
76+ maxItems: 1
77+ description: The GPIO that enables the external microphone
78+
79+ nvidia,headset:
80+ type: boolean
81+ description: The Mic Jack represents state of the headset microphone pin
82+
83+additionalProperties: true
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml+10−0
@@ -44,6 +44,16 @@ properties: · 43 unmodified lines
4444 minItems: 1
4545 maxItems: 3
4646
47+ interconnects:
48+ items:
49+ - description: APE read memory client
50+ - description: APE write memory client
51+
52+ interconnect-names:
53+ items:
54+ - const: dma-mem # read
55+ - const: write
56+
4757 iommus:
4858 maxItems: 1
4959
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.txt+0−53
@@ -1,53 +0,0 @@
1−NVIDIA Tegra audio complex, with MAX98090 CODEC
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-max98090"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the MAX98090's pins (as documented in its binding), and the jacks
16− on the board:
17−
18− * Headphones
19− * Speakers
20− * Mic Jack
21− * Int Mic
22−
23−- nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
24− connected to the CODEC.
25−- nvidia,audio-codec : The phandle of the MAX98090 audio codec.
26−
27−Optional properties:
28−- nvidia,hp-det-gpios : The GPIO that detect headphones are plugged in
29−- nvidia,mic-det-gpios : The GPIO that detect microphones are plugged in
30−
31−Example:
32−
33−sound {
34− compatible = "nvidia,tegra-audio-max98090-venice2",
35− "nvidia,tegra-audio-max98090";
36− nvidia,model = "NVIDIA Tegra Venice2";
37−
38− nvidia,audio-routing =
39− "Headphones", "HPR",
40− "Headphones", "HPL",
41− "Speakers", "SPKR",
42− "Speakers", "SPKL",
43− "Mic Jack", "MICBIAS",
44− "IN34", "Mic Jack";
45−
46− nvidia,i2s-controller = <&tegra_i2s1>;
47− nvidia,audio-codec = <&acodec>;
48−
49− clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
50− <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
51− <&tegra_car TEGRA124_CLK_EXTERN1>;
52− clock-names = "pll_a", "pll_a_out0", "mclk";
53−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.yaml+97−0
@@ -0,0 +1,97 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-max98090.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with MAX98090 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ oneOf:
19+ - items:
20+ - pattern: '^[a-z0-9]+,tegra-audio-max98090(-[a-z0-9]+)+$'
21+ - const: nvidia,tegra-audio-max98090
22+ - items:
23+ - enum:
24+ - nvidia,tegra-audio-max98090-nyan-big
25+ - nvidia,tegra-audio-max98090-nyan-blaze
26+ - const: nvidia,tegra-audio-max98090-nyan
27+ - const: nvidia,tegra-audio-max98090
28+
29+ nvidia,audio-routing:
30+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
31+ description: |
32+ A list of the connections between audio components.
33+ Each entry is a pair of strings, the first being the connection's sink,
34+ the second being the connection's source. Valid names for sources and
35+ sinks are the pins (documented in the binding document),
36+ and the jacks on the board.
37+ minItems: 2
38+ items:
39+ enum:
40+ # Board Connectors
41+ - "Headphones"
42+ - "Speakers"
43+ - "Mic Jack"
44+ - "Int Mic"
45+
46+ # CODEC Pins
47+ - MIC1
48+ - MIC2
49+ - DMICL
50+ - DMICR
51+ - IN1
52+ - IN2
53+ - IN3
54+ - IN4
55+ - IN5
56+ - IN6
57+ - IN12
58+ - IN34
59+ - IN56
60+ - HPL
61+ - HPR
62+ - SPKL
63+ - SPKR
64+ - RCVL
65+ - RCVR
66+ - MICBIAS
67+
68+required:
69+ - nvidia,i2s-controller
70+
71+unevaluatedProperties: false
72+
73+examples:
74+ - |
75+ #include <dt-bindings/clock/tegra124-car.h>
76+
77+ sound {
78+ compatible = "nvidia,tegra-audio-max98090-venice2",
79+ "nvidia,tegra-audio-max98090";
80+ nvidia,model = "NVIDIA Tegra Venice2";
81+
82+ nvidia,audio-routing =
83+ "Headphones", "HPR",
84+ "Headphones", "HPL",
85+ "Speakers", "SPKR",
86+ "Speakers", "SPKL",
87+ "Mic Jack", "MICBIAS",
88+ "IN34", "Mic Jack";
89+
90+ nvidia,i2s-controller = <&tegra_i2s1>;
91+ nvidia,audio-codec = <&acodec>;
92+
93+ clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
94+ <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
95+ <&tegra_car TEGRA124_CLK_EXTERN1>;
96+ clock-names = "pll_a", "pll_a_out0", "mclk";
97+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt+0−52
@@ -1,52 +0,0 @@
1−NVIDIA Tegra audio complex, with RT5640 CODEC
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-rt5640"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the RT5640's pins (as documented in its binding), and the jacks
16− on the board:
17−
18− * Headphones
19− * Speakers
20− * Mic Jack
21−
22−- nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
23− connected to the CODEC.
24−- nvidia,audio-codec : The phandle of the RT5640 audio codec. This binding
25− assumes that AIF1 on the CODEC is connected to Tegra.
26−
27−Optional properties:
28−- nvidia,hp-det-gpios : The GPIO that detects headphones are plugged in
29−
30−Example:
31−
32−sound {
33− compatible = "nvidia,tegra-audio-rt5640-dalmore",
34− "nvidia,tegra-audio-rt5640";
35− nvidia,model = "NVIDIA Tegra Dalmore";
36−
37− nvidia,audio-routing =
38− "Headphones", "HPOR",
39− "Headphones", "HPOL",
40− "Speakers", "SPORP",
41− "Speakers", "SPORN",
42− "Speakers", "SPOLP",
43− "Speakers", "SPOLN";
44−
45− nvidia,i2s-controller = <&tegra_i2s1>;
46− nvidia,audio-codec = <&rt5640>;
47−
48− nvidia,hp-det-gpios = <&gpio 143 0>; /* GPIO PR7 */
49−
50− clocks = <&tegra_car 216>, <&tegra_car 217>, <&tegra_car 120>;
51− clock-names = "pll_a", "pll_a_out0", "mclk";
52−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.yaml+85−0
@@ -0,0 +1,85 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-rt5640.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with RT5639 or RT5640 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-rt56(39|40)(-[a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-rt5640
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headphones"
35+ - "Speakers"
36+ - "Mic Jack"
37+
38+ # CODEC Pins
39+ - DMIC1
40+ - DMIC2
41+ - MICBIAS1
42+ - IN1P
43+ - IN1R
44+ - IN2P
45+ - IN2R
46+ - HPOL
47+ - HPOR
48+ - LOUTL
49+ - LOUTR
50+ - MONOP
51+ - MONON
52+ - SPOLP
53+ - SPOLN
54+ - SPORP
55+ - SPORN
56+
57+required:
58+ - nvidia,i2s-controller
59+
60+unevaluatedProperties: false
61+
62+examples:
63+ - |
64+ sound {
65+ compatible = "nvidia,tegra-audio-rt5640-dalmore",
66+ "nvidia,tegra-audio-rt5640";
67+ nvidia,model = "NVIDIA Tegra Dalmore";
68+
69+ nvidia,audio-routing =
70+ "Headphones", "HPOR",
71+ "Headphones", "HPOL",
72+ "Speakers", "SPORP",
73+ "Speakers", "SPORN",
74+ "Speakers", "SPOLP",
75+ "Speakers", "SPOLN";
76+
77+ nvidia,i2s-controller = <&tegra_i2s1>;
78+ nvidia,audio-codec = <&rt5640>;
79+
80+ nvidia,hp-det-gpios = <&gpio 143 0>;
81+
82+ clocks = <&clk 216>, <&clk 217>, <&clk 120>;
83+ clock-names = "pll_a", "pll_a_out0", "mclk";
84+ };
85+
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5677.txt+0−67
@@ -1,67 +0,0 @@
1−NVIDIA Tegra audio complex, with RT5677 CODEC
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-rt5677"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the RT5677's pins (as documented in its binding), and the jacks
16− on the board:
17−
18− * Headphone
19− * Speaker
20− * Headset Mic
21− * Internal Mic 1
22− * Internal Mic 2
23−
24−- nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
25− connected to the CODEC.
26−- nvidia,audio-codec : The phandle of the RT5677 audio codec. This binding
27− assumes that AIF1 on the CODEC is connected to Tegra.
28−
29−Optional properties:
30−- nvidia,hp-det-gpios : The GPIO that detects headphones are plugged in
31−- nvidia,hp-en-gpios : The GPIO that enables headphone amplifier
32−- nvidia,mic-present-gpios: The GPIO that mic jack is plugged in
33−- nvidia,dmic-clk-en-gpios : The GPIO that gates DMIC clock signal
34−
35−Example:
36−
37−sound {
38− compatible = "nvidia,tegra-audio-rt5677-ryu",
39− "nvidia,tegra-audio-rt5677";
40− nvidia,model = "NVIDIA Tegra Ryu";
41−
42− nvidia,audio-routing =
43− "Headphone", "LOUT2",
44− "Headphone", "LOUT1",
45− "Headset Mic", "MICBIAS1",
46− "IN1P", "Headset Mic",
47− "IN1N", "Headset Mic",
48− "DMIC L1", "Internal Mic 1",
49− "DMIC R1", "Internal Mic 1",
50− "DMIC L2", "Internal Mic 2",
51− "DMIC R2", "Internal Mic 2",
52− "Speaker", "PDM1L",
53− "Speaker", "PDM1R";
54−
55− nvidia,i2s-controller = <&tegra_i2s1>;
56− nvidia,audio-codec = <&rt5677>;
57−
58− nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(R, 7) GPIO_ACTIVE_HIGH>;
59− nvidia,mic-present-gpios = <&gpio TEGRA_GPIO(O, 5) GPIO_ACTIVE_LOW>;
60− nvidia,hp-en-gpios = <&rt5677 1 GPIO_ACTIVE_HIGH>;
61− nvidia,dmic-clk-en-gpios = <&rt5677 2 GPIO_ACTIVE_HIGH>;
62−
63− clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
64− <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
65− <&tegra_car TEGRA124_CLK_EXTERN1>;
66− clock-names = "pll_a", "pll_a_out0", "mclk";
67−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5677.yaml+100−0
@@ -0,0 +1,100 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-rt5677.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with RT5677 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-rt5677(-[a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-rt5677
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headphone"
35+ - "Speaker"
36+ - "Headset Mic"
37+ - "Internal Mic 1"
38+ - "Internal Mic 2"
39+
40+ # CODEC Pins
41+ - IN1P
42+ - IN1N
43+ - IN2P
44+ - IN2N
45+ - MICBIAS1
46+ - DMIC1
47+ - DMIC2
48+ - DMIC3
49+ - DMIC4
50+ - "DMIC L1"
51+ - "DMIC L2"
52+ - "DMIC L3"
53+ - "DMIC L4"
54+ - "DMIC R1"
55+ - "DMIC R2"
56+ - "DMIC R3"
57+ - "DMIC R4"
58+ - LOUT1
59+ - LOUT2
60+ - LOUT3
61+ - PDM1L
62+ - PDM1R
63+ - PDM2L
64+ - PDM2R
65+
66+required:
67+ - nvidia,i2s-controller
68+
69+unevaluatedProperties: false
70+
71+examples:
72+ - |
73+ sound {
74+ compatible = "nvidia,tegra-audio-rt5677-ryu",
75+ "nvidia,tegra-audio-rt5677";
76+ nvidia,model = "NVIDIA Tegra Ryu";
77+
78+ nvidia,audio-routing =
79+ "Headphone", "LOUT2",
80+ "Headphone", "LOUT1",
81+ "Headset Mic", "MICBIAS1",
82+ "IN1P", "Headset Mic",
83+ "IN1N", "Headset Mic",
84+ "DMIC L1", "Internal Mic 1",
85+ "DMIC R1", "Internal Mic 1",
86+ "DMIC L2", "Internal Mic 2",
87+ "DMIC R2", "Internal Mic 2",
88+ "Speaker", "PDM1L",
89+ "Speaker", "PDM1R";
90+
91+ nvidia,i2s-controller = <&tegra_i2s1>;
92+ nvidia,audio-codec = <&rt5677>;
93+
94+ nvidia,hp-det-gpios = <&gpio 143 0>;
95+
96+ clocks = <&clk 216>,
97+ <&clk 217>,
98+ <&clk 121>;
99+ clock-names = "pll_a", "pll_a_out0", "mclk";
100+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-sgtl5000.txt+0−42
@@ -1,42 +0,0 @@
1−NVIDIA Tegra audio complex, with SGTL5000 CODEC
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-sgtl5000"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the SGTL5000's pins (as documented in its binding), and the jacks
16− on the board:
17−
18− * Headphone Jack
19− * Line In Jack
20− * Mic Jack
21−
22−- nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
23− connected to the CODEC.
24−- nvidia,audio-codec : The phandle of the SGTL5000 audio codec.
25−
26−Example:
27−
28−sound {
29− compatible = "toradex,tegra-audio-sgtl5000-apalis_t30",
30− "nvidia,tegra-audio-sgtl5000";
31− nvidia,model = "Toradex Apalis T30";
32− nvidia,audio-routing =
33− "Headphone Jack", "HP_OUT",
34− "LINE_IN", "Line In Jack",
35− "MIC_IN", "Mic Jack";
36− nvidia,i2s-controller = <&tegra_i2s2>;
37− nvidia,audio-codec = <&sgtl5000>;
38− clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
39− <&tegra_car TEGRA30_CLK_PLL_A_OUT0>,
40− <&tegra_car TEGRA30_CLK_EXTERN1>;
41− clock-names = "pll_a", "pll_a_out0", "mclk";
42−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-sgtl5000.yaml+67−0
@@ -0,0 +1,67 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-sgtl5000.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with SGTL5000 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-sgtl5000([-_][a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-sgtl5000
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headphone Jack"
35+ - "Line In Jack"
36+ - "Mic Jack"
37+
38+ # CODEC Pins
39+ - HP_OUT
40+ - LINE_OUT
41+ - LINE_IN
42+ - MIC_IN
43+
44+required:
45+ - nvidia,i2s-controller
46+
47+unevaluatedProperties: false
48+
49+examples:
50+ - |
51+ #include <dt-bindings/clock/tegra30-car.h>
52+
53+ sound {
54+ compatible = "toradex,tegra-audio-sgtl5000-apalis_t30",
55+ "nvidia,tegra-audio-sgtl5000";
56+ nvidia,model = "Toradex Apalis T30 SGTL5000";
57+ nvidia,audio-routing =
58+ "Headphone Jack", "HP_OUT",
59+ "LINE_IN", "Line In Jack",
60+ "MIC_IN", "Mic Jack";
61+ nvidia,i2s-controller = <&tegra_i2s2>;
62+ nvidia,audio-codec = <&codec>;
63+ clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
64+ <&tegra_car TEGRA30_CLK_PLL_A_OUT0>,
65+ <&tegra_car TEGRA30_CLK_EXTERN1>;
66+ clock-names = "pll_a", "pll_a_out0", "mclk";
67+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-trimslice.txt+0−21
@@ -1,21 +0,0 @@
1−NVIDIA Tegra audio complex for TrimSlice
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-trimslice"
5−- clocks : Must contain an entry for each entry in clock-names.
6−- clock-names : Must include the following entries:
7− "pll_a" (The Tegra clock of that name),
8− "pll_a_out0" (The Tegra clock of that name),
9− "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
10−- nvidia,i2s-controller : The phandle of the Tegra I2S1 controller
11−- nvidia,audio-codec : The phandle of the WM8903 audio codec
12−
13−Example:
14−
15−sound {
16− compatible = "nvidia,tegra-audio-trimslice";
17− nvidia,i2s-controller = <&tegra_i2s1>;
18− nvidia,audio-codec = <&codec>;
19− clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
20− clock-names = "pll_a", "pll_a_out0", "mclk";
21−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-trimslice.yaml+33−0
@@ -0,0 +1,33 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-trimslice.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with TrimSlice CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ const: nvidia,tegra-audio-trimslice
19+
20+required:
21+ - nvidia,i2s-controller
22+
23+unevaluatedProperties: false
24+
25+examples:
26+ - |
27+ sound {
28+ compatible = "nvidia,tegra-audio-trimslice";
29+ nvidia,i2s-controller = <&tegra_i2s1>;
30+ nvidia,audio-codec = <&codec>;
31+ clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
32+ clock-names = "pll_a", "pll_a_out0", "mclk";
33+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt+0−40
@@ -1,40 +0,0 @@
1−NVIDIA Tegra audio complex
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-wm8753"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the WM8753's pins as documented in the binding for the WM8753,
16− and the jacks on the board:
17−
18− * Headphone Jack
19− * Mic Jack
20−
21−- nvidia,i2s-controller : The phandle of the Tegra I2S1 controller
22−- nvidia,audio-codec : The phandle of the WM8753 audio codec
23−Example:
24−
25−sound {
26− compatible = "nvidia,tegra-audio-wm8753-whistler",
27− "nvidia,tegra-audio-wm8753"
28− nvidia,model = "tegra-wm8753-harmony";
29−
30− nvidia,audio-routing =
31− "Headphone Jack", "LOUT1",
32− "Headphone Jack", "ROUT1";
33−
34− nvidia,i2s-controller = <&i2s1>;
35− nvidia,audio-codec = <&wm8753>;
36−
37− clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
38− clock-names = "pll_a", "pll_a_out0", "mclk";
39−};
40−
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.yaml+79−0
@@ -0,0 +1,79 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-wm8753.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with WM8753 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-wm8753(-[a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-wm8753
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headphone Jack"
35+ - "Mic Jack"
36+
37+ # CODEC Pins
38+ - LOUT1
39+ - LOUT2
40+ - ROUT1
41+ - ROUT2
42+ - MONO1
43+ - MONO2
44+ - OUT3
45+ - OUT4
46+ - LINE1
47+ - LINE2
48+ - RXP
49+ - RXN
50+ - ACIN
51+ - ACOP
52+ - MIC1N
53+ - MIC1
54+ - MIC2N
55+ - MIC2
56+ - "Mic Bias"
57+
58+required:
59+ - nvidia,i2s-controller
60+
61+unevaluatedProperties: false
62+
63+examples:
64+ - |
65+ sound {
66+ compatible = "nvidia,tegra-audio-wm8753-whistler",
67+ "nvidia,tegra-audio-wm8753";
68+ nvidia,model = "tegra-wm8753-harmony";
69+
70+ nvidia,audio-routing =
71+ "Headphone Jack", "LOUT1",
72+ "Headphone Jack", "ROUT1";
73+
74+ nvidia,i2s-controller = <&i2s1>;
75+ nvidia,audio-codec = <&wm8753>;
76+
77+ clocks = <&clk 112>, <&clk 113>, <&clk 93>;
78+ clock-names = "pll_a", "pll_a_out0", "mclk";
79+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt+0−62
@@ -1,62 +0,0 @@
1−NVIDIA Tegra audio complex
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-wm8903"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the WM8903's pins (documented in the WM8903 binding document),
16− and the jacks on the board:
17−
18− * Headphone Jack
19− * Int Spk
20− * Mic Jack
21− * Int Mic
22−
23−- nvidia,i2s-controller : The phandle of the Tegra I2S1 controller
24−- nvidia,audio-codec : The phandle of the WM8903 audio codec
25−
26−Optional properties:
27−- nvidia,spkr-en-gpios : The GPIO that enables the speakers
28−- nvidia,hp-mute-gpios : The GPIO that mutes the headphones
29−- nvidia,hp-det-gpios : The GPIO that detect headphones are plugged in
30−- nvidia,int-mic-en-gpios : The GPIO that enables the internal microphone
31−- nvidia,ext-mic-en-gpios : The GPIO that enables the external microphone
32−- nvidia,headset : The Mic Jack represents state of the headset microphone pin
33−
34−Example:
35−
36−sound {
37− compatible = "nvidia,tegra-audio-wm8903-harmony",
38− "nvidia,tegra-audio-wm8903"
39− nvidia,model = "tegra-wm8903-harmony";
40−
41− nvidia,audio-routing =
42− "Headphone Jack", "HPOUTR",
43− "Headphone Jack", "HPOUTL",
44− "Int Spk", "ROP",
45− "Int Spk", "RON",
46− "Int Spk", "LOP",
47− "Int Spk", "LON",
48− "Mic Jack", "MICBIAS",
49− "IN1L", "Mic Jack";
50−
51− nvidia,i2s-controller = <&i2s1>;
52− nvidia,audio-codec = <&wm8903>;
53−
54− nvidia,spkr-en-gpios = <&codec 2 0>;
55− nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */
56− nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */
57− nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */
58−
59− clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
60− clock-names = "pll_a", "pll_a_out0", "mclk";
61−};
62−
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.yaml+93−0
@@ -0,0 +1,93 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-wm8903.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with WM8903 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ oneOf:
19+ - items:
20+ - pattern: '^[a-z0-9]+,tegra-audio-wm8903(-[a-z0-9]+)+$'
21+ - const: nvidia,tegra-audio-wm8903
22+ - items:
23+ - pattern: ad,tegra-audio-plutux
24+ - const: nvidia,tegra-audio-wm8903
25+
26+ nvidia,audio-routing:
27+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
28+ description: |
29+ A list of the connections between audio components.
30+ Each entry is a pair of strings, the first being the connection's sink,
31+ the second being the connection's source. Valid names for sources and
32+ sinks are the pins (documented in the binding document),
33+ and the jacks on the board.
34+ minItems: 2
35+ items:
36+ enum:
37+ # Board Connectors
38+ - "Headphone Jack"
39+ - "Int Spk"
40+ - "Mic Jack"
41+ - "Int Mic"
42+
43+ # CODEC Pins
44+ - IN1L
45+ - IN1R
46+ - IN2L
47+ - IN2R
48+ - IN3L
49+ - IN3R
50+ - DMICDAT
51+ - HPOUTL
52+ - HPOUTR
53+ - LINEOUTL
54+ - LINEOUTR
55+ - LOP
56+ - LON
57+ - ROP
58+ - RON
59+ - MICBIAS
60+
61+required:
62+ - nvidia,i2s-controller
63+
64+unevaluatedProperties: false
65+
66+examples:
67+ - |
68+ sound {
69+ compatible = "nvidia,tegra-audio-wm8903-harmony",
70+ "nvidia,tegra-audio-wm8903";
71+ nvidia,model = "tegra-wm8903-harmony";
72+
73+ nvidia,audio-routing =
74+ "Headphone Jack", "HPOUTR",
75+ "Headphone Jack", "HPOUTL",
76+ "Int Spk", "ROP",
77+ "Int Spk", "RON",
78+ "Int Spk", "LOP",
79+ "Int Spk", "LON",
80+ "Mic Jack", "MICBIAS",
81+ "IN1L", "Mic Jack";
82+
83+ nvidia,i2s-controller = <&i2s1>;
84+ nvidia,audio-codec = <&wm8903>;
85+
86+ nvidia,spkr-en-gpios = <&codec 2 0>;
87+ nvidia,hp-det-gpios = <&gpio 178 0>;
88+ nvidia,int-mic-en-gpios = <&gpio 184 0>;
89+ nvidia,ext-mic-en-gpios = <&gpio 185 0>;
90+
91+ clocks = <&clk 112>, <&clk 113>, <&clk 93>;
92+ clock-names = "pll_a", "pll_a_out0", "mclk";
93+ };
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt+0−60
@@ -1,60 +0,0 @@
1−NVIDIA Tegra audio complex
2−
3−Required properties:
4−- compatible : "nvidia,tegra-audio-wm9712"
5−- clocks : Must contain an entry for each entry in clock-names.
6− See ../clocks/clock-bindings.txt for details.
7−- clock-names : Must include the following entries:
8− - pll_a
9− - pll_a_out0
10− - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
11−- nvidia,model : The user-visible name of this sound complex.
12−- nvidia,audio-routing : A list of the connections between audio components.
13− Each entry is a pair of strings, the first being the connection's sink,
14− the second being the connection's source. Valid names for sources and
15− sinks are the WM9712's pins, and the jacks on the board:
16−
17− WM9712 pins:
18−
19− * MONOOUT
20− * HPOUTL
21− * HPOUTR
22− * LOUT2
23− * ROUT2
24− * OUT3
25− * LINEINL
26− * LINEINR
27− * PHONE
28− * PCBEEP
29− * MIC1
30− * MIC2
31− * Mic Bias
32−
33− Board connectors:
34−
35− * Headphone
36− * LineIn
37− * Mic
38−
39−- nvidia,ac97-controller : The phandle of the Tegra AC97 controller
40−
41−
42−Example:
43−
44−sound {
45− compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
46− "nvidia,tegra-audio-wm9712";
47− nvidia,model = "Toradex Colibri T20";
48−
49− nvidia,audio-routing =
50− "Headphone", "HPOUTL",
51− "Headphone", "HPOUTR",
52− "LineIn", "LINEINL",
53− "LineIn", "LINEINR",
54− "Mic", "MIC1";
55−
56− nvidia,ac97-controller = <&ac97>;
57−
58− clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 93>;
59− clock-names = "pll_a", "pll_a_out0", "mclk";
60−};
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.yaml+76−0
@@ -0,0 +1,76 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-wm9712.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra audio complex with WM9712 CODEC
8+
9+maintainers:
10+ - Jon Hunter <jonathanh@nvidia.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: nvidia,tegra-audio-common.yaml#
15+
16+properties:
17+ compatible:
18+ items:
19+ - pattern: '^[a-z0-9]+,tegra-audio-wm9712([-_][a-z0-9]+)+$'
20+ - const: nvidia,tegra-audio-wm9712
21+
22+ nvidia,audio-routing:
23+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
24+ description: |
25+ A list of the connections between audio components.
26+ Each entry is a pair of strings, the first being the connection's sink,
27+ the second being the connection's source. Valid names for sources and
28+ sinks are the pins (documented in the binding document),
29+ and the jacks on the board.
30+ minItems: 2
31+ items:
32+ enum:
33+ # Board Connectors
34+ - "Headphone"
35+ - "LineIn"
36+ - "Mic"
37+
38+ # CODEC Pins
39+ - MONOOUT
40+ - HPOUTL
41+ - HPOUTR
42+ - LOUT2
43+ - ROUT2
44+ - OUT3
45+ - LINEINL
46+ - LINEINR
47+ - PHONE
48+ - PCBEEP
49+ - MIC1
50+ - MIC2
51+ - "Mic Bias"
52+
53+required:
54+ - nvidia,ac97-controller
55+
56+unevaluatedProperties: false
57+
58+examples:
59+ - |
60+ sound {
61+ compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
62+ "nvidia,tegra-audio-wm9712";
63+ nvidia,model = "Toradex Colibri T20";
64+
65+ nvidia,audio-routing =
66+ "Headphone", "HPOUTL",
67+ "Headphone", "HPOUTR",
68+ "LineIn", "LINEINL",
69+ "LineIn", "LINEINR",
70+ "Mic", "MIC1";
71+
72+ nvidia,ac97-controller = <&ac97>;
73+
74+ clocks = <&clk 112>, <&clk 113>, <&clk 93>;
75+ clock-names = "pll_a", "pll_a_out0", "mclk";
76+ };
Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt+0−30
@@ -1,30 +0,0 @@
1−NVIDIA Tegra 20 I2S controller
2−
3−Required properties:
4−- compatible : "nvidia,tegra20-i2s"
5−- reg : Should contain I2S registers location and length
6−- interrupts : Should contain I2S interrupt
7−- resets : Must contain an entry for each entry in reset-names.
8− See ../reset/reset.txt for details.
9−- reset-names : Must include the following entries:
10− - i2s
11−- dmas : Must contain an entry for each entry in clock-names.
12− See ../dma/dma.txt for details.
13−- dma-names : Must include the following entries:
14− - rx
15− - tx
16−- clocks : Must contain one entry, for the module clock.
17− See ../clocks/clock-bindings.txt for details.
18−
19−Example:
20−
21−i2s@70002800 {
22− compatible = "nvidia,tegra20-i2s";
23− reg = <0x70002800 0x200>;
24− interrupts = < 45 >;
25− clocks = <&tegra_car 11>;
26− resets = <&tegra_car 11>;
27− reset-names = "i2s";
28− dmas = <&apbdma 21>, <&apbdma 21>;
29− dma-names = "rx", "tx";
30−};
Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml+77−0
@@ -0,0 +1,77 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra20-i2s.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra20 I2S Controller
8+
9+description: |
10+ The I2S Controller streams synchronous serial audio data between system
11+ memory and an external audio device. The controller supports the I2S Left
12+ Justified Mode, Right Justified Mode, and DSP mode formats.
13+
14+maintainers:
15+ - Thierry Reding <treding@nvidia.com>
16+ - Jon Hunter <jonathanh@nvidia.com>
17+
18+properties:
19+ compatible:
20+ const: nvidia,tegra20-i2s
21+
22+ reg:
23+ maxItems: 1
24+
25+ resets:
26+ maxItems: 1
27+
28+ reset-names:
29+ const: i2s
30+
31+ interrupts:
32+ maxItems: 1
33+
34+ clocks:
35+ minItems: 1
36+
37+ dmas:
38+ minItems: 2
39+
40+ dma-names:
41+ items:
42+ - const: rx
43+ - const: tx
44+
45+ nvidia,fixed-parent-rate:
46+ description: |
47+ Specifies whether board prefers parent clock to stay at a fixed rate.
48+ This allows multiple Tegra20 audio components work simultaneously by
49+ limiting number of supportable audio rates.
50+ type: boolean
51+
52+required:
53+ - compatible
54+ - reg
55+ - resets
56+ - reset-names
57+ - interrupts
58+ - clocks
59+ - dmas
60+ - dma-names
61+
62+additionalProperties: false
63+
64+examples:
65+ - |
66+ i2s@70002800 {
67+ compatible = "nvidia,tegra20-i2s";
68+ reg = <0x70002800 0x200>;
69+ interrupts = <45>;
70+ clocks = <&tegra_car 11>;
71+ resets = <&tegra_car 11>;
72+ reset-names = "i2s";
73+ dmas = <&apbdma 21>, <&apbdma 21>;
74+ dma-names = "rx", "tx";
75+ };
76+
77+...
Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml+85−0
@@ -0,0 +1,85 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/nvidia,tegra20-spdif.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: NVIDIA Tegra20 S/PDIF Controller
8+
9+description: |
10+ The S/PDIF controller supports both input and output in serial audio
11+ digital interface format. The input controller can digitally recover
12+ a clock from the received stream. The S/PDIF controller is also used
13+ to generate the embedded audio for HDMI output channel.
14+
15+maintainers:
16+ - Thierry Reding <treding@nvidia.com>
17+ - Jon Hunter <jonathanh@nvidia.com>
18+
19+properties:
20+ compatible:
21+ const: nvidia,tegra20-spdif
22+
23+ reg:
24+ maxItems: 1
25+
26+ resets:
27+ maxItems: 1
28+
29+ interrupts:
30+ maxItems: 1
31+
32+ clocks:
33+ minItems: 2
34+
35+ clock-names:
36+ items:
37+ - const: out
38+ - const: in
39+
40+ dmas:
41+ minItems: 2
42+
43+ dma-names:
44+ items:
45+ - const: rx
46+ - const: tx
47+
48+ "#sound-dai-cells":
49+ const: 0
50+
51+ nvidia,fixed-parent-rate:
52+ description: |
53+ Specifies whether board prefers parent clock to stay at a fixed rate.
54+ This allows multiple Tegra20 audio components work simultaneously by
55+ limiting number of supportable audio rates.
56+ type: boolean
57+
58+required:
59+ - compatible
60+ - reg
61+ - resets
62+ - interrupts
63+ - clocks
64+ - clock-names
65+ - dmas
66+ - dma-names
67+ - "#sound-dai-cells"
68+
69+additionalProperties: false
70+
71+examples:
72+ - |
73+ spdif@70002400 {
74+ compatible = "nvidia,tegra20-spdif";
75+ reg = <0x70002400 0x200>;
76+ interrupts = <77>;
77+ clocks = <&clk 99>, <&clk 98>;
78+ clock-names = "out", "in";
79+ resets = <&rst 10>;
80+ dmas = <&apbdma 3>, <&apbdma 3>;
81+ dma-names = "rx", "tx";
82+ #sound-dai-cells = <0>;
83+ };
84+
85+...
Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml+2−0
@@ -50,9 +50,11 @@ properties: · 49 unmodified lines
5050 - const: hda2codec_2x
5151
5252 resets:
53+ minItems: 2
5354 maxItems: 3
5455
5556 reset-names:
57+ minItems: 2
5658 items:
5759 - const: hda
5860 - const: hda2hdmi
Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml+41−0
@@ -24,11 +24,23 @@ properties: · 23 unmodified lines
2424 '#sound-dai-cells':
2525 const: 0
2626
27+ rcv-gpios:
28+ description: optional GPIO to be asserted when receiver mode is enabled.
29+
2730 sound-name-prefix: true
2831
2932 vddd-supply:
3033 description: regulator phandle for the VDDD power supply.
3134
35+if:
36+ not:
37+ properties:
38+ compatible:
39+ const: nxp,tfa9897
40+then:
41+ properties:
42+ rcv-gpios: false
43+
3244 required:
3345 - compatible
3446 - reg
@@ -55,3 +67,32 @@ examples: · 20 unmodified lines
5567 #sound-dai-cells = <0>;
5668 };
5769 };
70+
71+ - |
72+ #include <dt-bindings/gpio/gpio.h>
73+ i2c {
74+ #address-cells = <1>;
75+ #size-cells = <0>;
76+
77+ speaker_codec_top: audio-codec@34 {
78+ compatible = "nxp,tfa9897";
79+ reg = <0x34>;
80+ vddd-supply = <&pm8916_l6>;
81+ rcv-gpios = <&msmgpio 50 GPIO_ACTIVE_HIGH>;
82+ pinctrl-names = "default";
83+ pinctrl-0 = <&speaker_top_default>;
84+ sound-name-prefix = "Speaker Top";
85+ #sound-dai-cells = <0>;
86+ };
87+
88+ speaker_codec_bottom: audio-codec@36 {
89+ compatible = "nxp,tfa9897";
90+ reg = <0x36>;
91+ vddd-supply = <&pm8916_l6>;
92+ rcv-gpios = <&msmgpio 111 GPIO_ACTIVE_HIGH>;
93+ pinctrl-names = "default";
94+ pinctrl-0 = <&speaker_bottom_default>;
95+ sound-name-prefix = "Speaker Bottom";
96+ #sound-dai-cells = <0>;
97+ };
98+ };
Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt+0−96
@@ -1,96 +0,0 @@
1−* Qualcomm Technologies APQ8016 SBC ASoC machine driver
2−
3−This node models the Qualcomm Technologies APQ8016 SBC ASoC machine driver
4−
5−Required properties:
6−
7−- compatible : "qcom,apq8016-sbc-sndcard"
8−
9−- pinctrl-N : One property must exist for each entry in
10− pinctrl-names. See ../pinctrl/pinctrl-bindings.txt
11− for details of the property values.
12−- pinctrl-names : Must contain a "default" entry.
13−- reg : Must contain an address for each entry in reg-names.
14−- reg-names : A list which must include the following entries:
15− * "mic-iomux"
16− * "spkr-iomux"
17−- qcom,model : Name of the sound card.
18−
19−- qcom,audio-routing : A list of the connections between audio components.
20− Each entry is a pair of strings, the first being the
21− connection's sink, the second being the connection's
22− source. Valid names could be power supplies, MicBias
23− of msm8x16_wcd codec and the jacks on the board:
24−
25− Power supplies:
26− * MIC BIAS External1
27− * MIC BIAS External2
28− * MIC BIAS Internal1
29− * MIC BIAS Internal2
30−
31− Board connectors:
32− * Headset Mic
33− * Secondary Mic
34− * DMIC
35− * Ext Spk
36−
37−Optional properties:
38−
39−- aux-devs : A list of phandles for auxiliary devices (e.g. analog
40− amplifiers) that do not appear directly within the DAI
41− links. Should be connected to another audio component
42− using "qcom,audio-routing".
43−
44−Dai-link subnode properties and subnodes:
45−
46−Required dai-link subnodes:
47−
48−- cpu : CPU sub-node
49−- codec : CODEC sub-node
50−
51−Required CPU/CODEC subnodes properties:
52−
53−-link-name : Name of the dai link.
54−-sound-dai : phandle/s and port of CPU/CODEC
55−
56−Example:
57−
58−sound: sound {
59− compatible = "qcom,apq8016-sbc-sndcard";
60− reg = <0x07702000 0x4>, <0x07702004 0x4>;
61− reg-names = "mic-iomux", "spkr-iomux";
62− qcom,model = "DB410c";
63−
64− qcom,audio-routing =
65− "MIC BIAS External1", "Handset Mic",
66− "MIC BIAS Internal2", "Headset Mic",
67− "MIC BIAS External1", "Secondary Mic",
68− "AMIC1", "MIC BIAS External1",
69− "AMIC2", "MIC BIAS Internal2",
70− "AMIC3", "MIC BIAS External1",
71− "DMIC1", "MIC BIAS Internal1",
72− "MIC BIAS Internal1", "Digital Mic1",
73− "DMIC2", "MIC BIAS Internal1",
74− "MIC BIAS Internal1", "Digital Mic2";
75−
76− /* I2S - Internal codec */
77− internal-dai-link@0 {
78− cpu { /* PRIMARY */
79− sound-dai = <&lpass MI2S_PRIMARY>;
80− };
81− codec {
82− sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
83− };
84− };
85−
86− /* External Primary or External Secondary -ADV7533 HDMI */
87− external-dai-link@0 {
88− link-name = "ADV7533";
89− cpu { /* QUAT */
90− sound-dai = <&lpass MI2S_QUATERNARY>;
91− };
92− codec {
93− sound-dai = <&adv_bridge 0>;
94− };
95− };
96−};
Documentation/devicetree/bindings/sound/qcom,sm8250.yaml+146−6
@@ -4,18 +4,20 @@ · 3 unmodified lines
44 $id: http://devicetree.org/schemas/sound/qcom,sm8250.yaml#
55 $schema: http://devicetree.org/meta-schemas/core.yaml#
66
7−title: Qualcomm Technologies Inc. SM8250 ASoC sound card driver
7+title: Qualcomm Technologies Inc. ASoC sound card drivers
88
99 maintainers:
1010 - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
1111
1212 description:
13− This bindings describes SC8250 SoC based sound cards
13+ This bindings describes Qualcomm SoC based sound cards
1414 which uses LPASS internal codec for audio.
1515
1616 properties:
1717 compatible:
1818 enum:
19+ - qcom,apq8016-sbc-sndcard
20+ - qcom,msm8916-qdsp6-sndcard
1921 - qcom,sm8250-sndcard
2022 - qcom,qrb5165-rb5-sndcard
2123
@@ -27,10 +29,28 @@ properties: · 5 unmodified lines
2729 being the connection's source. Valid names could be power supplies,
2830 MicBias of codec and the jacks on the board.
2931
32+ aux-devs:
33+ $ref: /schemas/types.yaml#/definitions/phandle-array
34+ description: |
35+ List of phandles pointing to auxiliary devices, such
36+ as amplifiers, to be added to the sound card.
37+
3038 model:
3139 $ref: /schemas/types.yaml#/definitions/string
3240 description: User visible long sound card name
3341
42+ pin-switches:
43+ description: List of widget names for which pin switches should be created.
44+ $ref: /schemas/types.yaml#/definitions/string-array
45+
46+ widgets:
47+ description: User specified audio sound widgets.
48+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
49+
50+ # Only valid for some compatibles (see allOf if below)
51+ reg: true
52+ reg-names: true
53+
3454 patternProperties:
3555 ".*-dai-link$":
3656 description:
@@ -73,6 +93,34 @@ required: · 36 unmodified lines
7393 - compatible
7494 - model
7595
96+allOf:
97+ - if:
98+ properties:
99+ compatible:
100+ contains:
101+ enum:
102+ - qcom,apq8016-sbc-sndcard
103+ - qcom,msm8916-qdsp6-sndcard
104+ then:
105+ properties:
106+ reg:
107+ items:
108+ - description: Microphone I/O mux register address
109+ - description: Speaker I/O mux register address
110+ reg-names:
111+ items:
112+ - const: mic-iomux
113+ - const: spkr-iomux
114+ required:
115+ - compatible
116+ - model
117+ - reg
118+ - reg-names
119+ else:
120+ properties:
121+ reg: false
122+ reg-names: false
123+
76124 additionalProperties: false
77125
78126 examples:
@@ -86,10 +134,7 @@ examples: · 7 unmodified lines
86134 audio-routing = "SpkrLeft IN", "WSA_SPK1 OUT",
87135 "SpkrRight IN", "WSA_SPK2 OUT",
88136 "VA DMIC0", "vdd-micb",
89− "VA DMIC1", "vdd-micb",
90− "MM_DL1", "MultiMedia1 Playback",
91− "MM_DL2", "MultiMedia2 Playback",
92− "MultiMedia3 Capture", "MM_UL3";
137+ "VA DMIC1", "vdd-micb";
93138
94139 mm1-dai-link {
95140 link-name = "MultiMedia0";
@@ -157,3 +202,98 @@ examples: · 61 unmodified lines
157202 };
158203 };
159204 };
205+
206+ - |
207+ #include <dt-bindings/sound/qcom,lpass.h>
208+ sound@7702000 {
209+ compatible = "qcom,apq8016-sbc-sndcard";
210+ reg = <0x07702000 0x4>, <0x07702004 0x4>;
211+ reg-names = "mic-iomux", "spkr-iomux";
212+
213+ model = "DB410c";
214+ audio-routing =
215+ "AMIC2", "MIC BIAS Internal2",
216+ "AMIC3", "MIC BIAS External1";
217+
218+ pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act>;
219+ pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus>;
220+ pinctrl-names = "default", "sleep";
221+
222+ quaternary-dai-link {
223+ link-name = "ADV7533";
224+ cpu {
225+ sound-dai = <&lpass MI2S_QUATERNARY>;
226+ };
227+ codec {
228+ sound-dai = <&adv_bridge 0>;
229+ };
230+ };
231+
232+ primary-dai-link {
233+ link-name = "WCD";
234+ cpu {
235+ sound-dai = <&lpass MI2S_PRIMARY>;
236+ };
237+ codec {
238+ sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
239+ };
240+ };
241+
242+ tertiary-dai-link {
243+ link-name = "WCD-Capture";
244+ cpu {
245+ sound-dai = <&lpass MI2S_TERTIARY>;
246+ };
247+ codec {
248+ sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
249+ };
250+ };
251+ };
252+
253+ - |
254+ #include <dt-bindings/sound/qcom,q6afe.h>
255+ #include <dt-bindings/sound/qcom,q6asm.h>
256+ sound@7702000 {
257+ compatible = "qcom,msm8916-qdsp6-sndcard";
258+ reg = <0x07702000 0x4>, <0x07702004 0x4>;
259+ reg-names = "mic-iomux", "spkr-iomux";
260+
261+ model = "msm8916";
262+ widgets =
263+ "Speaker", "Speaker",
264+ "Headphone", "Headphones";
265+ pin-switches = "Speaker";
266+ audio-routing =
267+ "Speaker", "Speaker Amp OUT",
268+ "Speaker Amp IN", "HPH_R",
269+ "Headphones", "HPH_L",
270+ "Headphones", "HPH_R",
271+ "AMIC1", "MIC BIAS Internal1",
272+ "AMIC2", "MIC BIAS Internal2",
273+ "AMIC3", "MIC BIAS Internal3";
274+ aux-devs = <&speaker_amp>;
275+
276+ pinctrl-names = "default", "sleep";
277+ pinctrl-0 = <&cdc_pdm_lines_act>;
278+ pinctrl-1 = <&cdc_pdm_lines_sus>;
279+
280+ mm1-dai-link {
281+ link-name = "MultiMedia1";
282+ cpu {
283+ sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
284+ };
285+ };
286+
287+ primary-dai-link {
288+ link-name = "Primary MI2S";
289+ cpu {
290+ sound-dai = <&q6afedai PRIMARY_MI2S_RX>;
291+ };
292+ platform {
293+ sound-dai = <&q6routing>;
294+ };
295+ codec {
296+ sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
297+ };
298+ };
299+ };
Documentation/devicetree/bindings/sound/realtek,rt5682s.yaml+4−0
@@ -61,6 +61,10 @@ properties: · 60 unmodified lines
6161 description: |
6262 Set the delay time (ms) for the requirement of the particular DMIC.
6363
64+ realtek,amic-delay-ms:
65+ description: |
66+ Set the delay time (ms) for the requirement of the particular platform or AMIC.
67+
6468 realtek,dmic-clk-driving-high:
6569 type: boolean
6670 description: |
Documentation/devicetree/bindings/sound/simple-audio-amplifier.yaml+4−4
@@ -9,6 +9,9 @@ title: Simple Audio Amplifier Device Tree Bindings · 8 unmodified lines
99 maintainers:
1010 - Jerome Brunet <jbrunet@baylibre.com>
1111
12+allOf:
13+ - $ref: name-prefix.yaml#
14+
1215 properties:
1316 compatible:
1417 enum:
@@ -22,10 +25,7 @@ properties: · 7 unmodified lines
2225 description: >
2326 power supply for the device
2427
25− sound-name-prefix:
26− $ref: /schemas/types.yaml#/definitions/string
27− description: >
28− See ./name-prefix.txt
28+ sound-name-prefix: true
2929
3030 required:
3131 - compatible
Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml+137−0
@@ -0,0 +1,137 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/ti,tlv320adc3xxx.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Texas Instruments TLV320ADC3001/TLV320ADC3101 Stereo ADC
8+
9+maintainers:
10+ - Ricard Wanderlof <ricardw@axis.com>
11+
12+description: |
13+ Texas Instruments TLV320ADC3001 and TLV320ADC3101 Stereo ADC
14+ https://www.ti.com/product/TLV320ADC3001
15+ https://www.ti.com/product/TLV320ADC3101
16+
17+properties:
18+ compatible:
19+ enum:
20+ - ti,tlv320adc3001
21+ - ti,tlv320adc3101
22+
23+ reg:
24+ maxItems: 1
25+ description: I2C address
26+
27+ '#sound-dai-cells':
28+ const: 0
29+
30+ '#gpio-cells':
31+ const: 2
32+
33+ gpio-controller: true
34+
35+ reset-gpios:
36+ maxItems: 1
37+ description: GPIO pin used for codec reset (RESET pin)
38+
39+ clocks:
40+ maxItems: 1
41+ description: Master clock (MCLK)
42+
43+ ti,dmdin-gpio1:
44+ $ref: /schemas/types.yaml#/definitions/uint32
45+ enum:
46+ - 0 # ADC3XXX_GPIO_DISABLED - I/O buffers powered down and not used
47+ - 1 # ADC3XXX_GPIO_INPUT - Various non-GPIO input functions
48+ - 2 # ADC3XXX_GPIO_GPI - General purpose input
49+ - 3 # ADC3XXX_GPIO_GPO - General purpose output
50+ - 4 # ADC3XXX_GPIO_CLKOUT - Clock source set in CLKOUT_MUX reg
51+ - 5 # ADC3XXX_GPIO_INT1 - INT1 output
52+ - 6 # ADC3XXX_GPIO_SECONDARY_BCLK - Codec interface secondary BCLK
53+ - 7 # ADC3XXX_GPIO_SECONDARY_WCLK - Codec interface secondary WCLK
54+ default: 0
55+ description: |
56+ Configuration for DMDIN/GPIO1 pin.
57+
58+ When ADC3XXX_GPIO_GPO is configured, this causes corresponding the
59+ ALSA control "GPIOx Output" to appear, as a switch control.
60+
61+ ti,dmclk-gpio2:
62+ $ref: /schemas/types.yaml#/definitions/uint32
63+ enum:
64+ - 0 # ADC3XXX_GPIO_DISABLED - I/O buffers powered down and not used
65+ - 1 # ADC3XXX_GPIO_INPUT - Various non-GPIO input functions
66+ - 2 # ADC3XXX_GPIO_GPI - General purpose input
67+ - 3 # ADC3XXX_GPIO_GPO - General purpose output
68+ - 4 # ADC3XXX_GPIO_CLKOUT - Clock source set in CLKOUT_MUX reg
69+ - 5 # ADC3XXX_GPIO_INT1 - INT1 output
70+ - 6 # ADC3XXX_GPIO_SECONDARY_BCLK - Codec interface secondary BCLK
71+ - 7 # ADC3XXX_GPIO_SECONDARY_WCLK - Codec interface secondary WCLK
72+ default: 0
73+ description: |
74+ Configuration for DMCLK/GPIO2 pin.
75+
76+ When ADC3XXX_GPIO_GPO is configured, this causes corresponding the
77+ ALSA control "GPIOx Output" to appear, as a switch control.
78+
79+ Note that there is currently no support for reading the GPIO pins as
80+ inputs.
81+
82+ ti,micbias1-vg:
83+ $ref: /schemas/types.yaml#/definitions/uint32
84+ enum:
85+ - 0 # ADC3XXX_MICBIAS_OFF - Mic bias is powered down
86+ - 1 # ADC3XXX_MICBIAS_2_0V - Mic bias is set to 2.0V
87+ - 2 # ADC3XXX_MICBIAS_2_5V - Mic bias is set to 2.5V
88+ - 3 # ADC3XXX_MICBIAS_AVDD - Mic bias is same as AVDD supply
89+ default: 0
90+ description: |
91+ Mic bias voltage output on MICBIAS1 pin
92+
93+ ti,micbias2-vg:
94+ $ref: /schemas/types.yaml#/definitions/uint32
95+ enum:
96+ - 0 # ADC3XXX_MICBIAS_OFF - Mic bias is powered down
97+ - 1 # ADC3XXX_MICBIAS_2_0V - Mic bias is set to 2.0V
98+ - 2 # ADC3XXX_MICBIAS_2_5V - Mic bias is set to 2.5V
99+ - 3 # ADC3XXX_MICBIAS_AVDD - Mic bias is same as AVDD supply
100+ default: 0
101+ description: |
102+ Mic bias voltage output on MICBIAS2 pin
103+
104+required:
105+ - compatible
106+ - reg
107+ - clocks
108+
109+additionalProperties: false
110+
111+examples:
112+ - |
113+
114+ #include <dt-bindings/gpio/gpio.h>
115+ #include <dt-bindings/sound/tlv320adc3xxx.h>
116+
117+ i2c {
118+ #address-cells = <1>;
119+ #size-cells = <0>;
120+ tlv320adc3101: audio-codec@18 {
121+ compatible = "ti,tlv320adc3101";
122+ reg = <0x18>;
123+ reset-gpios = <&gpio_pc 3 GPIO_ACTIVE_LOW>;
124+ clocks = <&audio_mclk>;
125+ gpio-controller;
126+ #gpio-cells = <2>;
127+ ti,dmdin-gpio1 = <ADC3XXX_GPIO_GPO>;
128+ ti,micbias1-vg = <ADC3XXX_MICBIAS_AVDD>;
129+ };
130+ };
131+
132+ audio_mclk: clock {
133+ compatible = "fixed-clock";
134+ #clock-cells = <0>;
135+ clock-frequency = <24576000>;
136+ };
137+...
Documentation/devicetree/bindings/sound/wlf,wm8903.yaml+116−0
@@ -0,0 +1,116 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: "http://devicetree.org/schemas/sound/wlf,wm8903.yaml#"
5+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6+
7+title: WM8903 audio codec
8+
9+description: |
10+ This device supports I2C only.
11+ Pins on the device (for linking into audio routes):
12+ * IN1L
13+ * IN1R
14+ * IN2L
15+ * IN2R
16+ * IN3L
17+ * IN3R
18+ * DMICDAT
19+ * HPOUTL
20+ * HPOUTR
21+ * LINEOUTL
22+ * LINEOUTR
23+ * LOP
24+ * LON
25+ * ROP
26+ * RON
27+ * MICBIAS
28+
29+maintainers:
30+ - patches@opensource.cirrus.com
31+
32+properties:
33+ compatible:
34+ const: wlf,wm8903
35+
36+ reg:
37+ maxItems: 1
38+
39+ gpio-controller: true
40+ '#gpio-cells':
41+ const: 2
42+
43+ interrupts:
44+ maxItems: 1
45+
46+ micdet-cfg:
47+ $ref: /schemas/types.yaml#/definitions/uint32
48+ default: 0
49+ description: Default register value for R6 (Mic Bias).
50+
51+ micdet-delay:
52+ $ref: /schemas/types.yaml#/definitions/uint32
53+ default: 100
54+ description: The debounce delay for microphone detection in mS.
55+
56+ gpio-cfg:
57+ $ref: /schemas/types.yaml#/definitions/uint32-array
58+ description: |
59+ minItems: 5
60+ maxItems: 5
61+ A list of GPIO configuration register values.
62+ If absent, no configuration of these registers is performed.
63+ If any entry has the value 0xffffffff, that GPIO's
64+ configuration will not be modified.
65+
66+ AVDD-supply:
67+ description: Analog power supply regulator on the AVDD pin.
68+
69+ CPVDD-supply:
70+ description: Charge pump supply regulator on the CPVDD pin.
71+
72+ DBVDD-supply:
73+ description: Digital buffer supply regulator for the DBVDD pin.
74+
75+ DCVDD-supply:
76+ description: Digital core supply regulator for the DCVDD pin.
77+
78+
79+required:
80+ - compatible
81+ - reg
82+ - gpio-controller
83+ - '#gpio-cells'
84+
85+additionalProperties: false
86+
87+examples:
88+ - |
89+ i2c {
90+ #address-cells = <1>;
91+ #size-cells = <0>;
92+
93+ wm8903: codec@1a {
94+ compatible = "wlf,wm8903";
95+ reg = <0x1a>;
96+ interrupts = <347>;
97+
98+ AVDD-supply = <&fooreg_a>;
99+ CPVDD-supply = <&fooreg_b>;
100+ DBVDD-supply = <&fooreg_c>;
101+ DCVDD-supply = <&fooreg_d>;
102+
103+ gpio-controller;
104+ #gpio-cells = <2>;
105+
106+ micdet-cfg = <0>;
107+ micdet-delay = <100>;
108+ gpio-cfg = <
109+ 0x0600 /* DMIC_LR, output */
110+ 0x0680 /* DMIC_DAT, input */
111+ 0x0000 /* GPIO, output, low */
112+ 0x0200 /* Interrupt, output */
113+ 0x01a0 /* BCLK, input, active high */
114+ >;
115+ };
116+ };
Documentation/devicetree/bindings/sound/wm8903.txt+0−82
@@ -1,82 +0,0 @@
1−WM8903 audio CODEC
2−
3−This device supports I2C only.
4−
5−Required properties:
6−
7− - compatible : "wlf,wm8903"
8−
9− - reg : the I2C address of the device.
10−
11− - gpio-controller : Indicates this device is a GPIO controller.
12−
13− - #gpio-cells : Should be two. The first cell is the pin number and the
14− second cell is used to specify optional parameters (currently unused).
15−
16−Optional properties:
17−
18− - interrupts : The interrupt line the codec is connected to.
19−
20− - micdet-cfg : Default register value for R6 (Mic Bias). If absent, the
21− default is 0.
22−
23− - micdet-delay : The debounce delay for microphone detection in mS. If
24− absent, the default is 100.
25−
26− - gpio-cfg : A list of GPIO configuration register values. The list must
27− be 5 entries long. If absent, no configuration of these registers is
28− performed. If any entry has the value 0xffffffff, that GPIO's
29− configuration will not be modified.
30−
31− - AVDD-supply : Analog power supply regulator on the AVDD pin.
32−
33− - CPVDD-supply : Charge pump supply regulator on the CPVDD pin.
34−
35− - DBVDD-supply : Digital buffer supply regulator for the DBVDD pin.
36−
37− - DCVDD-supply : Digital core supply regulator for the DCVDD pin.
38−
39−Pins on the device (for linking into audio routes):
40−
41− * IN1L
42− * IN1R
43− * IN2L
44− * IN2R
45− * IN3L
46− * IN3R
47− * DMICDAT
48− * HPOUTL
49− * HPOUTR
50− * LINEOUTL
51− * LINEOUTR
52− * LOP
53− * LON
54− * ROP
55− * RON
56− * MICBIAS
57−
58−Example:
59−
60−wm8903: codec@1a {
61− compatible = "wlf,wm8903";
62− reg = <0x1a>;
63− interrupts = < 347 >;
64−
65− AVDD-supply = <&fooreg_a>;
66− CPVDD-supply = <&fooreg_b>;
67− DBVDD-supply = <&fooreg_c>;
68− DCVDC-supply = <&fooreg_d>;
69−
70− gpio-controller;
71− #gpio-cells = <2>;
72−
73− micdet-cfg = <0>;
74− micdet-delay = <100>;
75− gpio-cfg = <
76− 0x0600 /* DMIC_LR, output */
77− 0x0680 /* DMIC_DAT, input */
78− 0x0000 /* GPIO, output, low */
79− 0x0200 /* Interrupt, output */
80− 0x01a0 /* BCLK, input, active high */
81− >;
82−};
MAINTAINERS+11−0
@@ -4568,9 +4568,12 @@ F: drivers/media/cec/i2c/ch7322.c · 4567 unmodified lines
45684568 CIRRUS LOGIC AUDIO CODEC DRIVERS
45694569 M: James Schulman <james.schulman@cirrus.com>
45704570 M: David Rhodes <david.rhodes@cirrus.com>
4571+M: Lucas Tanure <tanureal@opensource.cirrus.com>
45714572 L: alsa-devel@alsa-project.org (moderated for non-subscribers)
45724573 L: patches@opensource.cirrus.com
45734574 S: Maintained
4575+F: Documentation/devicetree/bindings/sound/cirrus,cs*
4576+F: sound/pci/hda/cs*
45744577 F: sound/soc/codecs/cs*
45754578
45764579 CIRRUS LOGIC DSP FIRMWARE DRIVER
@@ -17988,6 +17991,7 @@ F: Documentation/sound/ · 13411 unmodified lines
1798817991 F: include/sound/
1798917992 F: include/uapi/sound/
1799017993 F: sound/
17994+F: tools/testing/selftests/alsa
1799117995
1799217996 SOUND - COMPRESSED AUDIO
1799317997 M: Vinod Koul <vkoul@kernel.org>
@@ -18007,6 +18011,13 @@ F: include/sound/dmaengine_pcm.h · 13 unmodified lines
1800718011 F: sound/core/pcm_dmaengine.c
1800818012 F: sound/soc/soc-generic-dmaengine-pcm.c
1800918013
18014+SOUND - ALSA SELFTESTS
18015+M: Mark Brown <broonie@kernel.org>
18016+L: alsa-devel@alsa-project.org (moderated for non-subscribers)
18017+L: linux-kselftest@vger.kernel.org
18018+S: Supported
18019+F: tools/testing/selftests/alsa
18020+
1801018021 SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
1801118022 M: Liam Girdwood <lgirdwood@gmail.com>
1801218023 M: Mark Brown <broonie@kernel.org>
arch/arm64/boot/dts/nvidia/tegra194.dtsi+2−3
@@ -995,9 +995,8 @@ · 994 unmodified lines
995995 <&bpmp TEGRA194_CLK_HDA2CODEC_2X>;
996996 clock-names = "hda", "hda2hdmi", "hda2codec_2x";
997997 resets = <&bpmp TEGRA194_RESET_HDA>,
998− <&bpmp TEGRA194_RESET_HDA2HDMICODEC>,
999− <&bpmp TEGRA194_RESET_HDA2CODEC_2X>;
1000− reset-names = "hda", "hda2hdmi", "hda2codec_2x";
998+ <&bpmp TEGRA194_RESET_HDA2HDMICODEC>;
999+ reset-names = "hda", "hda2hdmi";
10011000 power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>;
10021001 interconnects = <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>,
10031002 <&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>;
drivers/dma/mmp_pdma.c+0−6
@@ -727,12 +727,6 @@ static int mmp_pdma_config_write(struct dma_chan *dchan, · 726 unmodified lines
727727
728728 chan->dir = direction;
729729 chan->dev_addr = addr;
730− /* FIXME: drivers should be ported over to use the filter
731− * function. Once that's done, the following two lines can
732− * be removed.
733− */
734− if (cfg->slave_id)
735− chan->drcmr = cfg->slave_id;
736730
737731 return 0;
738732 }
drivers/dma/pxa_dma.c+0−7
@@ -909,13 +909,6 @@ static void pxad_get_config(struct pxad_chan *chan, · 908 unmodified lines
909909 *dcmd |= PXA_DCMD_BURST16;
910910 else if (maxburst == 32)
911911 *dcmd |= PXA_DCMD_BURST32;
912−
913− /* FIXME: drivers should be ported over to use the filter
914− * function. Once that's done, the following two lines can
915− * be removed.
916− */
917− if (chan->cfg.slave_id)
918− chan->drcmr = chan->cfg.slave_id;
919912 }
920913
921914 static struct dma_async_tx_descriptor *
drivers/dma/qcom/qcom_adm.c+49−7
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/device.h>
99 #include <linux/dmaengine.h>
1010 #include <linux/dma-mapping.h>
11+#include <linux/dma/qcom_adm.h>
1112 #include <linux/init.h>
1213 #include <linux/interrupt.h>
1314 #include <linux/io.h>
@@ -140,6 +141,8 @@ struct adm_chan { · 126 unmodified lines
140141
141142 struct adm_async_desc *curr_txd;
142143 struct dma_slave_config slave;
144+ u32 crci;
145+ u32 mux;
143146 struct list_head node;
144147
145148 int error;
@@ -379,8 +382,8 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, · 233 unmodified lines
379382 return ERR_PTR(-EINVAL);
380383 }
381384
382− crci = achan->slave.slave_id & 0xf;
383− if (!crci || achan->slave.slave_id > 0x1f) {
385+ crci = achan->crci & 0xf;
386+ if (!crci || achan->crci > 0x1f) {
384387 dev_err(adev->dev, "invalid crci value\n");
385388 return ERR_PTR(-EINVAL);
386389 }
@@ -403,9 +406,7 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, · 16 unmodified lines
403406 if (!async_desc)
404407 return ERR_PTR(-ENOMEM);
405408
406− if (crci)
407− async_desc->mux = achan->slave.slave_id & ADM_CRCI_MUX_SEL ?
408− ADM_CRCI_CTL_MUX_SEL : 0;
409+ async_desc->mux = achan->mux ? ADM_CRCI_CTL_MUX_SEL : 0;
409410 async_desc->crci = crci;
410411 async_desc->blk_size = blk_size;
411412 async_desc->dma_len = single_count * sizeof(struct adm_desc_hw_single) +
@@ -488,10 +489,13 @@ static int adm_terminate_all(struct dma_chan *chan) · 76 unmodified lines
488489 static int adm_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg)
489490 {
490491 struct adm_chan *achan = to_adm_chan(chan);
492+ struct qcom_adm_peripheral_config *config = cfg->peripheral_config;
491493 unsigned long flag;
492494
493495 spin_lock_irqsave(&achan->vc.lock, flag);
494496 memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config));
497+ if (cfg->peripheral_size == sizeof(config))
498+ achan->crci = config->crci;
495499 spin_unlock_irqrestore(&achan->vc.lock, flag);
496500
497501 return 0;
@@ -694,6 +698,45 @@ static void adm_channel_init(struct adm_device *adev, struct adm_chan *achan, · 196 unmodified lines
694698 achan->vc.desc_free = adm_dma_free_desc;
695699 }
696700
701+/**
702+ * adm_dma_xlate
703+ * @dma_spec: pointer to DMA specifier as found in the device tree
704+ * @ofdma: pointer to DMA controller data
705+ *
706+ * This can use either 1-cell or 2-cell formats, the first cell
707+ * identifies the slave device, while the optional second cell
708+ * contains the crci value.
709+ *
710+ * Returns pointer to appropriate dma channel on success or NULL on error.
711+ */
712+static struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec,
713+ struct of_dma *ofdma)
714+{
715+ struct dma_device *dev = ofdma->of_dma_data;
716+ struct dma_chan *chan, *candidate = NULL;
717+ struct adm_chan *achan;
718+
719+ if (!dev || dma_spec->args_count > 2)
720+ return NULL;
721+
722+ list_for_each_entry(chan, &dev->channels, device_node)
723+ if (chan->chan_id == dma_spec->args[0]) {
724+ candidate = chan;
725+ break;
726+ }
727+
728+ if (!candidate)
729+ return NULL;
730+
731+ achan = to_adm_chan(candidate);
732+ if (dma_spec->args_count == 2)
733+ achan->crci = dma_spec->args[1];
734+ else
735+ achan->crci = 0;
736+
737+ return dma_get_slave_channel(candidate);
738+}
739+
697740 static int adm_dma_probe(struct platform_device *pdev)
698741 {
699742 struct adm_device *adev;
@@ -838,8 +881,7 @@ static int adm_dma_probe(struct platform_device *pdev) · 138 unmodified lines
838881 goto err_disable_clks;
839882 }
840883
841− ret = of_dma_controller_register(pdev->dev.of_node,
842− of_dma_xlate_by_chan_id,
884+ ret = of_dma_controller_register(pdev->dev.of_node, adm_dma_xlate,
843885 &adev->common);
844886 if (ret)
845887 goto err_unregister_dma;
drivers/dma/sh/shdma-base.c+0−8
@@ -786,14 +786,6 @@ static int shdma_config(struct dma_chan *chan, · 785 unmodified lines
786786 if (!config)
787787 return -EINVAL;
788788
789− /*
790− * overriding the slave_id through dma_slave_config is deprecated,
791− * but possibly some out-of-tree drivers still do it.
792− */
793− if (WARN_ON_ONCE(config->slave_id &&
794− config->slave_id != schan->real_slave_id))
795− schan->real_slave_id = config->slave_id;
796−
797789 /*
798790 * We could lock this, but you shouldn't be configuring the
799791 * channel, while using it...
drivers/dma/sprd-dma.c+0−3
@@ -795,9 +795,6 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, · 794 unmodified lines
795795 return dst_datawidth;
796796 }
797797
798− if (slave_cfg->slave_id)
799− schan->dev_id = slave_cfg->slave_id;
800−
801798 hw->cfg = SPRD_DMA_DONOT_WAIT_BDONE << SPRD_DMA_WAIT_BDONE_OFFSET;
802799
803800 /*
drivers/dma/tegra20-apb-dma.c+0−6
@@ -343,12 +343,6 @@ static int tegra_dma_slave_config(struct dma_chan *dc, · 342 unmodified lines
343343 }
344344
345345 memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig));
346− if (tdc->slave_id == TEGRA_APBDMA_SLAVE_ID_INVALID &&
347− sconfig->device_fc) {
348− if (sconfig->slave_id > TEGRA_APBDMA_CSR_REQ_SEL_MASK)
349− return -EINVAL;
350− tdc->slave_id = sconfig->slave_id;
351− }
352346 tdc->config_init = true;
353347
354348 return 0;
drivers/dma/xilinx/xilinx_dpdma.c+11−6
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/clk.h>
1313 #include <linux/debugfs.h>
1414 #include <linux/delay.h>
15+#include <linux/dma/xilinx_dpdma.h>
1516 #include <linux/dmaengine.h>
1617 #include <linux/dmapool.h>
1718 #include <linux/interrupt.h>
@@ -1273,6 +1274,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, · 1255 unmodified lines
12731274 struct dma_slave_config *config)
12741275 {
12751276 struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan);
1277+ struct xilinx_dpdma_peripheral_config *pconfig;
12761278 unsigned long flags;
12771279
12781280 /*
@@ -1282,15 +1284,18 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, · 3 unmodified lines
12821284 * fixed both on the DPDMA side and on the DP controller side.
12831285 */
12841286
1285− spin_lock_irqsave(&chan->lock, flags);
1286−
12871287 /*
1288− * Abuse the slave_id to indicate that the channel is part of a video
1289− * group.
1288+ * Use the peripheral_config to indicate that the channel is part
1289+ * of a video group. This requires matching use of the custom
1290+ * structure in each driver.
12901291 */
1291− if (chan->id <= ZYNQMP_DPDMA_VIDEO2)
1292− chan->video_group = config->slave_id != 0;
1292+ pconfig = config->peripheral_config;
1293+ if (WARN_ON(pconfig && config->peripheral_size != sizeof(*pconfig)))
1294+ return -EINVAL;
12931295
1296+ spin_lock_irqsave(&chan->lock, flags);
1297+ if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && pconfig)
1298+ chan->video_group = pconfig->video_group;
12941299 spin_unlock_irqrestore(&chan->lock, flags);
12951300
12961301 return 0;
drivers/firmware/cirrus/cs_dsp.c+115−41
@@ -12,16 +12,10 @@ · 11 unmodified lines
1212 #include <linux/ctype.h>
1313 #include <linux/debugfs.h>
1414 #include <linux/delay.h>
15−#include <linux/device.h>
16−#include <linux/firmware.h>
17−#include <linux/interrupt.h>
18−#include <linux/list.h>
1915 #include <linux/module.h>
2016 #include <linux/moduleparam.h>
21−#include <linux/regmap.h>
2217 #include <linux/slab.h>
2318 #include <linux/vmalloc.h>
24−#include <linux/workqueue.h>
2519
2620 #include <linux/firmware/cirrus/cs_dsp.h>
2721 #include <linux/firmware/cirrus/wmfw.h>
@@ -622,7 +616,8 @@ static void cs_dsp_halo_show_fw_status(struct cs_dsp *dsp) · 594 unmodified lines
622616 offs[0], offs[1], offs[2], offs[3]);
623617 }
624618
625−static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg)
619+static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg,
620+ unsigned int off)
626621 {
627622 const struct cs_dsp_alg_region *alg_region = &ctl->alg_region;
628623 struct cs_dsp *dsp = ctl->dsp;
@@ -635,7 +630,7 @@ static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg · 6 unmodified lines
635630 return -EINVAL;
636631 }
637632
638− *reg = dsp->ops->region_to_reg(mem, ctl->alg_region.base + ctl->offset);
633+ *reg = dsp->ops->region_to_reg(mem, ctl->alg_region.base + ctl->offset + off);
639634
640635 return 0;
641636 }
@@ -659,10 +654,12 @@ int cs_dsp_coeff_write_acked_control(struct cs_dsp_coeff_ctl *ctl, unsigned int · 17 unmodified lines
659654 unsigned int reg;
660655 int i, ret;
661656
657+ lockdep_assert_held(&dsp->pwr_lock);
658+
662659 if (!dsp->running)
663660 return -EPERM;
664661
665− ret = cs_dsp_coeff_base_reg(ctl, &reg);
662+ ret = cs_dsp_coeff_base_reg(ctl, &reg, 0);
666663 if (ret)
667664 return ret;
668665
@@ -716,14 +713,14 @@ int cs_dsp_coeff_write_acked_control(struct cs_dsp_coeff_ctl *ctl, unsigned int · 47 unmodified lines
716713 EXPORT_SYMBOL_GPL(cs_dsp_coeff_write_acked_control);
717714
718715 static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl,
719− const void *buf, size_t len)
716+ unsigned int off, const void *buf, size_t len)
720717 {
721718 struct cs_dsp *dsp = ctl->dsp;
722719 void *scratch;
723720 int ret;
724721 unsigned int reg;
725722
726− ret = cs_dsp_coeff_base_reg(ctl, &reg);
723+ ret = cs_dsp_coeff_base_reg(ctl, &reg, off);
727724 if (ret)
728725 return ret;
729726
@@ -749,38 +746,49 @@ static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, · 19 unmodified lines
749746 /**
750747 * cs_dsp_coeff_write_ctrl() - Writes the given buffer to the given coefficient control
751748 * @ctl: pointer to coefficient control
749+ * @off: word offset at which data should be written
752750 * @buf: the buffer to write to the given control
753− * @len: the length of the buffer
751+ * @len: the length of the buffer in bytes
754752 *
755753 * Must be called with pwr_lock held.
756754 *
757755 * Return: Zero for success, a negative number on error.
758756 */
759−int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, const void *buf, size_t len)
757+int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl,
758+ unsigned int off, const void *buf, size_t len)
760759 {
761760 int ret = 0;
762761
762+ if (!ctl)
763+ return -ENOENT;
764+
765+ lockdep_assert_held(&ctl->dsp->pwr_lock);
766+
767+ if (len + off * sizeof(u32) > ctl->len)
768+ return -EINVAL;
769+
763770 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
764771 ret = -EPERM;
765772 else if (buf != ctl->cache)
766− memcpy(ctl->cache, buf, len);
773+ memcpy(ctl->cache + off * sizeof(u32), buf, len);
767774
768775 ctl->set = 1;
769776 if (ctl->enabled && ctl->dsp->running)
770− ret = cs_dsp_coeff_write_ctrl_raw(ctl, buf, len);
777+ ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len);
771778
772779 return ret;
773780 }
774781 EXPORT_SYMBOL_GPL(cs_dsp_coeff_write_ctrl);
775782
776−static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, void *buf, size_t len)
783+static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl,
784+ unsigned int off, void *buf, size_t len)
777785 {
778786 struct cs_dsp *dsp = ctl->dsp;
779787 void *scratch;
780788 int ret;
781789 unsigned int reg;
782790
783− ret = cs_dsp_coeff_base_reg(ctl, &reg);
791+ ret = cs_dsp_coeff_base_reg(ctl, &reg, off);
784792 if (ret)
785793 return ret;
786794
@@ -806,28 +814,38 @@ static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, void *buf, s · 19 unmodified lines
806814 /**
807815 * cs_dsp_coeff_read_ctrl() - Reads the given coefficient control into the given buffer
808816 * @ctl: pointer to coefficient control
817+ * @off: word offset at which data should be read
809818 * @buf: the buffer to store to the given control
810− * @len: the length of the buffer
819+ * @len: the length of the buffer in bytes
811820 *
812821 * Must be called with pwr_lock held.
813822 *
814823 * Return: Zero for success, a negative number on error.
815824 */
816−int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, void *buf, size_t len)
825+int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl,
826+ unsigned int off, void *buf, size_t len)
817827 {
818828 int ret = 0;
819829
830+ if (!ctl)
831+ return -ENOENT;
832+
833+ lockdep_assert_held(&ctl->dsp->pwr_lock);
834+
835+ if (len + off * sizeof(u32) > ctl->len)
836+ return -EINVAL;
837+
820838 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) {
821839 if (ctl->enabled && ctl->dsp->running)
822− return cs_dsp_coeff_read_ctrl_raw(ctl, buf, len);
840+ return cs_dsp_coeff_read_ctrl_raw(ctl, off, buf, len);
823841 else
824842 return -EPERM;
825843 } else {
826844 if (!ctl->flags && ctl->enabled && ctl->dsp->running)
827− ret = cs_dsp_coeff_read_ctrl_raw(ctl, ctl->cache, ctl->len);
845+ ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len);
828846
829847 if (buf != ctl->cache)
830− memcpy(buf, ctl->cache, len);
848+ memcpy(buf, ctl->cache + off * sizeof(u32), len);
831849 }
832850
833851 return ret;
@@ -851,7 +869,7 @@ static int cs_dsp_coeff_init_control_caches(struct cs_dsp *dsp) · 17 unmodified lines
851869 * created so we don't need to do anything.
852870 */
853871 if (!ctl->flags || (ctl->flags & WMFW_CTL_FLAG_READABLE)) {
854− ret = cs_dsp_coeff_read_ctrl_raw(ctl, ctl->cache, ctl->len);
872+ ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len);
855873 if (ret < 0)
856874 return ret;
857875 }
@@ -869,7 +887,7 @@ static int cs_dsp_coeff_sync_controls(struct cs_dsp *dsp) · 11 unmodified lines
869887 if (!ctl->enabled)
870888 continue;
871889 if (ctl->set && !(ctl->flags & WMFW_CTL_FLAG_VOLATILE)) {
872− ret = cs_dsp_coeff_write_ctrl_raw(ctl, ctl->cache,
890+ ret = cs_dsp_coeff_write_ctrl_raw(ctl, 0, ctl->cache,
873891 ctl->len);
874892 if (ret < 0)
875893 return ret;
@@ -1159,6 +1177,7 @@ static int cs_dsp_parse_coeff(struct cs_dsp *dsp, · 283 unmodified lines
11591177 return -EINVAL;
11601178 break;
11611179 case WMFW_CTL_TYPE_HOSTEVENT:
1180+ case WMFW_CTL_TYPE_FWEVENT:
11621181 ret = cs_dsp_check_coeff_flags(dsp, &coeff_blk,
11631182 WMFW_CTL_FLAG_SYS |
11641183 WMFW_CTL_FLAG_VOLATILE |
@@ -1459,6 +1478,8 @@ struct cs_dsp_coeff_ctl *cs_dsp_get_ctl(struct cs_dsp *dsp, const char *name, in · 294 unmodified lines
14591478 {
14601479 struct cs_dsp_coeff_ctl *pos, *rslt = NULL;
14611480
1481+ lockdep_assert_held(&dsp->pwr_lock);
1482+
14621483 list_for_each_entry(pos, &dsp->ctl_list, list) {
14631484 if (!pos->subname)
14641485 continue;
@@ -1554,6 +1575,8 @@ struct cs_dsp_alg_region *cs_dsp_find_alg_region(struct cs_dsp *dsp, · 89 unmodified lines
15541575 {
15551576 struct cs_dsp_alg_region *alg_region;
15561577
1578+ lockdep_assert_held(&dsp->pwr_lock);
1579+
15571580 list_for_each_entry(alg_region, &dsp->alg_regions, list) {
15581581 if (id == alg_region->alg && type == alg_region->type)
15591582 return alg_region;
@@ -1565,7 +1588,7 @@ EXPORT_SYMBOL_GPL(cs_dsp_find_alg_region); · 5 unmodified lines
15651588
15661589 static struct cs_dsp_alg_region *cs_dsp_create_region(struct cs_dsp *dsp,
15671590 int type, __be32 id,
1568− __be32 base)
1591+ __be32 ver, __be32 base)
15691592 {
15701593 struct cs_dsp_alg_region *alg_region;
15711594
@@ -1575,6 +1598,7 @@ static struct cs_dsp_alg_region *cs_dsp_create_region(struct cs_dsp *dsp, · 3 unmodified lines
15751598
15761599 alg_region->type = type;
15771600 alg_region->alg = be32_to_cpu(id);
1601+ alg_region->ver = be32_to_cpu(ver);
15781602 alg_region->base = be32_to_cpu(base);
15791603
15801604 list_add_tail(&alg_region->list, &dsp->alg_regions);
@@ -1624,14 +1648,14 @@ static void cs_dsp_parse_wmfw_v3_id_header(struct cs_dsp *dsp, · 43 unmodified lines
16241648 nalgs);
16251649 }
16261650
1627−static int cs_dsp_create_regions(struct cs_dsp *dsp, __be32 id, int nregions,
1628− const int *type, __be32 *base)
1651+static int cs_dsp_create_regions(struct cs_dsp *dsp, __be32 id, __be32 ver,
1652+ int nregions, const int *type, __be32 *base)
16291653 {
16301654 struct cs_dsp_alg_region *alg_region;
16311655 int i;
16321656
16331657 for (i = 0; i < nregions; i++) {
1634− alg_region = cs_dsp_create_region(dsp, type[i], id, base[i]);
1658+ alg_region = cs_dsp_create_region(dsp, type[i], id, ver, base[i]);
16351659 if (IS_ERR(alg_region))
16361660 return PTR_ERR(alg_region);
16371661 }
@@ -1666,12 +1690,14 @@ static int cs_dsp_adsp1_setup_algs(struct cs_dsp *dsp) · 28 unmodified lines
16661690 cs_dsp_parse_wmfw_id_header(dsp, &adsp1_id.fw, n_algs);
16671691
16681692 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP1_ZM,
1669− adsp1_id.fw.id, adsp1_id.zm);
1693+ adsp1_id.fw.id, adsp1_id.fw.ver,
1694+ adsp1_id.zm);
16701695 if (IS_ERR(alg_region))
16711696 return PTR_ERR(alg_region);
16721697
16731698 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP1_DM,
1674− adsp1_id.fw.id, adsp1_id.dm);
1699+ adsp1_id.fw.id, adsp1_id.fw.ver,
1700+ adsp1_id.dm);
16751701 if (IS_ERR(alg_region))
16761702 return PTR_ERR(alg_region);
16771703
@@ -1694,6 +1720,7 @@ static int cs_dsp_adsp1_setup_algs(struct cs_dsp *dsp) · 16 unmodified lines
16941720
16951721 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP1_DM,
16961722 adsp1_alg[i].alg.id,
1723+ adsp1_alg[i].alg.ver,
16971724 adsp1_alg[i].dm);
16981725 if (IS_ERR(alg_region)) {
16991726 ret = PTR_ERR(alg_region);
@@ -1715,6 +1742,7 @@ static int cs_dsp_adsp1_setup_algs(struct cs_dsp *dsp) · 15 unmodified lines
17151742
17161743 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP1_ZM,
17171744 adsp1_alg[i].alg.id,
1745+ adsp1_alg[i].alg.ver,
17181746 adsp1_alg[i].zm);
17191747 if (IS_ERR(alg_region)) {
17201748 ret = PTR_ERR(alg_region);
@@ -1767,17 +1795,20 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp) · 46 unmodified lines
17671795 cs_dsp_parse_wmfw_id_header(dsp, &adsp2_id.fw, n_algs);
17681796
17691797 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_XM,
1770− adsp2_id.fw.id, adsp2_id.xm);
1798+ adsp2_id.fw.id, adsp2_id.fw.ver,
1799+ adsp2_id.xm);
17711800 if (IS_ERR(alg_region))
17721801 return PTR_ERR(alg_region);
17731802
17741803 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_YM,
1775− adsp2_id.fw.id, adsp2_id.ym);
1804+ adsp2_id.fw.id, adsp2_id.fw.ver,
1805+ adsp2_id.ym);
17761806 if (IS_ERR(alg_region))
17771807 return PTR_ERR(alg_region);
17781808
17791809 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_ZM,
1780− adsp2_id.fw.id, adsp2_id.zm);
1810+ adsp2_id.fw.id, adsp2_id.fw.ver,
1811+ adsp2_id.zm);
17811812 if (IS_ERR(alg_region))
17821813 return PTR_ERR(alg_region);
17831814
@@ -1802,6 +1833,7 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp) · 18 unmodified lines
18021833
18031834 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_XM,
18041835 adsp2_alg[i].alg.id,
1836+ adsp2_alg[i].alg.ver,
18051837 adsp2_alg[i].xm);
18061838 if (IS_ERR(alg_region)) {
18071839 ret = PTR_ERR(alg_region);
@@ -1823,6 +1855,7 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp) · 15 unmodified lines
18231855
18241856 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_YM,
18251857 adsp2_alg[i].alg.id,
1858+ adsp2_alg[i].alg.ver,
18261859 adsp2_alg[i].ym);
18271860 if (IS_ERR(alg_region)) {
18281861 ret = PTR_ERR(alg_region);
@@ -1844,6 +1877,7 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp) · 15 unmodified lines
18441877
18451878 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_ZM,
18461879 adsp2_alg[i].alg.id,
1880+ adsp2_alg[i].alg.ver,
18471881 adsp2_alg[i].zm);
18481882 if (IS_ERR(alg_region)) {
18491883 ret = PTR_ERR(alg_region);
@@ -1869,7 +1903,7 @@ out: · 19 unmodified lines
18691903 return ret;
18701904 }
18711905
1872−static int cs_dsp_halo_create_regions(struct cs_dsp *dsp, __be32 id,
1906+static int cs_dsp_halo_create_regions(struct cs_dsp *dsp, __be32 id, __be32 ver,
18731907 __be32 xm_base, __be32 ym_base)
18741908 {
18751909 static const int types[] = {
@@ -1878,7 +1912,7 @@ static int cs_dsp_halo_create_regions(struct cs_dsp *dsp, __be32 id, · 2 unmodified lines
18781912 };
18791913 __be32 bases[] = { xm_base, xm_base, ym_base, ym_base };
18801914
1881− return cs_dsp_create_regions(dsp, id, ARRAY_SIZE(types), types, bases);
1915+ return cs_dsp_create_regions(dsp, id, ver, ARRAY_SIZE(types), types, bases);
18821916 }
18831917
18841918 static int cs_dsp_halo_setup_algs(struct cs_dsp *dsp)
@@ -1906,7 +1940,7 @@ static int cs_dsp_halo_setup_algs(struct cs_dsp *dsp) · 21 unmodified lines
19061940
19071941 cs_dsp_parse_wmfw_v3_id_header(dsp, &halo_id.fw, n_algs);
19081942
1909− ret = cs_dsp_halo_create_regions(dsp, halo_id.fw.id,
1943+ ret = cs_dsp_halo_create_regions(dsp, halo_id.fw.id, halo_id.fw.ver,
19101944 halo_id.xm_base, halo_id.ym_base);
19111945 if (ret)
19121946 return ret;
@@ -1930,6 +1964,7 @@ static int cs_dsp_halo_setup_algs(struct cs_dsp *dsp) · 17 unmodified lines
19301964 be32_to_cpu(halo_alg[i].ym_base));
19311965
19321966 ret = cs_dsp_halo_create_regions(dsp, halo_alg[i].alg.id,
1967+ halo_alg[i].alg.ver,
19331968 halo_alg[i].xm_base,
19341969 halo_alg[i].ym_base);
19351970 if (ret)
@@ -1951,7 +1986,8 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 15 unmodified lines
19511986 const struct cs_dsp_region *mem;
19521987 struct cs_dsp_alg_region *alg_region;
19531988 const char *region_name;
1954− int ret, pos, blocks, type, offset, reg;
1989+ int ret, pos, blocks, type, offset, reg, version;
1990+ char *text = NULL;
19551991 struct cs_dsp_buf *buf;
19561992
19571993 if (!firmware)
@@ -1973,6 +2009,7 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 15 unmodified lines
19732009
19742010 switch (be32_to_cpu(hdr->rev) & 0xff) {
19752011 case 1:
2012+ case 2:
19762013 break;
19772014 default:
19782015 cs_dsp_err(dsp, "%s: Unsupported coefficient file format %d\n",
@@ -1995,6 +2032,7 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 16 unmodified lines
19952032
19962033 type = le16_to_cpu(blk->type);
19972034 offset = le16_to_cpu(blk->offset);
2035+ version = le32_to_cpu(blk->ver) >> 8;
19982036
19992037 cs_dsp_dbg(dsp, "%s.%d: %x v%d.%d.%d\n",
20002038 file, blocks, le32_to_cpu(blk->id),
@@ -2008,6 +2046,8 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 7 unmodified lines
20082046 region_name = "Unknown";
20092047 switch (type) {
20102048 case (WMFW_NAME_TEXT << 8):
2049+ text = kzalloc(le32_to_cpu(blk->len) + 1, GFP_KERNEL);
2050+ break;
20112051 case (WMFW_INFO_TEXT << 8):
20122052 case (WMFW_METADATA << 8):
20132053 break;
@@ -2052,6 +2092,16 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 38 unmodified lines
20522092 alg_region = cs_dsp_find_alg_region(dsp, type,
20532093 le32_to_cpu(blk->id));
20542094 if (alg_region) {
2095+ if (version != alg_region->ver)
2096+ cs_dsp_warn(dsp,
2097+ "Algorithm coefficient version %d.%d.%d but expected %d.%d.%d\n",
2098+ (version >> 16) & 0xFF,
2099+ (version >> 8) & 0xFF,
2100+ version & 0xFF,
2101+ (alg_region->ver >> 16) & 0xFF,
2102+ (alg_region->ver >> 8) & 0xFF,
2103+ alg_region->ver & 0xFF);
2104+
20552105 reg = alg_region->base;
20562106 reg = dsp->ops->region_to_reg(mem, reg);
20572107 reg += offset;
@@ -2067,6 +2117,13 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 9 unmodified lines
20672117 break;
20682118 }
20692119
2120+ if (text) {
2121+ memcpy(text, blk->data, le32_to_cpu(blk->len));
2122+ cs_dsp_info(dsp, "%s: %s\n", dsp->fw_name, text);
2123+ kfree(text);
2124+ text = NULL;
2125+ }
2126+
20702127 if (reg) {
20712128 if (le32_to_cpu(blk->len) >
20722129 firmware->size - pos - sizeof(*blk)) {
@@ -2117,6 +2174,7 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 44 unmodified lines
21172174 out_fw:
21182175 regmap_async_complete(regmap);
21192176 cs_dsp_buf_free(&buf_list);
2177+ kfree(text);
21202178 return ret;
21212179 }
21222180
@@ -2600,6 +2658,12 @@ int cs_dsp_run(struct cs_dsp *dsp) · 477 unmodified lines
26002658 goto err;
26012659 }
26022660
2661+ if (dsp->client_ops->pre_run) {
2662+ ret = dsp->client_ops->pre_run(dsp);
2663+ if (ret)
2664+ goto err;
2665+ }
2666+
26032667 /* Sync set controls */
26042668 ret = cs_dsp_coeff_sync_controls(dsp);
26052669 if (ret != 0)
@@ -2680,10 +2744,16 @@ EXPORT_SYMBOL_GPL(cs_dsp_stop); · 74 unmodified lines
26802744
26812745 static int cs_dsp_halo_start_core(struct cs_dsp *dsp)
26822746 {
2683− return regmap_update_bits(dsp->regmap,
2684− dsp->base + HALO_CCM_CORE_CONTROL,
2685− HALO_CORE_RESET | HALO_CORE_EN,
2686− HALO_CORE_RESET | HALO_CORE_EN);
2747+ int ret;
2748+
2749+ ret = regmap_update_bits(dsp->regmap, dsp->base + HALO_CCM_CORE_CONTROL,
2750+ HALO_CORE_RESET | HALO_CORE_EN,
2751+ HALO_CORE_RESET | HALO_CORE_EN);
2752+ if (ret)
2753+ return ret;
2754+
2755+ return regmap_update_bits(dsp->regmap, dsp->base + HALO_CCM_CORE_CONTROL,
2756+ HALO_CORE_RESET, 0);
26872757 }
26882758
26892759 static void cs_dsp_halo_stop_core(struct cs_dsp *dsp)
@@ -2789,6 +2859,8 @@ int cs_dsp_read_raw_data_block(struct cs_dsp *dsp, int mem_type, unsigned int me · 99 unmodified lines
27892859 unsigned int reg;
27902860 int ret;
27912861
2862+ lockdep_assert_held(&dsp->pwr_lock);
2863+
27922864 if (!mem)
27932865 return -EINVAL;
27942866
@@ -2842,6 +2914,8 @@ int cs_dsp_write_data_word(struct cs_dsp *dsp, int mem_type, unsigned int mem_ad · 47 unmodified lines
28422914 __be32 val = cpu_to_be32(data & 0x00ffffffu);
28432915 unsigned int reg;
28442916
2917+ lockdep_assert_held(&dsp->pwr_lock);
2918+
28452919 if (!mem)
28462920 return -EINVAL;
28472921
drivers/gpu/drm/xlnx/zynqmp_disp.c+7−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424
2525 #include <linux/clk.h>
2626 #include <linux/delay.h>
27+#include <linux/dma/xilinx_dpdma.h>
2728 #include <linux/dma-mapping.h>
2829 #include <linux/dmaengine.h>
2930 #include <linux/module.h>
@@ -1058,14 +1059,18 @@ static void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, · 1028 unmodified lines
10581059 zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
10591060
10601061 /*
1061− * Set slave_id for each DMA channel to indicate they're part of a
1062+ * Set pconfig for each DMA channel to indicate they're part of a
10621063 * video group.
10631064 */
10641065 for (i = 0; i < info->num_planes; i++) {
10651066 struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
1067+ struct xilinx_dpdma_peripheral_config pconfig = {
1068+ .video_group = true,
1069+ };
10661070 struct dma_slave_config config = {
10671071 .direction = DMA_MEM_TO_DEV,
1068− .slave_id = 1,
1072+ .peripheral_config = &pconfig,
1073+ .peripheral_size = sizeof(pconfig),
10691074 };
10701075
10711076 dmaengine_slave_config(dma->chan, &config);
drivers/mmc/host/bcm2835.c+0−2
@@ -1293,14 +1293,12 @@ static int bcm2835_add_host(struct bcm2835_host *host) · 1292 unmodified lines
12931293
12941294 host->dma_cfg_tx.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
12951295 host->dma_cfg_tx.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1296− host->dma_cfg_tx.slave_id = 13; /* DREQ channel */
12971296 host->dma_cfg_tx.direction = DMA_MEM_TO_DEV;
12981297 host->dma_cfg_tx.src_addr = 0;
12991298 host->dma_cfg_tx.dst_addr = host->phys_addr + SDDATA;
13001299
13011300 host->dma_cfg_rx.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
13021301 host->dma_cfg_rx.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1303− host->dma_cfg_rx.slave_id = 13; /* DREQ channel */
13041302 host->dma_cfg_rx.direction = DMA_DEV_TO_MEM;
13051303 host->dma_cfg_rx.src_addr = host->phys_addr + SDDATA;
13061304 host->dma_cfg_rx.dst_addr = 0;
drivers/mtd/nand/raw/qcom_nandc.c+12−2
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/clk.h>
77 #include <linux/slab.h>
88 #include <linux/bitops.h>
9+#include <linux/dma/qcom_adm.h>
910 #include <linux/dma-mapping.h>
1011 #include <linux/dmaengine.h>
1112 #include <linux/module.h>
@@ -952,6 +953,7 @@ static int prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read, · 940 unmodified lines
952953 struct dma_async_tx_descriptor *dma_desc;
953954 struct scatterlist *sgl;
954955 struct dma_slave_config slave_conf;
956+ struct qcom_adm_peripheral_config periph_conf = {};
955957 enum dma_transfer_direction dir_eng;
956958 int ret;
957959
@@ -983,11 +985,19 @@ static int prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read, · 25 unmodified lines
983985 if (read) {
984986 slave_conf.src_maxburst = 16;
985987 slave_conf.src_addr = nandc->base_dma + reg_off;
986− slave_conf.slave_id = nandc->data_crci;
988+ if (nandc->data_crci) {
989+ periph_conf.crci = nandc->data_crci;
990+ slave_conf.peripheral_config = &periph_conf;
991+ slave_conf.peripheral_size = sizeof(periph_conf);
992+ }
987993 } else {
988994 slave_conf.dst_maxburst = 16;
989995 slave_conf.dst_addr = nandc->base_dma + reg_off;
990− slave_conf.slave_id = nandc->cmd_crci;
996+ if (nandc->cmd_crci) {
997+ periph_conf.crci = nandc->cmd_crci;
998+ slave_conf.peripheral_config = &periph_conf;
999+ slave_conf.peripheral_size = sizeof(periph_conf);
1000+ }
9911001 }
9921002
9931003 ret = dmaengine_slave_config(nandc->chan, &slave_conf);
drivers/soc/mediatek/mtk-scpsys.c+11−4
@@ -411,12 +411,17 @@ out: · 410 unmodified lines
411411 return ret;
412412 }
413413
414−static void init_clks(struct platform_device *pdev, struct clk **clk)
414+static int init_clks(struct platform_device *pdev, struct clk **clk)
415415 {
416416 int i;
417417
418− for (i = CLK_NONE + 1; i < CLK_MAX; i++)
418+ for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
419419 clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
420+ if (IS_ERR(clk[i]))
421+ return PTR_ERR(clk[i]);
422+ }
423+
424+ return 0;
420425 }
421426
422427 static struct scp *init_scp(struct platform_device *pdev,
@@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pdev, · 3 unmodified lines
426431 {
427432 struct genpd_onecell_data *pd_data;
428433 struct resource *res;
429− int i, j;
434+ int i, j, ret;
430435 struct scp *scp;
431436 struct clk *clk[CLK_MAX];
432437
@@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pdev, · 48 unmodified lines
481486
482487 pd_data->num_domains = num;
483488
484− init_clks(pdev, clk);
489+ ret = init_clks(pdev, clk);
490+ if (ret)
491+ return ERR_PTR(ret);
485492
486493 for (i = 0; i < num; i++) {
487494 struct scp_domain *scpd = &scp->domains[i];
drivers/soundwire/cadence_master.c+2−34
@@ -1178,9 +1178,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, · 1177 unmodified lines
11781178 cdns->pcm.num_bd = config.pcm_bd;
11791179 cdns->pcm.num_in = config.pcm_in;
11801180 cdns->pcm.num_out = config.pcm_out;
1181− cdns->pdm.num_bd = config.pdm_bd;
1182− cdns->pdm.num_in = config.pdm_in;
1183− cdns->pdm.num_out = config.pdm_out;
11841181
11851182 /* Allocate PDIs for PCMs */
11861183 stream = &cdns->pcm;
@@ -1211,32 +1208,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, · 24 unmodified lines
12111208 stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out;
12121209 cdns->num_ports = stream->num_pdi;
12131210
1214− /* Allocate PDIs for PDMs */
1215− stream = &cdns->pdm;
1216− ret = cdns_allocate_pdi(cdns, &stream->bd,
1217− stream->num_bd, offset);
1218− if (ret)
1219− return ret;
1220−
1221− offset += stream->num_bd;
1222−
1223− ret = cdns_allocate_pdi(cdns, &stream->in,
1224− stream->num_in, offset);
1225− if (ret)
1226− return ret;
1227−
1228− offset += stream->num_in;
1229−
1230− ret = cdns_allocate_pdi(cdns, &stream->out,
1231− stream->num_out, offset);
1232−
1233− if (ret)
1234− return ret;
1235−
1236− /* Update total number of PDM PDIs */
1237− stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out;
1238− cdns->num_ports += stream->num_pdi;
1239−
12401211 return 0;
12411212 }
12421213 EXPORT_SYMBOL(sdw_cdns_pdi_init);
@@ -1681,7 +1652,7 @@ int sdw_cdns_probe(struct sdw_cdns *cdns) · 438 unmodified lines
16811652 EXPORT_SYMBOL(sdw_cdns_probe);
16821653
16831654 int cdns_set_sdw_stream(struct snd_soc_dai *dai,
1684− void *stream, bool pcm, int direction)
1655+ void *stream, int direction)
16851656 {
16861657 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
16871658 struct sdw_cdns_dma_data *dma;
@@ -1705,10 +1676,7 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai, · 17 unmodified lines
17051676 if (!dma)
17061677 return -ENOMEM;
17071678
1708− if (pcm)
1709− dma->stream_type = SDW_STREAM_PCM;
1710− else
1711− dma->stream_type = SDW_STREAM_PDM;
1679+ dma->stream_type = SDW_STREAM_PCM;
17121680
17131681 dma->bus = &cdns->bus;
17141682 dma->link_id = cdns->instance;
drivers/soundwire/cadence_master.h+4−10
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 * @h_ch_num: high channel for PDI
1818 * @ch_count: total channel count for PDI
1919 * @dir: data direction
20− * @type: stream type, PDM or PCM
20+ * @type: stream type, (only PCM supported)
2121 */
2222 struct sdw_cdns_pdi {
2323 int num;
@@ -62,17 +62,11 @@ struct sdw_cdns_streams { · 38 unmodified lines
6262 * @pcm_bd: number of bidirectional PCM streams supported
6363 * @pcm_in: number of input PCM streams supported
6464 * @pcm_out: number of output PCM streams supported
65− * @pdm_bd: number of bidirectional PDM streams supported
66− * @pdm_in: number of input PDM streams supported
67− * @pdm_out: number of output PDM streams supported
6865 */
6966 struct sdw_cdns_stream_config {
7067 unsigned int pcm_bd;
7168 unsigned int pcm_in;
7269 unsigned int pcm_out;
73− unsigned int pdm_bd;
74− unsigned int pdm_in;
75− unsigned int pdm_out;
7670 };
7771
7872 /**
@@ -86,6 +80,7 @@ struct sdw_cdns_stream_config { · 7 unmodified lines
8680 * @link_id: Master link id
8781 * @hw_params: hw_params to be applied in .prepare step
8882 * @suspended: status set when suspended, to be used in .prepare
83+ * @paused: status set in .trigger, to be used in suspend
8984 */
9085 struct sdw_cdns_dma_data {
9186 char *name;
@@ -96,6 +91,7 @@ struct sdw_cdns_dma_data { · 4 unmodified lines
9691 int link_id;
9792 struct snd_pcm_hw_params *hw_params;
9893 bool suspended;
94+ bool paused;
9995 };
10096
10197 /**
@@ -109,7 +105,6 @@ struct sdw_cdns_dma_data { · 7 unmodified lines
109105 * @ports: Data ports
110106 * @num_ports: Total number of data ports
111107 * @pcm: PCM streams
112− * @pdm: PDM streams
113108 * @registers: Cadence registers
114109 * @link_up: Link status
115110 * @msg_count: Messages sent on bus
@@ -127,7 +122,6 @@ struct sdw_cdns { · 11 unmodified lines
127122 int num_ports;
128123
129124 struct sdw_cdns_streams pcm;
130− struct sdw_cdns_streams pdm;
131125
132126 int pdi_loopback_source;
133127 int pdi_loopback_target;
@@ -186,7 +180,7 @@ cdns_xfer_msg_defer(struct sdw_bus *bus, · 52 unmodified lines
186180 int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params);
187181
188182 int cdns_set_sdw_stream(struct snd_soc_dai *dai,
189− void *stream, bool pcm, int direction);
183+ void *stream, int direction);
190184
191185 void sdw_cdns_check_self_clearing_bits(struct sdw_cdns *cdns, const char *string,
192186 bool initial_delay, int reset_iterations);
drivers/soundwire/intel.c+124−129
@@ -564,7 +564,7 @@ static void intel_pdi_init(struct sdw_intel *sdw, · 563 unmodified lines
564564 {
565565 void __iomem *shim = sdw->link_res->shim;
566566 unsigned int link_id = sdw->instance;
567− int pcm_cap, pdm_cap;
567+ int pcm_cap;
568568
569569 /* PCM Stream Capability */
570570 pcm_cap = intel_readw(shim, SDW_SHIM_PCMSCAP(link_id));
@@ -575,41 +575,25 @@ static void intel_pdi_init(struct sdw_intel *sdw, · 4 unmodified lines
575575
576576 dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n",
577577 config->pcm_bd, config->pcm_in, config->pcm_out);
578−
579− /* PDM Stream Capability */
580− pdm_cap = intel_readw(shim, SDW_SHIM_PDMSCAP(link_id));
581−
582− config->pdm_bd = FIELD_GET(SDW_SHIM_PDMSCAP_BSS, pdm_cap);
583− config->pdm_in = FIELD_GET(SDW_SHIM_PDMSCAP_ISS, pdm_cap);
584− config->pdm_out = FIELD_GET(SDW_SHIM_PDMSCAP_OSS, pdm_cap);
585−
586− dev_dbg(sdw->cdns.dev, "PDM cap bd:%d in:%d out:%d\n",
587− config->pdm_bd, config->pdm_in, config->pdm_out);
588578 }
589579
590580 static int
591−intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num, bool pcm)
581+intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num)
592582 {
593583 void __iomem *shim = sdw->link_res->shim;
594584 unsigned int link_id = sdw->instance;
595585 int count;
596586
597− if (pcm) {
598− count = intel_readw(shim, SDW_SHIM_PCMSYCHC(link_id, pdi_num));
587+ count = intel_readw(shim, SDW_SHIM_PCMSYCHC(link_id, pdi_num));
599588
600− /*
601− * WORKAROUND: on all existing Intel controllers, pdi
602− * number 2 reports channel count as 1 even though it
603− * supports 8 channels. Performing hardcoding for pdi
604− * number 2.
605− */
606− if (pdi_num == 2)
607− count = 7;
608−
609− } else {
610− count = intel_readw(shim, SDW_SHIM_PDMSCAP(link_id));
611− count = FIELD_GET(SDW_SHIM_PDMSCAP_CPSS, count);
612− }
589+ /*
590+ * WORKAROUND: on all existing Intel controllers, pdi
591+ * number 2 reports channel count as 1 even though it
592+ * supports 8 channels. Performing hardcoding for pdi
593+ * number 2.
594+ */
595+ if (pdi_num == 2)
596+ count = 7;
613597
614598 /* zero based values for channel count in register */
615599 count++;
@@ -620,12 +604,12 @@ intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num, bool pcm) · 4 unmodified lines
620604 static int intel_pdi_get_ch_update(struct sdw_intel *sdw,
621605 struct sdw_cdns_pdi *pdi,
622606 unsigned int num_pdi,
623− unsigned int *num_ch, bool pcm)
607+ unsigned int *num_ch)
624608 {
625609 int i, ch_count = 0;
626610
627611 for (i = 0; i < num_pdi; i++) {
628− pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num, pcm);
612+ pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num);
629613 ch_count += pdi->ch_count;
630614 pdi++;
631615 }
@@ -635,25 +619,23 @@ static int intel_pdi_get_ch_update(struct sdw_intel *sdw, · 3 unmodified lines
635619 }
636620
637621 static int intel_pdi_stream_ch_update(struct sdw_intel *sdw,
638− struct sdw_cdns_streams *stream, bool pcm)
622+ struct sdw_cdns_streams *stream)
639623 {
640624 intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd,
641− &stream->num_ch_bd, pcm);
625+ &stream->num_ch_bd);
642626
643627 intel_pdi_get_ch_update(sdw, stream->in, stream->num_in,
644− &stream->num_ch_in, pcm);
628+ &stream->num_ch_in);
645629
646630 intel_pdi_get_ch_update(sdw, stream->out, stream->num_out,
647− &stream->num_ch_out, pcm);
631+ &stream->num_ch_out);
648632
649633 return 0;
650634 }
651635
652636 static int intel_pdi_ch_update(struct sdw_intel *sdw)
653637 {
654− /* First update PCM streams followed by PDM streams */
655− intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm, true);
656− intel_pdi_stream_ch_update(sdw, &sdw->cdns.pdm, false);
638+ intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm);
657639
658640 return 0;
659641 }
@@ -711,7 +693,7 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi) · 51 unmodified lines
711693 }
712694
713695 static int intel_params_stream(struct sdw_intel *sdw,
714− struct snd_pcm_substream *substream,
696+ int stream,
715697 struct snd_soc_dai *dai,
716698 struct snd_pcm_hw_params *hw_params,
717699 int link_id, int alh_stream_id)
@@ -719,7 +701,7 @@ static int intel_params_stream(struct sdw_intel *sdw, · 1 unmodified line
719701 struct sdw_intel_link_res *res = sdw->link_res;
720702 struct sdw_intel_stream_params_data params_data;
721703
722− params_data.substream = substream;
704+ params_data.stream = stream; /* direction */
723705 params_data.dai = dai;
724706 params_data.hw_params = hw_params;
725707 params_data.link_id = link_id;
@@ -732,14 +714,14 @@ static int intel_params_stream(struct sdw_intel *sdw, · 6 unmodified lines
732714 }
733715
734716 static int intel_free_stream(struct sdw_intel *sdw,
735− struct snd_pcm_substream *substream,
717+ int stream,
736718 struct snd_soc_dai *dai,
737719 int link_id)
738720 {
739721 struct sdw_intel_link_res *res = sdw->link_res;
740722 struct sdw_intel_stream_free_data free_data;
741723
742− free_data.substream = substream;
724+ free_data.stream = stream; /* direction */
743725 free_data.dai = dai;
744726 free_data.link_id = link_id;
745727
@@ -840,7 +822,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream, · 94 unmodified lines
840822 struct sdw_port_config *pconfig;
841823 int ch, dir;
842824 int ret;
843− bool pcm = true;
844825
845826 dma = snd_soc_dai_get_dma_data(dai, substream);
846827 if (!dma)
@@ -852,13 +833,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream, · 5 unmodified lines
852833 else
853834 dir = SDW_DATA_DIR_TX;
854835
855− if (dma->stream_type == SDW_STREAM_PDM)
856− pcm = false;
857−
858− if (pcm)
859− pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pcm, ch, dir, dai->id);
860− else
861− pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pdm, ch, dir, dai->id);
836+ pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pcm, ch, dir, dai->id);
862837
863838 if (!pdi) {
864839 ret = -EINVAL;
@@ -871,12 +846,13 @@ static int intel_hw_params(struct snd_pcm_substream *substream, · 6 unmodified lines
871846 sdw_cdns_config_stream(cdns, ch, dir, pdi);
872847
873848 /* store pdi and hw_params, may be needed in prepare step */
849+ dma->paused = false;
874850 dma->suspended = false;
875851 dma->pdi = pdi;
876852 dma->hw_params = params;
877853
878854 /* Inform DSP about PDI stream number */
879− ret = intel_params_stream(sdw, substream, dai, params,
855+ ret = intel_params_stream(sdw, substream->stream, dai, params,
880856 sdw->instance,
881857 pdi->intel_alh_id);
882858 if (ret)
@@ -887,12 +863,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream, · 4 unmodified lines
887863 sconfig.frame_rate = params_rate(params);
888864 sconfig.type = dma->stream_type;
889865
890− if (dma->stream_type == SDW_STREAM_PDM) {
891− sconfig.frame_rate *= 50;
892− sconfig.bps = 1;
893− } else {
894− sconfig.bps = snd_pcm_format_width(params_format(params));
895− }
866+ sconfig.bps = snd_pcm_format_width(params_format(params));
896867
897868 /* Port configuration */
898869 pconfig = kzalloc(sizeof(*pconfig), GFP_KERNEL);
@@ -953,7 +924,7 @@ static int intel_prepare(struct snd_pcm_substream *substream, · 54 unmodified lines
953924 sdw_cdns_config_stream(cdns, ch, dir, dma->pdi);
954925
955926 /* Inform DSP about PDI stream number */
956− ret = intel_params_stream(sdw, substream, dai,
927+ ret = intel_params_stream(sdw, substream->stream, dai,
957928 dma->hw_params,
958929 sdw->instance,
959930 dma->pdi->intel_alh_id);
@@ -987,7 +958,7 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · 27 unmodified lines
987958 return ret;
988959 }
989960
990− ret = intel_free_stream(sdw, substream, dai, sdw->instance);
961+ ret = intel_free_stream(sdw, substream->stream, dai, sdw->instance);
991962 if (ret < 0) {
992963 dev_err(dai->dev, "intel_free_stream: failed %d\n", ret);
993964 return ret;
@@ -1008,39 +979,10 @@ static void intel_shutdown(struct snd_pcm_substream *substream, · 14 unmodified lines
1008979 pm_runtime_put_autosuspend(cdns->dev);
1009980 }
1010981
1011−static int intel_component_dais_suspend(struct snd_soc_component *component)
1012−{
1013− struct sdw_cdns_dma_data *dma;
1014− struct snd_soc_dai *dai;
1015−
1016− for_each_component_dais(component, dai) {
1017− /*
1018− * we don't have a .suspend dai_ops, and we don't have access
1019− * to the substream, so let's mark both capture and playback
1020− * DMA contexts as suspended
1021− */
1022− dma = dai->playback_dma_data;
1023− if (dma)
1024− dma->suspended = true;
1025−
1026− dma = dai->capture_dma_data;
1027− if (dma)
1028− dma->suspended = true;
1029− }
1030−
1031− return 0;
1032−}
1033−
1034982 static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai,
1035983 void *stream, int direction)
1036984 {
1037− return cdns_set_sdw_stream(dai, stream, true, direction);
1038−}
1039−
1040−static int intel_pdm_set_sdw_stream(struct snd_soc_dai *dai,
1041− void *stream, int direction)
1042−{
1043− return cdns_set_sdw_stream(dai, stream, false, direction);
985+ return cdns_set_sdw_stream(dai, stream, direction);
1044986 }
1045987
1046988 static void *intel_get_sdw_stream(struct snd_soc_dai *dai,
@@ -1059,24 +1001,100 @@ static void *intel_get_sdw_stream(struct snd_soc_dai *dai, · 12 unmodified lines
10591001 return dma->stream;
10601002 }
10611003
1062−static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
1063− .startup = intel_startup,
1064− .hw_params = intel_hw_params,
1065− .prepare = intel_prepare,
1066− .hw_free = intel_hw_free,
1067− .shutdown = intel_shutdown,
1068− .set_sdw_stream = intel_pcm_set_sdw_stream,
1069− .get_sdw_stream = intel_get_sdw_stream,
1070−};
1004+static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai)
1005+{
1006+ struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
1007+ struct sdw_intel *sdw = cdns_to_intel(cdns);
1008+ struct sdw_cdns_dma_data *dma;
1009+ int ret = 0;
10711010
1072−static const struct snd_soc_dai_ops intel_pdm_dai_ops = {
1011+ dma = snd_soc_dai_get_dma_data(dai, substream);
1012+ if (!dma) {
1013+ dev_err(dai->dev, "failed to get dma data in %s\n",
1014+ __func__);
1015+ return -EIO;
1016+ }
1017+
1018+ switch (cmd) {
1019+ case SNDRV_PCM_TRIGGER_SUSPEND:
1020+
1021+ /*
1022+ * The .prepare callback is used to deal with xruns and resume operations.
1023+ * In the case of xruns, the DMAs and SHIM registers cannot be touched,
1024+ * but for resume operations the DMAs and SHIM registers need to be initialized.
1025+ * the .trigger callback is used to track the suspend case only.
1026+ */
1027+
1028+ dma->suspended = true;
1029+
1030+ ret = intel_free_stream(sdw, substream->stream, dai, sdw->instance);
1031+ break;
1032+
1033+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1034+ dma->paused = true;
1035+ break;
1036+ case SNDRV_PCM_TRIGGER_STOP:
1037+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1038+ dma->paused = false;
1039+ break;
1040+ default:
1041+ break;
1042+ }
1043+
1044+ return ret;
1045+}
1046+
1047+static int intel_component_dais_suspend(struct snd_soc_component *component)
1048+{
1049+ struct snd_soc_dai *dai;
1050+
1051+ /*
1052+ * In the corner case where a SUSPEND happens during a PAUSE, the ALSA core
1053+ * does not throw the TRIGGER_SUSPEND. This leaves the DAIs in an unbalanced state.
1054+ * Since the component suspend is called last, we can trap this corner case
1055+ * and force the DAIs to release their resources.
1056+ */
1057+ for_each_component_dais(component, dai) {
1058+ struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
1059+ struct sdw_intel *sdw = cdns_to_intel(cdns);
1060+ struct sdw_cdns_dma_data *dma;
1061+ int stream;
1062+ int ret;
1063+
1064+ dma = dai->playback_dma_data;
1065+ stream = SNDRV_PCM_STREAM_PLAYBACK;
1066+ if (!dma) {
1067+ dma = dai->capture_dma_data;
1068+ stream = SNDRV_PCM_STREAM_CAPTURE;
1069+ }
1070+
1071+ if (!dma)
1072+ continue;
1073+
1074+ if (dma->suspended)
1075+ continue;
1076+
1077+ if (dma->paused) {
1078+ dma->suspended = true;
1079+
1080+ ret = intel_free_stream(sdw, stream, dai, sdw->instance);
1081+ if (ret < 0)
1082+ return ret;
1083+ }
1084+ }
1085+
1086+ return 0;
1087+}
1088+
1089+static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
10731090 .startup = intel_startup,
10741091 .hw_params = intel_hw_params,
10751092 .prepare = intel_prepare,
10761093 .hw_free = intel_hw_free,
1094+ .trigger = intel_trigger,
10771095 .shutdown = intel_shutdown,
1078− .set_sdw_stream = intel_pdm_set_sdw_stream,
1079− .get_sdw_stream = intel_get_sdw_stream,
1096+ .set_stream = intel_pcm_set_sdw_stream,
1097+ .get_stream = intel_get_sdw_stream,
10801098 };
10811099
10821100 static const struct snd_soc_component_driver dai_component = {
@@ -1087,7 +1105,7 @@ static const struct snd_soc_component_driver dai_component = { · 4 unmodified lines
10871105 static int intel_create_dai(struct sdw_cdns *cdns,
10881106 struct snd_soc_dai_driver *dais,
10891107 enum intel_pdi_type type,
1090− u32 num, u32 off, u32 max_ch, bool pcm)
1108+ u32 num, u32 off, u32 max_ch)
10911109 {
10921110 int i;
10931111
@@ -1116,10 +1134,7 @@ static int intel_create_dai(struct sdw_cdns *cdns, · 22 unmodified lines
11161134 dais[i].capture.formats = SNDRV_PCM_FMTBIT_S16_LE;
11171135 }
11181136
1119− if (pcm)
1120− dais[i].ops = &intel_pcm_dai_ops;
1121− else
1122− dais[i].ops = &intel_pdm_dai_ops;
1137+ dais[i].ops = &intel_pcm_dai_ops;
11231138 }
11241139
11251140 return 0;
@@ -1133,7 +1148,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 7 unmodified lines
11331148 int num_dai, ret, off = 0;
11341149
11351150 /* DAIs are created based on total number of PDIs supported */
1136− num_dai = cdns->pcm.num_pdi + cdns->pdm.num_pdi;
1151+ num_dai = cdns->pcm.num_pdi;
11371152
11381153 dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL);
11391154 if (!dais)
@@ -1143,39 +1158,19 @@ static int intel_register_dai(struct sdw_intel *sdw) · 3 unmodified lines
11431158 stream = &cdns->pcm;
11441159
11451160 ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in,
1146− off, stream->num_ch_in, true);
1161+ off, stream->num_ch_in);
11471162 if (ret)
11481163 return ret;
11491164
11501165 off += cdns->pcm.num_in;
11511166 ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pcm.num_out,
1152− off, stream->num_ch_out, true);
1167+ off, stream->num_ch_out);
11531168 if (ret)
11541169 return ret;
11551170
11561171 off += cdns->pcm.num_out;
11571172 ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pcm.num_bd,
1158− off, stream->num_ch_bd, true);
1159− if (ret)
1160− return ret;
1161−
1162− /* Create PDM DAIs */
1163− stream = &cdns->pdm;
1164− off += cdns->pcm.num_bd;
1165− ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pdm.num_in,
1166− off, stream->num_ch_in, false);
1167− if (ret)
1168− return ret;
1169−
1170− off += cdns->pdm.num_in;
1171− ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pdm.num_out,
1172− off, stream->num_ch_out, false);
1173− if (ret)
1174− return ret;
1175−
1176− off += cdns->pdm.num_out;
1177− ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd,
1178− off, stream->num_ch_bd, false);
1173+ off, stream->num_ch_bd);
11791174 if (ret)
11801175 return ret;
11811176
@@ -1549,7 +1544,7 @@ static int __maybe_unused intel_pm_prepare(struct device *dev) · 367 unmodified lines
15491544 struct sdw_intel *sdw = cdns_to_intel(cdns);
15501545 struct sdw_bus *bus = &cdns->bus;
15511546 u32 clock_stop_quirks;
1552− int ret = 0;
1547+ int ret;
15531548
15541549 if (bus->prop.hw_disabled || !sdw->startup_done) {
15551550 dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
drivers/soundwire/qcom.c+4−4
@@ -1024,8 +1024,8 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream, · 1023 unmodified lines
10241024 ctrl->sruntime[dai->id] = sruntime;
10251025
10261026 for_each_rtd_codec_dais(rtd, i, codec_dai) {
1027− ret = snd_soc_dai_set_sdw_stream(codec_dai, sruntime,
1028− substream->stream);
1027+ ret = snd_soc_dai_set_stream(codec_dai, sruntime,
1028+ substream->stream);
10291029 if (ret < 0 && ret != -ENOTSUPP) {
10301030 dev_err(dai->dev, "Failed to set sdw stream on %s\n",
10311031 codec_dai->name);
@@ -1051,8 +1051,8 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = { · 19 unmodified lines
10511051 .hw_free = qcom_swrm_hw_free,
10521052 .startup = qcom_swrm_startup,
10531053 .shutdown = qcom_swrm_shutdown,
1054− .set_sdw_stream = qcom_swrm_set_sdw_stream,
1055− .get_sdw_stream = qcom_swrm_get_sdw_stream,
1054+ .set_stream = qcom_swrm_set_sdw_stream,
1055+ .get_stream = qcom_swrm_get_sdw_stream,
10561056 };
10571057
10581058 static const struct snd_soc_component_driver qcom_swrm_dai_component = {
drivers/soundwire/stream.c+2−2
@@ -1863,7 +1863,7 @@ static int set_stream(struct snd_pcm_substream *substream, · 1862 unmodified lines
18631863
18641864 /* Set stream pointer on all DAIs */
18651865 for_each_rtd_dais(rtd, i, dai) {
1866− ret = snd_soc_dai_set_sdw_stream(dai, sdw_stream, substream->stream);
1866+ ret = snd_soc_dai_set_stream(dai, sdw_stream, substream->stream);
18671867 if (ret < 0) {
18681868 dev_err(rtd->dev, "failed to set stream pointer on dai %s\n", dai->name);
18691869 break;
@@ -1934,7 +1934,7 @@ void sdw_shutdown_stream(void *sdw_substream) · 64 unmodified lines
19341934 /* Find stream from first CPU DAI */
19351935 dai = asoc_rtd_to_cpu(rtd, 0);
19361936
1937− sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
1937+ sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
19381938
19391939 if (IS_ERR(sdw_stream)) {
19401940 dev_err(rtd->dev, "no stream found for DAI %s\n", dai->name);
drivers/spi/spi-pic32.c+0−2
@@ -370,7 +370,6 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width) · 369 unmodified lines
370370 cfg.src_addr_width = dma_width;
371371 cfg.dst_addr_width = dma_width;
372372 /* tx channel */
373− cfg.slave_id = pic32s->tx_irq;
374373 cfg.direction = DMA_MEM_TO_DEV;
375374 ret = dmaengine_slave_config(master->dma_tx, &cfg);
376375 if (ret) {
@@ -378,7 +377,6 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width) · 1 unmodified line
378377 return ret;
379378 }
380379 /* rx channel */
381− cfg.slave_id = pic32s->rx_irq;
382380 cfg.direction = DMA_DEV_TO_MEM;
383381 ret = dmaengine_slave_config(master->dma_rx, &cfg);
384382 if (ret)
drivers/tty/serial/msm_serial.c+13−2
@@ -9,6 +9,7 @@ · 8 unmodified lines
99
1010 #include <linux/kernel.h>
1111 #include <linux/atomic.h>
12+#include <linux/dma/qcom_adm.h>
1213 #include <linux/dma-mapping.h>
1314 #include <linux/dmaengine.h>
1415 #include <linux/module.h>
@@ -290,6 +291,7 @@ static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base) · 275 unmodified lines
290291 {
291292 struct device *dev = msm_port->uart.dev;
292293 struct dma_slave_config conf;
294+ struct qcom_adm_peripheral_config periph_conf = {};
293295 struct msm_dma *dma;
294296 u32 crci = 0;
295297 int ret;
@@ -308,7 +310,11 @@ static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base) · 12 unmodified lines
308310 conf.device_fc = true;
309311 conf.dst_addr = base + UARTDM_TF;
310312 conf.dst_maxburst = UARTDM_BURST_SIZE;
311− conf.slave_id = crci;
313+ if (crci) {
314+ conf.peripheral_config = &periph_conf;
315+ conf.peripheral_size = sizeof(periph_conf);
316+ periph_conf.crci = crci;
317+ }
312318
313319 ret = dmaengine_slave_config(dma->chan, &conf);
314320 if (ret)
@@ -333,6 +339,7 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) · 18 unmodified lines
333339 {
334340 struct device *dev = msm_port->uart.dev;
335341 struct dma_slave_config conf;
342+ struct qcom_adm_peripheral_config periph_conf = {};
336343 struct msm_dma *dma;
337344 u32 crci = 0;
338345 int ret;
@@ -355,7 +362,11 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) · 16 unmodified lines
355362 conf.device_fc = true;
356363 conf.src_addr = base + UARTDM_RF;
357364 conf.src_maxburst = UARTDM_BURST_SIZE;
358− conf.slave_id = crci;
365+ if (crci) {
366+ conf.peripheral_config = &periph_conf;
367+ conf.peripheral_size = sizeof(periph_conf);
368+ periph_conf.crci = crci;
369+ }
359370
360371 ret = dmaengine_slave_config(dma->chan, &conf);
361372 if (ret)
include/dt-bindings/sound/rt5640.h+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #define RT5640_JD_SRC_GPIO2 4
1717 #define RT5640_JD_SRC_GPIO3 5
1818 #define RT5640_JD_SRC_GPIO4 6
19+#define RT5640_JD_SRC_HDA_HEADER 7
1920
2021 #define RT5640_OVCD_SF_0P5 0
2122 #define RT5640_OVCD_SF_0P75 1
include/dt-bindings/sound/tlv320adc3xxx.h+28−0
@@ -0,0 +1,28 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2+/*
3+ * Devicetree bindings definitions for tlv320adc3xxx driver.
4+ *
5+ * Copyright (C) 2021 Axis Communications AB
6+ */
7+#ifndef __DT_TLV320ADC3XXX_H
8+#define __DT_TLV320ADC3XXX_H
9+
10+#define ADC3XXX_GPIO_DISABLED 0 /* I/O buffers powered down */
11+#define ADC3XXX_GPIO_INPUT 1 /* Various non-GPIO inputs */
12+#define ADC3XXX_GPIO_GPI 2 /* General purpose input */
13+#define ADC3XXX_GPIO_GPO 3 /* General purpose output */
14+#define ADC3XXX_GPIO_CLKOUT 4 /* Source set in reg. CLKOUT_MUX */
15+#define ADC3XXX_GPIO_INT1 5 /* INT1 output */
16+#define ADC3XXX_GPIO_INT2 6 /* INT2 output */
17+/* value 7 is reserved */
18+#define ADC3XXX_GPIO_SECONDARY_BCLK 8 /* Codec interface secondary BCLK */
19+#define ADC3XXX_GPIO_SECONDARY_WCLK 9 /* Codec interface secondary WCLK */
20+#define ADC3XXX_GPIO_ADC_MOD_CLK 10 /* Clock output for digital mics */
21+/* values 11-15 reserved */
22+
23+#define ADC3XXX_MICBIAS_OFF 0 /* Micbias pin powered off */
24+#define ADC3XXX_MICBIAS_2_0V 1 /* Micbias pin set to 2.0V */
25+#define ADC3XXX_MICBIAS_2_5V 2 /* Micbias pin set to 2.5V */
26+#define ADC3XXX_MICBIAS_AVDD 3 /* Use AVDD voltage for micbias pin */
27+
28+#endif /* __DT_TLV320ADC3XXX_H */
include/linux/dma/qcom_adm.h+12−0
@@ -0,0 +1,12 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+#ifndef __LINUX_DMA_QCOM_ADM_H
3+#define __LINUX_DMA_QCOM_ADM_H
4+
5+#include <linux/types.h>
6+
7+struct qcom_adm_peripheral_config {
8+ u32 crci;
9+ u32 mux;
10+};
11+
12+#endif /* __LINUX_DMA_QCOM_ADM_H */
include/linux/dma/xilinx_dpdma.h+11−0
@@ -0,0 +1,11 @@
1+// SPDX-License-Identifier: GPL-2.0
2+#ifndef __LINUX_DMA_XILINX_DPDMA_H
3+#define __LINUX_DMA_XILINX_DPDMA_H
4+
5+#include <linux/types.h>
6+
7+struct xilinx_dpdma_peripheral_config {
8+ bool video_group;
9+};
10+
11+#endif /* __LINUX_DMA_XILINX_DPDMA_H */
include/linux/dmaengine.h+0−4
@@ -418,9 +418,6 @@ enum dma_slave_buswidth { · 417 unmodified lines
418418 * @device_fc: Flow Controller Settings. Only valid for slave channels. Fill
419419 * with 'true' if peripheral should be flow controller. Direction will be
420420 * selected at Runtime.
421− * @slave_id: Slave requester id. Only valid for slave channels. The dma
422− * slave peripheral will have unique id as dma requester which need to be
423− * pass as slave config.
424421 * @peripheral_config: peripheral configuration for programming peripheral
425422 * for dmaengine transfer
426423 * @peripheral_size: peripheral configuration buffer size
@@ -448,7 +445,6 @@ struct dma_slave_config { · 21 unmodified lines
448445 u32 src_port_window_size;
449446 u32 dst_port_window_size;
450447 bool device_fc;
451− unsigned int slave_id;
452448 void *peripheral_config;
453449 size_t peripheral_size;
454450 };
include/linux/firmware/cirrus/cs_dsp.h+16−5
@@ -11,6 +11,11 @@ · 10 unmodified lines
1111 #ifndef __CS_DSP_H
1212 #define __CS_DSP_H
1313
14+#include <linux/device.h>
15+#include <linux/firmware.h>
16+#include <linux/list.h>
17+#include <linux/regmap.h>
18+
1419 #define CS_ADSP2_REGION_0 BIT(0)
1520 #define CS_ADSP2_REGION_1 BIT(1)
1621 #define CS_ADSP2_REGION_2 BIT(2)
@@ -49,12 +54,14 @@ struct cs_dsp_region { · 32 unmodified lines
4954 * struct cs_dsp_alg_region - Describes a logical algorithm region in DSP address space
5055 * @list: List node for internal use
5156 * @alg: Algorithm id
57+ * @ver: Expected algorithm version
5258 * @type: Memory region type
5359 * @base: Address of region
5460 */
5561 struct cs_dsp_alg_region {
5662 struct list_head list;
5763 unsigned int alg;
64+ unsigned int ver;
5865 int type;
5966 unsigned int base;
6067 };
@@ -69,8 +76,8 @@ struct cs_dsp_alg_region { · 8 unmodified lines
6976 * @enabled: Flag indicating whether control is enabled
7077 * @list: List node for internal use
7178 * @cache: Cached value of the control
72− * @offset: Offset of control within alg_region
73− * @len: Length of the cached value
79+ * @offset: Offset of control within alg_region in words
80+ * @len: Length of the cached value in bytes
7481 * @set: Flag indicating the value has been written by the user
7582 * @flags: Bitfield of WMFW_CTL_FLAG_ control flags defined in wmfw.h
7683 * @type: One of the WMFW_CTL_TYPE_ control types defined in wmfw.h
@@ -180,7 +187,8 @@ struct cs_dsp { · 103 unmodified lines
180187 * struct cs_dsp_client_ops - client callbacks
181188 * @control_add: Called under the pwr_lock when a control is created
182189 * @control_remove: Called under the pwr_lock when a control is destroyed
183− * @post_run: Called under the pwr_lock by cs_dsp_run()
190+ * @pre_run: Called under the pwr_lock by cs_dsp_run() before the core is started
191+ * @post_run: Called under the pwr_lock by cs_dsp_run() after the core is started
184192 * @post_stop: Called under the pwr_lock by cs_dsp_stop()
185193 * @watchdog_expired: Called when a watchdog expiry is detected
186194 *
@@ -190,6 +198,7 @@ struct cs_dsp { · 3 unmodified lines
190198 struct cs_dsp_client_ops {
191199 int (*control_add)(struct cs_dsp_coeff_ctl *ctl);
192200 void (*control_remove)(struct cs_dsp_coeff_ctl *ctl);
201+ int (*pre_run)(struct cs_dsp *dsp);
193202 int (*post_run)(struct cs_dsp *dsp);
194203 void (*post_stop)(struct cs_dsp *dsp);
195204 void (*watchdog_expired)(struct cs_dsp *dsp);
@@ -223,8 +232,10 @@ void cs_dsp_init_debugfs(struct cs_dsp *dsp, struct dentry *debugfs_root); · 27 unmodified lines
223232 void cs_dsp_cleanup_debugfs(struct cs_dsp *dsp);
224233
225234 int cs_dsp_coeff_write_acked_control(struct cs_dsp_coeff_ctl *ctl, unsigned int event_id);
226−int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, const void *buf, size_t len);
227−int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, void *buf, size_t len);
235+int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, unsigned int off,
236+ const void *buf, size_t len);
237+int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, unsigned int off,
238+ void *buf, size_t len);
228239 struct cs_dsp_coeff_ctl *cs_dsp_get_ctl(struct cs_dsp *dsp, const char *name, int type,
229240 unsigned int alg);
230241
include/linux/firmware/cirrus/wmfw.h+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #define WMFW_CTL_TYPE_ACKED 0x1000 /* acked control */
3030 #define WMFW_CTL_TYPE_HOSTEVENT 0x1001 /* event control */
3131 #define WMFW_CTL_TYPE_HOST_BUFFER 0x1002 /* host buffer pointer */
32+#define WMFW_CTL_TYPE_FWEVENT 0x1004 /* firmware event control */
3233
3334 struct wmfw_header {
3435 char magic[4];
include/linux/soundwire/sdw_intel.h+2−2
@@ -92,7 +92,7 @@ · 91 unmodified lines
9292 * firmware.
9393 */
9494 struct sdw_intel_stream_params_data {
95− struct snd_pcm_substream *substream;
95+ int stream;
9696 struct snd_soc_dai *dai;
9797 struct snd_pcm_hw_params *hw_params;
9898 int link_id;
@@ -105,7 +105,7 @@ struct sdw_intel_stream_params_data { · 6 unmodified lines
105105 * firmware.
106106 */
107107 struct sdw_intel_stream_free_data {
108− struct snd_pcm_substream *substream;
108+ int stream;
109109 struct snd_soc_dai *dai;
110110 int link_id;
111111 };
include/sound/cs35l41.h+746−0
@@ -10,6 +10,725 @@ · 9 unmodified lines
1010 #ifndef __CS35L41_H
1111 #define __CS35L41_H
1212
13+#include <linux/regmap.h>
14+
15+#define CS35L41_FIRSTREG 0x00000000
16+#define CS35L41_LASTREG 0x03804FE8
17+#define CS35L41_DEVID 0x00000000
18+#define CS35L41_REVID 0x00000004
19+#define CS35L41_FABID 0x00000008
20+#define CS35L41_RELID 0x0000000C
21+#define CS35L41_OTPID 0x00000010
22+#define CS35L41_SFT_RESET 0x00000020
23+#define CS35L41_TEST_KEY_CTL 0x00000040
24+#define CS35L41_USER_KEY_CTL 0x00000044
25+#define CS35L41_OTP_MEM0 0x00000400
26+#define CS35L41_OTP_MEM31 0x0000047C
27+#define CS35L41_OTP_CTRL0 0x00000500
28+#define CS35L41_OTP_CTRL1 0x00000504
29+#define CS35L41_OTP_CTRL3 0x00000508
30+#define CS35L41_OTP_CTRL4 0x0000050C
31+#define CS35L41_OTP_CTRL5 0x00000510
32+#define CS35L41_OTP_CTRL6 0x00000514
33+#define CS35L41_OTP_CTRL7 0x00000518
34+#define CS35L41_OTP_CTRL8 0x0000051C
35+#define CS35L41_PWR_CTRL1 0x00002014
36+#define CS35L41_PWR_CTRL2 0x00002018
37+#define CS35L41_PWR_CTRL3 0x0000201C
38+#define CS35L41_CTRL_OVRRIDE 0x00002020
39+#define CS35L41_AMP_OUT_MUTE 0x00002024
40+#define CS35L41_PROTECT_REL_ERR_IGN 0x00002034
41+#define CS35L41_GPIO_PAD_CONTROL 0x0000242C
42+#define CS35L41_JTAG_CONTROL 0x00002438
43+#define CS35L41_PWRMGT_CTL 0x00002900
44+#define CS35L41_WAKESRC_CTL 0x00002904
45+#define CS35L41_PWRMGT_STS 0x00002908
46+#define CS35L41_PLL_CLK_CTRL 0x00002C04
47+#define CS35L41_DSP_CLK_CTRL 0x00002C08
48+#define CS35L41_GLOBAL_CLK_CTRL 0x00002C0C
49+#define CS35L41_DATA_FS_SEL 0x00002C10
50+#define CS35L41_TST_FS_MON0 0x00002D10
51+#define CS35L41_MDSYNC_EN 0x00003400
52+#define CS35L41_MDSYNC_TX_ID 0x00003408
53+#define CS35L41_MDSYNC_PWR_CTRL 0x0000340C
54+#define CS35L41_MDSYNC_DATA_TX 0x00003410
55+#define CS35L41_MDSYNC_TX_STATUS 0x00003414
56+#define CS35L41_MDSYNC_DATA_RX 0x0000341C
57+#define CS35L41_MDSYNC_RX_STATUS 0x00003420
58+#define CS35L41_MDSYNC_ERR_STATUS 0x00003424
59+#define CS35L41_MDSYNC_SYNC_PTE2 0x00003528
60+#define CS35L41_MDSYNC_SYNC_PTE3 0x0000352C
61+#define CS35L41_MDSYNC_SYNC_MSM_STATUS 0x0000353C
62+#define CS35L41_BSTCVRT_VCTRL1 0x00003800
63+#define CS35L41_BSTCVRT_VCTRL2 0x00003804
64+#define CS35L41_BSTCVRT_PEAK_CUR 0x00003808
65+#define CS35L41_BSTCVRT_SFT_RAMP 0x0000380C
66+#define CS35L41_BSTCVRT_COEFF 0x00003810
67+#define CS35L41_BSTCVRT_SLOPE_LBST 0x00003814
68+#define CS35L41_BSTCVRT_SW_FREQ 0x00003818
69+#define CS35L41_BSTCVRT_DCM_CTRL 0x0000381C
70+#define CS35L41_BSTCVRT_DCM_MODE_FORCE 0x00003820
71+#define CS35L41_BSTCVRT_OVERVOLT_CTRL 0x00003830
72+#define CS35L41_VI_VOL_POL 0x00004000
73+#define CS35L41_VIMON_SPKMON_RESYNC 0x00004100
74+#define CS35L41_DTEMP_WARN_THLD 0x00004220
75+#define CS35L41_DTEMP_CFG 0x00004224
76+#define CS35L41_DTEMP_EN 0x00004308
77+#define CS35L41_VPVBST_FS_SEL 0x00004400
78+#define CS35L41_SP_ENABLES 0x00004800
79+#define CS35L41_SP_RATE_CTRL 0x00004804
80+#define CS35L41_SP_FORMAT 0x00004808
81+#define CS35L41_SP_HIZ_CTRL 0x0000480C
82+#define CS35L41_SP_FRAME_TX_SLOT 0x00004810
83+#define CS35L41_SP_FRAME_RX_SLOT 0x00004820
84+#define CS35L41_SP_TX_WL 0x00004830
85+#define CS35L41_SP_RX_WL 0x00004840
86+#define CS35L41_ASP_CONTROL4 0x00004854
87+#define CS35L41_DAC_PCM1_SRC 0x00004C00
88+#define CS35L41_ASP_TX1_SRC 0x00004C20
89+#define CS35L41_ASP_TX2_SRC 0x00004C24
90+#define CS35L41_ASP_TX3_SRC 0x00004C28
91+#define CS35L41_ASP_TX4_SRC 0x00004C2C
92+#define CS35L41_DSP1_RX1_SRC 0x00004C40
93+#define CS35L41_DSP1_RX2_SRC 0x00004C44
94+#define CS35L41_DSP1_RX3_SRC 0x00004C48
95+#define CS35L41_DSP1_RX4_SRC 0x00004C4C
96+#define CS35L41_DSP1_RX5_SRC 0x00004C50
97+#define CS35L41_DSP1_RX6_SRC 0x00004C54
98+#define CS35L41_DSP1_RX7_SRC 0x00004C58
99+#define CS35L41_DSP1_RX8_SRC 0x00004C5C
100+#define CS35L41_NGATE1_SRC 0x00004C60
101+#define CS35L41_NGATE2_SRC 0x00004C64
102+#define CS35L41_AMP_DIG_VOL_CTRL 0x00006000
103+#define CS35L41_VPBR_CFG 0x00006404
104+#define CS35L41_VBBR_CFG 0x00006408
105+#define CS35L41_VPBR_STATUS 0x0000640C
106+#define CS35L41_VBBR_STATUS 0x00006410
107+#define CS35L41_OVERTEMP_CFG 0x00006414
108+#define CS35L41_AMP_ERR_VOL 0x00006418
109+#define CS35L41_VOL_STATUS_TO_DSP 0x00006450
110+#define CS35L41_CLASSH_CFG 0x00006800
111+#define CS35L41_WKFET_CFG 0x00006804
112+#define CS35L41_NG_CFG 0x00006808
113+#define CS35L41_AMP_GAIN_CTRL 0x00006C04
114+#define CS35L41_DAC_MSM_CFG 0x00007400
115+#define CS35L41_IRQ1_CFG 0x00010000
116+#define CS35L41_IRQ1_STATUS 0x00010004
117+#define CS35L41_IRQ1_STATUS1 0x00010010
118+#define CS35L41_IRQ1_STATUS2 0x00010014
119+#define CS35L41_IRQ1_STATUS3 0x00010018
120+#define CS35L41_IRQ1_STATUS4 0x0001001C
121+#define CS35L41_IRQ1_RAW_STATUS1 0x00010090
122+#define CS35L41_IRQ1_RAW_STATUS2 0x00010094
123+#define CS35L41_IRQ1_RAW_STATUS3 0x00010098
124+#define CS35L41_IRQ1_RAW_STATUS4 0x0001009C
125+#define CS35L41_IRQ1_MASK1 0x00010110
126+#define CS35L41_IRQ1_MASK2 0x00010114
127+#define CS35L41_IRQ1_MASK3 0x00010118
128+#define CS35L41_IRQ1_MASK4 0x0001011C
129+#define CS35L41_IRQ1_FRC1 0x00010190
130+#define CS35L41_IRQ1_FRC2 0x00010194
131+#define CS35L41_IRQ1_FRC3 0x00010198
132+#define CS35L41_IRQ1_FRC4 0x0001019C
133+#define CS35L41_IRQ1_EDGE1 0x00010210
134+#define CS35L41_IRQ1_EDGE4 0x0001021C
135+#define CS35L41_IRQ1_POL1 0x00010290
136+#define CS35L41_IRQ1_POL2 0x00010294
137+#define CS35L41_IRQ1_POL3 0x00010298
138+#define CS35L41_IRQ1_POL4 0x0001029C
139+#define CS35L41_IRQ1_DB3 0x00010318
140+#define CS35L41_IRQ2_CFG 0x00010800
141+#define CS35L41_IRQ2_STATUS 0x00010804
142+#define CS35L41_IRQ2_STATUS1 0x00010810
143+#define CS35L41_IRQ2_STATUS2 0x00010814
144+#define CS35L41_IRQ2_STATUS3 0x00010818
145+#define CS35L41_IRQ2_STATUS4 0x0001081C
146+#define CS35L41_IRQ2_RAW_STATUS1 0x00010890
147+#define CS35L41_IRQ2_RAW_STATUS2 0x00010894
148+#define CS35L41_IRQ2_RAW_STATUS3 0x00010898
149+#define CS35L41_IRQ2_RAW_STATUS4 0x0001089C
150+#define CS35L41_IRQ2_MASK1 0x00010910
151+#define CS35L41_IRQ2_MASK2 0x00010914
152+#define CS35L41_IRQ2_MASK3 0x00010918
153+#define CS35L41_IRQ2_MASK4 0x0001091C
154+#define CS35L41_IRQ2_FRC1 0x00010990
155+#define CS35L41_IRQ2_FRC2 0x00010994
156+#define CS35L41_IRQ2_FRC3 0x00010998
157+#define CS35L41_IRQ2_FRC4 0x0001099C
158+#define CS35L41_IRQ2_EDGE1 0x00010A10
159+#define CS35L41_IRQ2_EDGE4 0x00010A1C
160+#define CS35L41_IRQ2_POL1 0x00010A90
161+#define CS35L41_IRQ2_POL2 0x00010A94
162+#define CS35L41_IRQ2_POL3 0x00010A98
163+#define CS35L41_IRQ2_POL4 0x00010A9C
164+#define CS35L41_IRQ2_DB3 0x00010B18
165+#define CS35L41_GPIO_STATUS1 0x00011000
166+#define CS35L41_GPIO1_CTRL1 0x00011008
167+#define CS35L41_GPIO2_CTRL1 0x0001100C
168+#define CS35L41_MIXER_NGATE_CFG 0x00012000
169+#define CS35L41_MIXER_NGATE_CH1_CFG 0x00012004
170+#define CS35L41_MIXER_NGATE_CH2_CFG 0x00012008
171+#define CS35L41_DSP_MBOX_1 0x00013000
172+#define CS35L41_DSP_MBOX_2 0x00013004
173+#define CS35L41_DSP_MBOX_3 0x00013008
174+#define CS35L41_DSP_MBOX_4 0x0001300C
175+#define CS35L41_DSP_MBOX_5 0x00013010
176+#define CS35L41_DSP_MBOX_6 0x00013014
177+#define CS35L41_DSP_MBOX_7 0x00013018
178+#define CS35L41_DSP_MBOX_8 0x0001301C
179+#define CS35L41_DSP_VIRT1_MBOX_1 0x00013020
180+#define CS35L41_DSP_VIRT1_MBOX_2 0x00013024
181+#define CS35L41_DSP_VIRT1_MBOX_3 0x00013028
182+#define CS35L41_DSP_VIRT1_MBOX_4 0x0001302C
183+#define CS35L41_DSP_VIRT1_MBOX_5 0x00013030
184+#define CS35L41_DSP_VIRT1_MBOX_6 0x00013034
185+#define CS35L41_DSP_VIRT1_MBOX_7 0x00013038
186+#define CS35L41_DSP_VIRT1_MBOX_8 0x0001303C
187+#define CS35L41_DSP_VIRT2_MBOX_1 0x00013040
188+#define CS35L41_DSP_VIRT2_MBOX_2 0x00013044
189+#define CS35L41_DSP_VIRT2_MBOX_3 0x00013048
190+#define CS35L41_DSP_VIRT2_MBOX_4 0x0001304C
191+#define CS35L41_DSP_VIRT2_MBOX_5 0x00013050
192+#define CS35L41_DSP_VIRT2_MBOX_6 0x00013054
193+#define CS35L41_DSP_VIRT2_MBOX_7 0x00013058
194+#define CS35L41_DSP_VIRT2_MBOX_8 0x0001305C
195+#define CS35L41_CLOCK_DETECT_1 0x00014000
196+#define CS35L41_TIMER1_CONTROL 0x00015000
197+#define CS35L41_TIMER1_COUNT_PRESET 0x00015004
198+#define CS35L41_TIMER1_START_STOP 0x0001500C
199+#define CS35L41_TIMER1_STATUS 0x00015010
200+#define CS35L41_TIMER1_COUNT_READBACK 0x00015014
201+#define CS35L41_TIMER1_DSP_CLK_CFG 0x00015018
202+#define CS35L41_TIMER1_DSP_CLK_STATUS 0x0001501C
203+#define CS35L41_TIMER2_CONTROL 0x00015100
204+#define CS35L41_TIMER2_COUNT_PRESET 0x00015104
205+#define CS35L41_TIMER2_START_STOP 0x0001510C
206+#define CS35L41_TIMER2_STATUS 0x00015110
207+#define CS35L41_TIMER2_COUNT_READBACK 0x00015114
208+#define CS35L41_TIMER2_DSP_CLK_CFG 0x00015118
209+#define CS35L41_TIMER2_DSP_CLK_STATUS 0x0001511C
210+#define CS35L41_DFT_JTAG_CONTROL 0x00016000
211+#define CS35L41_DIE_STS1 0x00017040
212+#define CS35L41_DIE_STS2 0x00017044
213+#define CS35L41_TEMP_CAL1 0x00017048
214+#define CS35L41_TEMP_CAL2 0x0001704C
215+#define CS35L41_DSP1_XMEM_PACK_0 0x02000000
216+#define CS35L41_DSP1_XMEM_PACK_3068 0x02002FF0
217+#define CS35L41_DSP1_XMEM_UNPACK32_0 0x02400000
218+#define CS35L41_DSP1_XMEM_UNPACK32_2046 0x02401FF8
219+#define CS35L41_DSP1_TIMESTAMP_COUNT 0x025C0800
220+#define CS35L41_DSP1_SYS_ID 0x025E0000
221+#define CS35L41_DSP1_SYS_VERSION 0x025E0004
222+#define CS35L41_DSP1_SYS_CORE_ID 0x025E0008
223+#define CS35L41_DSP1_SYS_AHB_ADDR 0x025E000C
224+#define CS35L41_DSP1_SYS_XSRAM_SIZE 0x025E0010
225+#define CS35L41_DSP1_SYS_YSRAM_SIZE 0x025E0018
226+#define CS35L41_DSP1_SYS_PSRAM_SIZE 0x025E0020
227+#define CS35L41_DSP1_SYS_PM_BOOT_SIZE 0x025E0028
228+#define CS35L41_DSP1_SYS_FEATURES 0x025E002C
229+#define CS35L41_DSP1_SYS_FIR_FILTERS 0x025E0030
230+#define CS35L41_DSP1_SYS_LMS_FILTERS 0x025E0034
231+#define CS35L41_DSP1_SYS_XM_BANK_SIZE 0x025E0038
232+#define CS35L41_DSP1_SYS_YM_BANK_SIZE 0x025E003C
233+#define CS35L41_DSP1_SYS_PM_BANK_SIZE 0x025E0040
234+#define CS35L41_DSP1_AHBM_WIN0_CTRL0 0x025E2000
235+#define CS35L41_DSP1_AHBM_WIN0_CTRL1 0x025E2004
236+#define CS35L41_DSP1_AHBM_WIN1_CTRL0 0x025E2008
237+#define CS35L41_DSP1_AHBM_WIN1_CTRL1 0x025E200C
238+#define CS35L41_DSP1_AHBM_WIN2_CTRL0 0x025E2010
239+#define CS35L41_DSP1_AHBM_WIN2_CTRL1 0x025E2014
240+#define CS35L41_DSP1_AHBM_WIN3_CTRL0 0x025E2018
241+#define CS35L41_DSP1_AHBM_WIN3_CTRL1 0x025E201C
242+#define CS35L41_DSP1_AHBM_WIN4_CTRL0 0x025E2020
243+#define CS35L41_DSP1_AHBM_WIN4_CTRL1 0x025E2024
244+#define CS35L41_DSP1_AHBM_WIN5_CTRL0 0x025E2028
245+#define CS35L41_DSP1_AHBM_WIN5_CTRL1 0x025E202C
246+#define CS35L41_DSP1_AHBM_WIN6_CTRL0 0x025E2030
247+#define CS35L41_DSP1_AHBM_WIN6_CTRL1 0x025E2034
248+#define CS35L41_DSP1_AHBM_WIN7_CTRL0 0x025E2038
249+#define CS35L41_DSP1_AHBM_WIN7_CTRL1 0x025E203C
250+#define CS35L41_DSP1_AHBM_WIN_DBG_CTRL0 0x025E2040
251+#define CS35L41_DSP1_AHBM_WIN_DBG_CTRL1 0x025E2044
252+#define CS35L41_DSP1_XMEM_UNPACK24_0 0x02800000
253+#define CS35L41_DSP1_XMEM_UNPACK24_4093 0x02803FF4
254+#define CS35L41_DSP1_CTRL_BASE 0x02B80000
255+#define CS35L41_DSP1_CORE_SOFT_RESET 0x02B80010
256+#define CS35L41_DSP1_DEBUG 0x02B80040
257+#define CS35L41_DSP1_TIMER_CTRL 0x02B80048
258+#define CS35L41_DSP1_STREAM_ARB_CTRL 0x02B80050
259+#define CS35L41_DSP1_RX1_RATE 0x02B80080
260+#define CS35L41_DSP1_RX2_RATE 0x02B80088
261+#define CS35L41_DSP1_RX3_RATE 0x02B80090
262+#define CS35L41_DSP1_RX4_RATE 0x02B80098
263+#define CS35L41_DSP1_RX5_RATE 0x02B800A0
264+#define CS35L41_DSP1_RX6_RATE 0x02B800A8
265+#define CS35L41_DSP1_RX7_RATE 0x02B800B0
266+#define CS35L41_DSP1_RX8_RATE 0x02B800B8
267+#define CS35L41_DSP1_TX1_RATE 0x02B80280
268+#define CS35L41_DSP1_TX2_RATE 0x02B80288
269+#define CS35L41_DSP1_TX3_RATE 0x02B80290
270+#define CS35L41_DSP1_TX4_RATE 0x02B80298
271+#define CS35L41_DSP1_TX5_RATE 0x02B802A0
272+#define CS35L41_DSP1_TX6_RATE 0x02B802A8
273+#define CS35L41_DSP1_TX7_RATE 0x02B802B0
274+#define CS35L41_DSP1_TX8_RATE 0x02B802B8
275+#define CS35L41_DSP1_NMI_CTRL1 0x02B80480
276+#define CS35L41_DSP1_NMI_CTRL2 0x02B80488
277+#define CS35L41_DSP1_NMI_CTRL3 0x02B80490
278+#define CS35L41_DSP1_NMI_CTRL4 0x02B80498
279+#define CS35L41_DSP1_NMI_CTRL5 0x02B804A0
280+#define CS35L41_DSP1_NMI_CTRL6 0x02B804A8
281+#define CS35L41_DSP1_NMI_CTRL7 0x02B804B0
282+#define CS35L41_DSP1_NMI_CTRL8 0x02B804B8
283+#define CS35L41_DSP1_RESUME_CTRL 0x02B80500
284+#define CS35L41_DSP1_IRQ1_CTRL 0x02B80508
285+#define CS35L41_DSP1_IRQ2_CTRL 0x02B80510
286+#define CS35L41_DSP1_IRQ3_CTRL 0x02B80518
287+#define CS35L41_DSP1_IRQ4_CTRL 0x02B80520
288+#define CS35L41_DSP1_IRQ5_CTRL 0x02B80528
289+#define CS35L41_DSP1_IRQ6_CTRL 0x02B80530
290+#define CS35L41_DSP1_IRQ7_CTRL 0x02B80538
291+#define CS35L41_DSP1_IRQ8_CTRL 0x02B80540
292+#define CS35L41_DSP1_IRQ9_CTRL 0x02B80548
293+#define CS35L41_DSP1_IRQ10_CTRL 0x02B80550
294+#define CS35L41_DSP1_IRQ11_CTRL 0x02B80558
295+#define CS35L41_DSP1_IRQ12_CTRL 0x02B80560
296+#define CS35L41_DSP1_IRQ13_CTRL 0x02B80568
297+#define CS35L41_DSP1_IRQ14_CTRL 0x02B80570
298+#define CS35L41_DSP1_IRQ15_CTRL 0x02B80578
299+#define CS35L41_DSP1_IRQ16_CTRL 0x02B80580
300+#define CS35L41_DSP1_IRQ17_CTRL 0x02B80588
301+#define CS35L41_DSP1_IRQ18_CTRL 0x02B80590
302+#define CS35L41_DSP1_IRQ19_CTRL 0x02B80598
303+#define CS35L41_DSP1_IRQ20_CTRL 0x02B805A0
304+#define CS35L41_DSP1_IRQ21_CTRL 0x02B805A8
305+#define CS35L41_DSP1_IRQ22_CTRL 0x02B805B0
306+#define CS35L41_DSP1_IRQ23_CTRL 0x02B805B8
307+#define CS35L41_DSP1_SCRATCH1 0x02B805C0
308+#define CS35L41_DSP1_SCRATCH2 0x02B805C8
309+#define CS35L41_DSP1_SCRATCH3 0x02B805D0
310+#define CS35L41_DSP1_SCRATCH4 0x02B805D8
311+#define CS35L41_DSP1_CCM_CORE_CTRL 0x02BC1000
312+#define CS35L41_DSP1_CCM_CLK_OVERRIDE 0x02BC1008
313+#define CS35L41_DSP1_XM_MSTR_EN 0x02BC2000
314+#define CS35L41_DSP1_XM_CORE_PRI 0x02BC2008
315+#define CS35L41_DSP1_XM_AHB_PACK_PL_PRI 0x02BC2010
316+#define CS35L41_DSP1_XM_AHB_UP_PL_PRI 0x02BC2018
317+#define CS35L41_DSP1_XM_ACCEL_PL0_PRI 0x02BC2020
318+#define CS35L41_DSP1_XM_NPL0_PRI 0x02BC2078
319+#define CS35L41_DSP1_YM_MSTR_EN 0x02BC20C0
320+#define CS35L41_DSP1_YM_CORE_PRI 0x02BC20C8
321+#define CS35L41_DSP1_YM_AHB_PACK_PL_PRI 0x02BC20D0
322+#define CS35L41_DSP1_YM_AHB_UP_PL_PRI 0x02BC20D8
323+#define CS35L41_DSP1_YM_ACCEL_PL0_PRI 0x02BC20E0
324+#define CS35L41_DSP1_YM_NPL0_PRI 0x02BC2138
325+#define CS35L41_DSP1_PM_MSTR_EN 0x02BC2180
326+#define CS35L41_DSP1_PM_PATCH0_ADDR 0x02BC2188
327+#define CS35L41_DSP1_PM_PATCH0_EN 0x02BC218C
328+#define CS35L41_DSP1_PM_PATCH0_DATA_LO 0x02BC2190
329+#define CS35L41_DSP1_PM_PATCH0_DATA_HI 0x02BC2194
330+#define CS35L41_DSP1_PM_PATCH1_ADDR 0x02BC2198
331+#define CS35L41_DSP1_PM_PATCH1_EN 0x02BC219C
332+#define CS35L41_DSP1_PM_PATCH1_DATA_LO 0x02BC21A0
333+#define CS35L41_DSP1_PM_PATCH1_DATA_HI 0x02BC21A4
334+#define CS35L41_DSP1_PM_PATCH2_ADDR 0x02BC21A8
335+#define CS35L41_DSP1_PM_PATCH2_EN 0x02BC21AC
336+#define CS35L41_DSP1_PM_PATCH2_DATA_LO 0x02BC21B0
337+#define CS35L41_DSP1_PM_PATCH2_DATA_HI 0x02BC21B4
338+#define CS35L41_DSP1_PM_PATCH3_ADDR 0x02BC21B8
339+#define CS35L41_DSP1_PM_PATCH3_EN 0x02BC21BC
340+#define CS35L41_DSP1_PM_PATCH3_DATA_LO 0x02BC21C0
341+#define CS35L41_DSP1_PM_PATCH3_DATA_HI 0x02BC21C4
342+#define CS35L41_DSP1_PM_PATCH4_ADDR 0x02BC21C8
343+#define CS35L41_DSP1_PM_PATCH4_EN 0x02BC21CC
344+#define CS35L41_DSP1_PM_PATCH4_DATA_LO 0x02BC21D0
345+#define CS35L41_DSP1_PM_PATCH4_DATA_HI 0x02BC21D4
346+#define CS35L41_DSP1_PM_PATCH5_ADDR 0x02BC21D8
347+#define CS35L41_DSP1_PM_PATCH5_EN 0x02BC21DC
348+#define CS35L41_DSP1_PM_PATCH5_DATA_LO 0x02BC21E0
349+#define CS35L41_DSP1_PM_PATCH5_DATA_HI 0x02BC21E4
350+#define CS35L41_DSP1_PM_PATCH6_ADDR 0x02BC21E8
351+#define CS35L41_DSP1_PM_PATCH6_EN 0x02BC21EC
352+#define CS35L41_DSP1_PM_PATCH6_DATA_LO 0x02BC21F0
353+#define CS35L41_DSP1_PM_PATCH6_DATA_HI 0x02BC21F4
354+#define CS35L41_DSP1_PM_PATCH7_ADDR 0x02BC21F8
355+#define CS35L41_DSP1_PM_PATCH7_EN 0x02BC21FC
356+#define CS35L41_DSP1_PM_PATCH7_DATA_LO 0x02BC2200
357+#define CS35L41_DSP1_PM_PATCH7_DATA_HI 0x02BC2204
358+#define CS35L41_DSP1_MPU_XM_ACCESS0 0x02BC3000
359+#define CS35L41_DSP1_MPU_YM_ACCESS0 0x02BC3004
360+#define CS35L41_DSP1_MPU_WNDW_ACCESS0 0x02BC3008
361+#define CS35L41_DSP1_MPU_XREG_ACCESS0 0x02BC300C
362+#define CS35L41_DSP1_MPU_YREG_ACCESS0 0x02BC3014
363+#define CS35L41_DSP1_MPU_XM_ACCESS1 0x02BC3018
364+#define CS35L41_DSP1_MPU_YM_ACCESS1 0x02BC301C
365+#define CS35L41_DSP1_MPU_WNDW_ACCESS1 0x02BC3020
366+#define CS35L41_DSP1_MPU_XREG_ACCESS1 0x02BC3024
367+#define CS35L41_DSP1_MPU_YREG_ACCESS1 0x02BC302C
368+#define CS35L41_DSP1_MPU_XM_ACCESS2 0x02BC3030
369+#define CS35L41_DSP1_MPU_YM_ACCESS2 0x02BC3034
370+#define CS35L41_DSP1_MPU_WNDW_ACCESS2 0x02BC3038
371+#define CS35L41_DSP1_MPU_XREG_ACCESS2 0x02BC303C
372+#define CS35L41_DSP1_MPU_YREG_ACCESS2 0x02BC3044
373+#define CS35L41_DSP1_MPU_XM_ACCESS3 0x02BC3048
374+#define CS35L41_DSP1_MPU_YM_ACCESS3 0x02BC304C
375+#define CS35L41_DSP1_MPU_WNDW_ACCESS3 0x02BC3050
376+#define CS35L41_DSP1_MPU_XREG_ACCESS3 0x02BC3054
377+#define CS35L41_DSP1_MPU_YREG_ACCESS3 0x02BC305C
378+#define CS35L41_DSP1_MPU_XM_VIO_ADDR 0x02BC3100
379+#define CS35L41_DSP1_MPU_XM_VIO_STATUS 0x02BC3104
380+#define CS35L41_DSP1_MPU_YM_VIO_ADDR 0x02BC3108
381+#define CS35L41_DSP1_MPU_YM_VIO_STATUS 0x02BC310C
382+#define CS35L41_DSP1_MPU_PM_VIO_ADDR 0x02BC3110
383+#define CS35L41_DSP1_MPU_PM_VIO_STATUS 0x02BC3114
384+#define CS35L41_DSP1_MPU_LOCK_CONFIG 0x02BC3140
385+#define CS35L41_DSP1_MPU_WDT_RST_CTRL 0x02BC3180
386+#define CS35L41_DSP1_STRMARB_MSTR0_CFG0 0x02BC5000
387+#define CS35L41_DSP1_STRMARB_MSTR0_CFG1 0x02BC5004
388+#define CS35L41_DSP1_STRMARB_MSTR0_CFG2 0x02BC5008
389+#define CS35L41_DSP1_STRMARB_MSTR1_CFG0 0x02BC5010
390+#define CS35L41_DSP1_STRMARB_MSTR1_CFG1 0x02BC5014
391+#define CS35L41_DSP1_STRMARB_MSTR1_CFG2 0x02BC5018
392+#define CS35L41_DSP1_STRMARB_MSTR2_CFG0 0x02BC5020
393+#define CS35L41_DSP1_STRMARB_MSTR2_CFG1 0x02BC5024
394+#define CS35L41_DSP1_STRMARB_MSTR2_CFG2 0x02BC5028
395+#define CS35L41_DSP1_STRMARB_MSTR3_CFG0 0x02BC5030
396+#define CS35L41_DSP1_STRMARB_MSTR3_CFG1 0x02BC5034
397+#define CS35L41_DSP1_STRMARB_MSTR3_CFG2 0x02BC5038
398+#define CS35L41_DSP1_STRMARB_MSTR4_CFG0 0x02BC5040
399+#define CS35L41_DSP1_STRMARB_MSTR4_CFG1 0x02BC5044
400+#define CS35L41_DSP1_STRMARB_MSTR4_CFG2 0x02BC5048
401+#define CS35L41_DSP1_STRMARB_MSTR5_CFG0 0x02BC5050
402+#define CS35L41_DSP1_STRMARB_MSTR5_CFG1 0x02BC5054
403+#define CS35L41_DSP1_STRMARB_MSTR5_CFG2 0x02BC5058
404+#define CS35L41_DSP1_STRMARB_MSTR6_CFG0 0x02BC5060
405+#define CS35L41_DSP1_STRMARB_MSTR6_CFG1 0x02BC5064
406+#define CS35L41_DSP1_STRMARB_MSTR6_CFG2 0x02BC5068
407+#define CS35L41_DSP1_STRMARB_MSTR7_CFG0 0x02BC5070
408+#define CS35L41_DSP1_STRMARB_MSTR7_CFG1 0x02BC5074
409+#define CS35L41_DSP1_STRMARB_MSTR7_CFG2 0x02BC5078
410+#define CS35L41_DSP1_STRMARB_TX0_CFG0 0x02BC5200
411+#define CS35L41_DSP1_STRMARB_TX0_CFG1 0x02BC5204
412+#define CS35L41_DSP1_STRMARB_TX1_CFG0 0x02BC5208
413+#define CS35L41_DSP1_STRMARB_TX1_CFG1 0x02BC520C
414+#define CS35L41_DSP1_STRMARB_TX2_CFG0 0x02BC5210
415+#define CS35L41_DSP1_STRMARB_TX2_CFG1 0x02BC5214
416+#define CS35L41_DSP1_STRMARB_TX3_CFG0 0x02BC5218
417+#define CS35L41_DSP1_STRMARB_TX3_CFG1 0x02BC521C
418+#define CS35L41_DSP1_STRMARB_TX4_CFG0 0x02BC5220
419+#define CS35L41_DSP1_STRMARB_TX4_CFG1 0x02BC5224
420+#define CS35L41_DSP1_STRMARB_TX5_CFG0 0x02BC5228
421+#define CS35L41_DSP1_STRMARB_TX5_CFG1 0x02BC522C
422+#define CS35L41_DSP1_STRMARB_TX6_CFG0 0x02BC5230
423+#define CS35L41_DSP1_STRMARB_TX6_CFG1 0x02BC5234
424+#define CS35L41_DSP1_STRMARB_TX7_CFG0 0x02BC5238
425+#define CS35L41_DSP1_STRMARB_TX7_CFG1 0x02BC523C
426+#define CS35L41_DSP1_STRMARB_RX0_CFG0 0x02BC5400
427+#define CS35L41_DSP1_STRMARB_RX0_CFG1 0x02BC5404
428+#define CS35L41_DSP1_STRMARB_RX1_CFG0 0x02BC5408
429+#define CS35L41_DSP1_STRMARB_RX1_CFG1 0x02BC540C
430+#define CS35L41_DSP1_STRMARB_RX2_CFG0 0x02BC5410
431+#define CS35L41_DSP1_STRMARB_RX2_CFG1 0x02BC5414
432+#define CS35L41_DSP1_STRMARB_RX3_CFG0 0x02BC5418
433+#define CS35L41_DSP1_STRMARB_RX3_CFG1 0x02BC541C
434+#define CS35L41_DSP1_STRMARB_RX4_CFG0 0x02BC5420
435+#define CS35L41_DSP1_STRMARB_RX4_CFG1 0x02BC5424
436+#define CS35L41_DSP1_STRMARB_RX5_CFG0 0x02BC5428
437+#define CS35L41_DSP1_STRMARB_RX5_CFG1 0x02BC542C
438+#define CS35L41_DSP1_STRMARB_RX6_CFG0 0x02BC5430
439+#define CS35L41_DSP1_STRMARB_RX6_CFG1 0x02BC5434
440+#define CS35L41_DSP1_STRMARB_RX7_CFG0 0x02BC5438
441+#define CS35L41_DSP1_STRMARB_RX7_CFG1 0x02BC543C
442+#define CS35L41_DSP1_STRMARB_IRQ0_CFG0 0x02BC5600
443+#define CS35L41_DSP1_STRMARB_IRQ0_CFG1 0x02BC5604
444+#define CS35L41_DSP1_STRMARB_IRQ0_CFG2 0x02BC5608
445+#define CS35L41_DSP1_STRMARB_IRQ1_CFG0 0x02BC5610
446+#define CS35L41_DSP1_STRMARB_IRQ1_CFG1 0x02BC5614
447+#define CS35L41_DSP1_STRMARB_IRQ1_CFG2 0x02BC5618
448+#define CS35L41_DSP1_STRMARB_IRQ2_CFG0 0x02BC5620
449+#define CS35L41_DSP1_STRMARB_IRQ2_CFG1 0x02BC5624
450+#define CS35L41_DSP1_STRMARB_IRQ2_CFG2 0x02BC5628
451+#define CS35L41_DSP1_STRMARB_IRQ3_CFG0 0x02BC5630
452+#define CS35L41_DSP1_STRMARB_IRQ3_CFG1 0x02BC5634
453+#define CS35L41_DSP1_STRMARB_IRQ3_CFG2 0x02BC5638
454+#define CS35L41_DSP1_STRMARB_IRQ4_CFG0 0x02BC5640
455+#define CS35L41_DSP1_STRMARB_IRQ4_CFG1 0x02BC5644
456+#define CS35L41_DSP1_STRMARB_IRQ4_CFG2 0x02BC5648
457+#define CS35L41_DSP1_STRMARB_IRQ5_CFG0 0x02BC5650
458+#define CS35L41_DSP1_STRMARB_IRQ5_CFG1 0x02BC5654
459+#define CS35L41_DSP1_STRMARB_IRQ5_CFG2 0x02BC5658
460+#define CS35L41_DSP1_STRMARB_IRQ6_CFG0 0x02BC5660
461+#define CS35L41_DSP1_STRMARB_IRQ6_CFG1 0x02BC5664
462+#define CS35L41_DSP1_STRMARB_IRQ6_CFG2 0x02BC5668
463+#define CS35L41_DSP1_STRMARB_IRQ7_CFG0 0x02BC5670
464+#define CS35L41_DSP1_STRMARB_IRQ7_CFG1 0x02BC5674
465+#define CS35L41_DSP1_STRMARB_IRQ7_CFG2 0x02BC5678
466+#define CS35L41_DSP1_STRMARB_RESYNC_MSK 0x02BC5A00
467+#define CS35L41_DSP1_STRMARB_ERR_STATUS 0x02BC5A08
468+#define CS35L41_DSP1_INTPCTL_RES_STATIC 0x02BC6000
469+#define CS35L41_DSP1_INTPCTL_RES_DYN 0x02BC6004
470+#define CS35L41_DSP1_INTPCTL_NMI_CTRL 0x02BC6008
471+#define CS35L41_DSP1_INTPCTL_IRQ_INV 0x02BC6010
472+#define CS35L41_DSP1_INTPCTL_IRQ_MODE 0x02BC6014
473+#define CS35L41_DSP1_INTPCTL_IRQ_EN 0x02BC6018
474+#define CS35L41_DSP1_INTPCTL_IRQ_MSK 0x02BC601C
475+#define CS35L41_DSP1_INTPCTL_IRQ_FLUSH 0x02BC6020
476+#define CS35L41_DSP1_INTPCTL_IRQ_MSKCLR 0x02BC6024
477+#define CS35L41_DSP1_INTPCTL_IRQ_FRC 0x02BC6028
478+#define CS35L41_DSP1_INTPCTL_IRQ_MSKSET 0x02BC602C
479+#define CS35L41_DSP1_INTPCTL_IRQ_ERR 0x02BC6030
480+#define CS35L41_DSP1_INTPCTL_IRQ_PEND 0x02BC6034
481+#define CS35L41_DSP1_INTPCTL_IRQ_GEN 0x02BC6038
482+#define CS35L41_DSP1_INTPCTL_TESTBITS 0x02BC6040
483+#define CS35L41_DSP1_WDT_CONTROL 0x02BC7000
484+#define CS35L41_DSP1_WDT_STATUS 0x02BC7008
485+#define CS35L41_DSP1_YMEM_PACK_0 0x02C00000
486+#define CS35L41_DSP1_YMEM_PACK_1532 0x02C017F0
487+#define CS35L41_DSP1_YMEM_UNPACK32_0 0x03000000
488+#define CS35L41_DSP1_YMEM_UNPACK32_1022 0x03000FF8
489+#define CS35L41_DSP1_YMEM_UNPACK24_0 0x03400000
490+#define CS35L41_DSP1_YMEM_UNPACK24_2045 0x03401FF4
491+#define CS35L41_DSP1_PMEM_0 0x03800000
492+#define CS35L41_DSP1_PMEM_5114 0x03804FE8
493+
494+/*test regs for emulation bringup*/
495+#define CS35L41_PLL_OVR 0x00003018
496+#define CS35L41_BST_TEST_DUTY 0x00003900
497+#define CS35L41_DIGPWM_IOCTRL 0x0000706C
498+
499+/*registers populated by OTP*/
500+#define CS35L41_OTP_TRIM_1 0x0000208c
501+#define CS35L41_OTP_TRIM_2 0x00002090
502+#define CS35L41_OTP_TRIM_3 0x00003010
503+#define CS35L41_OTP_TRIM_4 0x0000300C
504+#define CS35L41_OTP_TRIM_5 0x0000394C
505+#define CS35L41_OTP_TRIM_6 0x00003950
506+#define CS35L41_OTP_TRIM_7 0x00003954
507+#define CS35L41_OTP_TRIM_8 0x00003958
508+#define CS35L41_OTP_TRIM_9 0x0000395C
509+#define CS35L41_OTP_TRIM_10 0x0000416C
510+#define CS35L41_OTP_TRIM_11 0x00004160
511+#define CS35L41_OTP_TRIM_12 0x00004170
512+#define CS35L41_OTP_TRIM_13 0x00004360
513+#define CS35L41_OTP_TRIM_14 0x00004448
514+#define CS35L41_OTP_TRIM_15 0x0000444C
515+#define CS35L41_OTP_TRIM_16 0x00006E30
516+#define CS35L41_OTP_TRIM_17 0x00006E34
517+#define CS35L41_OTP_TRIM_18 0x00006E38
518+#define CS35L41_OTP_TRIM_19 0x00006E3C
519+#define CS35L41_OTP_TRIM_20 0x00006E40
520+#define CS35L41_OTP_TRIM_21 0x00006E44
521+#define CS35L41_OTP_TRIM_22 0x00006E48
522+#define CS35L41_OTP_TRIM_23 0x00006E4C
523+#define CS35L41_OTP_TRIM_24 0x00006E50
524+#define CS35L41_OTP_TRIM_25 0x00006E54
525+#define CS35L41_OTP_TRIM_26 0x00006E58
526+#define CS35L41_OTP_TRIM_27 0x00006E5C
527+#define CS35L41_OTP_TRIM_28 0x00006E60
528+#define CS35L41_OTP_TRIM_29 0x00006E64
529+#define CS35L41_OTP_TRIM_30 0x00007418
530+#define CS35L41_OTP_TRIM_31 0x0000741C
531+#define CS35L41_OTP_TRIM_32 0x00007434
532+#define CS35L41_OTP_TRIM_33 0x00007068
533+#define CS35L41_OTP_TRIM_34 0x0000410C
534+#define CS35L41_OTP_TRIM_35 0x0000400C
535+#define CS35L41_OTP_TRIM_36 0x00002030
536+
537+#define CS35L41_MAX_CACHE_REG 36
538+#define CS35L41_OTP_SIZE_WORDS 32
539+#define CS35L41_NUM_OTP_ELEM 100
540+
541+#define CS35L41_VALID_PDATA 0x80000000
542+#define CS35L41_NUM_SUPPLIES 2
543+
544+#define CS35L41_SCLK_MSTR_MASK 0x10
545+#define CS35L41_SCLK_MSTR_SHIFT 4
546+#define CS35L41_LRCLK_MSTR_MASK 0x01
547+#define CS35L41_LRCLK_MSTR_SHIFT 0
548+#define CS35L41_SCLK_INV_MASK 0x40
549+#define CS35L41_SCLK_INV_SHIFT 6
550+#define CS35L41_LRCLK_INV_MASK 0x04
551+#define CS35L41_LRCLK_INV_SHIFT 2
552+#define CS35L41_SCLK_FRC_MASK 0x20
553+#define CS35L41_SCLK_FRC_SHIFT 5
554+#define CS35L41_LRCLK_FRC_MASK 0x02
555+#define CS35L41_LRCLK_FRC_SHIFT 1
556+
557+#define CS35L41_AMP_GAIN_PCM_MASK 0x3E0
558+#define CS35L41_AMP_GAIN_ZC_MASK 0x0400
559+#define CS35L41_AMP_GAIN_ZC_SHIFT 10
560+
561+#define CS35L41_BST_CTL_MASK 0xFF
562+#define CS35L41_BST_CTL_SEL_MASK 0x03
563+#define CS35L41_BST_CTL_SEL_REG 0x00
564+#define CS35L41_BST_CTL_SEL_CLASSH 0x01
565+#define CS35L41_BST_IPK_MASK 0x7F
566+#define CS35L41_BST_IPK_SHIFT 0
567+#define CS35L41_BST_LIM_MASK 0x4
568+#define CS35L41_BST_LIM_SHIFT 2
569+#define CS35L41_BST_K1_MASK 0x000000FF
570+#define CS35L41_BST_K1_SHIFT 0
571+#define CS35L41_BST_K2_MASK 0x0000FF00
572+#define CS35L41_BST_K2_SHIFT 8
573+#define CS35L41_BST_SLOPE_MASK 0x0000FF00
574+#define CS35L41_BST_SLOPE_SHIFT 8
575+#define CS35L41_BST_LBST_VAL_MASK 0x00000003
576+#define CS35L41_BST_LBST_VAL_SHIFT 0
577+
578+#define CS35L41_TEMP_THLD_MASK 0x03
579+#define CS35L41_VMON_IMON_VOL_MASK 0x07FF07FF
580+#define CS35L41_PDM_MODE_MASK 0x01
581+#define CS35L41_PDM_MODE_SHIFT 0
582+
583+#define CS35L41_CH_MEM_DEPTH_MASK 0x07
584+#define CS35L41_CH_MEM_DEPTH_SHIFT 0
585+#define CS35L41_CH_HDRM_CTL_MASK 0x007F0000
586+#define CS35L41_CH_HDRM_CTL_SHIFT 16
587+#define CS35L41_CH_REL_RATE_MASK 0xFF00
588+#define CS35L41_CH_REL_RATE_SHIFT 8
589+#define CS35L41_CH_WKFET_DLY_MASK 0x001C
590+#define CS35L41_CH_WKFET_DLY_SHIFT 2
591+#define CS35L41_CH_WKFET_THLD_MASK 0x0F00
592+#define CS35L41_CH_WKFET_THLD_SHIFT 8
593+
594+#define CS35L41_HW_NG_SEL_MASK 0x3F00
595+#define CS35L41_HW_NG_SEL_SHIFT 8
596+#define CS35L41_HW_NG_DLY_MASK 0x0070
597+#define CS35L41_HW_NG_DLY_SHIFT 4
598+#define CS35L41_HW_NG_THLD_MASK 0x0007
599+#define CS35L41_HW_NG_THLD_SHIFT 0
600+
601+#define CS35L41_DSP_NG_ENABLE_MASK 0x00010000
602+#define CS35L41_DSP_NG_ENABLE_SHIFT 16
603+#define CS35L41_DSP_NG_THLD_MASK 0x7
604+#define CS35L41_DSP_NG_THLD_SHIFT 0
605+#define CS35L41_DSP_NG_DELAY_MASK 0x0F00
606+#define CS35L41_DSP_NG_DELAY_SHIFT 8
607+
608+#define CS35L41_ASP_FMT_MASK 0x0700
609+#define CS35L41_ASP_FMT_SHIFT 8
610+#define CS35L41_ASP_DOUT_HIZ_MASK 0x03
611+#define CS35L41_ASP_DOUT_HIZ_SHIFT 0
612+#define CS35L41_ASP_WIDTH_16 0x10
613+#define CS35L41_ASP_WIDTH_24 0x18
614+#define CS35L41_ASP_WIDTH_32 0x20
615+#define CS35L41_ASP_WIDTH_TX_MASK 0xFF0000
616+#define CS35L41_ASP_WIDTH_TX_SHIFT 16
617+#define CS35L41_ASP_WIDTH_RX_MASK 0xFF000000
618+#define CS35L41_ASP_WIDTH_RX_SHIFT 24
619+#define CS35L41_ASP_RX1_SLOT_MASK 0x3F
620+#define CS35L41_ASP_RX1_SLOT_SHIFT 0
621+#define CS35L41_ASP_RX2_SLOT_MASK 0x3F00
622+#define CS35L41_ASP_RX2_SLOT_SHIFT 8
623+#define CS35L41_ASP_RX_WL_MASK 0x3F
624+#define CS35L41_ASP_TX_WL_MASK 0x3F
625+#define CS35L41_ASP_RX_WL_SHIFT 0
626+#define CS35L41_ASP_TX_WL_SHIFT 0
627+#define CS35L41_ASP_SOURCE_MASK 0x7F
628+
629+#define CS35L41_INPUT_SRC_ASPRX1 0x08
630+#define CS35L41_INPUT_SRC_ASPRX2 0x09
631+#define CS35L41_INPUT_SRC_VMON 0x18
632+#define CS35L41_INPUT_SRC_IMON 0x19
633+#define CS35L41_INPUT_SRC_CLASSH 0x21
634+#define CS35L41_INPUT_SRC_VPMON 0x28
635+#define CS35L41_INPUT_SRC_VBSTMON 0x29
636+#define CS35L41_INPUT_SRC_TEMPMON 0x3A
637+#define CS35L41_INPUT_SRC_RSVD 0x3B
638+#define CS35L41_INPUT_DSP_TX1 0x32
639+#define CS35L41_INPUT_DSP_TX2 0x33
640+
641+#define CS35L41_WR_PEND_STS_MASK 0x2
642+
643+#define CS35L41_PLL_CLK_SEL_MASK 0x07
644+#define CS35L41_PLL_CLK_SEL_SHIFT 0
645+#define CS35L41_PLL_CLK_EN_MASK 0x10
646+#define CS35L41_PLL_CLK_EN_SHIFT 4
647+#define CS35L41_PLL_OPENLOOP_MASK 0x0800
648+#define CS35L41_PLL_OPENLOOP_SHIFT 11
649+#define CS35L41_PLLSRC_SCLK 0
650+#define CS35L41_PLLSRC_LRCLK 1
651+#define CS35L41_PLLSRC_SELF 3
652+#define CS35L41_PLLSRC_PDMCLK 4
653+#define CS35L41_PLLSRC_MCLK 5
654+#define CS35L41_PLLSRC_SWIRE 7
655+#define CS35L41_REFCLK_FREQ_MASK 0x7E0
656+#define CS35L41_REFCLK_FREQ_SHIFT 5
657+
658+#define CS35L41_GLOBAL_FS_MASK 0x1F
659+#define CS35L41_GLOBAL_FS_SHIFT 0
660+
661+#define CS35L41_GLOBAL_EN_MASK 0x01
662+#define CS35L41_GLOBAL_EN_SHIFT 0
663+#define CS35L41_BST_EN_MASK 0x0030
664+#define CS35L41_BST_EN_SHIFT 4
665+#define CS35L41_BST_EN_DEFAULT 0x2
666+#define CS35L41_AMP_EN_SHIFT 0
667+#define CS35L41_AMP_EN_MASK 1
668+
669+#define CS35L41_PDN_DONE_MASK 0x00800000
670+#define CS35L41_PDN_DONE_SHIFT 23
671+#define CS35L41_PUP_DONE_MASK 0x01000000
672+#define CS35L41_PUP_DONE_SHIFT 24
673+
674+#define CS35L36_PUP_DONE_IRQ_UNMASK 0x5F
675+#define CS35L36_PUP_DONE_IRQ_MASK 0xBF
676+
677+#define CS35L41_AMP_SHORT_ERR 0x80000000
678+#define CS35L41_BST_SHORT_ERR 0x0100
679+#define CS35L41_TEMP_WARN 0x8000
680+#define CS35L41_TEMP_ERR 0x00020000
681+#define CS35L41_BST_OVP_ERR 0x40
682+#define CS35L41_BST_DCM_UVP_ERR 0x80
683+#define CS35L41_OTP_BOOT_DONE 0x02
684+#define CS35L41_PLL_UNLOCK 0x10
685+#define CS35L41_OTP_BOOT_ERR 0x80000000
686+
687+#define CS35L41_AMP_SHORT_ERR_RLS 0x02
688+#define CS35L41_BST_SHORT_ERR_RLS 0x04
689+#define CS35L41_BST_OVP_ERR_RLS 0x08
690+#define CS35L41_BST_UVP_ERR_RLS 0x10
691+#define CS35L41_TEMP_WARN_ERR_RLS 0x20
692+#define CS35L41_TEMP_ERR_RLS 0x40
693+
694+#define CS35L41_INT1_MASK_DEFAULT 0x7FFCFE3F
695+#define CS35L41_INT1_UNMASK_PUP 0xFEFFFFFF
696+#define CS35L41_INT1_UNMASK_PDN 0xFF7FFFFF
697+
698+#define CS35L41_GPIO_DIR_MASK 0x80000000
699+#define CS35L41_GPIO_DIR_SHIFT 31
700+#define CS35L41_GPIO1_CTRL_MASK 0x00030000
701+#define CS35L41_GPIO1_CTRL_SHIFT 16
702+#define CS35L41_GPIO2_CTRL_MASK 0x07000000
703+#define CS35L41_GPIO2_CTRL_SHIFT 24
704+#define CS35L41_GPIO_CTRL_OPEN_INT 2
705+#define CS35L41_GPIO_CTRL_ACTV_LO 4
706+#define CS35L41_GPIO_CTRL_ACTV_HI 5
707+#define CS35L41_GPIO_POL_MASK 0x1000
708+#define CS35L41_GPIO_POL_SHIFT 12
709+
710+#define CS35L41_AMP_INV_PCM_SHIFT 14
711+#define CS35L41_AMP_INV_PCM_MASK BIT(CS35L41_AMP_INV_PCM_SHIFT)
712+#define CS35L41_AMP_PCM_VOL_SHIFT 3
713+#define CS35L41_AMP_PCM_VOL_MASK (0x7FF << 3)
714+#define CS35L41_AMP_PCM_VOL_MUTE 0x4CF
715+
716+#define CS35L41_CHIP_ID 0x35a40
717+#define CS35L41R_CHIP_ID 0x35b40
718+#define CS35L41_MTLREVID_MASK 0x0F
719+#define CS35L41_REVID_A0 0xA0
720+#define CS35L41_REVID_B0 0xB0
721+#define CS35L41_REVID_B2 0xB2
722+
723+#define CS35L41_HALO_CORE_RESET 0x00000200
724+
725+#define CS35L41_FS1_WINDOW_MASK 0x000007FF
726+#define CS35L41_FS2_WINDOW_MASK 0x00FFF800
727+#define CS35L41_FS2_WINDOW_SHIFT 12
728+
729+#define CS35L41_SPI_MAX_FREQ 4000000
730+#define CS35L41_REGSTRIDE 4
731+
13732 enum cs35l41_clk_ids {
14733 CS35L41_CLKID_SCLK = 0,
15734 CS35L41_CLKID_LRCLK = 1,
@@ -31,4 +750,31 @@ struct cs35l41_platform_data { · 15 unmodified lines
31750 struct cs35l41_irq_cfg irq_config2;
32751 };
33752
753+struct cs35l41_otp_packed_element_t {
754+ u32 reg;
755+ u8 shift;
756+ u8 size;
757+};
758+
759+struct cs35l41_otp_map_element_t {
760+ u32 id;
761+ u32 num_elements;
762+ const struct cs35l41_otp_packed_element_t *map;
763+ u32 bit_offset;
764+ u32 word_offset;
765+};
766+
767+extern struct regmap_config cs35l41_regmap_i2c;
768+extern struct regmap_config cs35l41_regmap_spi;
769+
770+int cs35l41_test_key_unlock(struct device *dev, struct regmap *regmap);
771+int cs35l41_test_key_lock(struct device *dev, struct regmap *regmap);
772+int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap);
773+int cs35l41_register_errata_patch(struct device *dev, struct regmap *reg, unsigned int reg_revid);
774+int cs35l41_set_channels(struct device *dev, struct regmap *reg,
775+ unsigned int tx_num, unsigned int *tx_slot,
776+ unsigned int rx_num, unsigned int *rx_slot);
777+int cs35l41_boost_config(struct device *dev, struct regmap *regmap, int boost_ind, int boost_cap,
778+ int boost_ipk);
779+
34780 #endif /* __CS35L41_H */
include/sound/dmaengine_pcm.h+0−2
@@ -60,7 +60,6 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) · 59 unmodified lines
6060 * @maxburst: Maximum number of words(note: words, as in units of the
6161 * src_addr_width member, not bytes) that can be send to or received from the
6262 * DAI in one burst.
63− * @slave_id: Slave requester id for the DMA channel.
6463 * @filter_data: Custom DMA channel filter data, this will usually be used when
6564 * requesting the DMA channel.
6665 * @chan_name: Custom channel name to use when requesting DMA channel.
@@ -74,7 +73,6 @@ struct snd_dmaengine_dai_dma_data { · 7 unmodified lines
7473 dma_addr_t addr;
7574 enum dma_slave_buswidth addr_width;
7675 u32 maxburst;
77− unsigned int slave_id;
7876 void *filter_data;
7977 const char *chan_name;
8078 unsigned int fifo_size;
include/sound/hda_codec.h+5−3
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 #ifndef __SOUND_HDA_CODEC_H
99 #define __SOUND_HDA_CODEC_H
1010
11−#include <linux/kref.h>
11+#include <linux/refcount.h>
1212 #include <linux/mod_devicetable.h>
1313 #include <sound/info.h>
1414 #include <sound/control.h>
@@ -166,8 +166,8 @@ struct hda_pcm { · 151 unmodified lines
166166 bool own_chmap; /* codec driver provides own channel maps */
167167 /* private: */
168168 struct hda_codec *codec;
169− struct kref kref;
170169 struct list_head list;
170+ unsigned int disconnected:1;
171171 };
172172
173173 /* codec information */
@@ -187,6 +187,8 @@ struct hda_codec { · 13 unmodified lines
187187
188188 /* PCM to create, set by patch_ops.build_pcms callback */
189189 struct list_head pcm_list_head;
190+ refcount_t pcm_ref;
191+ wait_queue_head_t remove_sleep;
190192
191193 /* codec specific info */
192194 void *spec;
@@ -420,7 +422,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec); · 227 unmodified lines
420422
421423 static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm)
422424 {
423− kref_get(&pcm->kref);
425+ refcount_inc(&pcm->codec->pcm_ref);
424426 }
425427 void snd_hda_codec_pcm_put(struct hda_pcm *pcm);
426428
include/sound/hdaudio.h+1−0
@@ -558,6 +558,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev, · 557 unmodified lines
558558 void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start);
559559 void snd_hdac_stream_clear(struct hdac_stream *azx_dev);
560560 void snd_hdac_stream_stop(struct hdac_stream *azx_dev);
561+void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus);
561562 void snd_hdac_stream_reset(struct hdac_stream *azx_dev);
562563 void snd_hdac_stream_sync_trigger(struct hdac_stream *azx_dev, bool set,
563564 unsigned int streams, unsigned int reg);
include/sound/hdaudio_ext.h+13−14
@@ -78,36 +78,35 @@ struct hdac_ext_stream { · 77 unmodified lines
7878 container_of(s, struct hdac_ext_stream, hstream)
7979
8080 void snd_hdac_ext_stream_init(struct hdac_bus *bus,
81− struct hdac_ext_stream *stream, int idx,
82− int direction, int tag);
81+ struct hdac_ext_stream *hext_stream, int idx,
82+ int direction, int tag);
8383 int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
84− int num_stream, int dir);
84+ int num_stream, int dir);
8585 void snd_hdac_stream_free_all(struct hdac_bus *bus);
8686 void snd_hdac_link_free_all(struct hdac_bus *bus);
8787 struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
8888 struct snd_pcm_substream *substream,
8989 int type);
90−void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
90+void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type);
9191 void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
92− struct hdac_ext_stream *azx_dev, bool decouple);
92+ struct hdac_ext_stream *hext_stream, bool decouple);
9393 void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
9494 struct hdac_ext_stream *azx_dev, bool decouple);
95−void snd_hdac_ext_stop_streams(struct hdac_bus *bus);
9695
9796 int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus,
98− struct hdac_ext_stream *stream, u32 value);
97+ struct hdac_ext_stream *hext_stream, u32 value);
9998 int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus,
100− struct hdac_ext_stream *stream);
99+ struct hdac_ext_stream *hext_stream);
101100 void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
102101 bool enable, int index);
103102 int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus,
104− struct hdac_ext_stream *stream, u32 value);
105−int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value);
103+ struct hdac_ext_stream *hext_stream, u32 value);
104+int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *hext_stream, u32 value);
106105
107−void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hstream);
108−void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hstream);
109−void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *hstream);
110−int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *stream, int fmt);
106+void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hext_stream);
107+void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hext_stream);
108+void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *hext_stream);
109+int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *hext_stream, int fmt);
111110
112111 struct hdac_ext_link {
113112 struct hdac_bus *bus;
include/sound/intel-nhlt.h+29−8
@@ -10,6 +10,14 @@ · 9 unmodified lines
1010
1111 #include <linux/acpi.h>
1212
13+enum nhlt_link_type {
14+ NHLT_LINK_HDA = 0,
15+ NHLT_LINK_DSP = 1,
16+ NHLT_LINK_DMIC = 2,
17+ NHLT_LINK_SSP = 3,
18+ NHLT_LINK_INVALID
19+};
20+
1321 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
1422
1523 struct wav_fmt {
@@ -33,14 +41,6 @@ struct wav_fmt_ext { · 17 unmodified lines
3341 u8 sub_fmt[16];
3442 } __packed;
3543
36−enum nhlt_link_type {
37− NHLT_LINK_HDA = 0,
38− NHLT_LINK_DSP = 1,
39− NHLT_LINK_DMIC = 2,
40− NHLT_LINK_SSP = 3,
41− NHLT_LINK_INVALID
42−};
43−
4444 enum nhlt_device_type {
4545 NHLT_DEVICE_BT = 0,
4646 NHLT_DEVICE_DMIC = 1,
@@ -132,6 +132,12 @@ void intel_nhlt_free(struct nhlt_acpi_table *addr); · 85 unmodified lines
132132
133133 int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt);
134134
135+bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 link_type);
136+struct nhlt_specific_cfg *
137+intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
138+ u32 bus_id, u8 link_type, u8 vbps, u8 bps,
139+ u8 num_ch, u32 rate, u8 dir, u8 dev_type);
140+
135141 #else
136142
137143 struct nhlt_acpi_table;
@@ -150,6 +156,21 @@ static inline int intel_nhlt_get_dmic_geo(struct device *dev, · 12 unmodified lines
150156 {
151157 return 0;
152158 }
159+
160+static inline bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt,
161+ u8 link_type)
162+{
163+ return false;
164+}
165+
166+static inline struct nhlt_specific_cfg *
167+intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
168+ u32 bus_id, u8 link_type, u8 vbps, u8 bps,
169+ u8 num_ch, u32 rate, u8 dir, u8 dev_type)
170+{
171+ return NULL;
172+}
173+
153174 #endif
154175
155176 #endif
include/sound/memalloc.h+7−7
@@ -36,13 +36,6 @@ struct snd_dma_device { · 35 unmodified lines
3636 #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */
3737 #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */
3838 #define SNDRV_DMA_TYPE_DEV_WC 5 /* continuous write-combined */
39−#ifdef CONFIG_SND_DMA_SGBUF
40−#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */
41−#define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */
42−#else
43−#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */
44−#define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC
45−#endif
4639 #ifdef CONFIG_GENERIC_ALLOCATOR
4740 #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */
4841 #else
@@ -51,6 +44,13 @@ struct snd_dma_device { · 2 unmodified lines
5144 #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */
5245 #define SNDRV_DMA_TYPE_NONCONTIG 8 /* non-coherent SG buffer */
5346 #define SNDRV_DMA_TYPE_NONCOHERENT 9 /* non-coherent buffer */
47+#ifdef CONFIG_SND_DMA_SGBUF
48+#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_NONCONTIG
49+#define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */
50+#else
51+#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */
52+#define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC
53+#endif
5454
5555 /*
5656 * info for buffer allocation
include/sound/pcm.h+3−0
@@ -147,6 +147,9 @@ struct snd_pcm_ops { · 146 unmodified lines
147147 #define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE)
148148 #define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE)
149149 #define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE)
150+// For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
151+// available bit count in most significant bit. It's for the case of so-called 'left-justified' or
152+// `right-padding` sample which has less width than 32 bit.
150153 #define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE)
151154 #define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE)
152155 #define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE)
include/sound/rt5682s.h+1−0
@@ -40,6 +40,7 @@ struct rt5682s_platform_data { · 39 unmodified lines
4040 enum rt5682s_jd_src jd_src;
4141 unsigned int dmic_clk_rate;
4242 unsigned int dmic_delay;
43+ unsigned int amic_delay;
4344 bool dmic_clk_driving_high;
4445
4546 const char *dai_clk_names[RT5682S_DAI_NUM_CLKS];
include/sound/soc-component.h+4−0
@@ -148,6 +148,8 @@ struct snd_soc_component_driver { · 147 unmodified lines
148148 struct vm_area_struct *vma);
149149 int (*ack)(struct snd_soc_component *component,
150150 struct snd_pcm_substream *substream);
151+ snd_pcm_sframes_t (*delay)(struct snd_soc_component *component,
152+ struct snd_pcm_substream *substream);
151153
152154 const struct snd_compress_ops *compress_ops;
153155
@@ -505,5 +507,7 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd, · 351 unmodified lines
505507 void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd,
506508 void *stream, int rollback);
507509 int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);
510+void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
511+ snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
508512
509513 #endif /* __SOC_COMPONENT_H */
include/sound/soc-dai.h+18−18
@@ -208,8 +208,6 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, · 207 unmodified lines
208208 struct snd_pcm_substream *substream);
209209 void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
210210 struct snd_pcm_substream *substream, int rollback);
211−snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
212− struct snd_pcm_substream *substream);
213211 void snd_soc_dai_suspend(struct snd_soc_dai *dai);
214212 void snd_soc_dai_resume(struct snd_soc_dai *dai);
215213 int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
@@ -238,6 +236,8 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd, · 22 unmodified lines
238236 int rollback);
239237 int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
240238 int cmd);
239+void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
240+ snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
241241
242242 int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
243243 struct snd_compr_stream *cstream);
@@ -295,9 +295,9 @@ struct snd_soc_dai_ops { · 51 unmodified lines
295295 unsigned int *rx_num, unsigned int *rx_slot);
296296 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
297297
298− int (*set_sdw_stream)(struct snd_soc_dai *dai,
299− void *stream, int direction);
300− void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction);
298+ int (*set_stream)(struct snd_soc_dai *dai,
299+ void *stream, int direction);
300+ void *(*get_stream)(struct snd_soc_dai *dai, int direction);
301301
302302 /*
303303 * DAI digital mute - optional.
@@ -515,42 +515,42 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) · 211 unmodified lines
515515 }
516516
517517 /**
518− * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation
518+ * snd_soc_dai_set_stream() - Configures a DAI for stream operation
519519 * @dai: DAI
520− * @stream: STREAM
520+ * @stream: STREAM (opaque structure depending on DAI type)
521521 * @direction: Stream direction(Playback/Capture)
522− * SoundWire subsystem doesn't have a notion of direction and we reuse
522+ * Some subsystems, such as SoundWire, don't have a notion of direction and we reuse
523523 * the ASoC stream direction to configure sink/source ports.
524524 * Playback maps to source ports and Capture for sink ports.
525525 *
526526 * This should be invoked with NULL to clear the stream set previously.
527527 * Returns 0 on success, a negative error code otherwise.
528528 */
529−static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
530− void *stream, int direction)
529+static inline int snd_soc_dai_set_stream(struct snd_soc_dai *dai,
530+ void *stream, int direction)
531531 {
532− if (dai->driver->ops->set_sdw_stream)
533− return dai->driver->ops->set_sdw_stream(dai, stream, direction);
532+ if (dai->driver->ops->set_stream)
533+ return dai->driver->ops->set_stream(dai, stream, direction);
534534 else
535535 return -ENOTSUPP;
536536 }
537537
538538 /**
539− * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI
539+ * snd_soc_dai_get_stream() - Retrieves stream from DAI
540540 * @dai: DAI
541541 * @direction: Stream direction(Playback/Capture)
542542 *
543543 * This routine only retrieves that was previously configured
544− * with snd_soc_dai_get_sdw_stream()
544+ * with snd_soc_dai_get_stream()
545545 *
546546 * Returns pointer to stream or an ERR_PTR value, e.g.
547547 * ERR_PTR(-ENOTSUPP) if callback is not supported;
548548 */
549−static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai,
550− int direction)
549+static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai,
550+ int direction)
551551 {
552− if (dai->driver->ops->get_sdw_stream)
553− return dai->driver->ops->get_sdw_stream(dai, direction);
552+ if (dai->driver->ops->get_stream)
553+ return dai->driver->ops->get_stream(dai, direction);
554554 else
555555 return ERR_PTR(-ENOTSUPP);
556556 }
include/sound/soc-dpcm.h+2−0
@@ -101,6 +101,8 @@ struct snd_soc_dpcm_runtime { · 100 unmodified lines
101101 enum snd_soc_dpcm_state state;
102102
103103 int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
104+
105+ int be_start; /* refcount protected by BE stream pcm lock */
104106 };
105107
106108 #define for_each_dpcm_fe(be, stream, _dpcm) \
include/sound/soc.h+1−2
@@ -893,8 +893,6 @@ struct snd_soc_card { · 892 unmodified lines
893893 struct mutex pcm_mutex;
894894 enum snd_soc_pcm_subclass pcm_subclass;
895895
896− spinlock_t dpcm_lock;
897−
898896 int (*probe)(struct snd_soc_card *card);
899897 int (*late_probe)(struct snd_soc_card *card);
900898 int (*remove)(struct snd_soc_card *card);
@@ -1213,6 +1211,7 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card, · 312 unmodified lines
12131211 const char *propname);
12141212 int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
12151213 const char *propname);
1214+int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop);
12161215 int snd_soc_of_get_slot_mask(struct device_node *np,
12171216 const char *prop_name,
12181217 unsigned int *mask);
include/sound/sof.h+22−0
@@ -17,6 +17,28 @@ · 16 unmodified lines
1717
1818 struct snd_sof_dsp_ops;
1919
20+/**
21+ * enum sof_fw_state - DSP firmware state definitions
22+ * @SOF_FW_BOOT_NOT_STARTED: firmware boot is not yet started
23+ * @SOF_FW_BOOT_PREPARE: preparing for boot (firmware loading for exaqmple)
24+ * @SOF_FW_BOOT_IN_PROGRESS: firmware boot is in progress
25+ * @SOF_FW_BOOT_FAILED: firmware boot failed
26+ * @SOF_FW_BOOT_READY_FAILED: firmware booted but fw_ready op failed
27+ * @SOF_FW_BOOT_READY_OK: firmware booted and fw_ready op passed
28+ * @SOF_FW_BOOT_COMPLETE: firmware is booted up and functional
29+ * @SOF_FW_CRASHED: firmware crashed after successful boot
30+ */
31+enum sof_fw_state {
32+ SOF_FW_BOOT_NOT_STARTED = 0,
33+ SOF_FW_BOOT_PREPARE,
34+ SOF_FW_BOOT_IN_PROGRESS,
35+ SOF_FW_BOOT_FAILED,
36+ SOF_FW_BOOT_READY_FAILED,
37+ SOF_FW_BOOT_READY_OK,
38+ SOF_FW_BOOT_COMPLETE,
39+ SOF_FW_CRASHED,
40+};
41+
2042 /*
2143 * SOF Platform data.
2244 */
include/sound/sof/dai-amd.h+21−0
@@ -0,0 +1,21 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2+/*
3+ * This file is provided under a dual BSD/GPLv2 license. When using or
4+ * redistributing this file, you may do so under either license.
5+ *
6+ * Copyright(c) 2021 Advanced Micro Devices, Inc.. All rights reserved.
7+ */
8+
9+#ifndef __INCLUDE_SOUND_SOF_DAI_AMD_H__
10+#define __INCLUDE_SOUND_SOF_DAI_AMD_H__
11+
12+#include <sound/sof/header.h>
13+
14+/* ACP Configuration Request - SOF_IPC_DAI_AMD_CONFIG */
15+struct sof_ipc_dai_acp_params {
16+ struct sof_ipc_hdr hdr;
17+
18+ uint32_t fsync_rate; /* FSYNC frequency in Hz */
19+ uint32_t tdm_slots;
20+} __packed;
21+#endif
include/sound/sof/dai-mediatek.h+23−0
@@ -0,0 +1,23 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2+/*
3+ * Copyright(c) 2021 Mediatek Corporation. All rights reserved.
4+ *
5+ * Author: Bo Pan <bo.pan@mediatek.com>
6+ */
7+
8+#ifndef __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__
9+#define __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__
10+
11+#include <sound/sof/header.h>
12+
13+struct sof_ipc_dai_mtk_afe_params {
14+ struct sof_ipc_hdr hdr;
15+ u32 channels;
16+ u32 rate;
17+ u32 format;
18+ u32 stream_id;
19+ u32 reserved[4]; /* reserve for future */
20+} __packed;
21+
22+#endif
23+
include/sound/sof/dai.h+29−6
@@ -12,6 +12,8 @@ · 11 unmodified lines
1212 #include <sound/sof/header.h>
1313 #include <sound/sof/dai-intel.h>
1414 #include <sound/sof/dai-imx.h>
15+#include <sound/sof/dai-amd.h>
16+#include <sound/sof/dai-mediatek.h>
1517
1618 /*
1719 * DAI Configuration.
@@ -50,12 +52,25 @@ · 32 unmodified lines
5052 #define SOF_DAI_FMT_INV_MASK 0x0f00
5153 #define SOF_DAI_FMT_CLOCK_PROVIDER_MASK 0xf000
5254
53−/* DAI_CONFIG flags */
54−#define SOF_DAI_CONFIG_FLAGS_MASK 0x3
55−#define SOF_DAI_CONFIG_FLAGS_NONE (0 << 0) /**< DAI_CONFIG sent without stage information */
56−#define SOF_DAI_CONFIG_FLAGS_HW_PARAMS (1 << 0) /**< DAI_CONFIG sent during hw_params stage */
57−#define SOF_DAI_CONFIG_FLAGS_HW_FREE (2 << 0) /**< DAI_CONFIG sent during hw_free stage */
58−#define SOF_DAI_CONFIG_FLAGS_RFU (3 << 0) /**< not used, reserved for future use */
55+/*
56+ * DAI_CONFIG flags. The 4 LSB bits are used for the commands, HW_PARAMS, HW_FREE and PAUSE
57+ * representing when the IPC is sent. The 4 MSB bits are used to add quirks along with the above
58+ * commands.
59+ */
60+#define SOF_DAI_CONFIG_FLAGS_CMD_MASK 0xF
61+#define SOF_DAI_CONFIG_FLAGS_NONE 0 /**< DAI_CONFIG sent without stage information */
62+#define SOF_DAI_CONFIG_FLAGS_HW_PARAMS BIT(0) /**< DAI_CONFIG sent during hw_params stage */
63+#define SOF_DAI_CONFIG_FLAGS_HW_FREE BIT(1) /**< DAI_CONFIG sent during hw_free stage */
64+/**< DAI_CONFIG sent during pause trigger. Only available ABI 3.20 onwards */
65+#define SOF_DAI_CONFIG_FLAGS_PAUSE BIT(2)
66+#define SOF_DAI_CONFIG_FLAGS_QUIRK_SHIFT 4
67+#define SOF_DAI_CONFIG_FLAGS_QUIRK_MASK (0xF << SOF_DAI_CONFIG_FLAGS_QUIRK_SHIFT)
68+/*
69+ * This should be used along with the SOF_DAI_CONFIG_FLAGS_HW_PARAMS to indicate that pipeline
70+ * stop/pause and DAI DMA stop/pause should happen in two steps. This change is only available
71+ * ABI 3.20 onwards.
72+ */
73+#define SOF_DAI_CONFIG_FLAGS_2_STEP_STOP BIT(0)
5974
6075 /** \brief Types of DAI */
6176 enum sof_ipc_dai_type {
@@ -66,6 +81,10 @@ enum sof_ipc_dai_type { · 4 unmodified lines
6681 SOF_DAI_INTEL_ALH, /**< Intel ALH */
6782 SOF_DAI_IMX_SAI, /**< i.MX SAI */
6883 SOF_DAI_IMX_ESAI, /**< i.MX ESAI */
84+ SOF_DAI_AMD_BT, /**< AMD ACP BT*/
85+ SOF_DAI_AMD_SP, /**< AMD ACP SP */
86+ SOF_DAI_AMD_DMIC, /**< AMD ACP DMIC */
87+ SOF_DAI_MEDIATEK_AFE, /**< Mediatek AFE */
6988 };
7089
7190 /* general purpose DAI configuration */
@@ -90,6 +109,10 @@ struct sof_ipc_dai_config { · 18 unmodified lines
90109 struct sof_ipc_dai_alh_params alh;
91110 struct sof_ipc_dai_esai_params esai;
92111 struct sof_ipc_dai_sai_params sai;
112+ struct sof_ipc_dai_acp_params acpbt;
113+ struct sof_ipc_dai_acp_params acpsp;
114+ struct sof_ipc_dai_acp_params acpdmic;
115+ struct sof_ipc_dai_mtk_afe_params afe;
93116 };
94117 } __packed;
95118
include/sound/sof/debug.h+2−0
@@ -19,6 +19,8 @@ enum sof_ipc_dbg_mem_zone { · 18 unmodified lines
1919 SOF_IPC_MEM_ZONE_SYS_RUNTIME = 1, /**< System-runtime zone */
2020 SOF_IPC_MEM_ZONE_RUNTIME = 2, /**< Runtime zone */
2121 SOF_IPC_MEM_ZONE_BUFFER = 3, /**< Buffer zone */
22+ SOF_IPC_MEM_ZONE_RUNTIME_SHARED = 4, /**< System runtime zone */
23+ SOF_IPC_MEM_ZONE_SYS_SHARED = 5, /**< System shared zone */
2224 };
2325
2426 /** ABI3.18 */
include/sound/sof/header.h+1−0
@@ -119,6 +119,7 @@ · 118 unmodified lines
119119 #define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002)
120120 #define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003)
121121 #define SOF_IPC_TRACE_FILTER_UPDATE SOF_CMD_TYPE(0x004) /**< ABI3.17 */
122+#define SOF_IPC_TRACE_DMA_FREE SOF_CMD_TYPE(0x005) /**< ABI3.20 */
122123
123124 /* debug */
124125 #define SOF_IPC_DEBUG_MEM_USAGE SOF_CMD_TYPE(0x001)
include/uapi/sound/asound.h+6−1
@@ -202,6 +202,11 @@ typedef int __bitwise snd_pcm_format_t; · 201 unmodified lines
202202 #define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
203203 #define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
204204 #define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
205+/*
206+ * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
207+ * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
208+ * `right-padding` sample which has less width than 32 bit.
209+ */
205210 #define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
206211 #define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
207212 #define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
@@ -300,7 +305,7 @@ typedef int __bitwise snd_pcm_subformat_t; · 92 unmodified lines
300305 #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
301306 #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
302307 #define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000 /* needs explicit sync of pointers and data */
303−
308+#define SNDRV_PCM_INFO_NO_REWINDS 0x20000000 /* hardware can only support monotonic changes of appl_ptr */
304309 #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
305310 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
306311
include/uapi/sound/sof/tokens.h+5−0
@@ -140,4 +140,9 @@ · 139 unmodified lines
140140 #define SOF_TKN_INTEL_HDA_RATE 1500
141141 #define SOF_TKN_INTEL_HDA_CH 1501
142142
143+/* AFE */
144+#define SOF_TKN_MEDIATEK_AFE_RATE 1600
145+#define SOF_TKN_MEDIATEK_AFE_CH 1601
146+#define SOF_TKN_MEDIATEK_AFE_FORMAT 1602
147+
143148 #endif
sound/core/Makefile+0−1
@@ -19,7 +19,6 @@ snd-$(CONFIG_SND_JACK) += ctljack.o jack.o · 18 unmodified lines
1919 snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \
2020 pcm_memory.o memalloc.o
2121 snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o
22−snd-pcm-$(CONFIG_SND_DMA_SGBUF) += sgbuf.o
2322 snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o
2423 snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o
2524
sound/core/control_led.c+1−1
@@ -509,7 +509,7 @@ static char *parse_string(char *s, char *val, size_t val_size) · 508 unmodified lines
509509 return s;
510510 }
511511
512−static char *parse_iface(char *s, unsigned int *val)
512+static char *parse_iface(char *s, snd_ctl_elem_iface_t *val)
513513 {
514514 if (!strncasecmp(s, "card", 4))
515515 *val = SNDRV_CTL_ELEM_IFACE_CARD;
sound/core/info_oss.c+2−4
@@ -32,10 +32,8 @@ int snd_oss_info_register(int dev, int num, char *string) · 31 unmodified lines
3232 mutex_lock(&strings);
3333 if (string == NULL) {
3434 x = snd_sndstat_strings[num][dev];
35− if (x) {
36− kfree(x);
37− x = NULL;
38− }
35+ kfree(x);
36+ x = NULL;
3937 } else {
4038 x = kstrdup(string, GFP_KERNEL);
4139 if (x == NULL) {
sound/core/jack.c+3−0
@@ -62,10 +62,13 @@ static int snd_jack_dev_free(struct snd_device *device) · 61 unmodified lines
6262 struct snd_card *card = device->card;
6363 struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl;
6464
65+ down_write(&card->controls_rwsem);
6566 list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) {
6667 list_del_init(&jack_kctl->list);
6768 snd_ctl_remove(card, jack_kctl->kctl);
6869 }
70+ up_write(&card->controls_rwsem);
71+
6972 if (jack->private_free)
7073 jack->private_free(jack);
7174
sound/core/memalloc.c+49−4
@@ -620,6 +620,52 @@ static const struct snd_malloc_ops snd_dma_noncontig_ops = { · 619 unmodified lines
620620 .get_chunk_size = snd_dma_noncontig_get_chunk_size,
621621 };
622622
623+/* x86-specific SG-buffer with WC pages */
624+#ifdef CONFIG_SND_DMA_SGBUF
625+#define sg_wc_address(it) ((unsigned long)page_address(sg_page_iter_page(it)))
626+
627+static void *snd_dma_sg_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
628+{
629+ void *p = snd_dma_noncontig_alloc(dmab, size);
630+ struct sg_table *sgt = dmab->private_data;
631+ struct sg_page_iter iter;
632+
633+ if (!p)
634+ return NULL;
635+ for_each_sgtable_page(sgt, &iter, 0)
636+ set_memory_wc(sg_wc_address(&iter), 1);
637+ return p;
638+}
639+
640+static void snd_dma_sg_wc_free(struct snd_dma_buffer *dmab)
641+{
642+ struct sg_table *sgt = dmab->private_data;
643+ struct sg_page_iter iter;
644+
645+ for_each_sgtable_page(sgt, &iter, 0)
646+ set_memory_wb(sg_wc_address(&iter), 1);
647+ snd_dma_noncontig_free(dmab);
648+}
649+
650+static int snd_dma_sg_wc_mmap(struct snd_dma_buffer *dmab,
651+ struct vm_area_struct *area)
652+{
653+ area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);
654+ return dma_mmap_noncontiguous(dmab->dev.dev, area,
655+ dmab->bytes, dmab->private_data);
656+}
657+
658+static const struct snd_malloc_ops snd_dma_sg_wc_ops = {
659+ .alloc = snd_dma_sg_wc_alloc,
660+ .free = snd_dma_sg_wc_free,
661+ .mmap = snd_dma_sg_wc_mmap,
662+ .sync = snd_dma_noncontig_sync,
663+ .get_addr = snd_dma_noncontig_get_addr,
664+ .get_page = snd_dma_noncontig_get_page,
665+ .get_chunk_size = snd_dma_noncontig_get_chunk_size,
666+};
667+#endif /* CONFIG_SND_DMA_SGBUF */
668+
623669 /*
624670 * Non-coherent pages allocator
625671 */
@@ -679,14 +725,13 @@ static const struct snd_malloc_ops *dma_ops[] = { · 53 unmodified lines
679725 [SNDRV_DMA_TYPE_DEV_WC] = &snd_dma_wc_ops,
680726 [SNDRV_DMA_TYPE_NONCONTIG] = &snd_dma_noncontig_ops,
681727 [SNDRV_DMA_TYPE_NONCOHERENT] = &snd_dma_noncoherent_ops,
728+#ifdef CONFIG_SND_DMA_SGBUF
729+ [SNDRV_DMA_TYPE_DEV_WC_SG] = &snd_dma_sg_wc_ops,
730+#endif
682731 #ifdef CONFIG_GENERIC_ALLOCATOR
683732 [SNDRV_DMA_TYPE_DEV_IRAM] = &snd_dma_iram_ops,
684733 #endif /* CONFIG_GENERIC_ALLOCATOR */
685734 #endif /* CONFIG_HAS_DMA */
686−#ifdef CONFIG_SND_DMA_SGBUF
687− [SNDRV_DMA_TYPE_DEV_SG] = &snd_dma_sg_ops,
688− [SNDRV_DMA_TYPE_DEV_WC_SG] = &snd_dma_sg_ops,
689−#endif
690735 };
691736
692737 static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab)
sound/core/oss/pcm_oss.c+1−1
@@ -2065,7 +2065,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr · 2064 unmodified lines
20652065 int err, cmd;
20662066
20672067 #ifdef OSS_DEBUG
2068− pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger);
2068+ pr_debug("pcm_oss: trigger = 0x%x\n", trigger);
20692069 #endif
20702070
20712071 psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
sound/core/pcm.c+5−1
@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); · 809 unmodified lines
810810 static void free_chmap(struct snd_pcm_str *pstr)
811811 {
812812 if (pstr->chmap_kctl) {
813− snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl);
813+ struct snd_card *card = pstr->pcm->card;
814+
815+ down_write(&card->controls_rwsem);
816+ snd_ctl_remove(card, pstr->chmap_kctl);
817+ up_write(&card->controls_rwsem);
814818 pstr->chmap_kctl = NULL;
815819 }
816820 }
sound/core/pcm_dmaengine.c+2−3
@@ -91,8 +91,8 @@ EXPORT_SYMBOL_GPL(snd_hwparams_to_dma_slave_config); · 90 unmodified lines
9191 * @dma_data: DAI DMA data
9292 * @slave_config: DMA slave configuration
9393 *
94− * Initializes the {dst,src}_addr, {dst,src}_maxburst, {dst,src}_addr_width and
95− * slave_id fields of the DMA slave config from the same fields of the DAI DMA
94+ * Initializes the {dst,src}_addr, {dst,src}_maxburst, {dst,src}_addr_width
95+ * fields of the DMA slave config from the same fields of the DAI DMA
9696 * data struct. The src and dst fields will be initialized depending on the
9797 * direction of the substream. If the substream is a playback stream the dst
9898 * fields will be initialized, if it is a capture stream the src fields will be
@@ -124,7 +124,6 @@ void snd_dmaengine_pcm_set_config_from_dai_data( · 25 unmodified lines
124124 slave_config->src_addr_width = dma_data->addr_width;
125125 }
126126
127− slave_config->slave_id = dma_data->slave_id;
128127 slave_config->peripheral_config = dma_data->peripheral_config;
129128 slave_config->peripheral_size = dma_data->peripheral_size;
130129 }
sound/core/pcm_lib.c+17−0
@@ -2128,11 +2128,28 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream, · 2127 unmodified lines
21282128 {
21292129 struct snd_pcm_runtime *runtime = substream->runtime;
21302130 snd_pcm_uframes_t old_appl_ptr = runtime->control->appl_ptr;
2131+ snd_pcm_sframes_t diff;
21312132 int ret;
21322133
21332134 if (old_appl_ptr == appl_ptr)
21342135 return 0;
21352136
2137+ if (appl_ptr >= runtime->boundary)
2138+ return -EINVAL;
2139+ /*
2140+ * check if a rewind is requested by the application
2141+ */
2142+ if (substream->runtime->info & SNDRV_PCM_INFO_NO_REWINDS) {
2143+ diff = appl_ptr - old_appl_ptr;
2144+ if (diff >= 0) {
2145+ if (diff > runtime->buffer_size)
2146+ return -EINVAL;
2147+ } else {
2148+ if (runtime->boundary + diff > runtime->buffer_size)
2149+ return -EINVAL;
2150+ }
2151+ }
2152+
21362153 runtime->control->appl_ptr = appl_ptr;
21372154 if (substream->ops->ack) {
21382155 ret = substream->ops->ack(substream);
sound/core/seq/seq_queue.c+12−2
@@ -235,12 +235,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) · 234 unmodified lines
235235
236236 /* -------------------------------------------------------- */
237237
238+#define MAX_CELL_PROCESSES_IN_QUEUE 1000
239+
238240 void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
239241 {
240242 unsigned long flags;
241243 struct snd_seq_event_cell *cell;
242244 snd_seq_tick_time_t cur_tick;
243245 snd_seq_real_time_t cur_time;
246+ int processed = 0;
244247
245248 if (q == NULL)
246249 return;
@@ -263,6 +266,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) · 16 unmodified lines
263266 if (!cell)
264267 break;
265268 snd_seq_dispatch_event(cell, atomic, hop);
269+ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE)
270+ goto out; /* the rest processed at the next batch */
266271 }
267272
268273 /* Process time queue... */
@@ -272,14 +277,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) · 3 unmodified lines
272277 if (!cell)
273278 break;
274279 snd_seq_dispatch_event(cell, atomic, hop);
280+ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE)
281+ goto out; /* the rest processed at the next batch */
275282 }
276283
284+ out:
277285 /* free lock */
278286 spin_lock_irqsave(&q->check_lock, flags);
279287 if (q->check_again) {
280288 q->check_again = 0;
281− spin_unlock_irqrestore(&q->check_lock, flags);
282− goto __again;
289+ if (processed < MAX_CELL_PROCESSES_IN_QUEUE) {
290+ spin_unlock_irqrestore(&q->check_lock, flags);
291+ goto __again;
292+ }
283293 }
284294 q->check_blocked = 0;
285295 spin_unlock_irqrestore(&q->check_lock, flags);
sound/core/seq/seq_virmidi.c+11−0
@@ -262,6 +262,16 @@ static int snd_virmidi_output_close(struct snd_rawmidi_substream *substream) · 261 unmodified lines
262262 return 0;
263263 }
264264
265+/*
266+ * drain output work queue
267+ */
268+static void snd_virmidi_output_drain(struct snd_rawmidi_substream *substream)
269+{
270+ struct snd_virmidi *vmidi = substream->runtime->private_data;
271+
272+ flush_work(&vmidi->output_work);
273+}
274+
265275 /*
266276 * subscribe callback - allow output to rawmidi device
267277 */
@@ -336,6 +346,7 @@ static const struct snd_rawmidi_ops snd_virmidi_output_ops = { · 68 unmodified lines
336346 .open = snd_virmidi_output_open,
337347 .close = snd_virmidi_output_close,
338348 .trigger = snd_virmidi_output_trigger,
349+ .drain = snd_virmidi_output_drain,
339350 };
340351
341352 /*
sound/core/sgbuf.c+0−201
@@ -1,201 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-or-later
2−/*
3− * Scatter-Gather buffer
4− *
5− * Copyright (c) by Takashi Iwai <tiwai@suse.de>
6− */
7−
8−#include <linux/slab.h>
9−#include <linux/mm.h>
10−#include <linux/vmalloc.h>
11−#include <linux/export.h>
12−#include <sound/memalloc.h>
13−#include "memalloc_local.h"
14−
15−struct snd_sg_page {
16− void *buf;
17− dma_addr_t addr;
18−};
19−
20−struct snd_sg_buf {
21− int size; /* allocated byte size */
22− int pages; /* allocated pages */
23− int tblsize; /* allocated table size */
24− struct snd_sg_page *table; /* address table */
25− struct page **page_table; /* page table (for vmap/vunmap) */
26− struct device *dev;
27−};
28−
29−/* table entries are align to 32 */
30−#define SGBUF_TBL_ALIGN 32
31−#define sgbuf_align_table(tbl) ALIGN((tbl), SGBUF_TBL_ALIGN)
32−
33−static void snd_dma_sg_free(struct snd_dma_buffer *dmab)
34−{
35− struct snd_sg_buf *sgbuf = dmab->private_data;
36− struct snd_dma_buffer tmpb;
37− int i;
38−
39− if (!sgbuf)
40− return;
41−
42− vunmap(dmab->area);
43− dmab->area = NULL;
44−
45− tmpb.dev.type = SNDRV_DMA_TYPE_DEV;
46− if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
47− tmpb.dev.type = SNDRV_DMA_TYPE_DEV_WC;
48− tmpb.dev.dev = sgbuf->dev;
49− for (i = 0; i < sgbuf->pages; i++) {
50− if (!(sgbuf->table[i].addr & ~PAGE_MASK))
51− continue; /* continuous pages */
52− tmpb.area = sgbuf->table[i].buf;
53− tmpb.addr = sgbuf->table[i].addr & PAGE_MASK;
54− tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT;
55− snd_dma_free_pages(&tmpb);
56− }
57−
58− kfree(sgbuf->table);
59− kfree(sgbuf->page_table);
60− kfree(sgbuf);
61− dmab->private_data = NULL;
62−}
63−
64−#define MAX_ALLOC_PAGES 32
65−
66−static void *snd_dma_sg_alloc(struct snd_dma_buffer *dmab, size_t size)
67−{
68− struct snd_sg_buf *sgbuf;
69− unsigned int i, pages, chunk, maxpages;
70− struct snd_dma_buffer tmpb;
71− struct snd_sg_page *table;
72− struct page **pgtable;
73− int type = SNDRV_DMA_TYPE_DEV;
74− pgprot_t prot = PAGE_KERNEL;
75− void *area;
76−
77− dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
78− if (!sgbuf)
79− return NULL;
80− if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG) {
81− type = SNDRV_DMA_TYPE_DEV_WC;
82−#ifdef pgprot_noncached
83− prot = pgprot_noncached(PAGE_KERNEL);
84−#endif
85− }
86− sgbuf->dev = dmab->dev.dev;
87− pages = snd_sgbuf_aligned_pages(size);
88− sgbuf->tblsize = sgbuf_align_table(pages);
89− table = kcalloc(sgbuf->tblsize, sizeof(*table), GFP_KERNEL);
90− if (!table)
91− goto _failed;
92− sgbuf->table = table;
93− pgtable = kcalloc(sgbuf->tblsize, sizeof(*pgtable), GFP_KERNEL);
94− if (!pgtable)
95− goto _failed;
96− sgbuf->page_table = pgtable;
97−
98− /* allocate pages */
99− maxpages = MAX_ALLOC_PAGES;
100− while (pages > 0) {
101− chunk = pages;
102− /* don't be too eager to take a huge chunk */
103− if (chunk > maxpages)
104− chunk = maxpages;
105− chunk <<= PAGE_SHIFT;
106− if (snd_dma_alloc_pages_fallback(type, dmab->dev.dev,
107− chunk, &tmpb) < 0) {
108− if (!sgbuf->pages)
109− goto _failed;
110− size = sgbuf->pages * PAGE_SIZE;
111− break;
112− }
113− chunk = tmpb.bytes >> PAGE_SHIFT;
114− for (i = 0; i < chunk; i++) {
115− table->buf = tmpb.area;
116− table->addr = tmpb.addr;
117− if (!i)
118− table->addr |= chunk; /* mark head */
119− table++;
120− *pgtable++ = virt_to_page(tmpb.area);
121− tmpb.area += PAGE_SIZE;
122− tmpb.addr += PAGE_SIZE;
123− }
124− sgbuf->pages += chunk;
125− pages -= chunk;
126− if (chunk < maxpages)
127− maxpages = chunk;
128− }
129−
130− sgbuf->size = size;
131− area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP, prot);
132− if (!area)
133− goto _failed;
134− return area;
135−
136− _failed:
137− snd_dma_sg_free(dmab); /* free the table */
138− return NULL;
139−}
140−
141−static dma_addr_t snd_dma_sg_get_addr(struct snd_dma_buffer *dmab,
142− size_t offset)
143−{
144− struct snd_sg_buf *sgbuf = dmab->private_data;
145− dma_addr_t addr;
146−
147− addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
148− addr &= ~((dma_addr_t)PAGE_SIZE - 1);
149− return addr + offset % PAGE_SIZE;
150−}
151−
152−static struct page *snd_dma_sg_get_page(struct snd_dma_buffer *dmab,
153− size_t offset)
154−{
155− struct snd_sg_buf *sgbuf = dmab->private_data;
156− unsigned int idx = offset >> PAGE_SHIFT;
157−
158− if (idx >= (unsigned int)sgbuf->pages)
159− return NULL;
160− return sgbuf->page_table[idx];
161−}
162−
163−static unsigned int snd_dma_sg_get_chunk_size(struct snd_dma_buffer *dmab,
164− unsigned int ofs,
165− unsigned int size)
166−{
167− struct snd_sg_buf *sg = dmab->private_data;
168− unsigned int start, end, pg;
169−
170− start = ofs >> PAGE_SHIFT;
171− end = (ofs + size - 1) >> PAGE_SHIFT;
172− /* check page continuity */
173− pg = sg->table[start].addr >> PAGE_SHIFT;
174− for (;;) {
175− start++;
176− if (start > end)
177− break;
178− pg++;
179− if ((sg->table[start].addr >> PAGE_SHIFT) != pg)
180− return (start << PAGE_SHIFT) - ofs;
181− }
182− /* ok, all on continuous pages */
183− return size;
184−}
185−
186−static int snd_dma_sg_mmap(struct snd_dma_buffer *dmab,
187− struct vm_area_struct *area)
188−{
189− if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
190− area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);
191− return -ENOENT; /* continue with the default mmap handler */
192−}
193−
194−const struct snd_malloc_ops snd_dma_sg_ops = {
195− .alloc = snd_dma_sg_alloc,
196− .free = snd_dma_sg_free,
197− .get_addr = snd_dma_sg_get_addr,
198− .get_page = snd_dma_sg_get_page,
199− .get_chunk_size = snd_dma_sg_get_chunk_size,
200− .mmap = snd_dma_sg_mmap,
201−};
sound/drivers/virmidi.c+0−3
@@ -90,15 +90,12 @@ static int snd_virmidi_probe(struct platform_device *devptr) · 89 unmodified lines
9090 }
9191 for (idx = 0; idx < midi_devs[dev]; idx++) {
9292 struct snd_rawmidi *rmidi;
93− struct snd_virmidi_dev *rdev;
9493
9594 err = snd_virmidi_new(card, idx, &rmidi);
9695 if (err < 0)
9796 return err;
98− rdev = rmidi->private_data;
9997 vmidi->midi[idx] = rmidi;
10098 strcpy(rmidi->name, "Virtual Raw MIDI");
101− rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH;
10299 }
103100
104101 strcpy(card->driver, "VirMIDI");
sound/hda/ext/hdac_ext_stream.c+100−116
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818 /**
1919 * snd_hdac_ext_stream_init - initialize each stream (aka device)
2020 * @bus: HD-audio core bus
21− * @stream: HD-audio ext core stream object to initialize
21+ * @hext_stream: HD-audio ext core stream object to initialize
2222 * @idx: stream index number
2323 * @direction: stream direction (SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE)
2424 * @tag: the tag id to assign
@@ -27,34 +27,34 @@ · 2 unmodified lines
2727 * invoke hdac stream initialization routine
2828 */
2929 void snd_hdac_ext_stream_init(struct hdac_bus *bus,
30− struct hdac_ext_stream *stream,
31− int idx, int direction, int tag)
30+ struct hdac_ext_stream *hext_stream,
31+ int idx, int direction, int tag)
3232 {
3333 if (bus->ppcap) {
34− stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE +
34+ hext_stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE +
3535 AZX_PPHC_INTERVAL * idx;
3636
37− stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE +
37+ hext_stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE +
3838 AZX_PPLC_MULTI * bus->num_streams +
3939 AZX_PPLC_INTERVAL * idx;
4040 }
4141
4242 if (bus->spbcap) {
43− stream->spib_addr = bus->spbcap + AZX_SPB_BASE +
43+ hext_stream->spib_addr = bus->spbcap + AZX_SPB_BASE +
4444 AZX_SPB_INTERVAL * idx +
4545 AZX_SPB_SPIB;
4646
47− stream->fifo_addr = bus->spbcap + AZX_SPB_BASE +
47+ hext_stream->fifo_addr = bus->spbcap + AZX_SPB_BASE +
4848 AZX_SPB_INTERVAL * idx +
4949 AZX_SPB_MAXFIFO;
5050 }
5151
5252 if (bus->drsmcap)
53− stream->dpibr_addr = bus->drsmcap + AZX_DRSM_BASE +
53+ hext_stream->dpibr_addr = bus->drsmcap + AZX_DRSM_BASE +
5454 AZX_DRSM_INTERVAL * idx;
5555
56− stream->decoupled = false;
57− snd_hdac_stream_init(bus, &stream->hstream, idx, direction, tag);
56+ hext_stream->decoupled = false;
57+ snd_hdac_stream_init(bus, &hext_stream->hstream, idx, direction, tag);
5858 }
5959 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init);
6060
@@ -67,18 +67,18 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init); · 6 unmodified lines
6767 * @dir: direction of streams
6868 */
6969 int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
70− int num_stream, int dir)
70+ int num_stream, int dir)
7171 {
7272 int stream_tag = 0;
7373 int i, tag, idx = start_idx;
7474
7575 for (i = 0; i < num_stream; i++) {
76− struct hdac_ext_stream *stream =
77− kzalloc(sizeof(*stream), GFP_KERNEL);
78− if (!stream)
76+ struct hdac_ext_stream *hext_stream =
77+ kzalloc(sizeof(*hext_stream), GFP_KERNEL);
78+ if (!hext_stream)
7979 return -ENOMEM;
8080 tag = ++stream_tag;
81− snd_hdac_ext_stream_init(bus, stream, idx, dir, tag);
81+ snd_hdac_ext_stream_init(bus, hext_stream, idx, dir, tag);
8282 idx++;
8383 }
8484
@@ -95,22 +95,22 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all); · 10 unmodified lines
9595 void snd_hdac_stream_free_all(struct hdac_bus *bus)
9696 {
9797 struct hdac_stream *s, *_s;
98− struct hdac_ext_stream *stream;
98+ struct hdac_ext_stream *hext_stream;
9999
100100 list_for_each_entry_safe(s, _s, &bus->stream_list, list) {
101− stream = stream_to_hdac_ext_stream(s);
102− snd_hdac_ext_stream_decouple(bus, stream, false);
101+ hext_stream = stream_to_hdac_ext_stream(s);
102+ snd_hdac_ext_stream_decouple(bus, hext_stream, false);
103103 list_del(&s->list);
104− kfree(stream);
104+ kfree(hext_stream);
105105 }
106106 }
107107 EXPORT_SYMBOL_GPL(snd_hdac_stream_free_all);
108108
109109 void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
110− struct hdac_ext_stream *stream,
110+ struct hdac_ext_stream *hext_stream,
111111 bool decouple)
112112 {
113− struct hdac_stream *hstream = &stream->hstream;
113+ struct hdac_stream *hstream = &hext_stream->hstream;
114114 u32 val;
115115 int mask = AZX_PPCTL_PROCEN(hstream->index);
116116
@@ -121,76 +121,76 @@ void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, · 4 unmodified lines
121121 else if (!decouple && val)
122122 snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
123123
124− stream->decoupled = decouple;
124+ hext_stream->decoupled = decouple;
125125 }
126126 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple_locked);
127127
128128 /**
129129 * snd_hdac_ext_stream_decouple - decouple the hdac stream
130130 * @bus: HD-audio core bus
131− * @stream: HD-audio ext core stream object to initialize
131+ * @hext_stream: HD-audio ext core stream object to initialize
132132 * @decouple: flag to decouple
133133 */
134134 void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
135− struct hdac_ext_stream *stream, bool decouple)
135+ struct hdac_ext_stream *hext_stream, bool decouple)
136136 {
137137 spin_lock_irq(&bus->reg_lock);
138− snd_hdac_ext_stream_decouple_locked(bus, stream, decouple);
138+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, decouple);
139139 spin_unlock_irq(&bus->reg_lock);
140140 }
141141 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple);
142142
143143 /**
144144 * snd_hdac_ext_link_stream_start - start a stream
145− * @stream: HD-audio ext core stream to start
145+ * @hext_stream: HD-audio ext core stream to start
146146 */
147−void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream)
147+void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hext_stream)
148148 {
149− snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
149+ snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL,
150150 AZX_PPLCCTL_RUN, AZX_PPLCCTL_RUN);
151151 }
152152 EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_start);
153153
154154 /**
155155 * snd_hdac_ext_link_stream_clear - stop a stream DMA
156− * @stream: HD-audio ext core stream to stop
156+ * @hext_stream: HD-audio ext core stream to stop
157157 */
158−void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *stream)
158+void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hext_stream)
159159 {
160− snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, AZX_PPLCCTL_RUN, 0);
160+ snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL, AZX_PPLCCTL_RUN, 0);
161161 }
162162 EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_clear);
163163
164164 /**
165165 * snd_hdac_ext_link_stream_reset - reset a stream
166− * @stream: HD-audio ext core stream to reset
166+ * @hext_stream: HD-audio ext core stream to reset
167167 */
168−void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream)
168+void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *hext_stream)
169169 {
170170 unsigned char val;
171171 int timeout;
172172
173− snd_hdac_ext_link_stream_clear(stream);
173+ snd_hdac_ext_link_stream_clear(hext_stream);
174174
175− snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
175+ snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL,
176176 AZX_PPLCCTL_STRST, AZX_PPLCCTL_STRST);
177177 udelay(3);
178178 timeout = 50;
179179 do {
180− val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) &
180+ val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL) &
181181 AZX_PPLCCTL_STRST;
182182 if (val)
183183 break;
184184 udelay(3);
185185 } while (--timeout);
186186 val &= ~AZX_PPLCCTL_STRST;
187− writel(val, stream->pplc_addr + AZX_REG_PPLCCTL);
187+ writel(val, hext_stream->pplc_addr + AZX_REG_PPLCCTL);
188188 udelay(3);
189189
190190 timeout = 50;
191191 /* waiting for hardware to report that the stream is out of reset */
192192 do {
193− val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) & AZX_PPLCCTL_STRST;
193+ val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL) & AZX_PPLCCTL_STRST;
194194 if (!val)
195195 break;
196196 udelay(3);
@@ -201,24 +201,24 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_reset); · 4 unmodified lines
201201
202202 /**
203203 * snd_hdac_ext_link_stream_setup - set up the SD for streaming
204− * @stream: HD-audio ext core stream to set up
204+ * @hext_stream: HD-audio ext core stream to set up
205205 * @fmt: stream format
206206 */
207−int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *stream, int fmt)
207+int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *hext_stream, int fmt)
208208 {
209− struct hdac_stream *hstream = &stream->hstream;
209+ struct hdac_stream *hstream = &hext_stream->hstream;
210210 unsigned int val;
211211
212212 /* make sure the run bit is zero for SD */
213− snd_hdac_ext_link_stream_clear(stream);
213+ snd_hdac_ext_link_stream_clear(hext_stream);
214214 /* program the stream_tag */
215− val = readl(stream->pplc_addr + AZX_REG_PPLCCTL);
215+ val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL);
216216 val = (val & ~AZX_PPLCCTL_STRM_MASK) |
217217 (hstream->stream_tag << AZX_PPLCCTL_STRM_SHIFT);
218− writel(val, stream->pplc_addr + AZX_REG_PPLCCTL);
218+ writel(val, hext_stream->pplc_addr + AZX_REG_PPLCCTL);
219219
220220 /* program the stream format */
221− writew(fmt, stream->pplc_addr + AZX_REG_PPLCFMT);
221+ writew(fmt, hext_stream->pplc_addr + AZX_REG_PPLCFMT);
222222
223223 return 0;
224224 }
@@ -230,7 +230,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_setup); · 5 unmodified lines
230230 * @stream: stream id
231231 */
232232 void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link,
233− int stream)
233+ int stream)
234234 {
235235 snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 1 << stream);
236236 }
@@ -250,10 +250,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id); · 13 unmodified lines
250250
251251 static struct hdac_ext_stream *
252252 hdac_ext_link_stream_assign(struct hdac_bus *bus,
253− struct snd_pcm_substream *substream)
253+ struct snd_pcm_substream *substream)
254254 {
255255 struct hdac_ext_stream *res = NULL;
256− struct hdac_stream *stream = NULL;
256+ struct hdac_stream *hstream = NULL;
257257
258258 if (!bus->ppcap) {
259259 dev_err(bus->dev, "stream type not supported\n");
@@ -261,22 +261,22 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus, · 1 unmodified line
261261 }
262262
263263 spin_lock_irq(&bus->reg_lock);
264− list_for_each_entry(stream, &bus->stream_list, list) {
265− struct hdac_ext_stream *hstream = container_of(stream,
266− struct hdac_ext_stream,
267− hstream);
268− if (stream->direction != substream->stream)
264+ list_for_each_entry(hstream, &bus->stream_list, list) {
265+ struct hdac_ext_stream *hext_stream = container_of(hstream,
266+ struct hdac_ext_stream,
267+ hstream);
268+ if (hstream->direction != substream->stream)
269269 continue;
270270
271271 /* check if decoupled stream and not in use is available */
272− if (hstream->decoupled && !hstream->link_locked) {
273− res = hstream;
272+ if (hext_stream->decoupled && !hext_stream->link_locked) {
273+ res = hext_stream;
274274 break;
275275 }
276276
277− if (!hstream->link_locked) {
278− snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
279− res = hstream;
277+ if (!hext_stream->link_locked) {
278+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, true);
279+ res = hext_stream;
280280 break;
281281 }
282282 }
@@ -290,10 +290,10 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus, · 7 unmodified lines
290290
291291 static struct hdac_ext_stream *
292292 hdac_ext_host_stream_assign(struct hdac_bus *bus,
293− struct snd_pcm_substream *substream)
293+ struct snd_pcm_substream *substream)
294294 {
295295 struct hdac_ext_stream *res = NULL;
296− struct hdac_stream *stream = NULL;
296+ struct hdac_stream *hstream = NULL;
297297
298298 if (!bus->ppcap) {
299299 dev_err(bus->dev, "stream type not supported\n");
@@ -301,17 +301,17 @@ hdac_ext_host_stream_assign(struct hdac_bus *bus, · 1 unmodified line
301301 }
302302
303303 spin_lock_irq(&bus->reg_lock);
304− list_for_each_entry(stream, &bus->stream_list, list) {
305− struct hdac_ext_stream *hstream = container_of(stream,
306− struct hdac_ext_stream,
307− hstream);
308− if (stream->direction != substream->stream)
304+ list_for_each_entry(hstream, &bus->stream_list, list) {
305+ struct hdac_ext_stream *hext_stream = container_of(hstream,
306+ struct hdac_ext_stream,
307+ hstream);
308+ if (hstream->direction != substream->stream)
309309 continue;
310310
311− if (!stream->opened) {
312− if (!hstream->decoupled)
313− snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
314− res = hstream;
311+ if (!hstream->opened) {
312+ if (!hext_stream->decoupled)
313+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, true);
314+ res = hext_stream;
315315 break;
316316 }
317317 }
@@ -346,16 +346,17 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, · 28 unmodified lines
346346 struct snd_pcm_substream *substream,
347347 int type)
348348 {
349− struct hdac_ext_stream *hstream = NULL;
350− struct hdac_stream *stream = NULL;
349+ struct hdac_ext_stream *hext_stream = NULL;
350+ struct hdac_stream *hstream = NULL;
351351
352352 switch (type) {
353353 case HDAC_EXT_STREAM_TYPE_COUPLED:
354− stream = snd_hdac_stream_assign(bus, substream);
355− if (stream)
356− hstream = container_of(stream,
357− struct hdac_ext_stream, hstream);
358− return hstream;
354+ hstream = snd_hdac_stream_assign(bus, substream);
355+ if (hstream)
356+ hext_stream = container_of(hstream,
357+ struct hdac_ext_stream,
358+ hstream);
359+ return hext_stream;
359360
360361 case HDAC_EXT_STREAM_TYPE_HOST:
361362 return hdac_ext_host_stream_assign(bus, substream);
@@ -371,34 +372,34 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_assign); · 9 unmodified lines
371372
372373 /**
373374 * snd_hdac_ext_stream_release - release the assigned stream
374− * @stream: HD-audio ext core stream to release
375+ * @hext_stream: HD-audio ext core stream to release
375376 * @type: type of stream (coupled, host or link stream)
376377 *
377378 * Release the stream that has been assigned by snd_hdac_ext_stream_assign().
378379 */
379−void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type)
380+void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type)
380381 {
381− struct hdac_bus *bus = stream->hstream.bus;
382+ struct hdac_bus *bus = hext_stream->hstream.bus;
382383
383384 switch (type) {
384385 case HDAC_EXT_STREAM_TYPE_COUPLED:
385− snd_hdac_stream_release(&stream->hstream);
386+ snd_hdac_stream_release(&hext_stream->hstream);
386387 break;
387388
388389 case HDAC_EXT_STREAM_TYPE_HOST:
389390 spin_lock_irq(&bus->reg_lock);
390− if (stream->decoupled && !stream->link_locked)
391− snd_hdac_ext_stream_decouple_locked(bus, stream, false);
391+ if (hext_stream->decoupled && !hext_stream->link_locked)
392+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
392393 spin_unlock_irq(&bus->reg_lock);
393− snd_hdac_stream_release(&stream->hstream);
394+ snd_hdac_stream_release(&hext_stream->hstream);
394395 break;
395396
396397 case HDAC_EXT_STREAM_TYPE_LINK:
397398 spin_lock_irq(&bus->reg_lock);
398− if (stream->decoupled && !stream->hstream.opened)
399− snd_hdac_ext_stream_decouple_locked(bus, stream, false);
400− stream->link_locked = 0;
401− stream->link_substream = NULL;
399+ if (hext_stream->decoupled && !hext_stream->hstream.opened)
400+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
401+ hext_stream->link_locked = 0;
402+ hext_stream->link_substream = NULL;
402403 spin_unlock_irq(&bus->reg_lock);
403404 break;
404405
@@ -437,11 +438,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_spbcap_enable); · 32 unmodified lines
437438 /**
438439 * snd_hdac_ext_stream_set_spib - sets the spib value of a stream
439440 * @bus: HD-audio core bus
440− * @stream: hdac_ext_stream
441+ * @hext_stream: hdac_ext_stream
441442 * @value: spib value to set
442443 */
443444 int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus,
444− struct hdac_ext_stream *stream, u32 value)
445+ struct hdac_ext_stream *hext_stream, u32 value)
445446 {
446447
447448 if (!bus->spbcap) {
@@ -449,7 +450,7 @@ int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus, · 1 unmodified line
449450 return -EINVAL;
450451 }
451452
452− writel(value, stream->spib_addr);
453+ writel(value, hext_stream->spib_addr);
453454
454455 return 0;
455456 }
@@ -458,12 +459,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_spib); · 2 unmodified lines
458459 /**
459460 * snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream
460461 * @bus: HD-audio core bus
461− * @stream: hdac_ext_stream
462+ * @hext_stream: hdac_ext_stream
462463 *
463464 * Return maxfifo for the stream
464465 */
465466 int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus,
466− struct hdac_ext_stream *stream)
467+ struct hdac_ext_stream *hext_stream)
467468 {
468469
469470 if (!bus->spbcap) {
@@ -471,27 +472,10 @@ int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus, · 1 unmodified line
471472 return -EINVAL;
472473 }
473474
474− return readl(stream->fifo_addr);
475+ return readl(hext_stream->fifo_addr);
475476 }
476477 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_get_spbmaxfifo);
477478
478−
479−/**
480− * snd_hdac_ext_stop_streams - stop all stream if running
481− * @bus: HD-audio core bus
482− */
483−void snd_hdac_ext_stop_streams(struct hdac_bus *bus)
484−{
485− struct hdac_stream *stream;
486−
487− if (bus->chip_init) {
488− list_for_each_entry(stream, &bus->stream_list, list)
489− snd_hdac_stream_stop(stream);
490− snd_hdac_bus_stop_chip(bus);
491− }
492−}
493−EXPORT_SYMBOL_GPL(snd_hdac_ext_stop_streams);
494−
495479 /**
496480 * snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
497481 * @bus: HD-audio core bus
@@ -520,11 +504,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_drsm_enable); · 22 unmodified lines
520504 /**
521505 * snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
522506 * @bus: HD-audio core bus
523− * @stream: hdac_ext_stream
507+ * @hext_stream: hdac_ext_stream
524508 * @value: dpib value to set
525509 */
526510 int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus,
527− struct hdac_ext_stream *stream, u32 value)
511+ struct hdac_ext_stream *hext_stream, u32 value)
528512 {
529513
530514 if (!bus->drsmcap) {
@@ -532,7 +516,7 @@ int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus, · 1 unmodified line
532516 return -EINVAL;
533517 }
534518
535− writel(value, stream->dpibr_addr);
519+ writel(value, hext_stream->dpibr_addr);
536520
537521 return 0;
538522 }
@@ -540,12 +524,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_dpibr); · 1 unmodified line
540524
541525 /**
542526 * snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
543− * @stream: hdac_ext_stream
527+ * @hext_stream: hdac_ext_stream
544528 * @value: lpib value to set
545529 */
546−int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value)
530+int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *hext_stream, u32 value)
547531 {
548− snd_hdac_stream_writel(&stream->hstream, SD_LPIB, value);
532+ snd_hdac_stream_writel(&hext_stream->hstream, SD_LPIB, value);
549533
550534 return 0;
551535 }
sound/hda/hdac_stream.c+20−10
@@ -142,6 +142,22 @@ void snd_hdac_stream_stop(struct hdac_stream *azx_dev) · 141 unmodified lines
142142 }
143143 EXPORT_SYMBOL_GPL(snd_hdac_stream_stop);
144144
145+/**
146+ * snd_hdac_stop_streams_and_chip - stop all streams and chip if running
147+ * @bus: HD-audio core bus
148+ */
149+void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus)
150+{
151+ struct hdac_stream *stream;
152+
153+ if (bus->chip_init) {
154+ list_for_each_entry(stream, &bus->stream_list, list)
155+ snd_hdac_stream_stop(stream);
156+ snd_hdac_bus_stop_chip(bus);
157+ }
158+}
159+EXPORT_SYMBOL_GPL(snd_hdac_stop_streams_and_chip);
160+
145161 /**
146162 * snd_hdac_stream_reset - reset a stream
147163 * @azx_dev: HD-audio core stream to reset
@@ -534,17 +550,11 @@ static void azx_timecounter_init(struct hdac_stream *azx_dev, · 386 unmodified lines
534550 cc->mask = CLOCKSOURCE_MASK(32);
535551
536552 /*
537− * Converting from 24 MHz to ns means applying a 125/3 factor.
538− * To avoid any saturation issues in intermediate operations,
539− * the 125 factor is applied first. The division is applied
540− * last after reading the timecounter value.
541− * Applying the 1/3 factor as part of the multiplication
542− * requires at least 20 bits for a decent precision, however
543− * overflows occur after about 4 hours or less, not a option.
553+ * Calculate the optimal mult/shift values. The counter wraps
554+ * around after ~178.9 seconds.
544555 */
545−
546− cc->mult = 125; /* saturation after 195 years */
547− cc->shift = 0;
556+ clocks_calc_mult_shift(&cc->mult, &cc->shift, 24000000,
557+ NSEC_PER_SEC, 178);
548558
549559 nsec = 0; /* audio time is elapsed time since trigger */
550560 timecounter_init(tc, cc, nsec);
sound/hda/intel-dsp-config.c+39−14
@@ -249,13 +249,13 @@ static const struct config_entry config_table[] = { · 248 unmodified lines
249249 }
250250 },
251251 {
252− .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
252+ .flags = FLAG_SOF,
253253 .device = 0x02c8,
254+ .codec_hid = "ESSX8336",
254255 },
255256 {
256− .flags = FLAG_SOF,
257+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
257258 .device = 0x02c8,
258− .codec_hid = "ESSX8336",
259259 },
260260 /* Cometlake-H */
261261 {
@@ -278,14 +278,14 @@ static const struct config_entry config_table[] = { · 16 unmodified lines
278278 }
279279 },
280280 {
281− .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
282− .device = 0x06c8,
283− },
284− {
285281 .flags = FLAG_SOF,
286282 .device = 0x06c8,
287283 .codec_hid = "ESSX8336",
288284 },
285+ {
286+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
287+ .device = 0x06c8,
288+ },
289289 #endif
290290
291291 /* Icelake */
@@ -309,13 +309,30 @@ static const struct config_entry config_table[] = { · 17 unmodified lines
309309 },
310310 #endif
311311
312−/* JasperLake */
312+/* Jasper Lake */
313313 #if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
314+ {
315+ .flags = FLAG_SOF,
316+ .device = 0x4dc8,
317+ .dmi_table = (const struct dmi_system_id []) {
318+ {
319+ .ident = "Google Chromebooks",
320+ .matches = {
321+ DMI_MATCH(DMI_SYS_VENDOR, "Google"),
322+ }
323+ },
324+ {}
325+ }
326+ },
314327 {
315328 .flags = FLAG_SOF,
316329 .device = 0x4dc8,
317330 .codec_hid = "ESSX8336",
318331 },
332+ {
333+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC,
334+ .device = 0x4dc8,
335+ },
319336 #endif
320337
321338 /* Tigerlake */
@@ -334,17 +351,17 @@ static const struct config_entry config_table[] = { · 12 unmodified lines
334351 }
335352 },
336353 {
337− .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
354+ .flags = FLAG_SOF,
338355 .device = 0xa0c8,
356+ .codec_hid = "ESSX8336",
339357 },
340358 {
341359 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
342− .device = 0x43c8,
360+ .device = 0xa0c8,
343361 },
344362 {
345− .flags = FLAG_SOF,
346− .device = 0xa0c8,
347− .codec_hid = "ESSX8336",
363+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
364+ .device = 0x43c8,
348365 },
349366 #endif
350367
@@ -374,6 +391,14 @@ static const struct config_entry config_table[] = { · 23 unmodified lines
374391 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
375392 .device = 0x51cc,
376393 },
394+ {
395+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
396+ .device = 0x51cd,
397+ },
398+ {
399+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
400+ .device = 0x54c8,
401+ },
377402 #endif
378403
379404 };
@@ -403,7 +428,7 @@ static int snd_intel_dsp_check_dmic(struct pci_dev *pci) · 23 unmodified lines
403428
404429 nhlt = intel_nhlt_init(&pci->dev);
405430 if (nhlt) {
406− if (intel_nhlt_get_dmic_geo(&pci->dev, nhlt))
431+ if (intel_nhlt_has_endpoint_type(nhlt, NHLT_LINK_DMIC))
407432 ret = 1;
408433 intel_nhlt_free(nhlt);
409434 }
sound/hda/intel-nhlt.c+102−0
@@ -110,3 +110,105 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt) · 109 unmodified lines
110110 return dmic_geo;
111111 }
112112 EXPORT_SYMBOL_GPL(intel_nhlt_get_dmic_geo);
113+
114+bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 link_type)
115+{
116+ struct nhlt_endpoint *epnt;
117+ int i;
118+
119+ if (!nhlt)
120+ return false;
121+
122+ epnt = (struct nhlt_endpoint *)nhlt->desc;
123+ for (i = 0; i < nhlt->endpoint_count; i++) {
124+ if (epnt->linktype == link_type)
125+ return true;
126+
127+ epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
128+ }
129+ return false;
130+}
131+EXPORT_SYMBOL(intel_nhlt_has_endpoint_type);
132+
133+static struct nhlt_specific_cfg *
134+nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch,
135+ u32 rate, u8 vbps, u8 bps)
136+{
137+ struct nhlt_fmt_cfg *cfg = fmt->fmt_config;
138+ struct wav_fmt *wfmt;
139+ u16 _bps, _vbps;
140+ int i;
141+
142+ dev_dbg(dev, "Endpoint format count=%d\n", fmt->fmt_count);
143+
144+ for (i = 0; i < fmt->fmt_count; i++) {
145+ wfmt = &cfg->fmt_ext.fmt;
146+ _bps = wfmt->bits_per_sample;
147+ _vbps = cfg->fmt_ext.sample.valid_bits_per_sample;
148+
149+ dev_dbg(dev, "Endpoint format: ch=%d fmt=%d/%d rate=%d\n",
150+ wfmt->channels, _vbps, _bps, wfmt->samples_per_sec);
151+
152+ if (wfmt->channels == num_ch && wfmt->samples_per_sec == rate &&
153+ vbps == _vbps && bps == _bps)
154+ return &cfg->config;
155+
156+ cfg = (struct nhlt_fmt_cfg *)(cfg->config.caps + cfg->config.size);
157+ }
158+
159+ return NULL;
160+}
161+
162+static bool nhlt_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt,
163+ u32 bus_id, u8 link_type, u8 dir, u8 dev_type)
164+{
165+ dev_dbg(dev, "Endpoint: vbus_id=%d link_type=%d dir=%d dev_type = %d\n",
166+ epnt->virtual_bus_id, epnt->linktype,
167+ epnt->direction, epnt->device_type);
168+
169+ if ((epnt->virtual_bus_id != bus_id) ||
170+ (epnt->linktype != link_type) ||
171+ (epnt->direction != dir))
172+ return false;
173+
174+ /* link of type DMIC bypasses device_type check */
175+ return epnt->linktype == NHLT_LINK_DMIC ||
176+ epnt->device_type == dev_type;
177+}
178+
179+struct nhlt_specific_cfg *
180+intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
181+ u32 bus_id, u8 link_type, u8 vbps, u8 bps,
182+ u8 num_ch, u32 rate, u8 dir, u8 dev_type)
183+{
184+ struct nhlt_specific_cfg *cfg;
185+ struct nhlt_endpoint *epnt;
186+ struct nhlt_fmt *fmt;
187+ int i;
188+
189+ if (!nhlt)
190+ return NULL;
191+
192+ dev_dbg(dev, "Looking for configuration:\n");
193+ dev_dbg(dev, " vbus_id=%d link_type=%d dir=%d, dev_type=%d\n",
194+ bus_id, link_type, dir, dev_type);
195+ dev_dbg(dev, " ch=%d fmt=%d/%d rate=%d\n", num_ch, vbps, bps, rate);
196+ dev_dbg(dev, "Endpoint count=%d\n", nhlt->endpoint_count);
197+
198+ epnt = (struct nhlt_endpoint *)nhlt->desc;
199+
200+ for (i = 0; i < nhlt->endpoint_count; i++) {
201+ if (nhlt_check_ep_match(dev, epnt, bus_id, link_type, dir, dev_type)) {
202+ fmt = (struct nhlt_fmt *)(epnt->config.caps + epnt->config.size);
203+
204+ cfg = nhlt_get_specific_cfg(dev, fmt, num_ch, rate, vbps, bps);
205+ if (cfg)
206+ return cfg;
207+ }
208+
209+ epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
210+ }
211+
212+ return NULL;
213+}
214+EXPORT_SYMBOL(intel_nhlt_get_endpoint_blob);
sound/isa/gus/gus_mem.c+13−9
@@ -24,8 +24,9 @@ void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) · 23 unmodified lines
2424 }
2525 }
2626
27−static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
28− struct snd_gf1_mem_block * block)
27+static struct snd_gf1_mem_block *
28+snd_gf1_mem_xalloc(struct snd_gf1_mem *alloc, struct snd_gf1_mem_block *block,
29+ const char *name)
2930 {
3031 struct snd_gf1_mem_block *pblock, *nblock;
3132
@@ -33,6 +34,12 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, · 1 unmodified line
3334 if (nblock == NULL)
3435 return NULL;
3536 *nblock = *block;
37+ nblock->name = kstrdup(name, GFP_KERNEL);
38+ if (!nblock->name) {
39+ kfree(nblock);
40+ return NULL;
41+ }
42+
3643 pblock = alloc->first;
3744 while (pblock) {
3845 if (pblock->ptr > nblock->ptr) {
@@ -44,7 +51,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, · 5 unmodified lines
4451 else
4552 nblock->prev->next = nblock;
4653 mutex_unlock(&alloc->memory_mutex);
47− return NULL;
54+ return nblock;
4855 }
4956 pblock = pblock->next;
5057 }
@@ -198,8 +205,7 @@ struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owne · 147 unmodified lines
198205 if (share_id != NULL)
199206 memcpy(&block.share_id, share_id, sizeof(block.share_id));
200207 block.owner = owner;
201− block.name = kstrdup(name, GFP_KERNEL);
202− nblock = snd_gf1_mem_xalloc(alloc, &block);
208+ nblock = snd_gf1_mem_xalloc(alloc, &block, name);
203209 snd_gf1_mem_lock(alloc, 1);
204210 return nblock;
205211 }
@@ -236,14 +242,12 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) · 30 unmodified lines
236242 if (gus->gf1.enh_mode) {
237243 block.ptr = 0;
238244 block.size = 1024;
239− block.name = kstrdup("InterWave LFOs", GFP_KERNEL);
240− if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
245+ if (!snd_gf1_mem_xalloc(alloc, &block, "InterWave LFOs"))
241246 return -ENOMEM;
242247 }
243248 block.ptr = gus->gf1.default_voice_address;
244249 block.size = 4;
245− block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL);
246− if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
250+ if (!snd_gf1_mem_xalloc(alloc, &block, "Voice default (NULL's)"))
247251 return -ENOMEM;
248252 #ifdef CONFIG_SND_DEBUG
249253 snd_card_ro_proc_new(gus->card, "gusmem", gus, snd_gf1_mem_info_read);
sound/pci/ac97/ac97_pcm.c+1−1
@@ -231,7 +231,7 @@ static int set_spdif_rate(struct snd_ac97 *ac97, unsigned short rate) · 230 unmodified lines
231231 * If the codec doesn't support VAR, the rate must be 48000 (except
232232 * for SPDIF).
233233 *
234− * The valid registers are AC97_PMC_MIC_ADC_RATE,
234+ * The valid registers are AC97_PCM_MIC_ADC_RATE,
235235 * AC97_PCM_FRONT_DAC_RATE, AC97_PCM_LR_ADC_RATE.
236236 * AC97_PCM_SURR_DAC_RATE and AC97_PCM_LFE_DAC_RATE are accepted
237237 * if the codec supports them.
sound/pci/hda/Kconfig+33−0
@@ -91,6 +91,39 @@ config SND_HDA_PATCH_LOADER · 90 unmodified lines
9191 start up. The "patch" file can be specified via patch module
9292 option, such as patch=hda-init.
9393
94+config SND_HDA_SCODEC_CS35L41
95+ tristate
96+
97+config SND_HDA_SCODEC_CS35L41_I2C
98+ tristate "Build CS35L41 HD-audio side codec support for I2C Bus"
99+ depends on I2C
100+ depends on ACPI
101+ depends on SND_SOC
102+ select SND_HDA_GENERIC
103+ select SND_SOC_CS35L41_LIB
104+ select SND_HDA_SCODEC_CS35L41
105+ help
106+ Say Y or M here to include CS35L41 I2C HD-audio side codec support
107+ in snd-hda-intel driver, such as ALC287.
108+
109+comment "Set to Y if you want auto-loading the side codec driver"
110+ depends on SND_HDA=y && SND_HDA_SCODEC_CS35L41_I2C=m
111+
112+config SND_HDA_SCODEC_CS35L41_SPI
113+ tristate "Build CS35L41 HD-audio codec support for SPI Bus"
114+ depends on SPI_MASTER
115+ depends on ACPI
116+ depends on SND_SOC
117+ select SND_HDA_GENERIC
118+ select SND_SOC_CS35L41_LIB
119+ select SND_HDA_SCODEC_CS35L41
120+ help
121+ Say Y or M here to include CS35L41 SPI HD-audio side codec support
122+ in snd-hda-intel driver, such as ALC287.
123+
124+comment "Set to Y if you want auto-loading the side codec driver"
125+ depends on SND_HDA=y && SND_HDA_SCODEC_CS35L41_SPI=m
126+
94127 config SND_HDA_CODEC_REALTEK
95128 tristate "Build Realtek HD-audio codec support"
96129 select SND_HDA_GENERIC
sound/pci/hda/Makefile+10−0
@@ -27,6 +27,11 @@ snd-hda-codec-conexant-objs := patch_conexant.o · 26 unmodified lines
2727 snd-hda-codec-via-objs := patch_via.o
2828 snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
2929
30+# side codecs
31+snd-hda-scodec-cs35l41-objs := cs35l41_hda.o
32+snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o
33+snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o
34+
3035 # common driver
3136 obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
3237
@@ -45,6 +50,11 @@ obj-$(CONFIG_SND_HDA_CODEC_CONEXANT) += snd-hda-codec-conexant.o · 12 unmodified lines
4550 obj-$(CONFIG_SND_HDA_CODEC_VIA) += snd-hda-codec-via.o
4651 obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
4752
53+# side codecs
54+obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o
55+obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o
56+obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o
57+
4858 # this must be the last entry after codec drivers;
4959 # otherwise the codec patches won't be hooked before the PCI probe
5060 # when built in kernel
sound/pci/hda/cs35l41_hda.c+528−0
@@ -0,0 +1,528 @@
1+// SPDX-License-Identifier: GPL-2.0
2+//
3+// cs35l41.c -- CS35l41 ALSA HDA audio driver
4+//
5+// Copyright 2021 Cirrus Logic, Inc.
6+//
7+// Author: Lucas Tanure <tanureal@opensource.cirrus.com>
8+
9+#include <linux/acpi.h>
10+#include <linux/module.h>
11+#include <sound/hda_codec.h>
12+#include "hda_local.h"
13+#include "hda_auto_parser.h"
14+#include "hda_jack.h"
15+#include "hda_generic.h"
16+#include "hda_component.h"
17+#include "cs35l41_hda.h"
18+
19+static const struct reg_sequence cs35l41_hda_config[] = {
20+ { CS35L41_PLL_CLK_CTRL, 0x00000430 }, //3200000Hz, BCLK Input, PLL_REFCLK_EN = 1
21+ { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, //GLOBAL_FS = 48 kHz
22+ { CS35L41_SP_ENABLES, 0x00010000 }, //ASP_RX1_EN = 1
23+ { CS35L41_SP_RATE_CTRL, 0x00000021 }, //ASP_BCLK_FREQ = 3.072 MHz
24+ { CS35L41_SP_FORMAT, 0x20200200 }, //24 bits, I2S, BCLK Slave, FSYNC Slave
25+ { CS35L41_DAC_PCM1_SRC, 0x00000008 }, //DACPCM1_SRC = ASPRX1
26+ { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, //AMP_VOL_PCM 0.0 dB
27+ { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, //AMP_GAIN_PCM 4.5 dB
28+ { CS35L41_PWR_CTRL2, 0x00000001 }, //AMP_EN = 1
29+};
30+
31+static const struct reg_sequence cs35l41_hda_start_bst[] = {
32+ { CS35L41_PWR_CTRL2, 0x00000021 }, //BST_EN = 10, AMP_EN = 1
33+ { CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1
34+};
35+
36+static const struct reg_sequence cs35l41_hda_stop_bst[] = {
37+ { CS35L41_PWR_CTRL1, 0x00000000, 3000}, // set GLOBAL_EN = 0
38+};
39+
40+// only on amps where GPIO1 is used to control ext. VSPK switch
41+static const struct reg_sequence cs35l41_start_ext_vspk[] = {
42+ { 0x00000040, 0x00000055 },
43+ { 0x00000040, 0x000000AA },
44+ { 0x00007438, 0x00585941 },
45+ { 0x00007414, 0x08C82222 },
46+ { 0x0000742C, 0x00000009 },
47+ { 0x00011008, 0x00008001 },
48+ { 0x0000742C, 0x0000000F },
49+ { 0x0000742C, 0x00000079 },
50+ { 0x00007438, 0x00585941 },
51+ { CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1
52+ { 0x0000742C, 0x000000F9 },
53+ { 0x00007438, 0x00580941 },
54+ { 0x00000040, 0x000000CC },
55+ { 0x00000040, 0x00000033 },
56+};
57+
58+//only on amps where GPIO1 is used to control ext. VSPK switch
59+static const struct reg_sequence cs35l41_stop_ext_vspk[] = {
60+ { 0x00000040, 0x00000055 },
61+ { 0x00000040, 0x000000AA },
62+ { 0x00007438, 0x00585941 },
63+ { 0x00002014, 0x00000000, 3000}, //set GLOBAL_EN = 0
64+ { 0x0000742C, 0x00000009 },
65+ { 0x00007438, 0x00580941 },
66+ { 0x00011008, 0x00000001 },
67+ { 0x0000393C, 0x000000C0, 6000},
68+ { 0x0000393C, 0x00000000 },
69+ { 0x00007414, 0x00C82222 },
70+ { 0x0000742C, 0x00000000 },
71+ { 0x00000040, 0x000000CC },
72+ { 0x00000040, 0x00000033 },
73+};
74+
75+static const struct reg_sequence cs35l41_safe_to_active[] = {
76+ { 0x00000040, 0x00000055 },
77+ { 0x00000040, 0x000000AA },
78+ { 0x0000742C, 0x0000000F },
79+ { 0x0000742C, 0x00000079 },
80+ { 0x00007438, 0x00585941 },
81+ { CS35L41_PWR_CTRL1, 0x00000001, 2000 }, //GLOBAL_EN = 1
82+ { 0x0000742C, 0x000000F9 },
83+ { 0x00007438, 0x00580941 },
84+ { 0x00000040, 0x000000CC },
85+ { 0x00000040, 0x00000033 },
86+};
87+
88+static const struct reg_sequence cs35l41_active_to_safe[] = {
89+ { 0x00000040, 0x00000055 },
90+ { 0x00000040, 0x000000AA },
91+ { 0x00007438, 0x00585941 },
92+ { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, //AMP_VOL_PCM Mute
93+ { CS35L41_PWR_CTRL2, 0x00000000 }, //AMP_EN = 0
94+ { CS35L41_PWR_CTRL1, 0x00000000 },
95+ { 0x0000742C, 0x00000009, 2000 },
96+ { 0x00007438, 0x00580941 },
97+ { 0x00000040, 0x000000CC },
98+ { 0x00000040, 0x00000033 },
99+};
100+
101+static const struct reg_sequence cs35l41_reset_to_safe[] = {
102+ { 0x00000040, 0x00000055 },
103+ { 0x00000040, 0x000000AA },
104+ { 0x00007438, 0x00585941 },
105+ { 0x00007414, 0x08C82222 },
106+ { 0x0000742C, 0x00000009 },
107+ { 0x00000040, 0x000000CC },
108+ { 0x00000040, 0x00000033 },
109+};
110+
111+static const struct cs35l41_hda_reg_sequence cs35l41_hda_reg_seq_no_bst = {
112+ .probe = cs35l41_reset_to_safe,
113+ .num_probe = ARRAY_SIZE(cs35l41_reset_to_safe),
114+ .open = cs35l41_hda_config,
115+ .num_open = ARRAY_SIZE(cs35l41_hda_config),
116+ .prepare = cs35l41_safe_to_active,
117+ .num_prepare = ARRAY_SIZE(cs35l41_safe_to_active),
118+ .cleanup = cs35l41_active_to_safe,
119+ .num_cleanup = ARRAY_SIZE(cs35l41_active_to_safe),
120+};
121+
122+static const struct cs35l41_hda_reg_sequence cs35l41_hda_reg_seq_ext_bst = {
123+ .open = cs35l41_hda_config,
124+ .num_open = ARRAY_SIZE(cs35l41_hda_config),
125+ .prepare = cs35l41_start_ext_vspk,
126+ .num_prepare = ARRAY_SIZE(cs35l41_start_ext_vspk),
127+ .cleanup = cs35l41_stop_ext_vspk,
128+ .num_cleanup = ARRAY_SIZE(cs35l41_stop_ext_vspk),
129+};
130+
131+static const struct cs35l41_hda_reg_sequence cs35l41_hda_reg_seq_int_bst = {
132+ .open = cs35l41_hda_config,
133+ .num_open = ARRAY_SIZE(cs35l41_hda_config),
134+ .prepare = cs35l41_hda_start_bst,
135+ .num_prepare = ARRAY_SIZE(cs35l41_hda_start_bst),
136+ .cleanup = cs35l41_hda_stop_bst,
137+ .num_cleanup = ARRAY_SIZE(cs35l41_hda_stop_bst),
138+};
139+
140+static void cs35l41_hda_playback_hook(struct device *dev, int action)
141+{
142+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
143+ const struct cs35l41_hda_reg_sequence *reg_seq = cs35l41->reg_seq;
144+ struct regmap *reg = cs35l41->regmap;
145+ int ret = 0;
146+
147+ switch (action) {
148+ case HDA_GEN_PCM_ACT_OPEN:
149+ if (reg_seq->open)
150+ ret = regmap_multi_reg_write(reg, reg_seq->open, reg_seq->num_open);
151+ break;
152+ case HDA_GEN_PCM_ACT_PREPARE:
153+ if (reg_seq->prepare)
154+ ret = regmap_multi_reg_write(reg, reg_seq->prepare, reg_seq->num_prepare);
155+ break;
156+ case HDA_GEN_PCM_ACT_CLEANUP:
157+ if (reg_seq->cleanup)
158+ ret = regmap_multi_reg_write(reg, reg_seq->cleanup, reg_seq->num_cleanup);
159+ break;
160+ case HDA_GEN_PCM_ACT_CLOSE:
161+ if (reg_seq->close)
162+ ret = regmap_multi_reg_write(reg, reg_seq->close, reg_seq->num_close);
163+ break;
164+ }
165+
166+ if (ret)
167+ dev_warn(cs35l41->dev, "Failed to apply multi reg write: %d\n", ret);
168+
169+}
170+
171+static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsigned int *tx_slot,
172+ unsigned int rx_num, unsigned int *rx_slot)
173+{
174+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
175+
176+ return cs35l41_set_channels(cs35l41->dev, cs35l41->regmap, tx_num, tx_slot, rx_num,
177+ rx_slot);
178+}
179+
180+static int cs35l41_hda_bind(struct device *dev, struct device *master, void *master_data)
181+{
182+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
183+ struct hda_component *comps = master_data;
184+
185+ if (comps && cs35l41->index >= 0 && cs35l41->index < HDA_MAX_COMPONENTS)
186+ comps = &comps[cs35l41->index];
187+ else
188+ return -EINVAL;
189+
190+ if (!comps->dev) {
191+ comps->dev = dev;
192+ strscpy(comps->name, dev_name(dev), sizeof(comps->name));
193+ comps->playback_hook = cs35l41_hda_playback_hook;
194+ comps->set_channel_map = cs35l41_hda_channel_map;
195+ return 0;
196+ }
197+
198+ return -EBUSY;
199+}
200+
201+static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *master_data)
202+{
203+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
204+ struct hda_component *comps = master_data;
205+
206+ if (comps[cs35l41->index].dev == dev)
207+ memset(&comps[cs35l41->index], 0, sizeof(*comps));
208+}
209+
210+static const struct component_ops cs35l41_hda_comp_ops = {
211+ .bind = cs35l41_hda_bind,
212+ .unbind = cs35l41_hda_unbind,
213+};
214+
215+static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41,
216+ const struct cs35l41_hda_hw_config *hw_cfg)
217+{
218+ bool internal_boost = false;
219+ int ret;
220+
221+ if (!hw_cfg) {
222+ cs35l41->reg_seq = &cs35l41_hda_reg_seq_no_bst;
223+ return 0;
224+ }
225+
226+ if (hw_cfg->bst_ind || hw_cfg->bst_cap || hw_cfg->bst_ipk)
227+ internal_boost = true;
228+
229+ switch (hw_cfg->gpio1_func) {
230+ case CS35l41_VSPK_SWITCH:
231+ regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
232+ CS35L41_GPIO1_CTRL_MASK, 1 << CS35L41_GPIO1_CTRL_SHIFT);
233+ break;
234+ case CS35l41_SYNC:
235+ regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
236+ CS35L41_GPIO1_CTRL_MASK, 2 << CS35L41_GPIO1_CTRL_SHIFT);
237+ break;
238+ }
239+
240+ switch (hw_cfg->gpio2_func) {
241+ case CS35L41_INTERRUPT:
242+ regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
243+ CS35L41_GPIO2_CTRL_MASK, 2 << CS35L41_GPIO2_CTRL_SHIFT);
244+ break;
245+ }
246+
247+ if (internal_boost) {
248+ cs35l41->reg_seq = &cs35l41_hda_reg_seq_int_bst;
249+ if (!(hw_cfg->bst_ind && hw_cfg->bst_cap && hw_cfg->bst_ipk))
250+ return -EINVAL;
251+ ret = cs35l41_boost_config(cs35l41->dev, cs35l41->regmap,
252+ hw_cfg->bst_ind, hw_cfg->bst_cap, hw_cfg->bst_ipk);
253+ if (ret)
254+ return ret;
255+ } else {
256+ cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst;
257+ }
258+
259+ ret = cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned int *)&hw_cfg->spk_pos);
260+ if (ret)
261+ return ret;
262+
263+ return 0;
264+}
265+
266+static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41,
267+ const char *hid, int id)
268+{
269+ struct cs35l41_hda_hw_config *hw_cfg;
270+ u32 values[HDA_MAX_COMPONENTS];
271+ struct acpi_device *adev;
272+ struct device *acpi_dev;
273+ char *property;
274+ size_t nval;
275+ int i, ret;
276+
277+ adev = acpi_dev_get_first_match_dev(hid, NULL, -1);
278+ if (!adev) {
279+ dev_err(cs35l41->dev, "Failed to find an ACPI device for %s\n", hid);
280+ return ERR_PTR(-ENODEV);
281+ }
282+
283+ acpi_dev = get_device(acpi_get_first_physical_node(adev));
284+ acpi_dev_put(adev);
285+
286+ property = "cirrus,dev-index";
287+ ret = device_property_count_u32(acpi_dev, property);
288+ if (ret <= 0)
289+ goto no_acpi_dsd;
290+
291+ if (ret > ARRAY_SIZE(values)) {
292+ ret = -EINVAL;
293+ goto err;
294+ }
295+ nval = ret;
296+
297+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
298+ if (ret)
299+ goto err;
300+
301+ cs35l41->index = -1;
302+ for (i = 0; i < nval; i++) {
303+ if (values[i] == id) {
304+ cs35l41->index = i;
305+ break;
306+ }
307+ }
308+ if (cs35l41->index == -1) {
309+ dev_err(cs35l41->dev, "No index found in %s\n", property);
310+ ret = -ENODEV;
311+ goto err;
312+ }
313+
314+ /* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */
315+ cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
316+ GPIOD_OUT_LOW, "cs35l41-reset");
317+
318+ hw_cfg = kzalloc(sizeof(*hw_cfg), GFP_KERNEL);
319+ if (!hw_cfg) {
320+ ret = -ENOMEM;
321+ goto err;
322+ }
323+
324+ property = "cirrus,speaker-position";
325+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
326+ if (ret)
327+ goto err_free;
328+ hw_cfg->spk_pos = values[cs35l41->index];
329+
330+ property = "cirrus,gpio1-func";
331+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
332+ if (ret)
333+ goto err_free;
334+ hw_cfg->gpio1_func = values[cs35l41->index];
335+
336+ property = "cirrus,gpio2-func";
337+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
338+ if (ret)
339+ goto err_free;
340+ hw_cfg->gpio2_func = values[cs35l41->index];
341+
342+ property = "cirrus,boost-peak-milliamp";
343+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
344+ if (ret == 0)
345+ hw_cfg->bst_ipk = values[cs35l41->index];
346+
347+ property = "cirrus,boost-ind-nanohenry";
348+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
349+ if (ret == 0)
350+ hw_cfg->bst_ind = values[cs35l41->index];
351+
352+ property = "cirrus,boost-cap-microfarad";
353+ ret = device_property_read_u32_array(acpi_dev, property, values, nval);
354+ if (ret == 0)
355+ hw_cfg->bst_cap = values[cs35l41->index];
356+
357+ put_device(acpi_dev);
358+
359+ return hw_cfg;
360+
361+err_free:
362+ kfree(hw_cfg);
363+err:
364+ put_device(acpi_dev);
365+ dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret);
366+
367+ return ERR_PTR(ret);
368+
369+no_acpi_dsd:
370+ /*
371+ * Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work.
372+ * And devices created by i2c-multi-instantiate don't have their device struct pointing to
373+ * the correct fwnode, so acpi_dev must be used here
374+ * And devm functions expect that the device requesting the resource has the correct
375+ * fwnode
376+ */
377+ if (strncmp(hid, "CLSA0100", 8) != 0)
378+ return ERR_PTR(-EINVAL);
379+
380+ /* check I2C address to assign the index */
381+ cs35l41->index = id == 0x40 ? 0 : 1;
382+ cs35l41->reset_gpio = gpiod_get_index(acpi_dev, NULL, 0, GPIOD_OUT_HIGH);
383+ cs35l41->vspk_always_on = true;
384+ put_device(acpi_dev);
385+
386+ return NULL;
387+}
388+
389+int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
390+ struct regmap *regmap)
391+{
392+ unsigned int int_sts, regid, reg_revid, mtl_revid, chipid, int_status;
393+ struct cs35l41_hda_hw_config *acpi_hw_cfg;
394+ struct cs35l41_hda *cs35l41;
395+ int ret;
396+
397+ if (IS_ERR(regmap))
398+ return PTR_ERR(regmap);
399+
400+ cs35l41 = devm_kzalloc(dev, sizeof(*cs35l41), GFP_KERNEL);
401+ if (!cs35l41)
402+ return -ENOMEM;
403+
404+ cs35l41->dev = dev;
405+ cs35l41->irq = irq;
406+ cs35l41->regmap = regmap;
407+ dev_set_drvdata(dev, cs35l41);
408+
409+ acpi_hw_cfg = cs35l41_hda_read_acpi(cs35l41, device_name, id);
410+ if (IS_ERR(acpi_hw_cfg))
411+ return PTR_ERR(acpi_hw_cfg);
412+
413+ if (IS_ERR(cs35l41->reset_gpio)) {
414+ ret = PTR_ERR(cs35l41->reset_gpio);
415+ cs35l41->reset_gpio = NULL;
416+ if (ret == -EBUSY) {
417+ dev_info(cs35l41->dev, "Reset line busy, assuming shared reset\n");
418+ } else {
419+ if (ret != -EPROBE_DEFER)
420+ dev_err(cs35l41->dev, "Failed to get reset GPIO: %d\n", ret);
421+ goto err;
422+ }
423+ }
424+ if (cs35l41->reset_gpio) {
425+ usleep_range(2000, 2100);
426+ gpiod_set_value_cansleep(cs35l41->reset_gpio, 1);
427+ }
428+
429+ usleep_range(2000, 2100);
430+
431+ ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS4, int_status,
432+ int_status & CS35L41_OTP_BOOT_DONE, 1000, 100000);
433+ if (ret) {
434+ dev_err(cs35l41->dev, "Failed waiting for OTP_BOOT_DONE: %d\n", ret);
435+ goto err;
436+ }
437+
438+ ret = regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_sts);
439+ if (ret || (int_sts & CS35L41_OTP_BOOT_ERR)) {
440+ dev_err(cs35l41->dev, "OTP Boot error\n");
441+ ret = -EIO;
442+ goto err;
443+ }
444+
445+ ret = regmap_read(cs35l41->regmap, CS35L41_DEVID, &regid);
446+ if (ret) {
447+ dev_err(cs35l41->dev, "Get Device ID failed: %d\n", ret);
448+ goto err;
449+ }
450+
451+ ret = regmap_read(cs35l41->regmap, CS35L41_REVID, &reg_revid);
452+ if (ret) {
453+ dev_err(cs35l41->dev, "Get Revision ID failed: %d\n", ret);
454+ goto err;
455+ }
456+
457+ mtl_revid = reg_revid & CS35L41_MTLREVID_MASK;
458+
459+ chipid = (mtl_revid % 2) ? CS35L41R_CHIP_ID : CS35L41_CHIP_ID;
460+ if (regid != chipid) {
461+ dev_err(cs35l41->dev, "CS35L41 Device ID (%X). Expected ID %X\n", regid, chipid);
462+ ret = -ENODEV;
463+ goto err;
464+ }
465+
466+ ret = cs35l41_register_errata_patch(cs35l41->dev, cs35l41->regmap, reg_revid);
467+ if (ret)
468+ goto err;
469+
470+ ret = cs35l41_otp_unpack(cs35l41->dev, cs35l41->regmap);
471+ if (ret) {
472+ dev_err(cs35l41->dev, "OTP Unpack failed: %d\n", ret);
473+ goto err;
474+ }
475+
476+ ret = cs35l41_hda_apply_properties(cs35l41, acpi_hw_cfg);
477+ if (ret)
478+ goto err;
479+ kfree(acpi_hw_cfg);
480+ acpi_hw_cfg = NULL;
481+
482+ if (cs35l41->reg_seq->probe) {
483+ ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe,
484+ cs35l41->reg_seq->num_probe);
485+ if (ret) {
486+ dev_err(cs35l41->dev, "Fail to apply probe reg patch: %d\n", ret);
487+ goto err;
488+ }
489+ }
490+
491+ ret = component_add(cs35l41->dev, &cs35l41_hda_comp_ops);
492+ if (ret) {
493+ dev_err(cs35l41->dev, "Register component failed: %d\n", ret);
494+ goto err;
495+ }
496+
497+ dev_info(cs35l41->dev, "Cirrus Logic CS35L41 (%x), Revision: %02X\n", regid, reg_revid);
498+
499+ return 0;
500+
501+err:
502+ kfree(acpi_hw_cfg);
503+ if (!cs35l41->vspk_always_on)
504+ gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
505+ gpiod_put(cs35l41->reset_gpio);
506+
507+ return ret;
508+}
509+EXPORT_SYMBOL_GPL(cs35l41_hda_probe);
510+
511+int cs35l41_hda_remove(struct device *dev)
512+{
513+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
514+
515+ component_del(cs35l41->dev, &cs35l41_hda_comp_ops);
516+
517+ if (!cs35l41->vspk_always_on)
518+ gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
519+ gpiod_put(cs35l41->reset_gpio);
520+
521+ return 0;
522+}
523+EXPORT_SYMBOL_GPL(cs35l41_hda_remove);
524+
525+
526+MODULE_DESCRIPTION("CS35L41 HDA Driver");
527+MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, <tanureal@opensource.cirrus.com>");
528+MODULE_LICENSE("GPL");
sound/pci/hda/cs35l41_hda.h+69−0
@@ -0,0 +1,69 @@
1+/* SPDX-License-Identifier: GPL-2.0
2+ *
3+ * cs35l41_hda.h -- CS35L41 ALSA HDA audio driver
4+ *
5+ * Copyright 2021 Cirrus Logic, Inc.
6+ *
7+ * Author: Lucas Tanure <tanureal@opensource.cirrus.com>
8+ */
9+
10+#ifndef __CS35L41_HDA_H__
11+#define __CS35L41_HDA_H__
12+
13+#include <linux/regulator/consumer.h>
14+#include <linux/gpio/consumer.h>
15+#include <linux/device.h>
16+#include <sound/cs35l41.h>
17+
18+enum cs35l41_hda_spk_pos {
19+ CS35l41_LEFT,
20+ CS35l41_RIGHT,
21+};
22+
23+enum cs35l41_hda_gpio_function {
24+ CS35L41_NOT_USED,
25+ CS35l41_VSPK_SWITCH,
26+ CS35L41_INTERRUPT,
27+ CS35l41_SYNC,
28+};
29+
30+struct cs35l41_hda_reg_sequence {
31+ const struct reg_sequence *probe;
32+ unsigned int num_probe;
33+ const struct reg_sequence *open;
34+ unsigned int num_open;
35+ const struct reg_sequence *prepare;
36+ unsigned int num_prepare;
37+ const struct reg_sequence *cleanup;
38+ unsigned int num_cleanup;
39+ const struct reg_sequence *close;
40+ unsigned int num_close;
41+};
42+
43+struct cs35l41_hda_hw_config {
44+ unsigned int spk_pos;
45+ unsigned int gpio1_func;
46+ unsigned int gpio2_func;
47+ int bst_ind;
48+ int bst_ipk;
49+ int bst_cap;
50+};
51+
52+struct cs35l41_hda {
53+ struct device *dev;
54+ struct regmap *regmap;
55+ struct gpio_desc *reset_gpio;
56+ const struct cs35l41_hda_reg_sequence *reg_seq;
57+
58+ int irq;
59+ int index;
60+
61+ /* Don't put the AMP in reset of VSPK can not be turned off */
62+ bool vspk_always_on;
63+};
64+
65+int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
66+ struct regmap *regmap);
67+int cs35l41_hda_remove(struct device *dev);
68+
69+#endif /*__CS35L41_HDA_H__*/
sound/pci/hda/cs35l41_hda_i2c.c+66−0
@@ -0,0 +1,66 @@
1+// SPDX-License-Identifier: GPL-2.0
2+//
3+// cs35l41.c -- CS35l41 HDA I2C driver
4+//
5+// Copyright 2021 Cirrus Logic, Inc.
6+//
7+// Author: Lucas Tanure <tanureal@opensource.cirrus.com>
8+
9+#include <linux/module.h>
10+#include <linux/i2c.h>
11+#include <linux/acpi.h>
12+
13+#include "cs35l41_hda.h"
14+
15+static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device_id *id)
16+{
17+ const char *device_name;
18+
19+ /* Compare against the device name so it works for I2C, normal ACPI
20+ * and for ACPI by i2c-multi-instantiate matching cases
21+ */
22+ if (strstr(dev_name(&clt->dev), "CLSA0100"))
23+ device_name = "CLSA0100";
24+ else if (strstr(dev_name(&clt->dev), "CSC3551"))
25+ device_name = "CSC3551";
26+ else
27+ return -ENODEV;
28+
29+ return cs35l41_hda_probe(&clt->dev, device_name, clt->addr, clt->irq,
30+ devm_regmap_init_i2c(clt, &cs35l41_regmap_i2c));
31+}
32+
33+static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
34+{
35+ return cs35l41_hda_remove(&clt->dev);
36+}
37+
38+static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
39+ { "cs35l41-hda", 0 },
40+ {}
41+};
42+
43+#ifdef CONFIG_ACPI
44+static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
45+ {"CLSA0100", 0 },
46+ {"CSC3551", 0 },
47+ { },
48+};
49+MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
50+#endif
51+
52+static struct i2c_driver cs35l41_i2c_driver = {
53+ .driver = {
54+ .name = "cs35l41-hda",
55+ .acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
56+ },
57+ .id_table = cs35l41_hda_i2c_id,
58+ .probe = cs35l41_hda_i2c_probe,
59+ .remove = cs35l41_hda_i2c_remove,
60+};
61+
62+module_i2c_driver(cs35l41_i2c_driver);
63+
64+MODULE_DESCRIPTION("HDA CS35L41 driver");
65+MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>");
66+MODULE_LICENSE("GPL");
sound/pci/hda/cs35l41_hda_spi.c+63−0
@@ -0,0 +1,63 @@
1+// SPDX-License-Identifier: GPL-2.0
2+//
3+// cs35l41.c -- CS35l41 HDA SPI driver
4+//
5+// Copyright 2021 Cirrus Logic, Inc.
6+//
7+// Author: Lucas Tanure <tanureal@opensource.cirrus.com>
8+
9+#include <linux/acpi.h>
10+#include <linux/module.h>
11+#include <linux/spi/spi.h>
12+
13+#include "cs35l41_hda.h"
14+
15+static int cs35l41_hda_spi_probe(struct spi_device *spi)
16+{
17+ const char *device_name;
18+
19+ /* Compare against the device name so it works for SPI, normal ACPI
20+ * and for ACPI by spi-multi-instantiate matching cases
21+ */
22+ if (strstr(dev_name(&spi->dev), "CSC3551"))
23+ device_name = "CSC3551";
24+ else
25+ return -ENODEV;
26+
27+ return cs35l41_hda_probe(&spi->dev, device_name, spi->chip_select, spi->irq,
28+ devm_regmap_init_spi(spi, &cs35l41_regmap_spi));
29+}
30+
31+static int cs35l41_hda_spi_remove(struct spi_device *spi)
32+{
33+ return cs35l41_hda_remove(&spi->dev);
34+}
35+
36+static const struct spi_device_id cs35l41_hda_spi_id[] = {
37+ { "cs35l41-hda", 0 },
38+ {}
39+};
40+
41+#ifdef CONFIG_ACPI
42+static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
43+ { "CSC3551", 0 },
44+ {},
45+};
46+MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
47+#endif
48+
49+static struct spi_driver cs35l41_spi_driver = {
50+ .driver = {
51+ .name = "cs35l41_hda",
52+ .acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
53+ },
54+ .id_table = cs35l41_hda_spi_id,
55+ .probe = cs35l41_hda_spi_probe,
56+ .remove = cs35l41_hda_spi_remove,
57+};
58+
59+module_spi_driver(cs35l41_spi_driver);
60+
61+MODULE_DESCRIPTION("HDA CS35L41 driver");
62+MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>");
63+MODULE_LICENSE("GPL");
sound/pci/hda/hda_auto_parser.c+1−5
@@ -92,14 +92,10 @@ static int compare_input_type(const void *ap, const void *bp) · 91 unmodified lines
9292 */
9393 static void reorder_outputs(unsigned int nums, hda_nid_t *pins)
9494 {
95− hda_nid_t nid;
96−
9795 switch (nums) {
9896 case 3:
9997 case 4:
100− nid = pins[1];
101− pins[1] = pins[2];
102− pins[2] = nid;
98+ swap(pins[1], pins[2]);
10399 break;
104100 }
105101 }
sound/pci/hda/hda_bind.c+7−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <sound/core.h>
1515 #include <sound/hda_codec.h>
1616 #include "hda_local.h"
17+#include "hda_jack.h"
1718
1819 /*
1920 * find a matching codec id
@@ -156,6 +157,12 @@ static int hda_codec_driver_remove(struct device *dev) · 136 unmodified lines
156157 return codec->bus->core.ext_ops->hdev_detach(&codec->core);
157158 }
158159
160+ refcount_dec(&codec->pcm_ref);
161+ snd_hda_codec_disconnect_pcms(codec);
162+ snd_hda_jack_tbl_disconnect(codec);
163+ wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
164+ snd_power_sync_ref(codec->bus->card);
165+
159166 if (codec->patch_ops.free)
160167 codec->patch_ops.free(codec);
161168 snd_hda_codec_cleanup_for_unbind(codec);
sound/pci/hda/hda_codec.c+29−16
@@ -703,20 +703,10 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) · 702 unmodified lines
703703 /*
704704 * PCM device
705705 */
706−static void release_pcm(struct kref *kref)
707−{
708− struct hda_pcm *pcm = container_of(kref, struct hda_pcm, kref);
709−
710− if (pcm->pcm)
711− snd_device_free(pcm->codec->card, pcm->pcm);
712− clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);
713− kfree(pcm->name);
714− kfree(pcm);
715−}
716−
717706 void snd_hda_codec_pcm_put(struct hda_pcm *pcm)
718707 {
719− kref_put(&pcm->kref, release_pcm);
708+ if (refcount_dec_and_test(&pcm->codec->pcm_ref))
709+ wake_up(&pcm->codec->remove_sleep);
720710 }
721711 EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_put);
722712
@@ -731,7 +721,6 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec, · 8 unmodified lines
731721 return NULL;
732722
733723 pcm->codec = codec;
734− kref_init(&pcm->kref);
735724 va_start(args, fmt);
736725 pcm->name = kvasprintf(GFP_KERNEL, fmt, args);
737726 va_end(args);
@@ -741,6 +730,7 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec, · 3 unmodified lines
741730 }
742731
743732 list_add_tail(&pcm->list, &codec->pcm_list_head);
733+ refcount_inc(&codec->pcm_ref);
744734 return pcm;
745735 }
746736 EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_new);
@@ -748,15 +738,31 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_new); · 1 unmodified line
748738 /*
749739 * codec destructor
750740 */
741+void snd_hda_codec_disconnect_pcms(struct hda_codec *codec)
742+{
743+ struct hda_pcm *pcm;
744+
745+ list_for_each_entry(pcm, &codec->pcm_list_head, list) {
746+ if (pcm->disconnected)
747+ continue;
748+ if (pcm->pcm)
749+ snd_device_disconnect(codec->card, pcm->pcm);
750+ snd_hda_codec_pcm_put(pcm);
751+ pcm->disconnected = 1;
752+ }
753+}
754+
751755 static void codec_release_pcms(struct hda_codec *codec)
752756 {
753757 struct hda_pcm *pcm, *n;
754758
755759 list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list) {
756− list_del_init(&pcm->list);
760+ list_del(&pcm->list);
757761 if (pcm->pcm)
758− snd_device_disconnect(codec->card, pcm->pcm);
759− snd_hda_codec_pcm_put(pcm);
762+ snd_device_free(pcm->codec->card, pcm->pcm);
763+ clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);
764+ kfree(pcm->name);
765+ kfree(pcm);
760766 }
761767 }
762768
@@ -769,6 +775,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec) · 6 unmodified lines
769775 codec->registered = 0;
770776 }
771777
778+ snd_hda_codec_disconnect_pcms(codec);
772779 cancel_delayed_work_sync(&codec->jackpoll_work);
773780 if (!codec->in_freeing)
774781 snd_hda_ctls_clear(codec);
@@ -792,6 +799,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec) · 17 unmodified lines
792799 remove_conn_list(codec);
793800 snd_hdac_regmap_exit(&codec->core);
794801 codec->configured = 0;
802+ refcount_set(&codec->pcm_ref, 1); /* reset refcount */
795803 }
796804 EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_for_unbind);
797805
@@ -958,6 +966,8 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, · 160 unmodified lines
958966 snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8);
959967 INIT_LIST_HEAD(&codec->conn_list);
960968 INIT_LIST_HEAD(&codec->pcm_list_head);
969+ refcount_set(&codec->pcm_ref, 1);
970+ init_waitqueue_head(&codec->remove_sleep);
961971
962972 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
963973 codec->depop_delay = -1;
@@ -1727,8 +1737,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) · 763 unmodified lines
17271737 {
17281738 int i;
17291739 struct hda_nid_item *items = codec->mixers.list;
1740+
1741+ down_write(&codec->card->controls_rwsem);
17301742 for (i = 0; i < codec->mixers.used; i++)
17311743 snd_ctl_remove(codec->card, items[i].kctl);
1744+ up_write(&codec->card->controls_rwsem);
17321745 snd_array_free(&codec->mixers);
17331746 snd_array_free(&codec->nids);
17341747 }
sound/pci/hda/hda_component.h+20−0
@@ -0,0 +1,20 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/*
3+ * HD audio Component Binding Interface
4+ *
5+ * Copyright (C) 2021 Cirrus Logic, Inc. and
6+ * Cirrus Logic International Semiconductor Ltd.
7+ */
8+
9+#include <linux/component.h>
10+
11+#define HDA_MAX_COMPONENTS 4
12+#define HDA_MAX_NAME_SIZE 50
13+
14+struct hda_component {
15+ struct device *dev;
16+ char name[HDA_MAX_NAME_SIZE];
17+ void (*playback_hook)(struct device *dev, int action);
18+ int (*set_channel_map)(struct device *dev, unsigned int rx_num, unsigned int *rx_slot,
19+ unsigned int tx_num, unsigned int *tx_slot);
20+};
sound/pci/hda/hda_controller.c+0−1
@@ -504,7 +504,6 @@ static int azx_get_time_info(struct snd_pcm_substream *substream, · 503 unmodified lines
504504 snd_pcm_gettime(substream->runtime, system_ts);
505505
506506 nsec = timecounter_read(&azx_dev->core.tc);
507− nsec = div_u64(nsec, 3); /* can be optimized */
508507 if (audio_tstamp_config->report_delay)
509508 nsec = azx_adjust_codec_delay(substream, nsec);
510509
sound/pci/hda/hda_generic.h+1−1
@@ -183,7 +183,7 @@ struct hda_gen_spec { · 182 unmodified lines
183183 struct automic_entry am_entry[MAX_AUTO_MIC_PINS];
184184
185185 /* for pin sensing */
186− /* current status; set in hda_geneic.c */
186+ /* current status; set in hda_generic.c */
187187 unsigned int hp_jack_present:1;
188188 unsigned int line_jack_present:1;
189189 unsigned int speaker_muted:1; /* current status of speaker mute */
sound/pci/hda/hda_intel.c+10−1
@@ -1350,8 +1350,12 @@ static void azx_free(struct azx *chip) · 1349 unmodified lines
13501350 if (hda->freed)
13511351 return;
13521352
1353− if (azx_has_pm_runtime(chip) && chip->running)
1353+ if (azx_has_pm_runtime(chip) && chip->running) {
13541354 pm_runtime_get_noresume(&pci->dev);
1355+ pm_runtime_forbid(&pci->dev);
1356+ pm_runtime_dont_use_autosuspend(&pci->dev);
1357+ }
1358+
13551359 chip->running = 0;
13561360
13571361 azx_del_card_list(chip);
@@ -2489,9 +2493,14 @@ static const struct pci_device_id azx_ids[] = { · 1131 unmodified lines
24892493 /* Alderlake-P */
24902494 { PCI_DEVICE(0x8086, 0x51c8),
24912495 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2496+ { PCI_DEVICE(0x8086, 0x51cd),
2497+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
24922498 /* Alderlake-M */
24932499 { PCI_DEVICE(0x8086, 0x51cc),
24942500 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2501+ /* Alderlake-N */
2502+ { PCI_DEVICE(0x8086, 0x54c8),
2503+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
24952504 /* Elkhart Lake */
24962505 { PCI_DEVICE(0x8086, 0x4b55),
24972506 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
sound/pci/hda/hda_jack.c+11−0
@@ -158,6 +158,17 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id) · 157 unmodified lines
158158 return jack;
159159 }
160160
161+void snd_hda_jack_tbl_disconnect(struct hda_codec *codec)
162+{
163+ struct hda_jack_tbl *jack = codec->jacktbl.list;
164+ int i;
165+
166+ for (i = 0; i < codec->jacktbl.used; i++, jack++) {
167+ if (!codec->bus->shutdown && jack->jack)
168+ snd_device_disconnect(codec->card, jack->jack);
169+ }
170+}
171+
161172 void snd_hda_jack_tbl_clear(struct hda_codec *codec)
162173 {
163174 struct hda_jack_tbl *jack = codec->jacktbl.list;
sound/pci/hda/hda_jack.h+1−0
@@ -69,6 +69,7 @@ struct hda_jack_tbl * · 68 unmodified lines
6969 snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec,
7070 unsigned char tag, int dev_id);
7171
72+void snd_hda_jack_tbl_disconnect(struct hda_codec *codec);
7273 void snd_hda_jack_tbl_clear(struct hda_codec *codec);
7374
7475 void snd_hda_jack_set_dirty_all(struct hda_codec *codec);
sound/pci/hda/hda_local.h+1−0
@@ -137,6 +137,7 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name, · 136 unmodified lines
137137 int snd_hda_codec_reset(struct hda_codec *codec);
138138 void snd_hda_codec_register(struct hda_codec *codec);
139139 void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec);
140+void snd_hda_codec_disconnect_pcms(struct hda_codec *codec);
140141
141142 #define snd_hda_regmap_sync(codec) snd_hdac_regmap_sync(&(codec)->core)
142143
sound/pci/hda/hda_tegra.c+34−9
@@ -68,14 +68,20 @@ · 67 unmodified lines
6868 */
6969 #define TEGRA194_NUM_SDO_LINES 4
7070
71+struct hda_tegra_soc {
72+ bool has_hda2codec_2x_reset;
73+};
74+
7175 struct hda_tegra {
7276 struct azx chip;
7377 struct device *dev;
74− struct reset_control *reset;
78+ struct reset_control_bulk_data resets[3];
7579 struct clk_bulk_data clocks[3];
80+ unsigned int nresets;
7681 unsigned int nclocks;
7782 void __iomem *regs;
7883 struct work_struct probe_work;
84+ const struct hda_tegra_soc *soc;
7985 };
8086
8187 #ifdef CONFIG_PM
@@ -170,7 +176,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) · 88 unmodified lines
170176 int rc;
171177
172178 if (!chip->running) {
173− rc = reset_control_assert(hda->reset);
179+ rc = reset_control_bulk_assert(hda->nresets, hda->resets);
174180 if (rc)
175181 return rc;
176182 }
@@ -187,7 +193,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) · 10 unmodified lines
187193 } else {
188194 usleep_range(10, 100);
189195
190− rc = reset_control_deassert(hda->reset);
196+ rc = reset_control_bulk_deassert(hda->nresets, hda->resets);
191197 if (rc)
192198 return rc;
193199 }
@@ -427,9 +433,17 @@ static int hda_tegra_create(struct snd_card *card, · 233 unmodified lines
427433 return 0;
428434 }
429435
436+static const struct hda_tegra_soc tegra30_data = {
437+ .has_hda2codec_2x_reset = true,
438+};
439+
440+static const struct hda_tegra_soc tegra194_data = {
441+ .has_hda2codec_2x_reset = false,
442+};
443+
430444 static const struct of_device_id hda_tegra_match[] = {
431− { .compatible = "nvidia,tegra30-hda" },
432− { .compatible = "nvidia,tegra194-hda" },
445+ { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data },
446+ { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data },
433447 {},
434448 };
435449 MODULE_DEVICE_TABLE(of, hda_tegra_match);
@@ -449,6 +463,8 @@ static int hda_tegra_probe(struct platform_device *pdev) · 13 unmodified lines
449463 hda->dev = &pdev->dev;
450464 chip = &hda->chip;
451465
466+ hda->soc = of_device_get_match_data(&pdev->dev);
467+
452468 err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
453469 THIS_MODULE, 0, &card);
454470 if (err < 0) {
@@ -456,11 +472,20 @@ static int hda_tegra_probe(struct platform_device *pdev) · 1 unmodified line
456472 return err;
457473 }
458474
459− hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev);
460− if (IS_ERR(hda->reset)) {
461− err = PTR_ERR(hda->reset);
475+ hda->resets[hda->nresets++].id = "hda";
476+ hda->resets[hda->nresets++].id = "hda2hdmi";
477+ /*
478+ * "hda2codec_2x" reset is not present on Tegra194. Though DT would
479+ * be updated to reflect this, but to have backward compatibility
480+ * below is necessary.
481+ */
482+ if (hda->soc->has_hda2codec_2x_reset)
483+ hda->resets[hda->nresets++].id = "hda2codec_2x";
484+
485+ err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets,
486+ hda->resets);
487+ if (err)
462488 goto out_free;
463− }
464489
465490 hda->clocks[hda->nclocks++].id = "hda";
466491 hda->clocks[hda->nclocks++].id = "hda2hdmi";
sound/pci/hda/patch_cs8409-tables.c+3−0
@@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = { · 251 unmodified lines
252252 .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq),
253253 .hp_jack_in = 0,
254254 .mic_jack_in = 0,
255+ .force_status_change = 1,
255256 .paged = 1,
256257 .suspended = 1,
257258 .no_type_dect = 0,
@@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = { · 185 unmodified lines
443444 .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq),
444445 .hp_jack_in = 0,
445446 .mic_jack_in = 0,
447+ .force_status_change = 1,
446448 .paged = 1,
447449 .suspended = 1,
448450 .no_type_dect = 0,
@@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = { · 7 unmodified lines
456458 .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq),
457459 .hp_jack_in = 0,
458460 .mic_jack_in = 0,
461+ .force_status_change = 1,
459462 .paged = 1,
460463 .suspended = 1,
461464 .no_type_dect = 1,
sound/pci/hda/patch_cs8409.c+6−3
@@ -628,15 +628,17 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42) · 627 unmodified lines
628628 cs8409_i2c_write(cs42l42, 0x1b74, 0x07);
629629 cs8409_i2c_write(cs42l42, 0x131b, 0xFD);
630630 cs8409_i2c_write(cs42l42, 0x1120, 0x80);
631− /* Wait ~100us*/
632− usleep_range(100, 200);
631+ /* Wait ~20ms*/
632+ usleep_range(20000, 25000);
633633 cs8409_i2c_write(cs42l42, 0x111f, 0x77);
634634 cs8409_i2c_write(cs42l42, 0x1120, 0xc0);
635635 }
636636
637637 static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status)
638638 {
639− int status_changed = 0;
639+ int status_changed = cs42l42->force_status_change;
640+
641+ cs42l42->force_status_change = 0;
640642
641643 /* TIP_SENSE INSERT/REMOVE */
642644 switch (reg_ts_status) {
@@ -791,6 +793,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) · 148 unmodified lines
791793 cs42l42->last_page = 0;
792794 cs42l42->hp_jack_in = 0;
793795 cs42l42->mic_jack_in = 0;
796+ cs42l42->force_status_change = 1;
794797
795798 /* Put CS42L42 into Reset */
796799 gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0);
sound/pci/hda/patch_cs8409.h+1−0
@@ -305,6 +305,7 @@ struct sub_codec { · 304 unmodified lines
305305
306306 unsigned int hp_jack_in:1;
307307 unsigned int mic_jack_in:1;
308+ unsigned int force_status_change:1;
308309 unsigned int suspended:1;
309310 unsigned int paged:1;
310311 unsigned int last_page;
sound/pci/hda/patch_hdmi.c+1−1
@@ -1535,7 +1535,7 @@ static void update_eld(struct hda_codec *codec, · 1534 unmodified lines
15351535 }
15361536 }
15371537
1538− if (!eld->eld_valid || eld->eld_size <= 0) {
1538+ if (!eld->eld_valid || eld->eld_size <= 0 || eld->info.sad_count <= 0) {
15391539 eld->eld_valid = false;
15401540 eld->eld_size = 0;
15411541 }
sound/pci/hda/patch_realtek.c+195−3
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include "hda_auto_parser.h"
2626 #include "hda_jack.h"
2727 #include "hda_generic.h"
28+#include "hda_component.h"
2829
2930 /* keep halting ALC5505 DSP, for power saving */
3031 #define HALT_REALTEK_ALC5505
@@ -126,6 +127,10 @@ struct alc_spec { · 95 unmodified lines
126127 unsigned int coef0;
127128 struct input_dev *kb_dev;
128129 u8 alc_mute_keycode_map[1];
130+
131+ /* component binding */
132+ struct component_match *match;
133+ struct hda_component comps[HDA_MAX_COMPONENTS];
129134 };
130135
131136 /*
@@ -1924,6 +1929,7 @@ enum { · 1792 unmodified lines
19241929 ALC887_FIXUP_ASUS_BASS,
19251930 ALC887_FIXUP_BASS_CHMAP,
19261931 ALC1220_FIXUP_GB_DUAL_CODECS,
1932+ ALC1220_FIXUP_GB_X570,
19271933 ALC1220_FIXUP_CLEVO_P950,
19281934 ALC1220_FIXUP_CLEVO_PB51ED,
19291935 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
@@ -2113,6 +2119,29 @@ static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, · 183 unmodified lines
21132119 }
21142120 }
21152121
2122+static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2123+ const struct hda_fixup *fix,
2124+ int action)
2125+{
2126+ static const hda_nid_t conn1[] = { 0x0c };
2127+ static const struct coef_fw gb_x570_coefs[] = {
2128+ WRITE_COEF(0x1a, 0x01c1),
2129+ WRITE_COEF(0x1b, 0x0202),
2130+ WRITE_COEF(0x43, 0x3005),
2131+ {}
2132+ };
2133+
2134+ switch (action) {
2135+ case HDA_FIXUP_ACT_PRE_PROBE:
2136+ snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2137+ snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2138+ break;
2139+ case HDA_FIXUP_ACT_INIT:
2140+ alc_process_coef_fw(codec, gb_x570_coefs);
2141+ break;
2142+ }
2143+}
2144+
21162145 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
21172146 const struct hda_fixup *fix,
21182147 int action)
@@ -2415,6 +2444,10 @@ static const struct hda_fixup alc882_fixups[] = { · 296 unmodified lines
24152444 .type = HDA_FIXUP_FUNC,
24162445 .v.func = alc1220_fixup_gb_dual_codecs,
24172446 },
2447+ [ALC1220_FIXUP_GB_X570] = {
2448+ .type = HDA_FIXUP_FUNC,
2449+ .v.func = alc1220_fixup_gb_x570,
2450+ },
24182451 [ALC1220_FIXUP_CLEVO_P950] = {
24192452 .type = HDA_FIXUP_FUNC,
24202453 .v.func = alc1220_fixup_clevo_p950,
@@ -2517,7 +2550,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 96 unmodified lines
25172550 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
25182551 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
25192552 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2520− SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
2553+ SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
25212554 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
25222555 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
25232556 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
@@ -6497,6 +6530,133 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, · 3973 unmodified lines
64976530 }
64986531 }
64996532
6533+static int comp_match_dev_name(struct device *dev, void *data)
6534+{
6535+ return strcmp(dev_name(dev), data) == 0;
6536+}
6537+
6538+static int find_comp_by_dev_name(struct alc_spec *spec, const char *name)
6539+{
6540+ int i;
6541+
6542+ for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6543+ if (strcmp(spec->comps[i].name, name) == 0)
6544+ return i;
6545+ }
6546+
6547+ return -ENODEV;
6548+}
6549+
6550+static int comp_bind(struct device *dev)
6551+{
6552+ struct hda_codec *cdc = dev_to_hda_codec(dev);
6553+ struct alc_spec *spec = cdc->spec;
6554+
6555+ return component_bind_all(dev, spec->comps);
6556+}
6557+
6558+static void comp_unbind(struct device *dev)
6559+{
6560+ struct hda_codec *cdc = dev_to_hda_codec(dev);
6561+ struct alc_spec *spec = cdc->spec;
6562+
6563+ component_unbind_all(dev, spec->comps);
6564+}
6565+
6566+static const struct component_master_ops comp_master_ops = {
6567+ .bind = comp_bind,
6568+ .unbind = comp_unbind,
6569+};
6570+
6571+static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6572+ struct snd_pcm_substream *sub, int action)
6573+{
6574+ struct alc_spec *spec = cdc->spec;
6575+ int i;
6576+
6577+ for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6578+ if (spec->comps[i].dev)
6579+ spec->comps[i].playback_hook(spec->comps[i].dev, action);
6580+ }
6581+}
6582+
6583+static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6584+ const char *hid, int count)
6585+{
6586+ struct device *dev = hda_codec_dev(cdc);
6587+ struct alc_spec *spec = cdc->spec;
6588+ char *name;
6589+ int ret, i;
6590+
6591+ switch (action) {
6592+ case HDA_FIXUP_ACT_PRE_PROBE:
6593+ for (i = 0; i < count; i++) {
6594+ name = devm_kasprintf(dev, GFP_KERNEL,
6595+ "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6596+ if (!name)
6597+ return;
6598+ component_match_add(dev, &spec->match, comp_match_dev_name, name);
6599+ }
6600+ ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6601+ if (ret)
6602+ codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6603+ else
6604+ spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6605+ break;
6606+ }
6607+}
6608+
6609+static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6610+{
6611+ cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6612+}
6613+
6614+static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6615+ struct snd_pcm_substream *sub, int action)
6616+{
6617+ struct alc_spec *spec = cdc->spec;
6618+ unsigned int rx_slot;
6619+ int i;
6620+
6621+ switch (action) {
6622+ case HDA_GEN_PCM_ACT_PREPARE:
6623+ rx_slot = 0;
6624+ i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.0");
6625+ if (i >= 0)
6626+ spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6627+
6628+ rx_slot = 1;
6629+ i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.1");
6630+ if (i >= 0)
6631+ spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6632+ break;
6633+ }
6634+
6635+ comp_generic_playback_hook(hinfo, cdc, sub, action);
6636+}
6637+
6638+static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6639+ int action)
6640+{
6641+ struct device *dev = hda_codec_dev(cdc);
6642+ struct alc_spec *spec = cdc->spec;
6643+ int ret;
6644+
6645+ switch (action) {
6646+ case HDA_FIXUP_ACT_PRE_PROBE:
6647+ component_match_add(dev, &spec->match, comp_match_dev_name,
6648+ "i2c-CLSA0100:00-cs35l41-hda.0");
6649+ component_match_add(dev, &spec->match, comp_match_dev_name,
6650+ "i2c-CLSA0100:00-cs35l41-hda.1");
6651+ ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6652+ if (ret)
6653+ codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6654+ else
6655+ spec->gen.pcm_playback_hook = alc287_legion_16achg6_playback_hook;
6656+ break;
6657+ }
6658+}
6659+
65006660 /* for alc295_fixup_hp_top_speakers */
65016661 #include "hp_x360_helper.c"
65026662
@@ -6784,6 +6944,10 @@ enum { · 281 unmodified lines
67846944 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
67856945 ALC233_FIXUP_NO_AUDIO_JACK,
67866946 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
6947+ ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6948+ ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
6949+ ALC287_FIXUP_LEGION_16ACHG6,
6950+ ALC287_FIXUP_CS35L41_I2C_2,
67876951 };
67886952
67896953 static const struct hda_fixup alc269_fixups[] = {
@@ -8380,6 +8544,18 @@ static const struct hda_fixup alc269_fixups[] = { · 1590 unmodified lines
83808544 .chained = true,
83818545 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
83828546 },
8547+ [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8548+ .type = HDA_FIXUP_FUNC,
8549+ .v.func = alc285_fixup_ideapad_s740_coef,
8550+ .chained = true,
8551+ .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8552+ },
8553+ [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8554+ .type = HDA_FIXUP_FUNC,
8555+ .v.func = alc287_fixup_legion_15imhg05_speakers,
8556+ .chained = true,
8557+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8558+ },
83838559 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
83848560 .type = HDA_FIXUP_VERBS,
83858561 //.v.verbs = legion_15imhg05_coefs,
@@ -8514,6 +8690,14 @@ static const struct hda_fixup alc269_fixups[] = { · 128 unmodified lines
85148690 .chained = true,
85158691 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
85168692 },
8693+ [ALC287_FIXUP_LEGION_16ACHG6] = {
8694+ .type = HDA_FIXUP_FUNC,
8695+ .v.func = alc287_fixup_legion_16achg6_speakers,
8696+ },
8697+ [ALC287_FIXUP_CS35L41_I2C_2] = {
8698+ .type = HDA_FIXUP_FUNC,
8699+ .v.func = cs35l41_fixup_i2c_two,
8700+ },
85178701 };
85188702
85198703 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8730,6 +8914,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 210 unmodified lines
87308914 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
87318915 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
87328916 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
8917+ SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
87338918 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
87348919 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
87358920 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
@@ -8910,6 +9095,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 174 unmodified lines
89109095 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
89119096 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
89129097 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9098+ SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9099+ SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9100+ SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
89139101 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
89149102 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
89159103 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
@@ -8921,13 +9109,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5 unmodified lines
89219109 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
89229110 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
89239111 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9112+ SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
89249113 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
9114+ SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9115+ SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
89259116 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9117+ SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
89269118 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
8927− SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9119+ SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
9120+ SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
89289121 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
89299122 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8930− SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
89319123 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
89329124 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
89339125 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
sound/pci/mixart/mixart_core.c+3−2
@@ -23,8 +23,6 @@ · 22 unmodified lines
2323 #define MSG_DESCRIPTOR_SIZE 0x24
2424 #define MSG_HEADER_SIZE (MSG_DESCRIPTOR_SIZE + 4)
2525
26−#define MSG_DEFAULT_SIZE 512
27−
2826 #define MSG_TYPE_MASK 0x00000003 /* mask for following types */
2927 #define MSG_TYPE_NOTIFY 0 /* embedded -> driver (only notification, do not get_msg() !) */
3028 #define MSG_TYPE_COMMAND 1 /* driver <-> embedded (a command has no answer) */
@@ -444,6 +442,9 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id) · 413 unmodified lines
444442 struct mixart_timer_notify *notify;
445443 notify = (struct mixart_timer_notify *)mixart_msg_data;
446444
445+ BUILD_BUG_ON(sizeof(notify) > sizeof(mixart_msg_data));
446+ if (snd_BUG_ON(notify->stream_count > ARRAY_SIZE(notify->streams)))
447+ break;
447448 for(i=0; i<notify->stream_count; i++) {
448449
449450 u32 buffer_id = notify->streams[i].buffer_id;
sound/pci/mixart/mixart_core.h+9−1
@@ -49,6 +49,7 @@ enum mixart_message_id { · 48 unmodified lines
4949 MSG_CLOCK_SET_PROPERTIES = 0x200002,
5050 };
5151
52+#define MSG_DEFAULT_SIZE 512
5253
5354 struct mixart_msg
5455 {
@@ -251,10 +252,17 @@ struct mixart_sample_pos · 196 unmodified lines
251252 u32 sample_pos_low_part;
252253 } __attribute__((packed));
253254
255+/*
256+ * This structure is limited by the size of MSG_DEFAULT_SIZE. Instead of
257+ * having MIXART_MAX_STREAM_PER_CARD * MIXART_MAX_CARDS many streams,
258+ * this is capped to have a total size below MSG_DEFAULT_SIZE.
259+ */
260+#define MIXART_MAX_TIMER_NOTIFY_STREAMS \
261+ ((MSG_DEFAULT_SIZE - sizeof(u32)) / sizeof(struct mixart_sample_pos))
254262 struct mixart_timer_notify
255263 {
256264 u32 stream_count;
257− struct mixart_sample_pos streams[MIXART_MAX_STREAM_PER_CARD * MIXART_MAX_CARDS];
265+ struct mixart_sample_pos streams[MIXART_MAX_TIMER_NOTIFY_STREAMS];
258266 } __attribute__((packed));
259267
260268
sound/ppc/beep.c+1−1
@@ -99,7 +99,7 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, · 98 unmodified lines
9999 return -1;
100100
101101 switch (code) {
102− case SND_BELL: if (hz) hz = 1000;
102+ case SND_BELL: if (hz) hz = 1000; break;
103103 case SND_TONE: break;
104104 default: return -1;
105105 }
sound/soc/amd/Kconfig+8−1
@@ -68,7 +68,7 @@ config SND_SOC_AMD_VANGOGH_MACH · 67 unmodified lines
6868 tristate "AMD Vangogh support for NAU8821 CS35L41"
6969 select SND_SOC_NAU8821
7070 select SND_SOC_CS35L41_SPI
71− depends on SND_SOC_AMD_ACP5x && I2C
71+ depends on SND_SOC_AMD_ACP5x && I2C && SPI_MASTER
7272 help
7373 This option enables machine driver for Vangogh platform
7474 using NAU8821 and CS35L41 codecs.
@@ -96,4 +96,11 @@ config SND_SOC_AMD_YC_MACH · 21 unmodified lines
9696 Say m if you have such a device.
9797 If unsure select "N".
9898
99+config SND_AMD_ACP_CONFIG
100+ tristate "AMD ACP configuration selection"
101+ select SND_SOC_ACPI if ACPI
102+ help
103+ This option adds an auto detection to determine which ACP
104+ driver modules to use
105+
99106 source "sound/soc/amd/acp/Kconfig"
sound/soc/amd/Makefile+2−0
@@ -3,6 +3,7 @@ acp_audio_dma-objs := acp-pcm-dma.o · 2 unmodified lines
33 snd-soc-acp-da7219mx98357-mach-objs := acp-da7219-max98357a.o
44 snd-soc-acp-rt5645-mach-objs := acp-rt5645.o
55 snd-soc-acp-rt5682-mach-objs := acp3x-rt5682-max9836.o
6+snd-acp-config-objs := acp-config.o
67
78 obj-$(CONFIG_SND_SOC_AMD_ACP) += acp_audio_dma.o
89 obj-$(CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH) += snd-soc-acp-da7219mx98357-mach.o
@@ -13,3 +14,4 @@ obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/ · 4 unmodified lines
1314 obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/
1415 obj-$(CONFIG_SND_SOC_AMD_ACP6x) += yc/
1516 obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/
17+obj-$(CONFIG_SND_AMD_ACP_CONFIG) += snd-acp-config.o
sound/soc/amd/acp-config.c+124−0
@@ -0,0 +1,124 @@
1+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2+//
3+// This file is provided under a dual BSD/GPLv2 license. When using or
4+// redistributing this file, you may do so under either license.
5+//
6+// Copyright(c) 2021 Advanced Micro Devices, Inc.
7+//
8+// Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9+//
10+
11+/* ACP machine configuration module */
12+
13+#include <linux/acpi.h>
14+#include <linux/bits.h>
15+#include <linux/dmi.h>
16+#include <linux/module.h>
17+#include <linux/pci.h>
18+
19+#include "../sof/amd/acp.h"
20+#include "mach-config.h"
21+
22+static int acp_quirk_data;
23+
24+static const struct config_entry config_table[] = {
25+ {
26+ .flags = FLAG_AMD_SOF,
27+ .device = ACP_PCI_DEV_ID,
28+ .dmi_table = (const struct dmi_system_id []) {
29+ {
30+ .matches = {
31+ DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
32+ DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
33+ },
34+ },
35+ {}
36+ },
37+ },
38+ {
39+ .flags = FLAG_AMD_SOF,
40+ .device = ACP_PCI_DEV_ID,
41+ .dmi_table = (const struct dmi_system_id []) {
42+ {
43+ .matches = {
44+ DMI_MATCH(DMI_SYS_VENDOR, "Google"),
45+ },
46+ },
47+ {}
48+ },
49+ },
50+};
51+
52+int snd_amd_acp_find_config(struct pci_dev *pci)
53+{
54+ const struct config_entry *table = config_table;
55+ u16 device = pci->device;
56+ int i;
57+
58+ /* Do not enable FLAGS on older platforms with Rev id zero */
59+ if (!pci->revision)
60+ return 0;
61+
62+ for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
63+ if (table->device != device)
64+ continue;
65+ if (table->dmi_table && !dmi_check_system(table->dmi_table))
66+ continue;
67+ acp_quirk_data = table->flags;
68+ return table->flags;
69+ }
70+
71+ return 0;
72+}
73+EXPORT_SYMBOL(snd_amd_acp_find_config);
74+
75+static struct snd_soc_acpi_codecs amp_rt1019 = {
76+ .num_codecs = 1,
77+ .codecs = {"10EC1019"}
78+};
79+
80+static struct snd_soc_acpi_codecs amp_max = {
81+ .num_codecs = 1,
82+ .codecs = {"MX98360A"}
83+};
84+
85+struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
86+ {
87+ .id = "10EC5682",
88+ .drv_name = "rt5682-rt1019",
89+ .pdata = (void *)&acp_quirk_data,
90+ .machine_quirk = snd_soc_acpi_codec_list,
91+ .quirk_data = &amp_rt1019,
92+ .fw_filename = "sof-rn.ri",
93+ .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
94+ },
95+ {
96+ .id = "10EC5682",
97+ .drv_name = "rt5682-max",
98+ .pdata = (void *)&acp_quirk_data,
99+ .machine_quirk = snd_soc_acpi_codec_list,
100+ .quirk_data = &amp_max,
101+ .fw_filename = "sof-rn.ri",
102+ .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
103+ },
104+ {
105+ .id = "RTL5682",
106+ .drv_name = "rt5682s-max",
107+ .pdata = (void *)&acp_quirk_data,
108+ .machine_quirk = snd_soc_acpi_codec_list,
109+ .quirk_data = &amp_max,
110+ .fw_filename = "sof-rn.ri",
111+ .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
112+ },
113+ {
114+ .id = "AMDI1019",
115+ .drv_name = "renoir-dsp",
116+ .pdata = (void *)&acp_quirk_data,
117+ .fw_filename = "sof-rn.ri",
118+ .sof_tplg_filename = "sof-acp.tplg",
119+ },
120+ {},
121+};
122+EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
123+
124+MODULE_LICENSE("Dual BSD/GPL");
sound/soc/amd/acp-da7219-max98357a.c+10−10
@@ -522,7 +522,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { · 521 unmodified lines
522522 .name = "amd-da7219-play",
523523 .stream_name = "Playback",
524524 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
525− | SND_SOC_DAIFMT_CBM_CFM,
525+ | SND_SOC_DAIFMT_CBP_CFP,
526526 .init = cz_da7219_init,
527527 .dpcm_playback = 1,
528528 .stop_dma_first = 1,
@@ -533,7 +533,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { · 4 unmodified lines
533533 .name = "amd-da7219-cap",
534534 .stream_name = "Capture",
535535 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
536− | SND_SOC_DAIFMT_CBM_CFM,
536+ | SND_SOC_DAIFMT_CBP_CFP,
537537 .dpcm_capture = 1,
538538 .stop_dma_first = 1,
539539 .ops = &cz_da7219_cap_ops,
@@ -543,7 +543,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { · 3 unmodified lines
543543 .name = "amd-max98357-play",
544544 .stream_name = "HiFi Playback",
545545 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
546− | SND_SOC_DAIFMT_CBM_CFM,
546+ | SND_SOC_DAIFMT_CBP_CFP,
547547 .dpcm_playback = 1,
548548 .stop_dma_first = 1,
549549 .ops = &cz_max_play_ops,
@@ -554,7 +554,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { · 4 unmodified lines
554554 .name = "dmic0",
555555 .stream_name = "DMIC0 Capture",
556556 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
557− | SND_SOC_DAIFMT_CBM_CFM,
557+ | SND_SOC_DAIFMT_CBP_CFP,
558558 .dpcm_capture = 1,
559559 .stop_dma_first = 1,
560560 .ops = &cz_dmic0_cap_ops,
@@ -565,7 +565,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { · 4 unmodified lines
565565 .name = "dmic1",
566566 .stream_name = "DMIC1 Capture",
567567 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
568− | SND_SOC_DAIFMT_CBM_CFM,
568+ | SND_SOC_DAIFMT_CBP_CFP,
569569 .dpcm_capture = 1,
570570 .stop_dma_first = 1,
571571 .ops = &cz_dmic1_cap_ops,
@@ -578,7 +578,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { · 6 unmodified lines
578578 .name = "amd-rt5682-play",
579579 .stream_name = "Playback",
580580 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
581− | SND_SOC_DAIFMT_CBM_CFM,
581+ | SND_SOC_DAIFMT_CBP_CFP,
582582 .init = cz_rt5682_init,
583583 .dpcm_playback = 1,
584584 .stop_dma_first = 1,
@@ -589,7 +589,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { · 4 unmodified lines
589589 .name = "amd-rt5682-cap",
590590 .stream_name = "Capture",
591591 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
592− | SND_SOC_DAIFMT_CBM_CFM,
592+ | SND_SOC_DAIFMT_CBP_CFP,
593593 .dpcm_capture = 1,
594594 .stop_dma_first = 1,
595595 .ops = &cz_rt5682_cap_ops,
@@ -599,7 +599,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { · 3 unmodified lines
599599 .name = "amd-max98357-play",
600600 .stream_name = "HiFi Playback",
601601 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
602− | SND_SOC_DAIFMT_CBM_CFM,
602+ | SND_SOC_DAIFMT_CBP_CFP,
603603 .dpcm_playback = 1,
604604 .stop_dma_first = 1,
605605 .ops = &cz_rt5682_max_play_ops,
@@ -610,7 +610,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { · 4 unmodified lines
610610 .name = "dmic0",
611611 .stream_name = "DMIC0 Capture",
612612 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
613− | SND_SOC_DAIFMT_CBM_CFM,
613+ | SND_SOC_DAIFMT_CBP_CFP,
614614 .dpcm_capture = 1,
615615 .stop_dma_first = 1,
616616 .ops = &cz_rt5682_dmic0_cap_ops,
@@ -621,7 +621,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { · 4 unmodified lines
621621 .name = "dmic1",
622622 .stream_name = "DMIC1 Capture",
623623 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
624− | SND_SOC_DAIFMT_CBM_CFM,
624+ | SND_SOC_DAIFMT_CBP_CFP,
625625 .dpcm_capture = 1,
626626 .stop_dma_first = 1,
627627 .ops = &cz_rt5682_dmic1_cap_ops,
sound/soc/amd/acp-pcm-dma.c+14−1
@@ -1003,6 +1003,7 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_soc_component *component, · 1002 unmodified lines
10031003
10041004 struct snd_pcm_runtime *runtime = substream->runtime;
10051005 struct audio_substream_data *rtd = runtime->private_data;
1006+ struct audio_drv_data *adata = dev_get_drvdata(component->dev);
10061007
10071008 if (!rtd)
10081009 return -EINVAL;
@@ -1023,7 +1024,7 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_soc_component *component, · 14 unmodified lines
10231024 }
10241025 if (bytescount > 0) {
10251026 delay = do_div(bytescount, period_bytes);
1026− runtime->delay = bytes_to_frames(runtime, delay);
1027+ adata->delay += bytes_to_frames(runtime, delay);
10271028 }
10281029 } else {
10291030 buffersize = frames_to_bytes(runtime, runtime->buffer_size);
@@ -1035,6 +1036,17 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_soc_component *component, · 5 unmodified lines
10351036 return bytes_to_frames(runtime, pos);
10361037 }
10371038
1039+static snd_pcm_sframes_t acp_dma_delay(struct snd_soc_component *component,
1040+ struct snd_pcm_substream *substream)
1041+{
1042+ struct audio_drv_data *adata = dev_get_drvdata(component->dev);
1043+ snd_pcm_sframes_t delay = adata->delay;
1044+
1045+ adata->delay = 0;
1046+
1047+ return delay;
1048+}
1049+
10381050 static int acp_dma_prepare(struct snd_soc_component *component,
10391051 struct snd_pcm_substream *substream)
10401052 {
@@ -1198,6 +1210,7 @@ static const struct snd_soc_component_driver acp_asoc_platform = { · 157 unmodified lines
11981210 .hw_params = acp_dma_hw_params,
11991211 .trigger = acp_dma_trigger,
12001212 .pointer = acp_dma_pointer,
1213+ .delay = acp_dma_delay,
12011214 .prepare = acp_dma_prepare,
12021215 .pcm_construct = acp_dma_new,
12031216 };
sound/soc/amd/acp-rt5645.c+2−2
@@ -111,7 +111,7 @@ static struct snd_soc_dai_link cz_dai_rt5650[] = { · 110 unmodified lines
111111 .name = "amd-rt5645-play",
112112 .stream_name = "RT5645_AIF1",
113113 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
114− | SND_SOC_DAIFMT_CBM_CFM,
114+ | SND_SOC_DAIFMT_CBP_CFP,
115115 .init = cz_init,
116116 .ops = &cz_aif1_ops,
117117 SND_SOC_DAILINK_REG(designware1, codec, platform),
@@ -120,7 +120,7 @@ static struct snd_soc_dai_link cz_dai_rt5650[] = { · 2 unmodified lines
120120 .name = "amd-rt5645-cap",
121121 .stream_name = "RT5645_AIF1",
122122 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
123− | SND_SOC_DAIFMT_CBM_CFM,
123+ | SND_SOC_DAIFMT_CBP_CFP,
124124 .ops = &cz_aif1_ops,
125125 SND_SOC_DAILINK_REG(designware2, codec, platform),
126126 },
sound/soc/amd/acp.h+1−0
@@ -151,6 +151,7 @@ struct audio_drv_data { · 150 unmodified lines
151151 struct snd_pcm_substream *capture_i2sbt_stream;
152152 void __iomem *acp_mmio;
153153 u32 asic_type;
154+ snd_pcm_sframes_t delay;
154155 };
155156
156157 /*
sound/soc/amd/acp/Kconfig+3−5
@@ -32,7 +32,7 @@ config SND_AMD_ASOC_RENOIR · 31 unmodified lines
3232
3333 config SND_SOC_AMD_MACH_COMMON
3434 tristate
35− depends on X86 && PCI && I2C
35+ depends on X86 && PCI && I2C && GPIOLIB
3636 select CLK_FIXED_FCH
3737 select SND_SOC_RT5682_I2C
3838 select SND_SOC_DMIC
@@ -44,17 +44,15 @@ config SND_SOC_AMD_MACH_COMMON · 5 unmodified lines
4444
4545 config SND_SOC_AMD_LEGACY_MACH
4646 tristate "AMD Legacy Machine Driver Support"
47− depends on X86 && PCI && I2C
47+ depends on X86 && PCI && I2C && GPIOLIB
4848 select SND_SOC_AMD_MACH_COMMON
49− depends on X86 && PCI && I2C
5049 help
5150 This option enables legacy sound card support for ACP audio.
5251
5352 config SND_SOC_AMD_SOF_MACH
5453 tristate "AMD SOF Machine Driver Support"
55− depends on X86 && PCI && I2C
54+ depends on X86 && PCI && I2C && GPIOLIB
5655 select SND_SOC_AMD_MACH_COMMON
57− depends on X86 && PCI && I2C
5856 help
5957 This option enables SOF sound card support for ACP audio.
6058
sound/soc/amd/acp/acp-legacy-mach.c+16−3
@@ -27,6 +27,7 @@ static struct acp_card_drvdata rt5682_rt1019_data = { · 26 unmodified lines
2727 .hs_codec_id = RT5682,
2828 .amp_codec_id = RT1019,
2929 .dmic_codec_id = NONE,
30+ .gpio_spkr_en = EN_SPKR_GPIO_GB,
3031 };
3132
3233 static const struct snd_kcontrol_new acp_controls[] = {
@@ -41,15 +42,16 @@ static const struct snd_kcontrol_new acp_controls[] = { · 8 unmodified lines
4142 static const struct snd_soc_dapm_widget acp_widgets[] = {
4243 SND_SOC_DAPM_HP("Headphone Jack", NULL),
4344 SND_SOC_DAPM_MIC("Headset Mic", NULL),
44− SND_SOC_DAPM_SPK("Spk", NULL),
45− SND_SOC_DAPM_SPK("Left Spk", NULL),
46− SND_SOC_DAPM_SPK("Right Spk", NULL),
45+ SND_SOC_DAPM_SPK("Spk", event_spkr_handler),
46+ SND_SOC_DAPM_SPK("Left Spk", event_spkr_handler),
47+ SND_SOC_DAPM_SPK("Right Spk", event_spkr_handler),
4748 };
4849
4950 static int acp_asoc_probe(struct platform_device *pdev)
5051 {
5152 struct snd_soc_card *card = NULL;
5253 struct device *dev = &pdev->dev;
54+ unsigned int spkr_gpio;
5355 int ret;
5456
5557 if (!pdev->id_entry)
@@ -67,9 +69,20 @@ static int acp_asoc_probe(struct platform_device *pdev) · 11 unmodified lines
6769 card->controls = acp_controls;
6870 card->num_controls = ARRAY_SIZE(acp_controls);
6971 card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data;
72+ spkr_gpio = ((struct acp_card_drvdata *)(card->drvdata))->gpio_spkr_en;
7073
7174 acp_legacy_dai_links_create(card);
7275
76+ if (gpio_is_valid(spkr_gpio)) {
77+ ret = devm_gpio_request(dev, spkr_gpio, "spkren");
78+ if (ret) {
79+ dev_err(dev, "(%s) gpio request failed: %d\n",
80+ __func__, ret);
81+ return ret;
82+ }
83+ gpio_direction_output(spkr_gpio, 0);
84+ }
85+
7386 ret = devm_snd_soc_register_card(&pdev->dev, card);
7487 if (ret) {
7588 dev_err(&pdev->dev,
sound/soc/amd/acp/acp-mach-common.c+29−4
@@ -71,6 +71,31 @@ static const struct snd_soc_dapm_route rt5682_map[] = { · 70 unmodified lines
7171 { "IN1P", NULL, "Headset Mic" },
7272 };
7373
74+int event_spkr_handler(struct snd_soc_dapm_widget *w,
75+ struct snd_kcontrol *k, int event)
76+{
77+ struct snd_soc_dapm_context *dapm = w->dapm;
78+ struct snd_soc_card *card = dapm->card;
79+ struct acp_card_drvdata *drvdata = snd_soc_card_get_drvdata(card);
80+
81+ if (!gpio_is_valid(drvdata->gpio_spkr_en))
82+ return 0;
83+
84+ switch (event) {
85+ case SND_SOC_DAPM_POST_PMU:
86+ gpio_set_value(drvdata->gpio_spkr_en, 1);
87+ break;
88+ case SND_SOC_DAPM_PRE_PMD:
89+ gpio_set_value(drvdata->gpio_spkr_en, 0);
90+ break;
91+ default:
92+ dev_warn(card->dev, "%s invalid setting\n", __func__);
93+ break;
94+ }
95+ return 0;
96+}
97+EXPORT_SYMBOL_NS_GPL(event_spkr_handler, SND_SOC_AMD_MACH);
98+
7499 /* Define card ops for RT5682 CODEC */
75100 static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd)
76101 {
@@ -268,8 +293,8 @@ static const struct snd_soc_ops acp_card_rt5682s_ops = { · 191 unmodified lines
268293
269294 /* Declare RT1019 codec components */
270295 SND_SOC_DAILINK_DEF(rt1019,
271− DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:01", "rt1019-aif"),
272− COMP_CODEC("i2c-10EC1019:02", "rt1019-aif")));
296+ DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
297+ COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
273298
274299 static const struct snd_soc_dapm_route rt1019_map_lr[] = {
275300 { "Left Spk", NULL, "Left SPO" },
@@ -278,11 +303,11 @@ static const struct snd_soc_dapm_route rt1019_map_lr[] = { · 2 unmodified lines
278303
279304 static struct snd_soc_codec_conf rt1019_conf[] = {
280305 {
281− .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
306+ .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"),
282307 .name_prefix = "Left",
283308 },
284309 {
285− .dlc = COMP_CODEC_CONF("i2c-10EC1019:02"),
310+ .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
286311 .name_prefix = "Right",
287312 },
288313 };
sound/soc/amd/acp/acp-mach.h+9−1
@@ -17,6 +17,12 @@ · 16 unmodified lines
1717 #include <linux/input.h>
1818 #include <linux/module.h>
1919 #include <sound/soc.h>
20+#include <linux/gpio.h>
21+#include <linux/gpio/consumer.h>
22+
23+#define EN_SPKR_GPIO_GB 0x11F
24+#define EN_SPKR_GPIO_NK 0x146
25+#define EN_SPKR_GPIO_NONE -EINVAL
2026
2127 enum be_id {
2228 HEADSET_BE_ID = 0,
@@ -49,9 +55,11 @@ struct acp_card_drvdata { · 26 unmodified lines
4955 unsigned int dai_fmt;
5056 struct clk *wclk;
5157 struct clk *bclk;
58+ unsigned int gpio_spkr_en;
5259 };
5360
5461 int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
5562 int acp_legacy_dai_links_create(struct snd_soc_card *card);
56−
63+int event_spkr_handler(struct snd_soc_dapm_widget *w,
64+ struct snd_kcontrol *k, int event);
5765 #endif
sound/soc/amd/acp/acp-sof-mach.c+18−3
@@ -27,6 +27,7 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { · 26 unmodified lines
2727 .hs_codec_id = RT5682,
2828 .amp_codec_id = RT1019,
2929 .dmic_codec_id = DMIC,
30+ .gpio_spkr_en = EN_SPKR_GPIO_GB,
3031 };
3132
3233 static struct acp_card_drvdata sof_rt5682_max_data = {
@@ -36,6 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { · 3 unmodified lines
3637 .hs_codec_id = RT5682,
3738 .amp_codec_id = MAX98360A,
3839 .dmic_codec_id = DMIC,
40+ .gpio_spkr_en = EN_SPKR_GPIO_NK,
3941 };
4042
4143 static struct acp_card_drvdata sof_rt5682s_max_data = {
@@ -45,6 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { · 3 unmodified lines
4547 .hs_codec_id = RT5682S,
4648 .amp_codec_id = MAX98360A,
4749 .dmic_codec_id = DMIC,
50+ .gpio_spkr_en = EN_SPKR_GPIO_NK,
4851 };
4952
5053 static const struct snd_kcontrol_new acp_controls[] = {
@@ -58,15 +61,16 @@ static const struct snd_kcontrol_new acp_controls[] = { · 7 unmodified lines
5861 static const struct snd_soc_dapm_widget acp_widgets[] = {
5962 SND_SOC_DAPM_HP("Headphone Jack", NULL),
6063 SND_SOC_DAPM_MIC("Headset Mic", NULL),
61− SND_SOC_DAPM_SPK("Spk", NULL),
62− SND_SOC_DAPM_SPK("Left Spk", NULL),
63− SND_SOC_DAPM_SPK("Right Spk", NULL),
64+ SND_SOC_DAPM_SPK("Spk", event_spkr_handler),
65+ SND_SOC_DAPM_SPK("Left Spk", event_spkr_handler),
66+ SND_SOC_DAPM_SPK("Right Spk", event_spkr_handler),
6467 };
6568
6669 static int acp_sof_probe(struct platform_device *pdev)
6770 {
6871 struct snd_soc_card *card = NULL;
6972 struct device *dev = &pdev->dev;
73+ unsigned int spkr_gpio;
7074 int ret;
7175
7276 if (!pdev->id_entry)
@@ -84,9 +88,20 @@ static int acp_sof_probe(struct platform_device *pdev) · 11 unmodified lines
8488 card->controls = acp_controls;
8589 card->num_controls = ARRAY_SIZE(acp_controls);
8690 card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data;
91+ spkr_gpio = ((struct acp_card_drvdata *)(card->drvdata))->gpio_spkr_en;
8792
8893 acp_sofdsp_dai_links_create(card);
8994
95+ if (gpio_is_valid(spkr_gpio)) {
96+ ret = devm_gpio_request(dev, spkr_gpio, "spkren");
97+ if (ret) {
98+ dev_err(dev, "(%s) gpio request failed: %d\n",
99+ __func__, ret);
100+ return ret;
101+ }
102+ gpio_direction_output(spkr_gpio, 0);
103+ }
104+
90105 ret = devm_snd_soc_register_card(&pdev->dev, card);
91106 if (ret) {
92107 dev_err(&pdev->dev,
sound/soc/amd/acp3x-rt5682-max9836.c+4−4
@@ -51,7 +51,7 @@ static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd) · 50 unmodified lines
5151 /* set rt5682 dai fmt */
5252 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
5353 | SND_SOC_DAIFMT_NB_NF
54− | SND_SOC_DAIFMT_CBM_CFM);
54+ | SND_SOC_DAIFMT_CBP_CFP);
5555 if (ret < 0) {
5656 dev_err(rtd->card->dev,
5757 "Failed to set rt5682 dai fmt: %d\n", ret);
@@ -302,7 +302,7 @@ static struct snd_soc_dai_link acp3x_dai[] = { · 244 unmodified lines
302302 .name = "acp3x-5682-play",
303303 .stream_name = "Playback",
304304 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
305− | SND_SOC_DAIFMT_CBM_CFM,
305+ | SND_SOC_DAIFMT_CBP_CFP,
306306 .init = acp3x_5682_init,
307307 .dpcm_playback = 1,
308308 .dpcm_capture = 1,
@@ -313,7 +313,7 @@ static struct snd_soc_dai_link acp3x_dai[] = { · 4 unmodified lines
313313 .name = "acp3x-max98357-play",
314314 .stream_name = "HiFi Playback",
315315 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
316− | SND_SOC_DAIFMT_CBS_CFS,
316+ | SND_SOC_DAIFMT_CBC_CFC,
317317 .dpcm_playback = 1,
318318 .ops = &acp3x_max_play_ops,
319319 .cpus = acp3x_bt,
@@ -325,7 +325,7 @@ static struct snd_soc_dai_link acp3x_dai[] = { · 5 unmodified lines
325325 .name = "acp3x-ec-dmic0-capture",
326326 .stream_name = "Capture DMIC0",
327327 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
328− | SND_SOC_DAIFMT_CBS_CFS,
328+ | SND_SOC_DAIFMT_CBC_CFC,
329329 .dpcm_capture = 1,
330330 .ops = &acp3x_ec_cap0_ops,
331331 SND_SOC_DAILINK_REG(acp3x_bt, cros_ec, platform),
sound/soc/amd/mach-config.h+28−0
@@ -0,0 +1,28 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2+/*
3+ * This file is provided under a dual BSD/GPLv2 license. When using or
4+ * redistributing this file, you may do so under either license.
5+ *
6+ * Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved.
7+ *
8+ * Author: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9+ */
10+#ifndef __AMD_MACH_CONFIG_H
11+#define __AMD_MACH_CONFIG_H
12+
13+#include <sound/soc-acpi.h>
14+
15+#define FLAG_AMD_SOF BIT(1)
16+#define FLAG_AMD_SOF_ONLY_DMIC BIT(2)
17+
18+#define ACP_PCI_DEV_ID 0x15E2
19+
20+extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
21+
22+struct config_entry {
23+ u32 flags;
24+ u16 device;
25+ const struct dmi_system_id *dmi_table;
26+};
27+
28+#endif
sound/soc/amd/yc/acp6x-pdm-dma.c+1−1
@@ -318,7 +318,7 @@ static int acp6x_pdm_dai_trigger(struct snd_pcm_substream *substream, · 317 unmodified lines
318318 return ret;
319319 }
320320
321−static struct snd_soc_dai_ops acp6x_pdm_dai_ops = {
321+static const struct snd_soc_dai_ops acp6x_pdm_dai_ops = {
322322 .trigger = acp6x_pdm_dai_trigger,
323323 };
324324
sound/soc/atmel/mikroe-proto.c+3−3
@@ -144,9 +144,9 @@ static int snd_proto_probe(struct platform_device *pdev) · 143 unmodified lines
144144 of_node_put(cpu_np);
145145
146146 ret = snd_soc_register_card(&snd_proto);
147− if (ret && ret != -EPROBE_DEFER)
148− dev_err(&pdev->dev,
149− "snd_soc_register_card() failed: %d\n", ret);
147+ if (ret)
148+ dev_err_probe(&pdev->dev, ret,
149+ "snd_soc_register_card() failed\n");
150150
151151 return ret;
152152 }
sound/soc/atmel/tse850-pcm5142.c+12−20
@@ -371,35 +371,27 @@ static int tse850_probe(struct platform_device *pdev) · 370 unmodified lines
371371 }
372372
373373 tse850->add = devm_gpiod_get(dev, "axentia,add", GPIOD_OUT_HIGH);
374− if (IS_ERR(tse850->add)) {
375− if (PTR_ERR(tse850->add) != -EPROBE_DEFER)
376− dev_err(dev, "failed to get 'add' gpio\n");
377− return PTR_ERR(tse850->add);
378− }
374+ if (IS_ERR(tse850->add))
375+ return dev_err_probe(dev, PTR_ERR(tse850->add),
376+ "failed to get 'add' gpio\n");
379377 tse850->add_cache = 1;
380378
381379 tse850->loop1 = devm_gpiod_get(dev, "axentia,loop1", GPIOD_OUT_HIGH);
382− if (IS_ERR(tse850->loop1)) {
383− if (PTR_ERR(tse850->loop1) != -EPROBE_DEFER)
384− dev_err(dev, "failed to get 'loop1' gpio\n");
385− return PTR_ERR(tse850->loop1);
386− }
380+ if (IS_ERR(tse850->loop1))
381+ return dev_err_probe(dev, PTR_ERR(tse850->loop1),
382+ "failed to get 'loop1' gpio\n");
387383 tse850->loop1_cache = 1;
388384
389385 tse850->loop2 = devm_gpiod_get(dev, "axentia,loop2", GPIOD_OUT_HIGH);
390− if (IS_ERR(tse850->loop2)) {
391− if (PTR_ERR(tse850->loop2) != -EPROBE_DEFER)
392− dev_err(dev, "failed to get 'loop2' gpio\n");
393− return PTR_ERR(tse850->loop2);
394− }
386+ if (IS_ERR(tse850->loop2))
387+ return dev_err_probe(dev, PTR_ERR(tse850->loop2),
388+ "failed to get 'loop2' gpio\n");
395389 tse850->loop2_cache = 1;
396390
397391 tse850->ana = devm_regulator_get(dev, "axentia,ana");
398− if (IS_ERR(tse850->ana)) {
399− if (PTR_ERR(tse850->ana) != -EPROBE_DEFER)
400− dev_err(dev, "failed to get 'ana' regulator\n");
401− return PTR_ERR(tse850->ana);
402− }
392+ if (IS_ERR(tse850->ana))
393+ return dev_err_probe(dev, PTR_ERR(tse850->ana),
394+ "failed to get 'ana' regulator\n");
403395
404396 ret = regulator_enable(tse850->ana);
405397 if (ret < 0) {
sound/soc/bcm/bcm63xx-i2s.h+0−1
@@ -74,7 +74,6 @@ · 73 unmodified lines
7474
7575 struct bcm_i2s_priv {
7676 struct device *dev;
77− struct resource *r_irq;
7877 struct regmap *regmap_i2s;
7978 struct clk *i2s_clk;
8079 struct snd_pcm_substream *play_substream;
sound/soc/bcm/bcm63xx-pcm-whistler.c+6−7
@@ -6,6 +6,7 @@ · 5 unmodified lines
66
77 #include <linux/dma-mapping.h>
88 #include <linux/io.h>
9+#include <linux/irq.h>
910 #include <linux/module.h>
1011 #include <sound/pcm_params.h>
1112 #include <linux/regmap.h>
@@ -387,14 +388,12 @@ int bcm63xx_soc_platform_probe(struct platform_device *pdev, · 375 unmodified lines
387388 {
388389 int ret;
389390
390− i2s_priv->r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
391− if (!i2s_priv->r_irq) {
392− dev_err(&pdev->dev, "Unable to get register irq resource.\n");
393− return -ENODEV;
394− }
391+ ret = platform_get_irq(pdev, 0);
392+ if (ret < 0)
393+ return ret;
395394
396− ret = devm_request_irq(&pdev->dev, i2s_priv->r_irq->start, i2s_dma_isr,
397− i2s_priv->r_irq->flags, "i2s_dma", (void *)i2s_priv);
395+ ret = devm_request_irq(&pdev->dev, ret, i2s_dma_isr,
396+ irq_get_trigger_type(ret), "i2s_dma", (void *)i2s_priv);
398397 if (ret) {
399398 dev_err(&pdev->dev,
400399 "i2s_init: failed to request interrupt.ret=%d\n", ret);
sound/soc/codecs/Kconfig+34−2
@@ -41,6 +41,7 @@ config SND_SOC_ALL_CODECS · 40 unmodified lines
4141 imply SND_SOC_ADS117X
4242 imply SND_SOC_AK4104
4343 imply SND_SOC_AK4118
44+ imply SND_SOC_AK4375
4445 imply SND_SOC_AK4458
4546 imply SND_SOC_AK4535
4647 imply SND_SOC_AK4554
@@ -220,6 +221,7 @@ config SND_SOC_ALL_CODECS · 173 unmodified lines
220221 imply SND_SOC_TDA7419
221222 imply SND_SOC_TFA9879
222223 imply SND_SOC_TFA989X
224+ imply SND_SOC_TLV320ADC3XXX
223225 imply SND_SOC_TLV320ADCX140
224226 imply SND_SOC_TLV320AIC23_I2C
225227 imply SND_SOC_TLV320AIC23_SPI
@@ -241,8 +243,7 @@ config SND_SOC_ALL_CODECS · 15 unmodified lines
241243 imply SND_SOC_UDA1380
242244 imply SND_SOC_WCD9335
243245 imply SND_SOC_WCD934X
244− imply SND_SOC_WCD937X
245− imply SND_SOC_WCD938X
246+ imply SND_SOC_WCD938X_SDW
246247 imply SND_SOC_LPASS_RX_MACRO
247248 imply SND_SOC_LPASS_TX_MACRO
248249 imply SND_SOC_WL1273
@@ -343,11 +344,15 @@ config SND_SOC_WM_ADSP · 94 unmodified lines
343344 default y if SND_SOC_WM5102=y
344345 default y if SND_SOC_WM5110=y
345346 default y if SND_SOC_WM2200=y
347+ default y if SND_SOC_CS35L41_SPI=y
348+ default y if SND_SOC_CS35L41_I2C=y
346349 default m if SND_SOC_MADERA=m
347350 default m if SND_SOC_CS47L24=m
348351 default m if SND_SOC_WM5102=m
349352 default m if SND_SOC_WM5110=m
350353 default m if SND_SOC_WM2200=m
354+ default m if SND_SOC_CS35L41_SPI=m
355+ default m if SND_SOC_CS35L41_I2C=m
351356
352357 config SND_SOC_AB8500_CODEC
353358 tristate
@@ -519,6 +524,16 @@ config SND_SOC_AK4118 · 165 unmodified lines
519524 depends on I2C
520525 select REGMAP_I2C
521526
527+config SND_SOC_AK4375
528+ tristate "AKM AK4375 CODEC"
529+ depends on I2C
530+ select REGMAP_I2C
531+ help
532+ Enable support for the Asahi-Kasei AK4375 codec.
533+
534+ To compile this driver as a module, choose M here: the module
535+ will be called snd-soc-ak4375.
536+
522537 config SND_SOC_AK4458
523538 tristate "AKM AK4458 CODEC"
524539 depends on I2C
@@ -609,14 +624,24 @@ config SND_SOC_CS35L36 · 84 unmodified lines
609624 tristate "Cirrus Logic CS35L36 CODEC"
610625 depends on I2C
611626
627+config SND_SOC_CS35L41_LIB
628+ tristate
629+
630+config SND_SOC_CS35L41
631+ tristate
632+
612633 config SND_SOC_CS35L41_SPI
613634 tristate "Cirrus Logic CS35L41 CODEC (SPI)"
614635 depends on SPI_MASTER
636+ select SND_SOC_CS35L41_LIB
637+ select SND_SOC_CS35L41
615638 select REGMAP_SPI
616639
617640 config SND_SOC_CS35L41_I2C
618641 tristate "Cirrus Logic CS35L41 CODEC (I2C)"
619642 depends on I2C
643+ select SND_SOC_CS35L41_LIB
644+ select SND_SOC_CS35L41
620645 select REGMAP_I2C
621646
622647 config SND_SOC_CS42L42
@@ -1486,6 +1511,13 @@ config SND_SOC_TFA989X · 863 unmodified lines
14861511 Note that the driver currently bypasses the built-in "CoolFlux DSP"
14871512 and does not support (hardware) volume control.
14881513
1514+config SND_SOC_TLV320ADC3XXX
1515+ tristate "Texas Instruments TLV320ADC3001/3101 audio ADC"
1516+ depends on I2C
1517+ help
1518+ Enable support for Texas Instruments TLV320ADC3001 and TLV320ADC3101
1519+ ADCs.
1520+
14891521 config SND_SOC_TLV320AIC23
14901522 tristate
14911523
sound/soc/codecs/Makefile+10−2
@@ -34,6 +34,7 @@ snd-soc-adav803-objs := adav803.o · 33 unmodified lines
3434 snd-soc-ads117x-objs := ads117x.o
3535 snd-soc-ak4104-objs := ak4104.o
3636 snd-soc-ak4118-objs := ak4118.o
37+snd-soc-ak4375-objs := ak4375.o
3738 snd-soc-ak4458-objs := ak4458.o
3839 snd-soc-ak4535-objs := ak4535.o
3940 snd-soc-ak4554-objs := ak4554.o
@@ -54,8 +55,10 @@ snd-soc-cs35l33-objs := cs35l33.o · 14 unmodified lines
5455 snd-soc-cs35l34-objs := cs35l34.o
5556 snd-soc-cs35l35-objs := cs35l35.o
5657 snd-soc-cs35l36-objs := cs35l36.o
57−snd-soc-cs35l41-spi-objs := cs35l41-spi.o cs35l41.o cs35l41-tables.o
58−snd-soc-cs35l41-i2c-objs := cs35l41-i2c.o cs35l41.o cs35l41-tables.o
58+snd-soc-cs35l41-lib-objs := cs35l41-lib.o
59+snd-soc-cs35l41-objs := cs35l41.o
60+snd-soc-cs35l41-spi-objs := cs35l41-spi.o
61+snd-soc-cs35l41-i2c-objs := cs35l41-i2c.o
5962 snd-soc-cs42l42-objs := cs42l42.o
6063 snd-soc-cs42l51-objs := cs42l51.o
6164 snd-soc-cs42l51-i2c-objs := cs42l51-i2c.o
@@ -238,6 +241,7 @@ snd-soc-tda7419-objs := tda7419.o · 176 unmodified lines
238241 snd-soc-tas2770-objs := tas2770.o
239242 snd-soc-tfa9879-objs := tfa9879.o
240243 snd-soc-tfa989x-objs := tfa989x.o
244+snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o
241245 snd-soc-tlv320aic23-objs := tlv320aic23.o
242246 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
243247 snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
@@ -369,6 +373,7 @@ obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o · 125 unmodified lines
369373 obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o
370374 obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o
371375 obj-$(CONFIG_SND_SOC_AK4118) += snd-soc-ak4118.o
376+obj-$(CONFIG_SND_SOC_AK4375) += snd-soc-ak4375.o
372377 obj-$(CONFIG_SND_SOC_AK4458) += snd-soc-ak4458.o
373378 obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o
374379 obj-$(CONFIG_SND_SOC_AK4554) += snd-soc-ak4554.o
@@ -391,6 +396,8 @@ obj-$(CONFIG_SND_SOC_CS35L33) += snd-soc-cs35l33.o · 16 unmodified lines
391396 obj-$(CONFIG_SND_SOC_CS35L34) += snd-soc-cs35l34.o
392397 obj-$(CONFIG_SND_SOC_CS35L35) += snd-soc-cs35l35.o
393398 obj-$(CONFIG_SND_SOC_CS35L36) += snd-soc-cs35l36.o
399+obj-$(CONFIG_SND_SOC_CS35L41) += snd-soc-cs35l41.o
400+obj-$(CONFIG_SND_SOC_CS35L41_LIB) += snd-soc-cs35l41-lib.o
394401 obj-$(CONFIG_SND_SOC_CS35L41_SPI) += snd-soc-cs35l41-spi.o
395402 obj-$(CONFIG_SND_SOC_CS35L41_I2C) += snd-soc-cs35l41-i2c.o
396403 obj-$(CONFIG_SND_SOC_CS42L42) += snd-soc-cs42l42.o
@@ -572,6 +579,7 @@ obj-$(CONFIG_SND_SOC_TDA7419) += snd-soc-tda7419.o · 175 unmodified lines
572579 obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o
573580 obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o
574581 obj-$(CONFIG_SND_SOC_TFA989X) += snd-soc-tfa989x.o
582+obj-$(CONFIG_SND_SOC_TLV320ADC3XXX) += snd-soc-tlv320adc3xxx.o
575583 obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o
576584 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o
577585 obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
sound/soc/codecs/adau1701.c+31−63
@@ -13,8 +13,8 @@ · 12 unmodified lines
1313 #include <linux/delay.h>
1414 #include <linux/slab.h>
1515 #include <linux/of.h>
16−#include <linux/of_gpio.h>
1716 #include <linux/of_device.h>
17+#include <linux/gpio/consumer.h>
1818 #include <linux/regulator/consumer.h>
1919 #include <linux/regmap.h>
2020 #include <sound/core.h>
@@ -106,8 +106,8 @@ static const char * const supply_names[] = { · 85 unmodified lines
106106 };
107107
108108 struct adau1701 {
109− int gpio_nreset;
110− int gpio_pll_mode[2];
109+ struct gpio_desc *gpio_nreset;
110+ struct gpio_descs *gpio_pll_mode;
111111 unsigned int dai_fmt;
112112 unsigned int pll_clkdiv;
113113 unsigned int sysclk;
@@ -303,39 +303,41 @@ static int adau1701_reset(struct snd_soc_component *component, unsigned int clkd · 189 unmodified lines
303303 struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component);
304304 int ret;
305305
306+ DECLARE_BITMAP(values, 2);
306307 sigmadsp_reset(adau1701->sigmadsp);
307308
308− if (clkdiv != ADAU1707_CLKDIV_UNSET &&
309− gpio_is_valid(adau1701->gpio_pll_mode[0]) &&
310− gpio_is_valid(adau1701->gpio_pll_mode[1])) {
309+ if (clkdiv != ADAU1707_CLKDIV_UNSET && adau1701->gpio_pll_mode) {
311310 switch (clkdiv) {
312311 case 64:
313− gpio_set_value_cansleep(adau1701->gpio_pll_mode[0], 0);
314− gpio_set_value_cansleep(adau1701->gpio_pll_mode[1], 0);
312+ __assign_bit(0, values, 0);
313+ __assign_bit(1, values, 0);
315314 break;
316315 case 256:
317− gpio_set_value_cansleep(adau1701->gpio_pll_mode[0], 0);
318− gpio_set_value_cansleep(adau1701->gpio_pll_mode[1], 1);
316+ __assign_bit(0, values, 0);
317+ __assign_bit(1, values, 1);
319318 break;
320319 case 384:
321− gpio_set_value_cansleep(adau1701->gpio_pll_mode[0], 1);
322− gpio_set_value_cansleep(adau1701->gpio_pll_mode[1], 0);
320+ __assign_bit(0, values, 1);
321+ __assign_bit(1, values, 0);
323322 break;
324− case 0: /* fallback */
323+ case 0: /* fallback */
325324 case 512:
326− gpio_set_value_cansleep(adau1701->gpio_pll_mode[0], 1);
327− gpio_set_value_cansleep(adau1701->gpio_pll_mode[1], 1);
325+ __assign_bit(0, values, 1);
326+ __assign_bit(1, values, 1);
328327 break;
329328 }
329+ gpiod_set_array_value_cansleep(adau1701->gpio_pll_mode->ndescs,
330+ adau1701->gpio_pll_mode->desc, adau1701->gpio_pll_mode->info,
331+ values);
330332 }
331333
332334 adau1701->pll_clkdiv = clkdiv;
333335
334− if (gpio_is_valid(adau1701->gpio_nreset)) {
335− gpio_set_value_cansleep(adau1701->gpio_nreset, 0);
336+ if (adau1701->gpio_nreset) {
337+ gpiod_set_value_cansleep(adau1701->gpio_nreset, 0);
336338 /* minimum reset time is 20ns */
337339 udelay(1);
338− gpio_set_value_cansleep(adau1701->gpio_nreset, 1);
340+ gpiod_set_value_cansleep(adau1701->gpio_nreset, 1);
339341 /* power-up time may be as long as 85ms */
340342 mdelay(85);
341343 }
@@ -719,8 +721,8 @@ static void adau1701_remove(struct snd_soc_component *component) · 377 unmodified lines
719721 {
720722 struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component);
721723
722− if (gpio_is_valid(adau1701->gpio_nreset))
723− gpio_set_value_cansleep(adau1701->gpio_nreset, 0);
724+ if (adau1701->gpio_nreset)
725+ gpiod_set_value_cansleep(adau1701->gpio_nreset, 0);
724726
725727 regulator_bulk_disable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies);
726728 }
@@ -788,8 +790,6 @@ static int adau1701_i2c_probe(struct i2c_client *client, · 61 unmodified lines
788790 {
789791 struct adau1701 *adau1701;
790792 struct device *dev = &client->dev;
791− int gpio_nreset = -EINVAL;
792− int gpio_pll_mode[2] = { -EINVAL, -EINVAL };
793793 int ret, i;
794794
795795 adau1701 = devm_kzalloc(dev, sizeof(*adau1701), GFP_KERNEL);
@@ -823,26 +823,6 @@ static int adau1701_i2c_probe(struct i2c_client *client, · 27 unmodified lines
823823
824824
825825 if (dev->of_node) {
826− gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
827− if (gpio_nreset < 0 && gpio_nreset != -ENOENT) {
828− ret = gpio_nreset;
829− goto exit_regulators_disable;
830− }
831−
832− gpio_pll_mode[0] = of_get_named_gpio(dev->of_node,
833− "adi,pll-mode-gpios", 0);
834− if (gpio_pll_mode[0] < 0 && gpio_pll_mode[0] != -ENOENT) {
835− ret = gpio_pll_mode[0];
836− goto exit_regulators_disable;
837− }
838−
839− gpio_pll_mode[1] = of_get_named_gpio(dev->of_node,
840− "adi,pll-mode-gpios", 1);
841− if (gpio_pll_mode[1] < 0 && gpio_pll_mode[1] != -ENOENT) {
842− ret = gpio_pll_mode[1];
843− goto exit_regulators_disable;
844− }
845−
846826 of_property_read_u32(dev->of_node, "adi,pll-clkdiv",
847827 &adau1701->pll_clkdiv);
848828
@@ -851,32 +831,20 @@ static int adau1701_i2c_probe(struct i2c_client *client, · 2 unmodified lines
851831 ARRAY_SIZE(adau1701->pin_config));
852832 }
853833
854− if (gpio_is_valid(gpio_nreset)) {
855− ret = devm_gpio_request_one(dev, gpio_nreset, GPIOF_OUT_INIT_LOW,
856− "ADAU1701 Reset");
857− if (ret < 0)
858− goto exit_regulators_disable;
834+ adau1701->gpio_nreset = devm_gpiod_get_optional(dev, "reset", GPIOD_IN);
835+
836+ if (IS_ERR(adau1701->gpio_nreset)) {
837+ ret = PTR_ERR(adau1701->gpio_nreset);
838+ goto exit_regulators_disable;
859839 }
860840
861− if (gpio_is_valid(gpio_pll_mode[0]) &&
862− gpio_is_valid(gpio_pll_mode[1])) {
863− ret = devm_gpio_request_one(dev, gpio_pll_mode[0],
864− GPIOF_OUT_INIT_LOW,
865− "ADAU1701 PLL mode 0");
866− if (ret < 0)
867− goto exit_regulators_disable;
841+ adau1701->gpio_pll_mode = devm_gpiod_get_array_optional(dev, "adi,pll-mode", GPIOD_OUT_LOW);
868842
869− ret = devm_gpio_request_one(dev, gpio_pll_mode[1],
870− GPIOF_OUT_INIT_LOW,
871− "ADAU1701 PLL mode 1");
872− if (ret < 0)
873− goto exit_regulators_disable;
843+ if (IS_ERR(adau1701->gpio_pll_mode)) {
844+ ret = PTR_ERR(adau1701->gpio_pll_mode);
845+ goto exit_regulators_disable;
874846 }
875847
876− adau1701->gpio_nreset = gpio_nreset;
877− adau1701->gpio_pll_mode[0] = gpio_pll_mode[0];
878− adau1701->gpio_pll_mode[1] = gpio_pll_mode[1];
879−
880848 i2c_set_clientdata(client, adau1701);
881849
882850 adau1701->sigmadsp = devm_sigmadsp_init_i2c(client,
sound/soc/codecs/ak4118.c+6−12
@@ -374,20 +374,14 @@ static int ak4118_i2c_probe(struct i2c_client *i2c, · 373 unmodified lines
374374 i2c_set_clientdata(i2c, ak4118);
375375
376376 ak4118->reset = devm_gpiod_get(&i2c->dev, "reset", GPIOD_OUT_HIGH);
377− if (IS_ERR(ak4118->reset)) {
378− ret = PTR_ERR(ak4118->reset);
379− if (ret != -EPROBE_DEFER)
380− dev_err(&i2c->dev, "Failed to get reset: %d\n", ret);
381− return ret;
382− }
377+ if (IS_ERR(ak4118->reset))
378+ return dev_err_probe(&i2c->dev, PTR_ERR(ak4118->reset),
379+ "Failed to get reset\n");
383380
384381 ak4118->irq = devm_gpiod_get(&i2c->dev, "irq", GPIOD_IN);
385− if (IS_ERR(ak4118->irq)) {
386− ret = PTR_ERR(ak4118->irq);
387− if (ret != -EPROBE_DEFER)
388− dev_err(&i2c->dev, "Failed to get IRQ: %d\n", ret);
389− return ret;
390− }
382+ if (IS_ERR(ak4118->irq))
383+ return dev_err_probe(&i2c->dev, PTR_ERR(ak4118->irq),
384+ "Failed to get IRQ\n");
391385
392386 ret = devm_request_threaded_irq(&i2c->dev, gpiod_to_irq(ak4118->irq),
393387 NULL, ak4118_irq_handler,
sound/soc/codecs/ak4375.c+610−0
@@ -0,0 +1,610 @@
1+// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+/*
4+ * Based on code by Hu Jin
5+ * Copyright (C) 2014 Asahi Kasei Microdevices Corporation
6+ */
7+
8+#include <linux/delay.h>
9+#include <linux/gpio/consumer.h>
10+#include <linux/i2c.h>
11+#include <linux/module.h>
12+#include <linux/of_device.h>
13+#include <linux/pm_runtime.h>
14+#include <linux/regulator/consumer.h>
15+#include <sound/soc.h>
16+#include <sound/tlv.h>
17+
18+/* Registers and fields */
19+#define AK4375_00_POWER_MANAGEMENT1 0x00
20+#define PMPLL BIT(0) /* 0: PLL off, 1: PLL on */
21+#define AK4375_01_POWER_MANAGEMENT2 0x01
22+#define PMCP1 BIT(0) /* Charge Pump 1: LDO1 and DAC */
23+#define PMCP2 BIT(1) /* Charge Pump 2: Class-G HP Amp */
24+#define PMLDO1P BIT(4)
25+#define PMLDO1N BIT(5)
26+#define PMLDO (PMLDO1P | PMLDO1N)
27+#define AK4375_02_POWER_MANAGEMENT3 0x02
28+#define AK4375_03_POWER_MANAGEMENT4 0x03
29+#define AK4375_04_OUTPUT_MODE_SETTING 0x04
30+#define AK4375_05_CLOCK_MODE_SELECT 0x05
31+#define FS_MASK GENMASK(4, 0)
32+#define FS_8KHZ 0x00
33+#define FS_11_025KHZ 0x01
34+#define FS_16KHZ 0x04
35+#define FS_22_05KHZ 0x05
36+#define FS_32KHZ 0x08
37+#define FS_44_1KHZ 0x09
38+#define FS_48KHZ 0x0a
39+#define FS_88_2KHZ 0x0d
40+#define FS_96KHZ 0x0e
41+#define FS_176_4KHZ 0x11
42+#define FS_192KHZ 0x12
43+#define CM_MASK GENMASK(6, 5) /* For SRC Bypass mode */
44+#define CM_0 (0x0 << 5)
45+#define CM_1 (0x1 << 5)
46+#define CM_2 (0x2 << 5)
47+#define CM_3 (0x3 << 5)
48+#define AK4375_06_DIGITAL_FILTER_SELECT 0x06
49+#define DADFSEL BIT(5) /* 0: in SRC Bypass mode, 1: in SRC mode */
50+#define DASL BIT(6)
51+#define DASD BIT(7)
52+#define AK4375_07_DAC_MONO_MIXING 0x07
53+#define DACMUTE_MASK (GENMASK(5, 4) | GENMASK(1, 0)) /* Clear to mute */
54+#define AK4375_08_JITTER_CLEANER_SETTING1 0x08
55+#define AK4375_09_JITTER_CLEANER_SETTING2 0x09
56+#define AK4375_0A_JITTER_CLEANER_SETTING3 0x0a
57+#define SELDAIN BIT(1) /* 0: SRC Bypass mode, 1: SRC mode */
58+#define XCKSEL BIT(6) /* 0: PLL0, 1: MCKI */
59+#define XCKCPSEL BIT(7) /* Should be equal to SELDAIN and XCKSEL */
60+#define AK4375_0B_LCH_OUTPUT_VOLUME 0x0b
61+#define AK4375_0C_RCH_OUTPUT_VOLUME 0x0c
62+#define AK4375_0D_HP_VOLUME_CONTROL 0x0d
63+#define AK4375_0E_PLL_CLK_SOURCE_SELECT 0x0e
64+#define PLS BIT(0) /* 0: MCKI, 1: BCLK */
65+#define AK4375_0F_PLL_REF_CLK_DIVIDER1 0x0f /* Reference clock divider [15:8] bits */
66+#define AK4375_10_PLL_REF_CLK_DIVIDER2 0x10 /* Reference clock divider [7:0] bis */
67+#define AK4375_11_PLL_FB_CLK_DIVIDER1 0x11 /* Feedback clock divider [15:8] bits */
68+#define AK4375_12_PLL_FB_CLK_DIVIDER2 0x12 /* Feedback clock divider [7:0] bits */
69+#define AK4375_13_SRC_CLK_SOURCE 0x13 /* SRC Bypass: SRCCKS=XCKSEL=SELDAIN=0 */
70+#define SRCCKS BIT(0) /* SRC Clock source 0: MCKI, 1: PLL0 */
71+#define DIV BIT(4)
72+#define AK4375_14_DAC_CLK_DIVIDER 0x14
73+#define AK4375_15_AUDIO_IF_FORMAT 0x15
74+#define DEVICEID_MASK GENMASK(7, 5)
75+#define AK4375_24_MODE_CONTROL 0x24
76+
77+#define AK4375_PLL_FREQ_OUT_112896000 112896000 /* 44.1 kHz base rate */
78+#define AK4375_PLL_FREQ_OUT_122880000 122880000 /* 32 and 48 kHz base rates */
79+
80+#define DEVICEID_AK4375 0x00
81+#define DEVICEID_AK4375A 0x01
82+#define DEVICEID_AK4376A 0x02
83+#define DEVICEID_AK4377 0x03
84+#define DEVICEID_AK4331 0x07
85+
86+static const char * const supply_names[] = {
87+ "avdd", "tvdd"
88+};
89+
90+struct ak4375_drvdata {
91+ struct snd_soc_dai_driver *dai_drv;
92+ const struct snd_soc_component_driver *comp_drv;
93+};
94+
95+struct ak4375_priv {
96+ struct device *dev;
97+ struct regmap *regmap;
98+ struct gpio_desc *pdn_gpiod;
99+ struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
100+ unsigned int rate;
101+ unsigned int pld;
102+ u8 mute_save;
103+};
104+
105+static const struct reg_default ak4375_reg_defaults[] = {
106+ { 0x00, 0x00 }, { 0x01, 0x00 }, { 0x02, 0x00 },
107+ { 0x03, 0x00 }, { 0x04, 0x00 }, { 0x05, 0x00 },
108+ { 0x06, 0x00 }, { 0x07, 0x00 }, { 0x08, 0x00 },
109+ { 0x09, 0x00 }, { 0x0a, 0x00 }, { 0x0b, 0x19 },
110+ { 0x0c, 0x19 }, { 0x0d, 0x75 }, { 0x0e, 0x01 },
111+ { 0x0f, 0x00 }, { 0x10, 0x00 }, { 0x11, 0x00 },
112+ { 0x12, 0x00 }, { 0x13, 0x00 }, { 0x14, 0x00 },
113+ { 0x15, 0x00 }, { 0x24, 0x00 },
114+};
115+
116+/*
117+ * Output Digital volume control:
118+ * from -12.5 to 3 dB in 0.5 dB steps (mute instead of -12.5 dB)
119+ */
120+static DECLARE_TLV_DB_SCALE(dac_tlv, -1250, 50, 0);
121+
122+/*
123+ * HP-Amp Analog volume control:
124+ * from -4.2 to 6 dB in 2 dB steps (mute instead of -4.2 dB)
125+ */
126+static DECLARE_TLV_DB_SCALE(hpg_tlv, -4200, 20, 0);
127+
128+static const char * const ak4375_ovolcn_select_texts[] = { "Dependent", "Independent" };
129+static const char * const ak4375_mdac_select_texts[] = { "x1", "x1/2" };
130+static const char * const ak4375_cpmode_select_texts[] = {
131+ "Automatic Switching",
132+ "+-VDD Operation",
133+ "+-1/2VDD Operation"
134+};
135+
136+/*
137+ * DASD, DASL bits Digital Filter Setting
138+ * 0, 0 : Sharp Roll-Off Filter
139+ * 0, 1 : Slow Roll-Off Filter
140+ * 1, 0 : Short delay Sharp Roll-Off Filter
141+ * 1, 1 : Short delay Slow Roll-Off Filter
142+ */
143+static const char * const ak4375_digfil_select_texts[] = {
144+ "Sharp Roll-Off Filter",
145+ "Slow Roll-Off Filter",
146+ "Short delay Sharp Roll-Off Filter",
147+ "Short delay Slow Roll-Off Filter",
148+};
149+
150+static const struct soc_enum ak4375_ovolcn_enum =
151+ SOC_ENUM_SINGLE(AK4375_0B_LCH_OUTPUT_VOLUME, 7,
152+ ARRAY_SIZE(ak4375_ovolcn_select_texts), ak4375_ovolcn_select_texts);
153+static const struct soc_enum ak4375_mdacl_enum =
154+ SOC_ENUM_SINGLE(AK4375_07_DAC_MONO_MIXING, 2,
155+ ARRAY_SIZE(ak4375_mdac_select_texts), ak4375_mdac_select_texts);
156+static const struct soc_enum ak4375_mdacr_enum =
157+ SOC_ENUM_SINGLE(AK4375_07_DAC_MONO_MIXING, 6,
158+ ARRAY_SIZE(ak4375_mdac_select_texts), ak4375_mdac_select_texts);
159+static const struct soc_enum ak4375_cpmode_enum =
160+ SOC_ENUM_SINGLE(AK4375_03_POWER_MANAGEMENT4, 2,
161+ ARRAY_SIZE(ak4375_cpmode_select_texts), ak4375_cpmode_select_texts);
162+static const struct soc_enum ak4375_digfil_enum =
163+ SOC_ENUM_SINGLE(AK4375_06_DIGITAL_FILTER_SELECT, 6,
164+ ARRAY_SIZE(ak4375_digfil_select_texts), ak4375_digfil_select_texts);
165+
166+static const struct snd_kcontrol_new ak4375_snd_controls[] = {
167+ SOC_DOUBLE_R_TLV("Digital Output Volume", AK4375_0B_LCH_OUTPUT_VOLUME,
168+ AK4375_0C_RCH_OUTPUT_VOLUME, 0, 0x1f, 0, dac_tlv),
169+ SOC_SINGLE_TLV("HP-Amp Analog Volume",
170+ AK4375_0D_HP_VOLUME_CONTROL, 0, 0x1f, 0, hpg_tlv),
171+
172+ SOC_DOUBLE("DAC Signal Invert Switch", AK4375_07_DAC_MONO_MIXING, 3, 7, 1, 0),
173+
174+ SOC_ENUM("Digital Volume Control", ak4375_ovolcn_enum),
175+ SOC_ENUM("DACL Signal Level", ak4375_mdacl_enum),
176+ SOC_ENUM("DACR Signal Level", ak4375_mdacr_enum),
177+ SOC_ENUM("Charge Pump Mode", ak4375_cpmode_enum),
178+ SOC_ENUM("DAC Digital Filter Mode", ak4375_digfil_enum),
179+};
180+
181+static const struct snd_kcontrol_new ak4375_hpl_mixer_controls[] = {
182+ SOC_DAPM_SINGLE("LDACL Switch", AK4375_07_DAC_MONO_MIXING, 0, 1, 0),
183+ SOC_DAPM_SINGLE("RDACL Switch", AK4375_07_DAC_MONO_MIXING, 1, 1, 0),
184+};
185+
186+static const struct snd_kcontrol_new ak4375_hpr_mixer_controls[] = {
187+ SOC_DAPM_SINGLE("LDACR Switch", AK4375_07_DAC_MONO_MIXING, 4, 1, 0),
188+ SOC_DAPM_SINGLE("RDACR Switch", AK4375_07_DAC_MONO_MIXING, 5, 1, 0),
189+};
190+
191+static int ak4375_dac_event(struct snd_soc_dapm_widget *w,
192+ struct snd_kcontrol *kcontrol, int event)
193+{
194+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
195+
196+ switch (event) {
197+ case SND_SOC_DAPM_PRE_PMU:
198+ snd_soc_component_update_bits(component, AK4375_00_POWER_MANAGEMENT1, PMPLL, PMPLL);
199+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMCP1, PMCP1);
200+ usleep_range(6500, 7000);
201+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMLDO, PMLDO);
202+ usleep_range(1000, 2000);
203+ break;
204+ case SND_SOC_DAPM_POST_PMU:
205+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMCP2, PMCP2);
206+ usleep_range(4500, 5000);
207+ break;
208+ case SND_SOC_DAPM_PRE_PMD:
209+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMCP2, 0x0);
210+ break;
211+ case SND_SOC_DAPM_POST_PMD:
212+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMLDO, 0x0);
213+ snd_soc_component_update_bits(component, AK4375_01_POWER_MANAGEMENT2, PMCP1, 0x0);
214+ snd_soc_component_update_bits(component, AK4375_00_POWER_MANAGEMENT1, PMPLL, 0x0);
215+ break;
216+ }
217+
218+ return 0;
219+}
220+
221+static const struct snd_soc_dapm_widget ak4375_dapm_widgets[] = {
222+ SND_SOC_DAPM_DAC_E("DAC", NULL, AK4375_02_POWER_MANAGEMENT3, 0, 0, ak4375_dac_event,
223+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
224+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
225+
226+ SND_SOC_DAPM_AIF_IN("SDTI", "HiFi Playback", 0, SND_SOC_NOPM, 0, 0),
227+
228+ SND_SOC_DAPM_OUTPUT("HPL"),
229+ SND_SOC_DAPM_OUTPUT("HPR"),
230+
231+ SND_SOC_DAPM_MIXER("HPR Mixer", AK4375_03_POWER_MANAGEMENT4, 1, 0,
232+ &ak4375_hpr_mixer_controls[0], ARRAY_SIZE(ak4375_hpr_mixer_controls)),
233+ SND_SOC_DAPM_MIXER("HPL Mixer", AK4375_03_POWER_MANAGEMENT4, 0, 0,
234+ &ak4375_hpl_mixer_controls[0], ARRAY_SIZE(ak4375_hpl_mixer_controls)),
235+};
236+
237+static const struct snd_soc_dapm_route ak4375_intercon[] = {
238+ { "DAC", NULL, "SDTI" },
239+
240+ { "HPL Mixer", "LDACL Switch", "DAC" },
241+ { "HPL Mixer", "RDACL Switch", "DAC" },
242+ { "HPR Mixer", "LDACR Switch", "DAC" },
243+ { "HPR Mixer", "RDACR Switch", "DAC" },
244+
245+ { "HPL", NULL, "HPL Mixer" },
246+ { "HPR", NULL, "HPR Mixer" },
247+};
248+
249+static int ak4375_hw_params(struct snd_pcm_substream *substream,
250+ struct snd_pcm_hw_params *params,
251+ struct snd_soc_dai *dai)
252+{
253+ struct snd_soc_component *component = dai->component;
254+ struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component);
255+ unsigned int freq_in, freq_out;
256+
257+ ak4375->rate = params_rate(params);
258+
259+ if (ak4375->rate <= 96000)
260+ ak4375->pld = 0;
261+ else
262+ ak4375->pld = 1;
263+
264+ freq_in = 32 * ak4375->rate / (ak4375->pld + 1);
265+
266+ if ((ak4375->rate % 8000) == 0)
267+ freq_out = AK4375_PLL_FREQ_OUT_122880000;
268+ else
269+ freq_out = AK4375_PLL_FREQ_OUT_112896000;
270+
271+ return snd_soc_dai_set_pll(dai, 0, 0, freq_in, freq_out);
272+}
273+
274+static int ak4375_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source,
275+ unsigned int freq_in, unsigned int freq_out)
276+{
277+ struct snd_soc_component *component = dai->component;
278+ struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component);
279+ unsigned int mclk, plm, mdiv, div;
280+ u8 cms, fs, cm;
281+
282+ cms = snd_soc_component_read(component, AK4375_05_CLOCK_MODE_SELECT);
283+ fs = cms & ~FS_MASK;
284+ cm = cms & ~CM_MASK;
285+
286+ switch (ak4375->rate) {
287+ case 8000:
288+ fs |= FS_8KHZ;
289+ break;
290+ case 11025:
291+ fs |= FS_11_025KHZ;
292+ break;
293+ case 16000:
294+ fs |= FS_16KHZ;
295+ break;
296+ case 22050:
297+ fs |= FS_22_05KHZ;
298+ break;
299+ case 32000:
300+ fs |= FS_32KHZ;
301+ break;
302+ case 44100:
303+ fs |= FS_44_1KHZ;
304+ break;
305+ case 48000:
306+ fs |= FS_48KHZ;
307+ break;
308+ case 88200:
309+ fs |= FS_88_2KHZ;
310+ break;
311+ case 96000:
312+ fs |= FS_96KHZ;
313+ break;
314+ case 176400:
315+ fs |= FS_176_4KHZ;
316+ break;
317+ case 192000:
318+ fs |= FS_192KHZ;
319+ break;
320+ default:
321+ return -EINVAL;
322+ }
323+
324+ if (ak4375->rate <= 24000) {
325+ cm |= CM_1;
326+ mclk = 512 * ak4375->rate;
327+ mdiv = freq_out / mclk - 1;
328+ div = 0;
329+ } else if (ak4375->rate <= 96000) {
330+ cm |= CM_0;
331+ mclk = 256 * ak4375->rate;
332+ mdiv = freq_out / mclk - 1;
333+ div = 0;
334+ } else {
335+ cm |= CM_3;
336+ mclk = 128 * ak4375->rate;
337+ mdiv = 4;
338+ div = 1;
339+ }
340+
341+ /* Writing both fields in one go seems to make playback choppy on start */
342+ snd_soc_component_update_bits(component, AK4375_05_CLOCK_MODE_SELECT, FS_MASK, fs);
343+ snd_soc_component_update_bits(component, AK4375_05_CLOCK_MODE_SELECT, CM_MASK, cm);
344+
345+ snd_soc_component_write(component, AK4375_0F_PLL_REF_CLK_DIVIDER1,
346+ (ak4375->pld & 0xff00) >> 8);
347+ snd_soc_component_write(component, AK4375_10_PLL_REF_CLK_DIVIDER2,
348+ ak4375->pld & 0x00ff);
349+
350+ plm = freq_out / freq_in - 1;
351+ snd_soc_component_write(component, AK4375_11_PLL_FB_CLK_DIVIDER1, (plm & 0xff00) >> 8);
352+ snd_soc_component_write(component, AK4375_12_PLL_FB_CLK_DIVIDER2, plm & 0x00ff);
353+
354+ snd_soc_component_update_bits(component, AK4375_13_SRC_CLK_SOURCE, DIV, div);
355+
356+ /* SRCCKS bit: force to 1 for SRC PLL source clock */
357+ snd_soc_component_update_bits(component, AK4375_13_SRC_CLK_SOURCE, SRCCKS, SRCCKS);
358+
359+ snd_soc_component_write(component, AK4375_14_DAC_CLK_DIVIDER, mdiv);
360+
361+ dev_dbg(ak4375->dev, "rate=%d mclk=%d f_in=%d f_out=%d PLD=%d PLM=%d MDIV=%d DIV=%d\n",
362+ ak4375->rate, mclk, freq_in, freq_out, ak4375->pld, plm, mdiv, div);
363+
364+ return 0;
365+}
366+
367+static int ak4375_mute(struct snd_soc_dai *dai, int mute, int direction)
368+{
369+ struct snd_soc_component *component = dai->component;
370+ struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component);
371+ u8 val = snd_soc_component_read(component, AK4375_07_DAC_MONO_MIXING);
372+
373+ dev_dbg(ak4375->dev, "mute=%d val=%d\n", mute, val);
374+
375+ if (mute) {
376+ ak4375->mute_save = val & DACMUTE_MASK;
377+ val &= ~DACMUTE_MASK;
378+ } else {
379+ val |= ak4375->mute_save;
380+ }
381+
382+ snd_soc_component_write(component, AK4375_07_DAC_MONO_MIXING, val);
383+
384+ return 0;
385+}
386+
387+#define AK4375_RATES (SNDRV_PCM_RATE_8000_48000 |\
388+ SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |\
389+ SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000)
390+
391+#define AK4375_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
392+ SNDRV_PCM_FMTBIT_S24_LE |\
393+ SNDRV_PCM_FMTBIT_S32_LE)
394+
395+static const struct snd_soc_dai_ops ak4375_dai_ops = {
396+ .hw_params = ak4375_hw_params,
397+ .mute_stream = ak4375_mute,
398+ .set_pll = ak4375_dai_set_pll,
399+};
400+
401+static struct snd_soc_dai_driver ak4375_dai = {
402+ .name = "ak4375-hifi",
403+ .playback = {
404+ .stream_name = "HiFi Playback",
405+ .channels_min = 1,
406+ .channels_max = 2,
407+ .rates = AK4375_RATES,
408+ .rate_min = 8000,
409+ .rate_max = 192000,
410+ .formats = AK4375_FORMATS,
411+ },
412+ .ops = &ak4375_dai_ops,
413+};
414+
415+static void ak4375_power_off(struct ak4375_priv *ak4375)
416+{
417+ gpiod_set_value_cansleep(ak4375->pdn_gpiod, 0);
418+ usleep_range(1000, 2000);
419+
420+ regulator_bulk_disable(ARRAY_SIZE(ak4375->supplies), ak4375->supplies);
421+}
422+
423+static int ak4375_power_on(struct ak4375_priv *ak4375)
424+{
425+ int ret;
426+
427+ ret = regulator_bulk_enable(ARRAY_SIZE(ak4375->supplies), ak4375->supplies);
428+ if (ret < 0) {
429+ dev_err(ak4375->dev, "Failed to enable regulators: %d\n", ret);
430+ return ret;
431+ }
432+
433+ usleep_range(3000, 4000);
434+
435+ gpiod_set_value_cansleep(ak4375->pdn_gpiod, 1);
436+ usleep_range(1000, 2000);
437+
438+ return 0;
439+}
440+
441+static int __maybe_unused ak4375_runtime_suspend(struct device *dev)
442+{
443+ struct ak4375_priv *ak4375 = dev_get_drvdata(dev);
444+
445+ regcache_cache_only(ak4375->regmap, true);
446+ ak4375_power_off(ak4375);
447+
448+ return 0;
449+}
450+
451+static int __maybe_unused ak4375_runtime_resume(struct device *dev)
452+{
453+ struct ak4375_priv *ak4375 = dev_get_drvdata(dev);
454+ int ret;
455+
456+ ret = ak4375_power_on(ak4375);
457+ if (ret < 0)
458+ return ret;
459+
460+ regcache_cache_only(ak4375->regmap, false);
461+ regcache_mark_dirty(ak4375->regmap);
462+
463+ return regcache_sync(ak4375->regmap);
464+}
465+
466+static const struct snd_soc_component_driver soc_codec_dev_ak4375 = {
467+ .controls = ak4375_snd_controls,
468+ .num_controls = ARRAY_SIZE(ak4375_snd_controls),
469+ .dapm_widgets = ak4375_dapm_widgets,
470+ .num_dapm_widgets = ARRAY_SIZE(ak4375_dapm_widgets),
471+ .dapm_routes = ak4375_intercon,
472+ .num_dapm_routes = ARRAY_SIZE(ak4375_intercon),
473+ .idle_bias_on = 1,
474+ .use_pmdown_time = 1,
475+ .endianness = 1,
476+ .non_legacy_dai_naming = 1,
477+};
478+
479+static const struct regmap_config ak4375_regmap = {
480+ .reg_bits = 8,
481+ .val_bits = 8,
482+ .max_register = AK4375_24_MODE_CONTROL,
483+ .reg_defaults = ak4375_reg_defaults,
484+ .num_reg_defaults = ARRAY_SIZE(ak4375_reg_defaults),
485+ .cache_type = REGCACHE_RBTREE,
486+};
487+
488+static const struct ak4375_drvdata ak4375_drvdata = {
489+ .dai_drv = &ak4375_dai,
490+ .comp_drv = &soc_codec_dev_ak4375,
491+};
492+
493+static const struct dev_pm_ops ak4375_pm = {
494+ SET_RUNTIME_PM_OPS(ak4375_runtime_suspend, ak4375_runtime_resume, NULL)
495+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
496+ pm_runtime_force_resume)
497+};
498+
499+static int ak4375_i2c_probe(struct i2c_client *i2c)
500+{
501+ struct ak4375_priv *ak4375;
502+ const struct ak4375_drvdata *drvdata;
503+ unsigned int deviceid;
504+ int ret, i;
505+
506+ ak4375 = devm_kzalloc(&i2c->dev, sizeof(*ak4375), GFP_KERNEL);
507+ if (!ak4375)
508+ return -ENOMEM;
509+
510+ ak4375->regmap = devm_regmap_init_i2c(i2c, &ak4375_regmap);
511+ if (IS_ERR(ak4375->regmap))
512+ return PTR_ERR(ak4375->regmap);
513+
514+ i2c_set_clientdata(i2c, ak4375);
515+ ak4375->dev = &i2c->dev;
516+
517+ drvdata = of_device_get_match_data(&i2c->dev);
518+
519+ for (i = 0; i < ARRAY_SIZE(supply_names); i++)
520+ ak4375->supplies[i].supply = supply_names[i];
521+
522+ ret = devm_regulator_bulk_get(ak4375->dev, ARRAY_SIZE(ak4375->supplies), ak4375->supplies);
523+ if (ret < 0) {
524+ dev_err(ak4375->dev, "Failed to get regulators: %d\n", ret);
525+ return ret;
526+ }
527+
528+ ak4375->pdn_gpiod = devm_gpiod_get_optional(ak4375->dev, "pdn", GPIOD_OUT_LOW);
529+ if (IS_ERR(ak4375->pdn_gpiod))
530+ return dev_err_probe(ak4375->dev, PTR_ERR(ak4375->pdn_gpiod),
531+ "failed to get pdn\n");
532+
533+ ret = ak4375_power_on(ak4375);
534+ if (ret < 0)
535+ return ret;
536+
537+ /* Don't read deviceid from cache */
538+ regcache_cache_bypass(ak4375->regmap, true);
539+
540+ ret = regmap_read(ak4375->regmap, AK4375_15_AUDIO_IF_FORMAT, &deviceid);
541+ if (ret < 0) {
542+ dev_err(ak4375->dev, "unable to read DEVICEID!\n");
543+ return ret;
544+ }
545+
546+ regcache_cache_bypass(ak4375->regmap, false);
547+
548+ deviceid = (deviceid & DEVICEID_MASK) >> 5;
549+
550+ switch (deviceid) {
551+ case DEVICEID_AK4331:
552+ dev_err(ak4375->dev, "found untested AK4331\n");
553+ return -EINVAL;
554+ case DEVICEID_AK4375:
555+ dev_dbg(ak4375->dev, "found AK4375\n");
556+ break;
557+ case DEVICEID_AK4375A:
558+ dev_dbg(ak4375->dev, "found AK4375A\n");
559+ break;
560+ case DEVICEID_AK4376A:
561+ dev_err(ak4375->dev, "found unsupported AK4376/A!\n");
562+ return -EINVAL;
563+ case DEVICEID_AK4377:
564+ dev_err(ak4375->dev, "found unsupported AK4377!\n");
565+ return -EINVAL;
566+ default:
567+ dev_err(ak4375->dev, "unrecognized DEVICEID!\n");
568+ return -EINVAL;
569+ }
570+
571+ pm_runtime_set_active(ak4375->dev);
572+ pm_runtime_enable(ak4375->dev);
573+
574+ ret = devm_snd_soc_register_component(ak4375->dev, drvdata->comp_drv,
575+ drvdata->dai_drv, 1);
576+ if (ret < 0) {
577+ dev_err(ak4375->dev, "Failed to register CODEC: %d\n", ret);
578+ return ret;
579+ }
580+
581+ return 0;
582+}
583+
584+static int ak4375_i2c_remove(struct i2c_client *i2c)
585+{
586+ pm_runtime_disable(&i2c->dev);
587+
588+ return 0;
589+}
590+
591+static const struct of_device_id ak4375_of_match[] = {
592+ { .compatible = "asahi-kasei,ak4375", .data = &ak4375_drvdata },
593+ { },
594+};
595+MODULE_DEVICE_TABLE(of, ak4375_of_match);
596+
597+static struct i2c_driver ak4375_i2c_driver = {
598+ .driver = {
599+ .name = "ak4375",
600+ .pm = &ak4375_pm,
601+ .of_match_table = ak4375_of_match,
602+ },
603+ .probe_new = ak4375_i2c_probe,
604+ .remove = ak4375_i2c_remove,
605+};
606+module_i2c_driver(ak4375_i2c_driver);
607+
608+MODULE_AUTHOR("Vincent Knecht <vincent.knecht@mailoo.org>");
609+MODULE_DESCRIPTION("ASoC AK4375 DAC driver");
610+MODULE_LICENSE("GPL");
sound/soc/codecs/cs35l35.c+1−1
@@ -1311,7 +1311,7 @@ static int cs35l35_handle_of_data(struct i2c_client *i2c_client, · 1310 unmodified lines
13111311 pdata->gain_zc = of_property_read_bool(np, "cirrus,amp-gain-zc");
13121312
13131313 classh = of_get_child_by_name(np, "cirrus,classh-internal-algo");
1314− classh_config->classh_algo_enable = classh ? true : false;
1314+ classh_config->classh_algo_enable = (classh != NULL);
13151315
13161316 if (classh_config->classh_algo_enable) {
13171317 classh_config->classh_bst_override =
sound/soc/codecs/cs35l41-i2c.c+3−16
@@ -17,27 +17,13 @@ · 16 unmodified lines
1717 #include <linux/platform_device.h>
1818 #include <linux/slab.h>
1919
20−#include <sound/cs35l41.h>
2120 #include "cs35l41.h"
2221
23−static struct regmap_config cs35l41_regmap_i2c = {
24− .reg_bits = 32,
25− .val_bits = 32,
26− .reg_stride = CS35L41_REGSTRIDE,
27− .reg_format_endian = REGMAP_ENDIAN_BIG,
28− .val_format_endian = REGMAP_ENDIAN_BIG,
29− .max_register = CS35L41_LASTREG,
30− .reg_defaults = cs35l41_reg,
31− .num_reg_defaults = ARRAY_SIZE(cs35l41_reg),
32− .volatile_reg = cs35l41_volatile_reg,
33− .readable_reg = cs35l41_readable_reg,
34− .precious_reg = cs35l41_precious_reg,
35− .cache_type = REGCACHE_RBTREE,
36−};
37−
3822 static const struct i2c_device_id cs35l41_id_i2c[] = {
3923 { "cs35l40", 0 },
4024 { "cs35l41", 0 },
25+ { "cs35l51", 0 },
26+ { "cs35l53", 0 },
4127 {}
4228 };
4329
@@ -100,6 +86,7 @@ MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_match); · 56 unmodified lines
10086 static struct i2c_driver cs35l41_i2c_driver = {
10187 .driver = {
10288 .name = "cs35l41",
89+ .pm = &cs35l41_pm_ops,
10390 .of_match_table = of_match_ptr(cs35l41_of_match),
10491 .acpi_match_table = ACPI_PTR(cs35l41_acpi_match),
10592 },
sound/soc/codecs/cs35l41-lib.crenamed from sound/soc/codecs/cs35l41-tables.c+512−66
@@ -1,17 +1,30 @@
11 // SPDX-License-Identifier: GPL-2.0
22 //
3−// cs35l41-tables.c -- CS35L41 ALSA SoC audio driver
3+// cs35l41-lib.c -- CS35L41 Common functions for HDA and ASoC Audio drivers
44 //
55 // Copyright 2017-2021 Cirrus Logic, Inc.
66 //
77 // Author: David Rhodes <david.rhodes@cirrus.com>
8+// Author: Lucas Tanure <lucas.tanure@cirrus.com>
89
9−#include "cs35l41.h"
10+#include <linux/dev_printk.h>
11+#include <linux/module.h>
12+#include <linux/regmap.h>
13+#include <linux/regulator/consumer.h>
14+#include <linux/slab.h>
1015
11−const struct reg_default cs35l41_reg[CS35L41_MAX_CACHE_REG] = {
16+#include <sound/cs35l41.h>
17+
18+static const struct reg_default cs35l41_reg[] = {
1219 { CS35L41_PWR_CTRL1, 0x00000000 },
20+ { CS35L41_PWR_CTRL2, 0x00000000 },
1321 { CS35L41_PWR_CTRL3, 0x01000010 },
1422 { CS35L41_GPIO_PAD_CONTROL, 0x00000000 },
23+ { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 },
24+ { CS35L41_TST_FS_MON0, 0x00020016 },
25+ { CS35L41_BSTCVRT_COEFF, 0x00002424 },
26+ { CS35L41_BSTCVRT_SLOPE_LBST, 0x00007500 },
27+ { CS35L41_BSTCVRT_PEAK_CUR, 0x0000004A },
1528 { CS35L41_SP_ENABLES, 0x00000000 },
1629 { CS35L41_SP_RATE_CTRL, 0x00000028 },
1730 { CS35L41_SP_FORMAT, 0x18180200 },
@@ -39,15 +52,20 @@ const struct reg_default cs35l41_reg[CS35L41_MAX_CACHE_REG] = { · 21 unmodified lines
3952 { CS35L41_CLASSH_CFG, 0x000B0405 },
4053 { CS35L41_WKFET_CFG, 0x00000111 },
4154 { CS35L41_NG_CFG, 0x00000033 },
42− { CS35L41_AMP_GAIN_CTRL, 0x00000273 },
55+ { CS35L41_AMP_GAIN_CTRL, 0x00000000 },
56+ { CS35L41_IRQ1_MASK1, 0xFFFFFFFF },
57+ { CS35L41_IRQ1_MASK2, 0xFFFFFFFF },
58+ { CS35L41_IRQ1_MASK3, 0xFFFF87FF },
59+ { CS35L41_IRQ1_MASK4, 0xFEFFFFFF },
4360 { CS35L41_GPIO1_CTRL1, 0xE1000001 },
4461 { CS35L41_GPIO2_CTRL1, 0xE1000001 },
4562 { CS35L41_MIXER_NGATE_CFG, 0x00000000 },
4663 { CS35L41_MIXER_NGATE_CH1_CFG, 0x00000303 },
4764 { CS35L41_MIXER_NGATE_CH2_CFG, 0x00000303 },
65+ { CS35L41_DSP1_CCM_CORE_CTRL, 0x00000101 },
4866 };
4967
50−bool cs35l41_readable_reg(struct device *dev, unsigned int reg)
68+static bool cs35l41_readable_reg(struct device *dev, unsigned int reg)
5169 {
5270 switch (reg) {
5371 case CS35L41_DEVID:
@@ -72,10 +90,14 @@ bool cs35l41_readable_reg(struct device *dev, unsigned int reg) · 18 unmodified lines
7290 case CS35L41_PROTECT_REL_ERR_IGN:
7391 case CS35L41_GPIO_PAD_CONTROL:
7492 case CS35L41_JTAG_CONTROL:
93+ case CS35L41_PWRMGT_CTL:
94+ case CS35L41_WAKESRC_CTL:
95+ case CS35L41_PWRMGT_STS:
7596 case CS35L41_PLL_CLK_CTRL:
7697 case CS35L41_DSP_CLK_CTRL:
7798 case CS35L41_GLOBAL_CLK_CTRL:
7899 case CS35L41_DATA_FS_SEL:
100+ case CS35L41_TST_FS_MON0:
79101 case CS35L41_MDSYNC_EN:
80102 case CS35L41_MDSYNC_TX_ID:
81103 case CS35L41_MDSYNC_PWR_CTRL:
@@ -200,6 +222,83 @@ bool cs35l41_readable_reg(struct device *dev, unsigned int reg) · 118 unmodified lines
200222 case CS35L41_DIE_STS2:
201223 case CS35L41_TEMP_CAL1:
202224 case CS35L41_TEMP_CAL2:
225+ case CS35L41_DSP1_TIMESTAMP_COUNT:
226+ case CS35L41_DSP1_SYS_ID:
227+ case CS35L41_DSP1_SYS_VERSION:
228+ case CS35L41_DSP1_SYS_CORE_ID:
229+ case CS35L41_DSP1_SYS_AHB_ADDR:
230+ case CS35L41_DSP1_SYS_XSRAM_SIZE:
231+ case CS35L41_DSP1_SYS_YSRAM_SIZE:
232+ case CS35L41_DSP1_SYS_PSRAM_SIZE:
233+ case CS35L41_DSP1_SYS_PM_BOOT_SIZE:
234+ case CS35L41_DSP1_SYS_FEATURES:
235+ case CS35L41_DSP1_SYS_FIR_FILTERS:
236+ case CS35L41_DSP1_SYS_LMS_FILTERS:
237+ case CS35L41_DSP1_SYS_XM_BANK_SIZE:
238+ case CS35L41_DSP1_SYS_YM_BANK_SIZE:
239+ case CS35L41_DSP1_SYS_PM_BANK_SIZE:
240+ case CS35L41_DSP1_RX1_RATE:
241+ case CS35L41_DSP1_RX2_RATE:
242+ case CS35L41_DSP1_RX3_RATE:
243+ case CS35L41_DSP1_RX4_RATE:
244+ case CS35L41_DSP1_RX5_RATE:
245+ case CS35L41_DSP1_RX6_RATE:
246+ case CS35L41_DSP1_RX7_RATE:
247+ case CS35L41_DSP1_RX8_RATE:
248+ case CS35L41_DSP1_TX1_RATE:
249+ case CS35L41_DSP1_TX2_RATE:
250+ case CS35L41_DSP1_TX3_RATE:
251+ case CS35L41_DSP1_TX4_RATE:
252+ case CS35L41_DSP1_TX5_RATE:
253+ case CS35L41_DSP1_TX6_RATE:
254+ case CS35L41_DSP1_TX7_RATE:
255+ case CS35L41_DSP1_TX8_RATE:
256+ case CS35L41_DSP1_SCRATCH1:
257+ case CS35L41_DSP1_SCRATCH2:
258+ case CS35L41_DSP1_SCRATCH3:
259+ case CS35L41_DSP1_SCRATCH4:
260+ case CS35L41_DSP1_CCM_CORE_CTRL:
261+ case CS35L41_DSP1_CCM_CLK_OVERRIDE:
262+ case CS35L41_DSP1_XM_MSTR_EN:
263+ case CS35L41_DSP1_XM_CORE_PRI:
264+ case CS35L41_DSP1_XM_AHB_PACK_PL_PRI:
265+ case CS35L41_DSP1_XM_AHB_UP_PL_PRI:
266+ case CS35L41_DSP1_XM_ACCEL_PL0_PRI:
267+ case CS35L41_DSP1_XM_NPL0_PRI:
268+ case CS35L41_DSP1_YM_MSTR_EN:
269+ case CS35L41_DSP1_YM_CORE_PRI:
270+ case CS35L41_DSP1_YM_AHB_PACK_PL_PRI:
271+ case CS35L41_DSP1_YM_AHB_UP_PL_PRI:
272+ case CS35L41_DSP1_YM_ACCEL_PL0_PRI:
273+ case CS35L41_DSP1_YM_NPL0_PRI:
274+ case CS35L41_DSP1_MPU_XM_ACCESS0:
275+ case CS35L41_DSP1_MPU_YM_ACCESS0:
276+ case CS35L41_DSP1_MPU_WNDW_ACCESS0:
277+ case CS35L41_DSP1_MPU_XREG_ACCESS0:
278+ case CS35L41_DSP1_MPU_YREG_ACCESS0:
279+ case CS35L41_DSP1_MPU_XM_ACCESS1:
280+ case CS35L41_DSP1_MPU_YM_ACCESS1:
281+ case CS35L41_DSP1_MPU_WNDW_ACCESS1:
282+ case CS35L41_DSP1_MPU_XREG_ACCESS1:
283+ case CS35L41_DSP1_MPU_YREG_ACCESS1:
284+ case CS35L41_DSP1_MPU_XM_ACCESS2:
285+ case CS35L41_DSP1_MPU_YM_ACCESS2:
286+ case CS35L41_DSP1_MPU_WNDW_ACCESS2:
287+ case CS35L41_DSP1_MPU_XREG_ACCESS2:
288+ case CS35L41_DSP1_MPU_YREG_ACCESS2:
289+ case CS35L41_DSP1_MPU_XM_ACCESS3:
290+ case CS35L41_DSP1_MPU_YM_ACCESS3:
291+ case CS35L41_DSP1_MPU_WNDW_ACCESS3:
292+ case CS35L41_DSP1_MPU_XREG_ACCESS3:
293+ case CS35L41_DSP1_MPU_YREG_ACCESS3:
294+ case CS35L41_DSP1_MPU_XM_VIO_ADDR:
295+ case CS35L41_DSP1_MPU_XM_VIO_STATUS:
296+ case CS35L41_DSP1_MPU_YM_VIO_ADDR:
297+ case CS35L41_DSP1_MPU_YM_VIO_STATUS:
298+ case CS35L41_DSP1_MPU_PM_VIO_ADDR:
299+ case CS35L41_DSP1_MPU_PM_VIO_STATUS:
300+ case CS35L41_DSP1_MPU_LOCK_CONFIG:
301+ case CS35L41_DSP1_MPU_WDT_RST_CTRL:
203302 case CS35L41_OTP_TRIM_1:
204303 case CS35L41_OTP_TRIM_2:
205304 case CS35L41_OTP_TRIM_3:
@@ -237,6 +336,13 @@ bool cs35l41_readable_reg(struct device *dev, unsigned int reg) · 31 unmodified lines
237336 case CS35L41_OTP_TRIM_35:
238337 case CS35L41_OTP_TRIM_36:
239338 case CS35L41_OTP_MEM0 ... CS35L41_OTP_MEM31:
339+ case CS35L41_DSP1_XMEM_PACK_0 ... CS35L41_DSP1_XMEM_PACK_3068:
340+ case CS35L41_DSP1_XMEM_UNPACK32_0 ... CS35L41_DSP1_XMEM_UNPACK32_2046:
341+ case CS35L41_DSP1_XMEM_UNPACK24_0 ... CS35L41_DSP1_XMEM_UNPACK24_4093:
342+ case CS35L41_DSP1_YMEM_PACK_0 ... CS35L41_DSP1_YMEM_PACK_1532:
343+ case CS35L41_DSP1_YMEM_UNPACK32_0 ... CS35L41_DSP1_YMEM_UNPACK32_1022:
344+ case CS35L41_DSP1_YMEM_UNPACK24_0 ... CS35L41_DSP1_YMEM_UNPACK24_2045:
345+ case CS35L41_DSP1_PMEM_0 ... CS35L41_DSP1_PMEM_5114:
240346 /*test regs*/
241347 case CS35L41_PLL_OVR:
242348 case CS35L41_BST_TEST_DUTY:
@@ -247,23 +353,35 @@ bool cs35l41_readable_reg(struct device *dev, unsigned int reg) · 4 unmodified lines
247353 }
248354 }
249355
250−bool cs35l41_precious_reg(struct device *dev, unsigned int reg)
356+static bool cs35l41_precious_reg(struct device *dev, unsigned int reg)
251357 {
252358 switch (reg) {
359+ case CS35L41_TEST_KEY_CTL:
360+ case CS35L41_USER_KEY_CTL:
253361 case CS35L41_OTP_MEM0 ... CS35L41_OTP_MEM31:
362+ case CS35L41_TST_FS_MON0:
363+ case CS35L41_DSP1_XMEM_PACK_0 ... CS35L41_DSP1_XMEM_PACK_3068:
364+ case CS35L41_DSP1_YMEM_PACK_0 ... CS35L41_DSP1_YMEM_PACK_1532:
365+ case CS35L41_DSP1_PMEM_0 ... CS35L41_DSP1_PMEM_5114:
254366 return true;
255367 default:
256368 return false;
257369 }
258370 }
259371
260−bool cs35l41_volatile_reg(struct device *dev, unsigned int reg)
372+static bool cs35l41_volatile_reg(struct device *dev, unsigned int reg)
261373 {
262374 switch (reg) {
263375 case CS35L41_DEVID:
264376 case CS35L41_SFT_RESET:
265377 case CS35L41_FABID:
266378 case CS35L41_REVID:
379+ case CS35L41_OTPID:
380+ case CS35L41_TEST_KEY_CTL:
381+ case CS35L41_USER_KEY_CTL:
382+ case CS35L41_PWRMGT_CTL:
383+ case CS35L41_WAKESRC_CTL:
384+ case CS35L41_PWRMGT_STS:
267385 case CS35L41_DTEMP_EN:
268386 case CS35L41_IRQ1_STATUS:
269387 case CS35L41_IRQ1_STATUS1:
@@ -274,17 +392,6 @@ bool cs35l41_volatile_reg(struct device *dev, unsigned int reg) · 4 unmodified lines
274392 case CS35L41_IRQ1_RAW_STATUS2:
275393 case CS35L41_IRQ1_RAW_STATUS3:
276394 case CS35L41_IRQ1_RAW_STATUS4:
277− case CS35L41_IRQ1_FRC1:
278− case CS35L41_IRQ1_FRC2:
279− case CS35L41_IRQ1_FRC3:
280− case CS35L41_IRQ1_FRC4:
281− case CS35L41_IRQ1_EDGE1:
282− case CS35L41_IRQ1_EDGE4:
283− case CS35L41_IRQ1_POL1:
284− case CS35L41_IRQ1_POL2:
285− case CS35L41_IRQ1_POL3:
286− case CS35L41_IRQ1_POL4:
287− case CS35L41_IRQ1_DB3:
288395 case CS35L41_IRQ2_STATUS:
289396 case CS35L41_IRQ2_STATUS1:
290397 case CS35L41_IRQ2_STATUS2:
@@ -294,54 +401,20 @@ bool cs35l41_volatile_reg(struct device *dev, unsigned int reg) · 3 unmodified lines
294401 case CS35L41_IRQ2_RAW_STATUS2:
295402 case CS35L41_IRQ2_RAW_STATUS3:
296403 case CS35L41_IRQ2_RAW_STATUS4:
297− case CS35L41_IRQ2_FRC1:
298− case CS35L41_IRQ2_FRC2:
299− case CS35L41_IRQ2_FRC3:
300− case CS35L41_IRQ2_FRC4:
301− case CS35L41_IRQ2_EDGE1:
302− case CS35L41_IRQ2_EDGE4:
303− case CS35L41_IRQ2_POL1:
304− case CS35L41_IRQ2_POL2:
305− case CS35L41_IRQ2_POL3:
306− case CS35L41_IRQ2_POL4:
307− case CS35L41_IRQ2_DB3:
308404 case CS35L41_GPIO_STATUS1:
309− case CS35L41_OTP_TRIM_1:
310− case CS35L41_OTP_TRIM_2:
311− case CS35L41_OTP_TRIM_3:
312− case CS35L41_OTP_TRIM_4:
313− case CS35L41_OTP_TRIM_5:
314− case CS35L41_OTP_TRIM_6:
315− case CS35L41_OTP_TRIM_7:
316− case CS35L41_OTP_TRIM_8:
317− case CS35L41_OTP_TRIM_9:
318− case CS35L41_OTP_TRIM_10:
319− case CS35L41_OTP_TRIM_11:
320− case CS35L41_OTP_TRIM_12:
321− case CS35L41_OTP_TRIM_13:
322− case CS35L41_OTP_TRIM_14:
323− case CS35L41_OTP_TRIM_15:
324− case CS35L41_OTP_TRIM_16:
325− case CS35L41_OTP_TRIM_17:
326− case CS35L41_OTP_TRIM_18:
327− case CS35L41_OTP_TRIM_19:
328− case CS35L41_OTP_TRIM_20:
329− case CS35L41_OTP_TRIM_21:
330− case CS35L41_OTP_TRIM_22:
331− case CS35L41_OTP_TRIM_23:
332− case CS35L41_OTP_TRIM_24:
333− case CS35L41_OTP_TRIM_25:
334− case CS35L41_OTP_TRIM_26:
335− case CS35L41_OTP_TRIM_27:
336− case CS35L41_OTP_TRIM_28:
337− case CS35L41_OTP_TRIM_29:
338− case CS35L41_OTP_TRIM_30:
339− case CS35L41_OTP_TRIM_31:
340− case CS35L41_OTP_TRIM_32:
341− case CS35L41_OTP_TRIM_33:
342− case CS35L41_OTP_TRIM_34:
343− case CS35L41_OTP_TRIM_35:
344− case CS35L41_OTP_TRIM_36:
405+ case CS35L41_DSP_MBOX_1 ... CS35L41_DSP_VIRT2_MBOX_8:
406+ case CS35L41_DSP1_XMEM_PACK_0 ... CS35L41_DSP1_XMEM_PACK_3068:
407+ case CS35L41_DSP1_XMEM_UNPACK32_0 ... CS35L41_DSP1_XMEM_UNPACK32_2046:
408+ case CS35L41_DSP1_XMEM_UNPACK24_0 ... CS35L41_DSP1_XMEM_UNPACK24_4093:
409+ case CS35L41_DSP1_YMEM_PACK_0 ... CS35L41_DSP1_YMEM_PACK_1532:
410+ case CS35L41_DSP1_YMEM_UNPACK32_0 ... CS35L41_DSP1_YMEM_UNPACK32_1022:
411+ case CS35L41_DSP1_YMEM_UNPACK24_0 ... CS35L41_DSP1_YMEM_UNPACK24_2045:
412+ case CS35L41_DSP1_PMEM_0 ... CS35L41_DSP1_PMEM_5114:
413+ case CS35L41_DSP1_SCRATCH1:
414+ case CS35L41_DSP1_SCRATCH2:
415+ case CS35L41_DSP1_SCRATCH3:
416+ case CS35L41_DSP1_SCRATCH4:
417+ case CS35L41_DSP1_CCM_CLK_OVERRIDE ... CS35L41_DSP1_WDT_STATUS:
345418 case CS35L41_OTP_MEM0 ... CS35L41_OTP_MEM31:
346419 return true;
347420 default:
@@ -555,7 +628,46 @@ static const struct cs35l41_otp_packed_element_t otp_map_2[CS35L41_NUM_OTP_ELEM] · 207 unmodified lines
555628 { 0x00017044, 0, 24 }, /*LOT_NUMBER*/
556629 };
557630
558−const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[CS35L41_NUM_OTP_MAPS] = {
631+static const struct reg_sequence cs35l41_reva0_errata_patch[] = {
632+ { 0x00003854, 0x05180240 },
633+ { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
634+ { 0x00004310, 0x00000000 },
635+ { CS35L41_VPVBST_FS_SEL, 0x00000000 },
636+ { CS35L41_OTP_TRIM_30, 0x9091A1C8 },
637+ { 0x00003014, 0x0200EE0E },
638+ { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
639+ { 0x00000054, 0x00000004 },
640+ { CS35L41_IRQ1_DB3, 0x00000000 },
641+ { CS35L41_IRQ2_DB3, 0x00000000 },
642+ { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
643+ { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
644+ { CS35L41_PWR_CTRL2, 0x00000000 },
645+ { CS35L41_AMP_GAIN_CTRL, 0x00000000 },
646+};
647+
648+static const struct reg_sequence cs35l41_revb0_errata_patch[] = {
649+ { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
650+ { 0x00004310, 0x00000000 },
651+ { CS35L41_VPVBST_FS_SEL, 0x00000000 },
652+ { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
653+ { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
654+ { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
655+ { CS35L41_PWR_CTRL2, 0x00000000 },
656+ { CS35L41_AMP_GAIN_CTRL, 0x00000000 },
657+};
658+
659+static const struct reg_sequence cs35l41_revb2_errata_patch[] = {
660+ { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
661+ { 0x00004310, 0x00000000 },
662+ { CS35L41_VPVBST_FS_SEL, 0x00000000 },
663+ { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
664+ { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
665+ { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
666+ { CS35L41_PWR_CTRL2, 0x00000000 },
667+ { CS35L41_AMP_GAIN_CTRL, 0x00000000 },
668+};
669+
670+static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] = {
559671 {
560672 .id = 0x01,
561673 .map = otp_map_1,
@@ -592,3 +704,337 @@ const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[CS35L41_NUM_OTP_MAPS] · 30 unmodified lines
592704 .word_offset = 2,
593705 },
594706 };
707+
708+struct regmap_config cs35l41_regmap_i2c = {
709+ .reg_bits = 32,
710+ .val_bits = 32,
711+ .reg_stride = CS35L41_REGSTRIDE,
712+ .reg_format_endian = REGMAP_ENDIAN_BIG,
713+ .val_format_endian = REGMAP_ENDIAN_BIG,
714+ .max_register = CS35L41_LASTREG,
715+ .reg_defaults = cs35l41_reg,
716+ .num_reg_defaults = ARRAY_SIZE(cs35l41_reg),
717+ .volatile_reg = cs35l41_volatile_reg,
718+ .readable_reg = cs35l41_readable_reg,
719+ .precious_reg = cs35l41_precious_reg,
720+ .cache_type = REGCACHE_RBTREE,
721+};
722+EXPORT_SYMBOL_GPL(cs35l41_regmap_i2c);
723+
724+struct regmap_config cs35l41_regmap_spi = {
725+ .reg_bits = 32,
726+ .val_bits = 32,
727+ .pad_bits = 16,
728+ .reg_stride = CS35L41_REGSTRIDE,
729+ .reg_format_endian = REGMAP_ENDIAN_BIG,
730+ .val_format_endian = REGMAP_ENDIAN_BIG,
731+ .max_register = CS35L41_LASTREG,
732+ .reg_defaults = cs35l41_reg,
733+ .num_reg_defaults = ARRAY_SIZE(cs35l41_reg),
734+ .volatile_reg = cs35l41_volatile_reg,
735+ .readable_reg = cs35l41_readable_reg,
736+ .precious_reg = cs35l41_precious_reg,
737+ .cache_type = REGCACHE_RBTREE,
738+};
739+EXPORT_SYMBOL_GPL(cs35l41_regmap_spi);
740+
741+static const struct cs35l41_otp_map_element_t *cs35l41_find_otp_map(u32 otp_id)
742+{
743+ int i;
744+
745+ for (i = 0; i < ARRAY_SIZE(cs35l41_otp_map_map); i++) {
746+ if (cs35l41_otp_map_map[i].id == otp_id)
747+ return &cs35l41_otp_map_map[i];
748+ }
749+
750+ return NULL;
751+}
752+
753+int cs35l41_test_key_unlock(struct device *dev, struct regmap *regmap)
754+{
755+ static const struct reg_sequence unlock[] = {
756+ { CS35L41_TEST_KEY_CTL, 0x00000055 },
757+ { CS35L41_TEST_KEY_CTL, 0x000000AA },
758+ };
759+ int ret;
760+
761+ ret = regmap_multi_reg_write(regmap, unlock, ARRAY_SIZE(unlock));
762+ if (ret)
763+ dev_err(dev, "Failed to unlock test key: %d\n", ret);
764+
765+ return ret;
766+}
767+EXPORT_SYMBOL_GPL(cs35l41_test_key_unlock);
768+
769+int cs35l41_test_key_lock(struct device *dev, struct regmap *regmap)
770+{
771+ static const struct reg_sequence unlock[] = {
772+ { CS35L41_TEST_KEY_CTL, 0x000000CC },
773+ { CS35L41_TEST_KEY_CTL, 0x00000033 },
774+ };
775+ int ret;
776+
777+ ret = regmap_multi_reg_write(regmap, unlock, ARRAY_SIZE(unlock));
778+ if (ret)
779+ dev_err(dev, "Failed to lock test key: %d\n", ret);
780+
781+ return ret;
782+}
783+EXPORT_SYMBOL_GPL(cs35l41_test_key_lock);
784+
785+/* Must be called with the TEST_KEY unlocked */
786+int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap)
787+{
788+ const struct cs35l41_otp_map_element_t *otp_map_match;
789+ const struct cs35l41_otp_packed_element_t *otp_map;
790+ int bit_offset, word_offset, ret, i;
791+ unsigned int bit_sum = 8;
792+ u32 otp_val, otp_id_reg;
793+ u32 *otp_mem;
794+
795+ otp_mem = kmalloc_array(CS35L41_OTP_SIZE_WORDS, sizeof(*otp_mem), GFP_KERNEL);
796+ if (!otp_mem)
797+ return -ENOMEM;
798+
799+ ret = regmap_read(regmap, CS35L41_OTPID, &otp_id_reg);
800+ if (ret) {
801+ dev_err(dev, "Read OTP ID failed: %d\n", ret);
802+ goto err_otp_unpack;
803+ }
804+
805+ otp_map_match = cs35l41_find_otp_map(otp_id_reg);
806+
807+ if (!otp_map_match) {
808+ dev_err(dev, "OTP Map matching ID %d not found\n", otp_id_reg);
809+ ret = -EINVAL;
810+ goto err_otp_unpack;
811+ }
812+
813+ ret = regmap_bulk_read(regmap, CS35L41_OTP_MEM0, otp_mem, CS35L41_OTP_SIZE_WORDS);
814+ if (ret) {
815+ dev_err(dev, "Read OTP Mem failed: %d\n", ret);
816+ goto err_otp_unpack;
817+ }
818+
819+ otp_map = otp_map_match->map;
820+
821+ bit_offset = otp_map_match->bit_offset;
822+ word_offset = otp_map_match->word_offset;
823+
824+ for (i = 0; i < otp_map_match->num_elements; i++) {
825+ dev_dbg(dev, "bitoffset= %d, word_offset=%d, bit_sum mod 32=%d\n",
826+ bit_offset, word_offset, bit_sum % 32);
827+ if (bit_offset + otp_map[i].size - 1 >= 32) {
828+ otp_val = (otp_mem[word_offset] &
829+ GENMASK(31, bit_offset)) >> bit_offset;
830+ otp_val |= (otp_mem[++word_offset] &
831+ GENMASK(bit_offset + otp_map[i].size - 33, 0)) <<
832+ (32 - bit_offset);
833+ bit_offset += otp_map[i].size - 32;
834+ } else {
835+ otp_val = (otp_mem[word_offset] &
836+ GENMASK(bit_offset + otp_map[i].size - 1, bit_offset)
837+ ) >> bit_offset;
838+ bit_offset += otp_map[i].size;
839+ }
840+ bit_sum += otp_map[i].size;
841+
842+ if (bit_offset == 32) {
843+ bit_offset = 0;
844+ word_offset++;
845+ }
846+
847+ if (otp_map[i].reg != 0) {
848+ ret = regmap_update_bits(regmap, otp_map[i].reg,
849+ GENMASK(otp_map[i].shift + otp_map[i].size - 1,
850+ otp_map[i].shift),
851+ otp_val << otp_map[i].shift);
852+ if (ret < 0) {
853+ dev_err(dev, "Write OTP val failed: %d\n", ret);
854+ goto err_otp_unpack;
855+ }
856+ }
857+ }
858+
859+ ret = 0;
860+
861+err_otp_unpack:
862+ kfree(otp_mem);
863+
864+ return ret;
865+}
866+EXPORT_SYMBOL_GPL(cs35l41_otp_unpack);
867+
868+/* Must be called with the TEST_KEY unlocked */
869+int cs35l41_register_errata_patch(struct device *dev, struct regmap *reg, unsigned int reg_revid)
870+{
871+ char *rev;
872+ int ret;
873+
874+ switch (reg_revid) {
875+ case CS35L41_REVID_A0:
876+ ret = regmap_register_patch(reg, cs35l41_reva0_errata_patch,
877+ ARRAY_SIZE(cs35l41_reva0_errata_patch));
878+ rev = "A0";
879+ break;
880+ case CS35L41_REVID_B0:
881+ ret = regmap_register_patch(reg, cs35l41_revb0_errata_patch,
882+ ARRAY_SIZE(cs35l41_revb0_errata_patch));
883+ rev = "B0";
884+ break;
885+ case CS35L41_REVID_B2:
886+ ret = regmap_register_patch(reg, cs35l41_revb2_errata_patch,
887+ ARRAY_SIZE(cs35l41_revb2_errata_patch));
888+ rev = "B2";
889+ break;
890+ default:
891+ ret = -EINVAL;
892+ rev = "XX";
893+ break;
894+ }
895+
896+ if (ret)
897+ dev_err(dev, "Failed to apply %s errata patch: %d\n", rev, ret);
898+
899+ ret = regmap_write(reg, CS35L41_DSP1_CCM_CORE_CTRL, 0);
900+ if (ret < 0)
901+ dev_err(dev, "Write CCM_CORE_CTRL failed: %d\n", ret);
902+
903+ return ret;
904+}
905+EXPORT_SYMBOL_GPL(cs35l41_register_errata_patch);
906+
907+int cs35l41_set_channels(struct device *dev, struct regmap *reg,
908+ unsigned int tx_num, unsigned int *tx_slot,
909+ unsigned int rx_num, unsigned int *rx_slot)
910+{
911+ unsigned int val, mask;
912+ int i;
913+
914+ if (tx_num > 4 || rx_num > 2)
915+ return -EINVAL;
916+
917+ val = 0;
918+ mask = 0;
919+ for (i = 0; i < rx_num; i++) {
920+ dev_dbg(dev, "rx slot %d position = %d\n", i, rx_slot[i]);
921+ val |= rx_slot[i] << (i * 8);
922+ mask |= 0x3F << (i * 8);
923+ }
924+ regmap_update_bits(reg, CS35L41_SP_FRAME_RX_SLOT, mask, val);
925+
926+ val = 0;
927+ mask = 0;
928+ for (i = 0; i < tx_num; i++) {
929+ dev_dbg(dev, "tx slot %d position = %d\n", i, tx_slot[i]);
930+ val |= tx_slot[i] << (i * 8);
931+ mask |= 0x3F << (i * 8);
932+ }
933+ regmap_update_bits(reg, CS35L41_SP_FRAME_TX_SLOT, mask, val);
934+
935+ return 0;
936+}
937+EXPORT_SYMBOL_GPL(cs35l41_set_channels);
938+
939+static const unsigned char cs35l41_bst_k1_table[4][5] = {
940+ { 0x24, 0x32, 0x32, 0x4F, 0x57 },
941+ { 0x24, 0x32, 0x32, 0x4F, 0x57 },
942+ { 0x40, 0x32, 0x32, 0x4F, 0x57 },
943+ { 0x40, 0x32, 0x32, 0x4F, 0x57 }
944+};
945+
946+static const unsigned char cs35l41_bst_k2_table[4][5] = {
947+ { 0x24, 0x49, 0x66, 0xA3, 0xEA },
948+ { 0x24, 0x49, 0x66, 0xA3, 0xEA },
949+ { 0x48, 0x49, 0x66, 0xA3, 0xEA },
950+ { 0x48, 0x49, 0x66, 0xA3, 0xEA }
951+};
952+
953+static const unsigned char cs35l41_bst_slope_table[4] = {
954+ 0x75, 0x6B, 0x3B, 0x28
955+};
956+
957+
958+int cs35l41_boost_config(struct device *dev, struct regmap *regmap, int boost_ind, int boost_cap,
959+ int boost_ipk)
960+{
961+ unsigned char bst_lbst_val, bst_cbst_range, bst_ipk_scaled;
962+ int ret;
963+
964+ switch (boost_ind) {
965+ case 1000: /* 1.0 uH */
966+ bst_lbst_val = 0;
967+ break;
968+ case 1200: /* 1.2 uH */
969+ bst_lbst_val = 1;
970+ break;
971+ case 1500: /* 1.5 uH */
972+ bst_lbst_val = 2;
973+ break;
974+ case 2200: /* 2.2 uH */
975+ bst_lbst_val = 3;
976+ break;
977+ default:
978+ dev_err(dev, "Invalid boost inductor value: %d nH\n", boost_ind);
979+ return -EINVAL;
980+ }
981+
982+ switch (boost_cap) {
983+ case 0 ... 19:
984+ bst_cbst_range = 0;
985+ break;
986+ case 20 ... 50:
987+ bst_cbst_range = 1;
988+ break;
989+ case 51 ... 100:
990+ bst_cbst_range = 2;
991+ break;
992+ case 101 ... 200:
993+ bst_cbst_range = 3;
994+ break;
995+ default: /* 201 uF and greater */
996+ bst_cbst_range = 4;
997+ }
998+
999+ ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_COEFF,
1000+ CS35L41_BST_K1_MASK | CS35L41_BST_K2_MASK,
1001+ cs35l41_bst_k1_table[bst_lbst_val][bst_cbst_range]
1002+ << CS35L41_BST_K1_SHIFT |
1003+ cs35l41_bst_k2_table[bst_lbst_val][bst_cbst_range]
1004+ << CS35L41_BST_K2_SHIFT);
1005+ if (ret) {
1006+ dev_err(dev, "Failed to write boost coefficients: %d\n", ret);
1007+ return ret;
1008+ }
1009+
1010+ ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_SLOPE_LBST,
1011+ CS35L41_BST_SLOPE_MASK | CS35L41_BST_LBST_VAL_MASK,
1012+ cs35l41_bst_slope_table[bst_lbst_val]
1013+ << CS35L41_BST_SLOPE_SHIFT |
1014+ bst_lbst_val << CS35L41_BST_LBST_VAL_SHIFT);
1015+ if (ret) {
1016+ dev_err(dev, "Failed to write boost slope/inductor value: %d\n", ret);
1017+ return ret;
1018+ }
1019+
1020+ if (boost_ipk < 1600 || boost_ipk > 4500) {
1021+ dev_err(dev, "Invalid boost inductor peak current: %d mA\n", boost_ipk);
1022+ return -EINVAL;
1023+ }
1024+ bst_ipk_scaled = ((boost_ipk - 1600) / 50) + 0x10;
1025+
1026+ ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_PEAK_CUR, CS35L41_BST_IPK_MASK,
1027+ bst_ipk_scaled << CS35L41_BST_IPK_SHIFT);
1028+ if (ret) {
1029+ dev_err(dev, "Failed to write boost inductor peak current: %d\n", ret);
1030+ return ret;
1031+ }
1032+
1033+ return 0;
1034+}
1035+EXPORT_SYMBOL_GPL(cs35l41_boost_config);
1036+
1037+MODULE_DESCRIPTION("CS35L41 library");
1038+MODULE_AUTHOR("David Rhodes, Cirrus Logic Inc, <david.rhodes@cirrus.com>");
1039+MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, <tanureal@opensource.cirrus.com>");
1040+MODULE_LICENSE("GPL");
sound/soc/codecs/cs35l41-spi.c+3−17
@@ -15,28 +15,13 @@ · 14 unmodified lines
1515 #include <linux/platform_device.h>
1616 #include <linux/spi/spi.h>
1717
18−#include <sound/cs35l41.h>
1918 #include "cs35l41.h"
2019
21−static struct regmap_config cs35l41_regmap_spi = {
22− .reg_bits = 32,
23− .val_bits = 32,
24− .pad_bits = 16,
25− .reg_stride = CS35L41_REGSTRIDE,
26− .reg_format_endian = REGMAP_ENDIAN_BIG,
27− .val_format_endian = REGMAP_ENDIAN_BIG,
28− .max_register = CS35L41_LASTREG,
29− .reg_defaults = cs35l41_reg,
30− .num_reg_defaults = ARRAY_SIZE(cs35l41_reg),
31− .volatile_reg = cs35l41_volatile_reg,
32− .readable_reg = cs35l41_readable_reg,
33− .precious_reg = cs35l41_precious_reg,
34− .cache_type = REGCACHE_RBTREE,
35−};
36−
3720 static const struct spi_device_id cs35l41_id_spi[] = {
3821 { "cs35l40", 0 },
3922 { "cs35l41", 0 },
23+ { "cs35l51", 0 },
24+ { "cs35l53", 0 },
4025 {}
4126 };
4227
@@ -99,6 +84,7 @@ MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_match); · 56 unmodified lines
9984 static struct spi_driver cs35l41_spi_driver = {
10085 .driver = {
10186 .name = "cs35l41",
87+ .pm = &cs35l41_pm_ops,
10288 .of_match_table = of_match_ptr(cs35l41_of_match),
10389 .acpi_match_table = ACPI_PTR(cs35l41_acpi_match),
10490 },
sound/soc/codecs/cs35l41.c+526−367
@@ -13,8 +13,8 @@ · 12 unmodified lines
1313 #include <linux/module.h>
1414 #include <linux/moduleparam.h>
1515 #include <linux/of_device.h>
16+#include <linux/pm_runtime.h>
1617 #include <linux/property.h>
17−#include <linux/slab.h>
1818 #include <sound/initval.h>
1919 #include <sound/pcm.h>
2020 #include <sound/pcm_params.h>
@@ -151,24 +151,6 @@ static const struct cs35l41_fs_mon_config cs35l41_fs_mon[] = { · 130 unmodified lines
151151 { 6144000, 16, 24 },
152152 };
153153
154−static const unsigned char cs35l41_bst_k1_table[4][5] = {
155− { 0x24, 0x32, 0x32, 0x4F, 0x57 },
156− { 0x24, 0x32, 0x32, 0x4F, 0x57 },
157− { 0x40, 0x32, 0x32, 0x4F, 0x57 },
158− { 0x40, 0x32, 0x32, 0x4F, 0x57 }
159−};
160−
161−static const unsigned char cs35l41_bst_k2_table[4][5] = {
162− { 0x24, 0x49, 0x66, 0xA3, 0xEA },
163− { 0x24, 0x49, 0x66, 0xA3, 0xEA },
164− { 0x48, 0x49, 0x66, 0xA3, 0xEA },
165− { 0x48, 0x49, 0x66, 0xA3, 0xEA }
166−};
167−
168−static const unsigned char cs35l41_bst_slope_table[4] = {
169− 0x75, 0x6B, 0x3B, 0x28
170−};
171−
172154 static int cs35l41_get_fs_mon_config_index(int freq)
173155 {
174156 int i;
@@ -197,6 +179,134 @@ static SOC_ENUM_SINGLE_DECL(pcm_sft_ramp, · 22 unmodified lines
197179 CS35L41_AMP_DIG_VOL_CTRL, 0,
198180 cs35l41_pcm_sftramp_text);
199181
182+static int cs35l41_dsp_preload_ev(struct snd_soc_dapm_widget *w,
183+ struct snd_kcontrol *kcontrol, int event)
184+{
185+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
186+ struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
187+ int ret;
188+
189+ switch (event) {
190+ case SND_SOC_DAPM_PRE_PMU:
191+ if (cs35l41->dsp.cs_dsp.booted)
192+ return 0;
193+
194+ return wm_adsp_early_event(w, kcontrol, event);
195+ case SND_SOC_DAPM_PRE_PMD:
196+ if (cs35l41->dsp.preloaded)
197+ return 0;
198+
199+ if (cs35l41->dsp.cs_dsp.running) {
200+ ret = wm_adsp_event(w, kcontrol, event);
201+ if (ret)
202+ return ret;
203+ }
204+
205+ return wm_adsp_early_event(w, kcontrol, event);
206+ default:
207+ return 0;
208+ }
209+}
210+
211+static bool cs35l41_check_cspl_mbox_sts(enum cs35l41_cspl_mbox_cmd cmd,
212+ enum cs35l41_cspl_mbox_status sts)
213+{
214+ switch (cmd) {
215+ case CSPL_MBOX_CMD_NONE:
216+ case CSPL_MBOX_CMD_UNKNOWN_CMD:
217+ return true;
218+ case CSPL_MBOX_CMD_PAUSE:
219+ case CSPL_MBOX_CMD_OUT_OF_HIBERNATE:
220+ return (sts == CSPL_MBOX_STS_PAUSED);
221+ case CSPL_MBOX_CMD_RESUME:
222+ return (sts == CSPL_MBOX_STS_RUNNING);
223+ case CSPL_MBOX_CMD_REINIT:
224+ return (sts == CSPL_MBOX_STS_RUNNING);
225+ case CSPL_MBOX_CMD_STOP_PRE_REINIT:
226+ return (sts == CSPL_MBOX_STS_RDY_FOR_REINIT);
227+ default:
228+ return false;
229+ }
230+}
231+
232+static int cs35l41_set_cspl_mbox_cmd(struct cs35l41_private *cs35l41,
233+ enum cs35l41_cspl_mbox_cmd cmd)
234+{
235+ unsigned int sts = 0, i;
236+ int ret;
237+
238+ // Set mailbox cmd
239+ ret = regmap_write(cs35l41->regmap, CS35L41_DSP_VIRT1_MBOX_1, cmd);
240+ if (ret < 0) {
241+ if (cmd != CSPL_MBOX_CMD_OUT_OF_HIBERNATE)
242+ dev_err(cs35l41->dev, "Failed to write MBOX: %d\n", ret);
243+ return ret;
244+ }
245+
246+ // Read mailbox status and verify it is appropriate for the given cmd
247+ for (i = 0; i < 5; i++) {
248+ usleep_range(1000, 1100);
249+
250+ ret = regmap_read(cs35l41->regmap, CS35L41_DSP_MBOX_2, &sts);
251+ if (ret < 0) {
252+ dev_err(cs35l41->dev, "Failed to read MBOX STS: %d\n", ret);
253+ continue;
254+ }
255+
256+ if (!cs35l41_check_cspl_mbox_sts(cmd, sts)) {
257+ dev_dbg(cs35l41->dev,
258+ "[%u] cmd %u returned invalid sts %u",
259+ i, cmd, sts);
260+ } else {
261+ return 0;
262+ }
263+ }
264+
265+ dev_err(cs35l41->dev,
266+ "Failed to set mailbox cmd %u (status %u)\n",
267+ cmd, sts);
268+
269+ return -ENOMSG;
270+}
271+
272+static int cs35l41_dsp_audio_ev(struct snd_soc_dapm_widget *w,
273+ struct snd_kcontrol *kcontrol, int event)
274+{
275+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
276+ struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
277+ unsigned int fw_status;
278+ int ret;
279+
280+ switch (event) {
281+ case SND_SOC_DAPM_POST_PMU:
282+ if (!cs35l41->dsp.cs_dsp.running)
283+ return wm_adsp_event(w, kcontrol, event);
284+
285+ ret = regmap_read(cs35l41->regmap, CS35L41_DSP_MBOX_2, &fw_status);
286+ if (ret < 0) {
287+ dev_err(cs35l41->dev,
288+ "Failed to read firmware status: %d\n", ret);
289+ return ret;
290+ }
291+
292+ switch (fw_status) {
293+ case CSPL_MBOX_STS_RUNNING:
294+ case CSPL_MBOX_STS_PAUSED:
295+ break;
296+ default:
297+ dev_err(cs35l41->dev, "Firmware status is invalid: %u\n",
298+ fw_status);
299+ return -EINVAL;
300+ }
301+
302+ return cs35l41_set_cspl_mbox_cmd(cs35l41, CSPL_MBOX_CMD_RESUME);
303+ case SND_SOC_DAPM_PRE_PMD:
304+ return cs35l41_set_cspl_mbox_cmd(cs35l41, CSPL_MBOX_CMD_PAUSE);
305+ default:
306+ return 0;
307+ }
308+}
309+
200310 static const char * const cs35l41_pcm_source_texts[] = {"ASP", "DSP"};
201311 static const unsigned int cs35l41_pcm_source_values[] = {0x08, 0x32};
202312 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l41_pcm_source_enum,
@@ -255,6 +365,24 @@ static SOC_VALUE_ENUM_SINGLE_DECL(cs35l41_asptx4_enum, · 52 unmodified lines
255365 static const struct snd_kcontrol_new asp_tx4_mux =
256366 SOC_DAPM_ENUM("ASPTX4 SRC", cs35l41_asptx4_enum);
257367
368+static SOC_VALUE_ENUM_SINGLE_DECL(cs35l41_dsprx1_enum,
369+ CS35L41_DSP1_RX1_SRC,
370+ 0, CS35L41_ASP_SOURCE_MASK,
371+ cs35l41_tx_input_texts,
372+ cs35l41_tx_input_values);
373+
374+static const struct snd_kcontrol_new dsp_rx1_mux =
375+ SOC_DAPM_ENUM("DSPRX1 SRC", cs35l41_dsprx1_enum);
376+
377+static SOC_VALUE_ENUM_SINGLE_DECL(cs35l41_dsprx2_enum,
378+ CS35L41_DSP1_RX2_SRC,
379+ 0, CS35L41_ASP_SOURCE_MASK,
380+ cs35l41_tx_input_texts,
381+ cs35l41_tx_input_values);
382+
383+static const struct snd_kcontrol_new dsp_rx2_mux =
384+ SOC_DAPM_ENUM("DSPRX2 SRC", cs35l41_dsprx2_enum);
385+
258386 static const struct snd_kcontrol_new cs35l41_aud_controls[] = {
259387 SOC_SINGLE_SX_TLV("Digital PCM Volume", CS35L41_AMP_DIG_VOL_CTRL,
260388 3, 0x4CF, 0x391, dig_vol_tlv),
@@ -282,130 +410,10 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = { · 21 unmodified lines
282410 CS35L41_AMP_INV_PCM_SHIFT, 1, 0),
283411 SOC_SINGLE("Amp Gain ZC", CS35L41_AMP_GAIN_CTRL,
284412 CS35L41_AMP_GAIN_ZC_SHIFT, 1, 0),
413+ WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
414+ WM_ADSP_FW_CONTROL("DSP1", 0),
285415 };
286416
287−static const struct cs35l41_otp_map_element_t *cs35l41_find_otp_map(u32 otp_id)
288−{
289− int i;
290−
291− for (i = 0; i < ARRAY_SIZE(cs35l41_otp_map_map); i++) {
292− if (cs35l41_otp_map_map[i].id == otp_id)
293− return &cs35l41_otp_map_map[i];
294− }
295−
296− return NULL;
297−}
298−
299−static int cs35l41_otp_unpack(void *data)
300−{
301− const struct cs35l41_otp_map_element_t *otp_map_match;
302− const struct cs35l41_otp_packed_element_t *otp_map;
303− struct cs35l41_private *cs35l41 = data;
304− int bit_offset, word_offset, ret, i;
305− unsigned int bit_sum = 8;
306− u32 otp_val, otp_id_reg;
307− u32 *otp_mem;
308−
309− otp_mem = kmalloc_array(CS35L41_OTP_SIZE_WORDS, sizeof(*otp_mem), GFP_KERNEL);
310− if (!otp_mem)
311− return -ENOMEM;
312−
313− ret = regmap_read(cs35l41->regmap, CS35L41_OTPID, &otp_id_reg);
314− if (ret < 0) {
315− dev_err(cs35l41->dev, "Read OTP ID failed: %d\n", ret);
316− goto err_otp_unpack;
317− }
318−
319− otp_map_match = cs35l41_find_otp_map(otp_id_reg);
320−
321− if (!otp_map_match) {
322− dev_err(cs35l41->dev, "OTP Map matching ID %d not found\n",
323− otp_id_reg);
324− ret = -EINVAL;
325− goto err_otp_unpack;
326− }
327−
328− ret = regmap_bulk_read(cs35l41->regmap, CS35L41_OTP_MEM0, otp_mem,
329− CS35L41_OTP_SIZE_WORDS);
330− if (ret < 0) {
331− dev_err(cs35l41->dev, "Read OTP Mem failed: %d\n", ret);
332− goto err_otp_unpack;
333− }
334−
335− otp_map = otp_map_match->map;
336−
337− bit_offset = otp_map_match->bit_offset;
338− word_offset = otp_map_match->word_offset;
339−
340− ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000055);
341− if (ret < 0) {
342− dev_err(cs35l41->dev, "Write Unlock key failed 1/2: %d\n", ret);
343− goto err_otp_unpack;
344− }
345− ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000AA);
346− if (ret < 0) {
347− dev_err(cs35l41->dev, "Write Unlock key failed 2/2: %d\n", ret);
348− goto err_otp_unpack;
349− }
350−
351− for (i = 0; i < otp_map_match->num_elements; i++) {
352− dev_dbg(cs35l41->dev,
353− "bitoffset= %d, word_offset=%d, bit_sum mod 32=%d\n",
354− bit_offset, word_offset, bit_sum % 32);
355− if (bit_offset + otp_map[i].size - 1 >= 32) {
356− otp_val = (otp_mem[word_offset] &
357− GENMASK(31, bit_offset)) >>
358− bit_offset;
359− otp_val |= (otp_mem[++word_offset] &
360− GENMASK(bit_offset +
361− otp_map[i].size - 33, 0)) <<
362− (32 - bit_offset);
363− bit_offset += otp_map[i].size - 32;
364− } else {
365− otp_val = (otp_mem[word_offset] &
366− GENMASK(bit_offset + otp_map[i].size - 1,
367− bit_offset)) >> bit_offset;
368− bit_offset += otp_map[i].size;
369− }
370− bit_sum += otp_map[i].size;
371−
372− if (bit_offset == 32) {
373− bit_offset = 0;
374− word_offset++;
375− }
376−
377− if (otp_map[i].reg != 0) {
378− ret = regmap_update_bits(cs35l41->regmap,
379− otp_map[i].reg,
380− GENMASK(otp_map[i].shift +
381− otp_map[i].size - 1,
382− otp_map[i].shift),
383− otp_val << otp_map[i].shift);
384− if (ret < 0) {
385− dev_err(cs35l41->dev, "Write OTP val failed: %d\n",
386− ret);
387− goto err_otp_unpack;
388− }
389− }
390− }
391−
392− ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000CC);
393− if (ret < 0) {
394− dev_err(cs35l41->dev, "Write Lock key failed 1/2: %d\n", ret);
395− goto err_otp_unpack;
396− }
397− ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000033);
398− if (ret < 0) {
399− dev_err(cs35l41->dev, "Write Lock key failed 2/2: %d\n", ret);
400− goto err_otp_unpack;
401− }
402− ret = 0;
403−
404−err_otp_unpack:
405− kfree(otp_mem);
406− return ret;
407−}
408−
409417 static irqreturn_t cs35l41_irq(int irq, void *data)
410418 {
411419 struct cs35l41_private *cs35l41 = data;
@@ -414,6 +422,8 @@ static irqreturn_t cs35l41_irq(int irq, void *data) · 2 unmodified lines
414422 int ret = IRQ_NONE;
415423 unsigned int i;
416424
425+ pm_runtime_get_sync(cs35l41->dev);
426+
417427 for (i = 0; i < ARRAY_SIZE(status); i++) {
418428 regmap_read(cs35l41->regmap,
419429 CS35L41_IRQ1_STATUS1 + (i * CS35L41_REGSTRIDE),
@@ -426,7 +436,7 @@ static irqreturn_t cs35l41_irq(int irq, void *data) · 6 unmodified lines
426436 /* Check to see if unmasked bits are active */
427437 if (!(status[0] & ~masks[0]) && !(status[1] & ~masks[1]) &&
428438 !(status[2] & ~masks[2]) && !(status[3] & ~masks[3]))
429− return IRQ_NONE;
439+ goto done;
430440
431441 if (status[3] & CS35L41_OTP_BOOT_DONE) {
432442 regmap_update_bits(cs35l41->regmap, CS35L41_IRQ1_MASK4,
@@ -531,23 +541,27 @@ static irqreturn_t cs35l41_irq(int irq, void *data) · 98 unmodified lines
531541 ret = IRQ_HANDLED;
532542 }
533543
544+done:
545+ pm_runtime_mark_last_busy(cs35l41->dev);
546+ pm_runtime_put_autosuspend(cs35l41->dev);
547+
534548 return ret;
535549 }
536550
537551 static const struct reg_sequence cs35l41_pup_patch[] = {
538− { 0x00000040, 0x00000055 },
539− { 0x00000040, 0x000000AA },
552+ { CS35L41_TEST_KEY_CTL, 0x00000055 },
553+ { CS35L41_TEST_KEY_CTL, 0x000000AA },
540554 { 0x00002084, 0x002F1AA0 },
541− { 0x00000040, 0x000000CC },
542− { 0x00000040, 0x00000033 },
555+ { CS35L41_TEST_KEY_CTL, 0x000000CC },
556+ { CS35L41_TEST_KEY_CTL, 0x00000033 },
543557 };
544558
545559 static const struct reg_sequence cs35l41_pdn_patch[] = {
546− { 0x00000040, 0x00000055 },
547− { 0x00000040, 0x000000AA },
560+ { CS35L41_TEST_KEY_CTL, 0x00000055 },
561+ { CS35L41_TEST_KEY_CTL, 0x000000AA },
548562 { 0x00002084, 0x002F1AA3 },
549− { 0x00000040, 0x000000CC },
550− { 0x00000040, 0x00000033 },
563+ { CS35L41_TEST_KEY_CTL, 0x000000CC },
564+ { CS35L41_TEST_KEY_CTL, 0x00000033 },
551565 };
552566
553567 static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
@@ -596,6 +610,14 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w, · 42 unmodified lines
596610 }
597611
598612 static const struct snd_soc_dapm_widget cs35l41_dapm_widgets[] = {
613+ SND_SOC_DAPM_SPK("DSP1 Preload", NULL),
614+ SND_SOC_DAPM_SUPPLY_S("DSP1 Preloader", 100, SND_SOC_NOPM, 0, 0,
615+ cs35l41_dsp_preload_ev,
616+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
617+ SND_SOC_DAPM_OUT_DRV_E("DSP1", SND_SOC_NOPM, 0, 0, NULL, 0,
618+ cs35l41_dsp_audio_ev,
619+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
620+
599621 SND_SOC_DAPM_OUTPUT("SPK"),
600622
601623 SND_SOC_DAPM_AIF_IN("ASPRX1", NULL, 0, CS35L41_SP_ENABLES, 16, 0),
@@ -611,11 +633,18 @@ static const struct snd_soc_dapm_widget cs35l41_dapm_widgets[] = { · 9 unmodified lines
611633 SND_SOC_DAPM_SIGGEN("VBST"),
612634 SND_SOC_DAPM_SIGGEN("TEMP"),
613635
614− SND_SOC_DAPM_ADC("VMON ADC", NULL, CS35L41_PWR_CTRL2, 12, 0),
615− SND_SOC_DAPM_ADC("IMON ADC", NULL, CS35L41_PWR_CTRL2, 13, 0),
616− SND_SOC_DAPM_ADC("VPMON ADC", NULL, CS35L41_PWR_CTRL2, 8, 0),
617− SND_SOC_DAPM_ADC("VBSTMON ADC", NULL, CS35L41_PWR_CTRL2, 9, 0),
618− SND_SOC_DAPM_ADC("TEMPMON ADC", NULL, CS35L41_PWR_CTRL2, 10, 0),
636+ SND_SOC_DAPM_SUPPLY("VMON", CS35L41_PWR_CTRL2, 12, 0, NULL, 0),
637+ SND_SOC_DAPM_SUPPLY("IMON", CS35L41_PWR_CTRL2, 13, 0, NULL, 0),
638+ SND_SOC_DAPM_SUPPLY("VPMON", CS35L41_PWR_CTRL2, 8, 0, NULL, 0),
639+ SND_SOC_DAPM_SUPPLY("VBSTMON", CS35L41_PWR_CTRL2, 9, 0, NULL, 0),
640+ SND_SOC_DAPM_SUPPLY("TEMPMON", CS35L41_PWR_CTRL2, 10, 0, NULL, 0),
641+
642+ SND_SOC_DAPM_ADC("VMON ADC", NULL, SND_SOC_NOPM, 0, 0),
643+ SND_SOC_DAPM_ADC("IMON ADC", NULL, SND_SOC_NOPM, 0, 0),
644+ SND_SOC_DAPM_ADC("VPMON ADC", NULL, SND_SOC_NOPM, 0, 0),
645+ SND_SOC_DAPM_ADC("VBSTMON ADC", NULL, SND_SOC_NOPM, 0, 0),
646+ SND_SOC_DAPM_ADC("TEMPMON ADC", NULL, SND_SOC_NOPM, 0, 0),
647+
619648 SND_SOC_DAPM_ADC("CLASS H", NULL, CS35L41_PWR_CTRL3, 4, 0),
620649
621650 SND_SOC_DAPM_OUT_DRV_E("Main AMP", CS35L41_PWR_CTRL2, 0, 0, NULL, 0,
@@ -626,33 +655,51 @@ static const struct snd_soc_dapm_widget cs35l41_dapm_widgets[] = { · 4 unmodified lines
626655 SND_SOC_DAPM_MUX("ASP TX2 Source", SND_SOC_NOPM, 0, 0, &asp_tx2_mux),
627656 SND_SOC_DAPM_MUX("ASP TX3 Source", SND_SOC_NOPM, 0, 0, &asp_tx3_mux),
628657 SND_SOC_DAPM_MUX("ASP TX4 Source", SND_SOC_NOPM, 0, 0, &asp_tx4_mux),
658+ SND_SOC_DAPM_MUX("DSP RX1 Source", SND_SOC_NOPM, 0, 0, &dsp_rx1_mux),
659+ SND_SOC_DAPM_MUX("DSP RX2 Source", SND_SOC_NOPM, 0, 0, &dsp_rx2_mux),
629660 SND_SOC_DAPM_MUX("PCM Source", SND_SOC_NOPM, 0, 0, &pcm_source_mux),
630661 SND_SOC_DAPM_SWITCH("DRE", SND_SOC_NOPM, 0, 0, &dre_ctrl),
631662 };
632663
633664 static const struct snd_soc_dapm_route cs35l41_audio_map[] = {
665+ {"DSP RX1 Source", "ASPRX1", "ASPRX1"},
666+ {"DSP RX1 Source", "ASPRX2", "ASPRX2"},
667+ {"DSP RX2 Source", "ASPRX1", "ASPRX1"},
668+ {"DSP RX2 Source", "ASPRX2", "ASPRX2"},
669+
670+ {"DSP1", NULL, "DSP RX1 Source"},
671+ {"DSP1", NULL, "DSP RX2 Source"},
672+
634673 {"ASP TX1 Source", "VMON", "VMON ADC"},
635674 {"ASP TX1 Source", "IMON", "IMON ADC"},
636675 {"ASP TX1 Source", "VPMON", "VPMON ADC"},
637676 {"ASP TX1 Source", "VBSTMON", "VBSTMON ADC"},
677+ {"ASP TX1 Source", "DSPTX1", "DSP1"},
678+ {"ASP TX1 Source", "DSPTX2", "DSP1"},
638679 {"ASP TX1 Source", "ASPRX1", "ASPRX1" },
639680 {"ASP TX1 Source", "ASPRX2", "ASPRX2" },
640681 {"ASP TX2 Source", "VMON", "VMON ADC"},
641682 {"ASP TX2 Source", "IMON", "IMON ADC"},
642683 {"ASP TX2 Source", "VPMON", "VPMON ADC"},
643684 {"ASP TX2 Source", "VBSTMON", "VBSTMON ADC"},
685+ {"ASP TX2 Source", "DSPTX1", "DSP1"},
686+ {"ASP TX2 Source", "DSPTX2", "DSP1"},
644687 {"ASP TX2 Source", "ASPRX1", "ASPRX1" },
645688 {"ASP TX2 Source", "ASPRX2", "ASPRX2" },
646689 {"ASP TX3 Source", "VMON", "VMON ADC"},
647690 {"ASP TX3 Source", "IMON", "IMON ADC"},
648691 {"ASP TX3 Source", "VPMON", "VPMON ADC"},
649692 {"ASP TX3 Source", "VBSTMON", "VBSTMON ADC"},
693+ {"ASP TX3 Source", "DSPTX1", "DSP1"},
694+ {"ASP TX3 Source", "DSPTX2", "DSP1"},
650695 {"ASP TX3 Source", "ASPRX1", "ASPRX1" },
651696 {"ASP TX3 Source", "ASPRX2", "ASPRX2" },
652697 {"ASP TX4 Source", "VMON", "VMON ADC"},
653698 {"ASP TX4 Source", "IMON", "IMON ADC"},
654699 {"ASP TX4 Source", "VPMON", "VPMON ADC"},
655700 {"ASP TX4 Source", "VBSTMON", "VBSTMON ADC"},
701+ {"ASP TX4 Source", "DSPTX1", "DSP1"},
702+ {"ASP TX4 Source", "DSPTX2", "DSP1"},
656703 {"ASP TX4 Source", "ASPRX1", "ASPRX1" },
657704 {"ASP TX4 Source", "ASPRX2", "ASPRX2" },
658705 {"ASPTX1", NULL, "ASP TX1 Source"},
@@ -664,12 +711,27 @@ static const struct snd_soc_dapm_route cs35l41_audio_map[] = { · 5 unmodified lines
664711 {"AMP Capture", NULL, "ASPTX3"},
665712 {"AMP Capture", NULL, "ASPTX4"},
666713
714+ {"DSP1", NULL, "VMON"},
715+ {"DSP1", NULL, "IMON"},
716+ {"DSP1", NULL, "VPMON"},
717+ {"DSP1", NULL, "VBSTMON"},
718+ {"DSP1", NULL, "TEMPMON"},
719+
720+ {"VMON ADC", NULL, "VMON"},
721+ {"IMON ADC", NULL, "IMON"},
722+ {"VPMON ADC", NULL, "VPMON"},
723+ {"VBSTMON ADC", NULL, "VBSTMON"},
724+ {"TEMPMON ADC", NULL, "TEMPMON"},
725+
667726 {"VMON ADC", NULL, "VSENSE"},
668727 {"IMON ADC", NULL, "ISENSE"},
669728 {"VPMON ADC", NULL, "VP"},
670729 {"VBSTMON ADC", NULL, "VBST"},
671730 {"TEMPMON ADC", NULL, "TEMP"},
672731
732+ {"DSP1 Preload", NULL, "DSP1 Preloader"},
733+ {"DSP1", NULL, "DSP1 Preloader"},
734+
673735 {"ASPRX1", NULL, "AMP Playback"},
674736 {"ASPRX2", NULL, "AMP Playback"},
675737 {"DRE", "Switch", "CLASS H"},
@@ -678,39 +740,24 @@ static const struct snd_soc_dapm_route cs35l41_audio_map[] = { · 2 unmodified lines
678740 {"SPK", NULL, "Main AMP"},
679741
680742 {"PCM Source", "ASP", "ASPRX1"},
743+ {"PCM Source", "DSP", "DSP1"},
681744 {"CLASS H", NULL, "PCM Source"},
682745 };
683746
684−static int cs35l41_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_num,
685− unsigned int *tx_slot, unsigned int rx_num,
686− unsigned int *rx_slot)
747+static const struct cs_dsp_region cs35l41_dsp1_regions[] = {
748+ { .type = WMFW_HALO_PM_PACKED, .base = CS35L41_DSP1_PMEM_0 },
749+ { .type = WMFW_HALO_XM_PACKED, .base = CS35L41_DSP1_XMEM_PACK_0 },
750+ { .type = WMFW_HALO_YM_PACKED, .base = CS35L41_DSP1_YMEM_PACK_0 },
751+ {. type = WMFW_ADSP2_XM, .base = CS35L41_DSP1_XMEM_UNPACK24_0},
752+ {. type = WMFW_ADSP2_YM, .base = CS35L41_DSP1_YMEM_UNPACK24_0},
753+};
754+
755+static int cs35l41_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_n,
756+ unsigned int *tx_slot, unsigned int rx_n, unsigned int *rx_slot)
687757 {
688758 struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(dai->component);
689− unsigned int val, mask;
690− int i;
691759
692− if (tx_num > 4 || rx_num > 2)
693− return -EINVAL;
694−
695− val = 0;
696− mask = 0;
697− for (i = 0; i < rx_num; i++) {
698− dev_dbg(cs35l41->dev, "rx slot %d position = %d\n", i, rx_slot[i]);
699− val |= rx_slot[i] << (i * 8);
700− mask |= 0x3F << (i * 8);
701− }
702− regmap_update_bits(cs35l41->regmap, CS35L41_SP_FRAME_RX_SLOT, mask, val);
703−
704− val = 0;
705− mask = 0;
706− for (i = 0; i < tx_num; i++) {
707− dev_dbg(cs35l41->dev, "tx slot %d position = %d\n", i, tx_slot[i]);
708− val |= tx_slot[i] << (i * 8);
709− mask |= 0x3F << (i * 8);
710− }
711− regmap_update_bits(cs35l41->regmap, CS35L41_SP_FRAME_TX_SLOT, mask, val);
712−
713− return 0;
760+ return cs35l41_set_channels(cs35l41->dev, cs35l41->regmap, tx_n, tx_slot, rx_n, rx_slot);
714761 }
715762
716763 static int cs35l41_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
@@ -946,88 +993,6 @@ static int cs35l41_dai_set_sysclk(struct snd_soc_dai *dai, · 229 unmodified lines
946993 return 0;
947994 }
948995
949−static int cs35l41_boost_config(struct cs35l41_private *cs35l41,
950− int boost_ind, int boost_cap, int boost_ipk)
951−{
952− unsigned char bst_lbst_val, bst_cbst_range, bst_ipk_scaled;
953− struct regmap *regmap = cs35l41->regmap;
954− struct device *dev = cs35l41->dev;
955− int ret;
956−
957− switch (boost_ind) {
958− case 1000: /* 1.0 uH */
959− bst_lbst_val = 0;
960− break;
961− case 1200: /* 1.2 uH */
962− bst_lbst_val = 1;
963− break;
964− case 1500: /* 1.5 uH */
965− bst_lbst_val = 2;
966− break;
967− case 2200: /* 2.2 uH */
968− bst_lbst_val = 3;
969− break;
970− default:
971− dev_err(dev, "Invalid boost inductor value: %d nH\n", boost_ind);
972− return -EINVAL;
973− }
974−
975− switch (boost_cap) {
976− case 0 ... 19:
977− bst_cbst_range = 0;
978− break;
979− case 20 ... 50:
980− bst_cbst_range = 1;
981− break;
982− case 51 ... 100:
983− bst_cbst_range = 2;
984− break;
985− case 101 ... 200:
986− bst_cbst_range = 3;
987− break;
988− default: /* 201 uF and greater */
989− bst_cbst_range = 4;
990− }
991−
992− ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_COEFF,
993− CS35L41_BST_K1_MASK | CS35L41_BST_K2_MASK,
994− cs35l41_bst_k1_table[bst_lbst_val][bst_cbst_range]
995− << CS35L41_BST_K1_SHIFT |
996− cs35l41_bst_k2_table[bst_lbst_val][bst_cbst_range]
997− << CS35L41_BST_K2_SHIFT);
998− if (ret) {
999− dev_err(dev, "Failed to write boost coefficients: %d\n", ret);
1000− return ret;
1001− }
1002−
1003− ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_SLOPE_LBST,
1004− CS35L41_BST_SLOPE_MASK | CS35L41_BST_LBST_VAL_MASK,
1005− cs35l41_bst_slope_table[bst_lbst_val]
1006− << CS35L41_BST_SLOPE_SHIFT |
1007− bst_lbst_val << CS35L41_BST_LBST_VAL_SHIFT);
1008− if (ret) {
1009− dev_err(dev, "Failed to write boost slope/inductor value: %d\n", ret);
1010− return ret;
1011− }
1012−
1013− if (boost_ipk < 1600 || boost_ipk > 4500) {
1014− dev_err(dev, "Invalid boost inductor peak current: %d mA\n",
1015− boost_ipk);
1016− return -EINVAL;
1017− }
1018− bst_ipk_scaled = ((boost_ipk - 1600) / 50) + 0x10;
1019−
1020− ret = regmap_update_bits(regmap, CS35L41_BSTCVRT_PEAK_CUR,
1021− CS35L41_BST_IPK_MASK,
1022− bst_ipk_scaled << CS35L41_BST_IPK_SHIFT);
1023− if (ret) {
1024− dev_err(dev, "Failed to write boost inductor peak current: %d\n", ret);
1025− return ret;
1026− }
1027−
1028− return 0;
1029−}
1030−
1031996 static int cs35l41_set_pdata(struct cs35l41_private *cs35l41)
1032997 {
1033998 int ret;
@@ -1036,9 +1001,8 @@ static int cs35l41_set_pdata(struct cs35l41_private *cs35l41) · 2 unmodified lines
10361001 /* Required */
10371002 if (cs35l41->pdata.bst_ipk &&
10381003 cs35l41->pdata.bst_ind && cs35l41->pdata.bst_cap) {
1039− ret = cs35l41_boost_config(cs35l41, cs35l41->pdata.bst_ind,
1040− cs35l41->pdata.bst_cap,
1041− cs35l41->pdata.bst_ipk);
1004+ ret = cs35l41_boost_config(cs35l41->dev, cs35l41->regmap, cs35l41->pdata.bst_ind,
1005+ cs35l41->pdata.bst_cap, cs35l41->pdata.bst_ipk);
10421006 if (ret) {
10431007 dev_err(cs35l41->dev, "Error in Boost DT config: %d\n", ret);
10441008 return ret;
@@ -1091,6 +1055,20 @@ static int cs35l41_irq_gpio_config(struct cs35l41_private *cs35l41) · 46 unmodified lines
10911055 return irq_pol;
10921056 }
10931057
1058+static int cs35l41_component_probe(struct snd_soc_component *component)
1059+{
1060+ struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
1061+
1062+ return wm_adsp2_component_probe(&cs35l41->dsp, component);
1063+}
1064+
1065+static void cs35l41_component_remove(struct snd_soc_component *component)
1066+{
1067+ struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
1068+
1069+ wm_adsp2_component_remove(&cs35l41->dsp, component);
1070+}
1071+
10941072 static const struct snd_soc_dai_ops cs35l41_ops = {
10951073 .startup = cs35l41_pcm_startup,
10961074 .set_fmt = cs35l41_set_dai_fmt,
@@ -1124,6 +1102,8 @@ static struct snd_soc_dai_driver cs35l41_dai[] = { · 27 unmodified lines
11241102
11251103 static const struct snd_soc_component_driver soc_component_dev_cs35l41 = {
11261104 .name = "cs35l41-codec",
1105+ .probe = cs35l41_component_probe,
1106+ .remove = cs35l41_component_remove,
11271107
11281108 .dapm_widgets = cs35l41_dapm_widgets,
11291109 .num_dapm_widgets = ARRAY_SIZE(cs35l41_dapm_widgets),
@@ -1185,50 +1165,90 @@ static int cs35l41_handle_pdata(struct device *dev, · 55 unmodified lines
11851165 return 0;
11861166 }
11871167
1188−static const struct reg_sequence cs35l41_reva0_errata_patch[] = {
1189− { 0x00000040, 0x00005555 },
1190− { 0x00000040, 0x0000AAAA },
1191− { 0x00003854, 0x05180240 },
1192− { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
1193− { 0x00004310, 0x00000000 },
1194− { CS35L41_VPVBST_FS_SEL, 0x00000000 },
1195− { CS35L41_OTP_TRIM_30, 0x9091A1C8 },
1196− { 0x00003014, 0x0200EE0E },
1197− { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
1198− { 0x00000054, 0x00000004 },
1199− { CS35L41_IRQ1_DB3, 0x00000000 },
1200− { CS35L41_IRQ2_DB3, 0x00000000 },
1201− { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
1202− { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
1203− { 0x00000040, 0x0000CCCC },
1204− { 0x00000040, 0x00003333 },
1168+static const struct reg_sequence cs35l41_fs_errata_patch[] = {
1169+ { CS35L41_DSP1_RX1_RATE, 0x00000001 },
1170+ { CS35L41_DSP1_RX2_RATE, 0x00000001 },
1171+ { CS35L41_DSP1_RX3_RATE, 0x00000001 },
1172+ { CS35L41_DSP1_RX4_RATE, 0x00000001 },
1173+ { CS35L41_DSP1_RX5_RATE, 0x00000001 },
1174+ { CS35L41_DSP1_RX6_RATE, 0x00000001 },
1175+ { CS35L41_DSP1_RX7_RATE, 0x00000001 },
1176+ { CS35L41_DSP1_RX8_RATE, 0x00000001 },
1177+ { CS35L41_DSP1_TX1_RATE, 0x00000001 },
1178+ { CS35L41_DSP1_TX2_RATE, 0x00000001 },
1179+ { CS35L41_DSP1_TX3_RATE, 0x00000001 },
1180+ { CS35L41_DSP1_TX4_RATE, 0x00000001 },
1181+ { CS35L41_DSP1_TX5_RATE, 0x00000001 },
1182+ { CS35L41_DSP1_TX6_RATE, 0x00000001 },
1183+ { CS35L41_DSP1_TX7_RATE, 0x00000001 },
1184+ { CS35L41_DSP1_TX8_RATE, 0x00000001 },
12051185 };
12061186
1207−static const struct reg_sequence cs35l41_revb0_errata_patch[] = {
1208− { 0x00000040, 0x00005555 },
1209− { 0x00000040, 0x0000AAAA },
1210− { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
1211− { 0x00004310, 0x00000000 },
1212− { CS35L41_VPVBST_FS_SEL, 0x00000000 },
1213− { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
1214− { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
1215− { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
1216− { 0x00000040, 0x0000CCCC },
1217− { 0x00000040, 0x00003333 },
1218−};
1187+static int cs35l41_dsp_init(struct cs35l41_private *cs35l41)
1188+{
1189+ struct wm_adsp *dsp;
1190+ int ret;
12191191
1220−static const struct reg_sequence cs35l41_revb2_errata_patch[] = {
1221− { 0x00000040, 0x00005555 },
1222− { 0x00000040, 0x0000AAAA },
1223− { CS35L41_VIMON_SPKMON_RESYNC, 0x00000000 },
1224− { 0x00004310, 0x00000000 },
1225− { CS35L41_VPVBST_FS_SEL, 0x00000000 },
1226− { CS35L41_BSTCVRT_DCM_CTRL, 0x00000051 },
1227− { CS35L41_DSP1_YM_ACCEL_PL0_PRI, 0x00000000 },
1228− { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 },
1229− { 0x00000040, 0x0000CCCC },
1230− { 0x00000040, 0x00003333 },
1231−};
1192+ dsp = &cs35l41->dsp;
1193+ dsp->part = "cs35l41";
1194+ dsp->cs_dsp.num = 1;
1195+ dsp->cs_dsp.type = WMFW_HALO;
1196+ dsp->cs_dsp.rev = 0;
1197+ dsp->fw = 9; /* 9 is WM_ADSP_FW_SPK_PROT in wm_adsp.c */
1198+ dsp->toggle_preload = true;
1199+ dsp->cs_dsp.dev = cs35l41->dev;
1200+ dsp->cs_dsp.regmap = cs35l41->regmap;
1201+ dsp->cs_dsp.base = CS35L41_DSP1_CTRL_BASE;
1202+ dsp->cs_dsp.base_sysinfo = CS35L41_DSP1_SYS_ID;
1203+ dsp->cs_dsp.mem = cs35l41_dsp1_regions;
1204+ dsp->cs_dsp.num_mems = ARRAY_SIZE(cs35l41_dsp1_regions);
1205+ dsp->cs_dsp.lock_regions = 0xFFFFFFFF;
1206+
1207+ ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41_fs_errata_patch,
1208+ ARRAY_SIZE(cs35l41_fs_errata_patch));
1209+ if (ret < 0) {
1210+ dev_err(cs35l41->dev, "Failed to write fs errata: %d\n", ret);
1211+ return ret;
1212+ }
1213+
1214+ ret = wm_halo_init(dsp);
1215+ if (ret) {
1216+ dev_err(cs35l41->dev, "wm_halo_init failed: %d\n", ret);
1217+ return ret;
1218+ }
1219+
1220+ ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX5_SRC,
1221+ CS35L41_INPUT_SRC_VPMON);
1222+ if (ret < 0) {
1223+ dev_err(cs35l41->dev, "Write INPUT_SRC_VPMON failed: %d\n", ret);
1224+ goto err_dsp;
1225+ }
1226+ ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX6_SRC,
1227+ CS35L41_INPUT_SRC_CLASSH);
1228+ if (ret < 0) {
1229+ dev_err(cs35l41->dev, "Write INPUT_SRC_CLASSH failed: %d\n", ret);
1230+ goto err_dsp;
1231+ }
1232+ ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX7_SRC,
1233+ CS35L41_INPUT_SRC_TEMPMON);
1234+ if (ret < 0) {
1235+ dev_err(cs35l41->dev, "Write INPUT_SRC_TEMPMON failed: %d\n", ret);
1236+ goto err_dsp;
1237+ }
1238+ ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX8_SRC,
1239+ CS35L41_INPUT_SRC_RSVD);
1240+ if (ret < 0) {
1241+ dev_err(cs35l41->dev, "Write INPUT_SRC_RSVD failed: %d\n", ret);
1242+ goto err_dsp;
1243+ }
1244+
1245+ return 0;
1246+
1247+err_dsp:
1248+ wm_adsp2_remove(dsp);
1249+
1250+ return ret;
1251+}
12321252
12331253 int cs35l41_probe(struct cs35l41_private *cs35l41,
12341254 struct cs35l41_platform_data *pdata)
@@ -1325,39 +1345,20 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, · 90 unmodified lines
13251345 goto err;
13261346 }
13271347
1328− switch (reg_revid) {
1329− case CS35L41_REVID_A0:
1330− ret = regmap_register_patch(cs35l41->regmap,
1331− cs35l41_reva0_errata_patch,
1332− ARRAY_SIZE(cs35l41_reva0_errata_patch));
1333− if (ret < 0) {
1334− dev_err(cs35l41->dev,
1335− "Failed to apply A0 errata patch: %d\n", ret);
1336− goto err;
1337− }
1338− break;
1339− case CS35L41_REVID_B0:
1340− ret = regmap_register_patch(cs35l41->regmap,
1341− cs35l41_revb0_errata_patch,
1342− ARRAY_SIZE(cs35l41_revb0_errata_patch));
1343− if (ret < 0) {
1344− dev_err(cs35l41->dev,
1345− "Failed to apply B0 errata patch: %d\n", ret);
1346− goto err;
1347− }
1348− break;
1349− case CS35L41_REVID_B2:
1350− ret = regmap_register_patch(cs35l41->regmap,
1351− cs35l41_revb2_errata_patch,
1352− ARRAY_SIZE(cs35l41_revb2_errata_patch));
1353− if (ret < 0) {
1354− dev_err(cs35l41->dev,
1355− "Failed to apply B2 errata patch: %d\n", ret);
1356− goto err;
1357− }
1358− break;
1348+ cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap);
1349+
1350+ ret = cs35l41_register_errata_patch(cs35l41->dev, cs35l41->regmap, reg_revid);
1351+ if (ret)
1352+ goto err;
1353+
1354+ ret = cs35l41_otp_unpack(cs35l41->dev, cs35l41->regmap);
1355+ if (ret < 0) {
1356+ dev_err(cs35l41->dev, "OTP Unpack failed: %d\n", ret);
1357+ goto err;
13591358 }
13601359
1360+ cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap);
1361+
13611362 irq_pol = cs35l41_irq_gpio_config(cs35l41);
13621363
13631364 /* Set interrupt masks for critical errors */
@@ -1367,71 +1368,229 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, · 3 unmodified lines
13671368 ret = devm_request_threaded_irq(cs35l41->dev, cs35l41->irq, NULL, cs35l41_irq,
13681369 IRQF_ONESHOT | IRQF_SHARED | irq_pol,
13691370 "cs35l41", cs35l41);
1370−
1371− /* CS35L41 needs INT for PDN_DONE */
13721371 if (ret != 0) {
13731372 dev_err(cs35l41->dev, "Failed to request IRQ: %d\n", ret);
13741373 goto err;
13751374 }
13761375
1377− ret = cs35l41_otp_unpack(cs35l41);
1378− if (ret < 0) {
1379− dev_err(cs35l41->dev, "OTP Unpack failed: %d\n", ret);
1380− goto err;
1381− }
1382−
1383− ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_CCM_CORE_CTRL, 0);
1384− if (ret < 0) {
1385− dev_err(cs35l41->dev, "Write CCM_CORE_CTRL failed: %d\n", ret);
1386− goto err;
1387− }
1388−
1389− ret = regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
1390− CS35L41_AMP_EN_MASK, 0);
1376+ ret = cs35l41_set_pdata(cs35l41);
13911377 if (ret < 0) {
1392− dev_err(cs35l41->dev, "Write CS35L41_PWR_CTRL2 failed: %d\n", ret);
1378+ dev_err(cs35l41->dev, "Set pdata failed: %d\n", ret);
13931379 goto err;
13941380 }
13951381
1396− ret = regmap_update_bits(cs35l41->regmap, CS35L41_AMP_GAIN_CTRL,
1397− CS35L41_AMP_GAIN_PCM_MASK, 0);
1398− if (ret < 0) {
1399− dev_err(cs35l41->dev, "Write CS35L41_AMP_GAIN_CTRL failed: %d\n", ret);
1382+ ret = cs35l41_dsp_init(cs35l41);
1383+ if (ret < 0)
14001384 goto err;
1401− }
14021385
1403− ret = cs35l41_set_pdata(cs35l41);
1404− if (ret < 0) {
1405− dev_err(cs35l41->dev, "Set pdata failed: %d\n", ret);
1406− goto err;
1407− }
1386+ pm_runtime_set_autosuspend_delay(cs35l41->dev, 3000);
1387+ pm_runtime_use_autosuspend(cs35l41->dev);
1388+ pm_runtime_mark_last_busy(cs35l41->dev);
1389+ pm_runtime_set_active(cs35l41->dev);
1390+ pm_runtime_get_noresume(cs35l41->dev);
1391+ pm_runtime_enable(cs35l41->dev);
14081392
14091393 ret = devm_snd_soc_register_component(cs35l41->dev,
14101394 &soc_component_dev_cs35l41,
14111395 cs35l41_dai, ARRAY_SIZE(cs35l41_dai));
14121396 if (ret < 0) {
14131397 dev_err(cs35l41->dev, "Register codec failed: %d\n", ret);
1414− goto err;
1398+ goto err_pm;
14151399 }
14161400
1401+ pm_runtime_put_autosuspend(cs35l41->dev);
1402+
14171403 dev_info(cs35l41->dev, "Cirrus Logic CS35L41 (%x), Revision: %02X\n",
14181404 regid, reg_revid);
14191405
14201406 return 0;
14211407
1408+err_pm:
1409+ pm_runtime_disable(cs35l41->dev);
1410+ pm_runtime_put_noidle(cs35l41->dev);
1411+
1412+ wm_adsp2_remove(&cs35l41->dsp);
14221413 err:
14231414 regulator_bulk_disable(CS35L41_NUM_SUPPLIES, cs35l41->supplies);
14241415 gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
14251416
14261417 return ret;
14271418 }
1419+EXPORT_SYMBOL_GPL(cs35l41_probe);
14281420
14291421 void cs35l41_remove(struct cs35l41_private *cs35l41)
14301422 {
1423+ pm_runtime_get_sync(cs35l41->dev);
1424+ pm_runtime_disable(cs35l41->dev);
1425+
14311426 regmap_write(cs35l41->regmap, CS35L41_IRQ1_MASK1, 0xFFFFFFFF);
1427+ wm_adsp2_remove(&cs35l41->dsp);
1428+
1429+ pm_runtime_put_noidle(cs35l41->dev);
1430+
14321431 regulator_bulk_disable(CS35L41_NUM_SUPPLIES, cs35l41->supplies);
14331432 gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
14341433 }
1434+EXPORT_SYMBOL_GPL(cs35l41_remove);
1435+
1436+static int __maybe_unused cs35l41_runtime_suspend(struct device *dev)
1437+{
1438+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1439+
1440+ dev_dbg(cs35l41->dev, "Runtime suspend\n");
1441+
1442+ if (!cs35l41->dsp.preloaded || !cs35l41->dsp.cs_dsp.running)
1443+ return 0;
1444+
1445+ dev_dbg(cs35l41->dev, "Enter hibernate\n");
1446+
1447+ regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0088);
1448+ regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0188);
1449+
1450+ // Don't wait for ACK since bus activity would wake the device
1451+ regmap_write(cs35l41->regmap, CS35L41_DSP_VIRT1_MBOX_1,
1452+ CSPL_MBOX_CMD_HIBERNATE);
1453+
1454+ regcache_cache_only(cs35l41->regmap, true);
1455+ regcache_mark_dirty(cs35l41->regmap);
1456+
1457+ return 0;
1458+}
1459+
1460+static void cs35l41_wait_for_pwrmgt_sts(struct cs35l41_private *cs35l41)
1461+{
1462+ const int pwrmgt_retries = 10;
1463+ unsigned int sts;
1464+ int i, ret;
1465+
1466+ for (i = 0; i < pwrmgt_retries; i++) {
1467+ ret = regmap_read(cs35l41->regmap, CS35L41_PWRMGT_STS, &sts);
1468+ if (ret)
1469+ dev_err(cs35l41->dev, "Failed to read PWRMGT_STS: %d\n", ret);
1470+ else if (!(sts & CS35L41_WR_PEND_STS_MASK))
1471+ return;
1472+
1473+ udelay(20);
1474+ }
1475+
1476+ dev_err(cs35l41->dev, "Timed out reading PWRMGT_STS\n");
1477+}
1478+
1479+static int cs35l41_exit_hibernate(struct cs35l41_private *cs35l41)
1480+{
1481+ const int wake_retries = 20;
1482+ const int sleep_retries = 5;
1483+ int ret, i, j;
1484+
1485+ for (i = 0; i < sleep_retries; i++) {
1486+ dev_dbg(cs35l41->dev, "Exit hibernate\n");
1487+
1488+ for (j = 0; j < wake_retries; j++) {
1489+ ret = cs35l41_set_cspl_mbox_cmd(cs35l41,
1490+ CSPL_MBOX_CMD_OUT_OF_HIBERNATE);
1491+ if (!ret)
1492+ break;
1493+
1494+ usleep_range(100, 200);
1495+ }
1496+
1497+ if (j < wake_retries) {
1498+ dev_dbg(cs35l41->dev, "Wake success at cycle: %d\n", j);
1499+ return 0;
1500+ }
1501+
1502+ dev_err(cs35l41->dev, "Wake failed, re-enter hibernate: %d\n", ret);
1503+
1504+ cs35l41_wait_for_pwrmgt_sts(cs35l41);
1505+ regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0088);
1506+
1507+ cs35l41_wait_for_pwrmgt_sts(cs35l41);
1508+ regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0188);
1509+
1510+ cs35l41_wait_for_pwrmgt_sts(cs35l41);
1511+ regmap_write(cs35l41->regmap, CS35L41_PWRMGT_CTL, 0x3);
1512+ }
1513+
1514+ dev_err(cs35l41->dev, "Timed out waking device\n");
1515+
1516+ return -ETIMEDOUT;
1517+}
1518+
1519+static int __maybe_unused cs35l41_runtime_resume(struct device *dev)
1520+{
1521+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1522+ int ret;
1523+
1524+ dev_dbg(cs35l41->dev, "Runtime resume\n");
1525+
1526+ if (!cs35l41->dsp.preloaded || !cs35l41->dsp.cs_dsp.running)
1527+ return 0;
1528+
1529+ regcache_cache_only(cs35l41->regmap, false);
1530+
1531+ ret = cs35l41_exit_hibernate(cs35l41);
1532+ if (ret)
1533+ return ret;
1534+
1535+ /* Test key needs to be unlocked to allow the OTP settings to re-apply */
1536+ cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap);
1537+ ret = regcache_sync(cs35l41->regmap);
1538+ cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap);
1539+ if (ret) {
1540+ dev_err(cs35l41->dev, "Failed to restore register cache: %d\n", ret);
1541+ return ret;
1542+ }
1543+
1544+ return 0;
1545+}
1546+
1547+static int __maybe_unused cs35l41_sys_suspend(struct device *dev)
1548+{
1549+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1550+
1551+ dev_dbg(cs35l41->dev, "System suspend, disabling IRQ\n");
1552+ disable_irq(cs35l41->irq);
1553+
1554+ return 0;
1555+}
1556+
1557+static int __maybe_unused cs35l41_sys_suspend_noirq(struct device *dev)
1558+{
1559+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1560+
1561+ dev_dbg(cs35l41->dev, "Late system suspend, reenabling IRQ\n");
1562+ enable_irq(cs35l41->irq);
1563+
1564+ return 0;
1565+}
1566+
1567+static int __maybe_unused cs35l41_sys_resume_noirq(struct device *dev)
1568+{
1569+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1570+
1571+ dev_dbg(cs35l41->dev, "Early system resume, disabling IRQ\n");
1572+ disable_irq(cs35l41->irq);
1573+
1574+ return 0;
1575+}
1576+
1577+static int __maybe_unused cs35l41_sys_resume(struct device *dev)
1578+{
1579+ struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
1580+
1581+ dev_dbg(cs35l41->dev, "System resume, reenabling IRQ\n");
1582+ enable_irq(cs35l41->irq);
1583+
1584+ return 0;
1585+}
1586+
1587+const struct dev_pm_ops cs35l41_pm_ops = {
1588+ SET_RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume, NULL)
1589+
1590+ SET_SYSTEM_SLEEP_PM_OPS(cs35l41_sys_suspend, cs35l41_sys_resume)
1591+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(cs35l41_sys_suspend_noirq, cs35l41_sys_resume_noirq)
1592+};
1593+EXPORT_SYMBOL_GPL(cs35l41_pm_ops);
14351594
14361595 MODULE_DESCRIPTION("ASoC CS35L41 driver");
14371596 MODULE_AUTHOR("David Rhodes, Cirrus Logic Inc, <david.rhodes@cirrus.com>");
sound/soc/codecs/cs35l41.h+18−731
@@ -11,751 +11,38 @@ · 10 unmodified lines
1111 #define __CS35L41_H__
1212
1313 #include <linux/gpio/consumer.h>
14−#include <linux/regmap.h>
1514 #include <linux/regulator/consumer.h>
15+#include <linux/firmware.h>
1616 #include <sound/core.h>
1717 #include <sound/cs35l41.h>
1818
19−#define CS35L41_FIRSTREG 0x00000000
20−#define CS35L41_LASTREG 0x03804FE8
21−#define CS35L41_DEVID 0x00000000
22−#define CS35L41_REVID 0x00000004
23−#define CS35L41_FABID 0x00000008
24−#define CS35L41_RELID 0x0000000C
25−#define CS35L41_OTPID 0x00000010
26−#define CS35L41_SFT_RESET 0x00000020
27−#define CS35L41_TEST_KEY_CTL 0x00000040
28−#define CS35L41_USER_KEY_CTL 0x00000044
29−#define CS35L41_OTP_MEM0 0x00000400
30−#define CS35L41_OTP_MEM31 0x0000047C
31−#define CS35L41_OTP_CTRL0 0x00000500
32−#define CS35L41_OTP_CTRL1 0x00000504
33−#define CS35L41_OTP_CTRL3 0x00000508
34−#define CS35L41_OTP_CTRL4 0x0000050C
35−#define CS35L41_OTP_CTRL5 0x00000510
36−#define CS35L41_OTP_CTRL6 0x00000514
37−#define CS35L41_OTP_CTRL7 0x00000518
38−#define CS35L41_OTP_CTRL8 0x0000051C
39−#define CS35L41_PWR_CTRL1 0x00002014
40−#define CS35L41_PWR_CTRL2 0x00002018
41−#define CS35L41_PWR_CTRL3 0x0000201C
42−#define CS35L41_CTRL_OVRRIDE 0x00002020
43−#define CS35L41_AMP_OUT_MUTE 0x00002024
44−#define CS35L41_PROTECT_REL_ERR_IGN 0x00002034
45−#define CS35L41_GPIO_PAD_CONTROL 0x0000242C
46−#define CS35L41_JTAG_CONTROL 0x00002438
47−#define CS35L41_PLL_CLK_CTRL 0x00002C04
48−#define CS35L41_DSP_CLK_CTRL 0x00002C08
49−#define CS35L41_GLOBAL_CLK_CTRL 0x00002C0C
50−#define CS35L41_DATA_FS_SEL 0x00002C10
51−#define CS35L41_TST_FS_MON0 0x00002D10
52−#define CS35L41_MDSYNC_EN 0x00003400
53−#define CS35L41_MDSYNC_TX_ID 0x00003408
54−#define CS35L41_MDSYNC_PWR_CTRL 0x0000340C
55−#define CS35L41_MDSYNC_DATA_TX 0x00003410
56−#define CS35L41_MDSYNC_TX_STATUS 0x00003414
57−#define CS35L41_MDSYNC_DATA_RX 0x0000341C
58−#define CS35L41_MDSYNC_RX_STATUS 0x00003420
59−#define CS35L41_MDSYNC_ERR_STATUS 0x00003424
60−#define CS35L41_MDSYNC_SYNC_PTE2 0x00003528
61−#define CS35L41_MDSYNC_SYNC_PTE3 0x0000352C
62−#define CS35L41_MDSYNC_SYNC_MSM_STATUS 0x0000353C
63−#define CS35L41_BSTCVRT_VCTRL1 0x00003800
64−#define CS35L41_BSTCVRT_VCTRL2 0x00003804
65−#define CS35L41_BSTCVRT_PEAK_CUR 0x00003808
66−#define CS35L41_BSTCVRT_SFT_RAMP 0x0000380C
67−#define CS35L41_BSTCVRT_COEFF 0x00003810
68−#define CS35L41_BSTCVRT_SLOPE_LBST 0x00003814
69−#define CS35L41_BSTCVRT_SW_FREQ 0x00003818
70−#define CS35L41_BSTCVRT_DCM_CTRL 0x0000381C
71−#define CS35L41_BSTCVRT_DCM_MODE_FORCE 0x00003820
72−#define CS35L41_BSTCVRT_OVERVOLT_CTRL 0x00003830
73−#define CS35L41_VI_VOL_POL 0x00004000
74−#define CS35L41_VIMON_SPKMON_RESYNC 0x00004100
75−#define CS35L41_DTEMP_WARN_THLD 0x00004220
76−#define CS35L41_DTEMP_CFG 0x00004224
77−#define CS35L41_DTEMP_EN 0x00004308
78−#define CS35L41_VPVBST_FS_SEL 0x00004400
79−#define CS35L41_SP_ENABLES 0x00004800
80−#define CS35L41_SP_RATE_CTRL 0x00004804
81−#define CS35L41_SP_FORMAT 0x00004808
82−#define CS35L41_SP_HIZ_CTRL 0x0000480C
83−#define CS35L41_SP_FRAME_TX_SLOT 0x00004810
84−#define CS35L41_SP_FRAME_RX_SLOT 0x00004820
85−#define CS35L41_SP_TX_WL 0x00004830
86−#define CS35L41_SP_RX_WL 0x00004840
87−#define CS35L41_ASP_CONTROL4 0x00004854
88−#define CS35L41_DAC_PCM1_SRC 0x00004C00
89−#define CS35L41_ASP_TX1_SRC 0x00004C20
90−#define CS35L41_ASP_TX2_SRC 0x00004C24
91−#define CS35L41_ASP_TX3_SRC 0x00004C28
92−#define CS35L41_ASP_TX4_SRC 0x00004C2C
93−#define CS35L41_DSP1_RX1_SRC 0x00004C40
94−#define CS35L41_DSP1_RX2_SRC 0x00004C44
95−#define CS35L41_DSP1_RX3_SRC 0x00004C48
96−#define CS35L41_DSP1_RX4_SRC 0x00004C4C
97−#define CS35L41_DSP1_RX5_SRC 0x00004C50
98−#define CS35L41_DSP1_RX6_SRC 0x00004C54
99−#define CS35L41_DSP1_RX7_SRC 0x00004C58
100−#define CS35L41_DSP1_RX8_SRC 0x00004C5C
101−#define CS35L41_NGATE1_SRC 0x00004C60
102−#define CS35L41_NGATE2_SRC 0x00004C64
103−#define CS35L41_AMP_DIG_VOL_CTRL 0x00006000
104−#define CS35L41_VPBR_CFG 0x00006404
105−#define CS35L41_VBBR_CFG 0x00006408
106−#define CS35L41_VPBR_STATUS 0x0000640C
107−#define CS35L41_VBBR_STATUS 0x00006410
108−#define CS35L41_OVERTEMP_CFG 0x00006414
109−#define CS35L41_AMP_ERR_VOL 0x00006418
110−#define CS35L41_VOL_STATUS_TO_DSP 0x00006450
111−#define CS35L41_CLASSH_CFG 0x00006800
112−#define CS35L41_WKFET_CFG 0x00006804
113−#define CS35L41_NG_CFG 0x00006808
114−#define CS35L41_AMP_GAIN_CTRL 0x00006C04
115−#define CS35L41_DAC_MSM_CFG 0x00007400
116−#define CS35L41_IRQ1_CFG 0x00010000
117−#define CS35L41_IRQ1_STATUS 0x00010004
118−#define CS35L41_IRQ1_STATUS1 0x00010010
119−#define CS35L41_IRQ1_STATUS2 0x00010014
120−#define CS35L41_IRQ1_STATUS3 0x00010018
121−#define CS35L41_IRQ1_STATUS4 0x0001001C
122−#define CS35L41_IRQ1_RAW_STATUS1 0x00010090
123−#define CS35L41_IRQ1_RAW_STATUS2 0x00010094
124−#define CS35L41_IRQ1_RAW_STATUS3 0x00010098
125−#define CS35L41_IRQ1_RAW_STATUS4 0x0001009C
126−#define CS35L41_IRQ1_MASK1 0x00010110
127−#define CS35L41_IRQ1_MASK2 0x00010114
128−#define CS35L41_IRQ1_MASK3 0x00010118
129−#define CS35L41_IRQ1_MASK4 0x0001011C
130−#define CS35L41_IRQ1_FRC1 0x00010190
131−#define CS35L41_IRQ1_FRC2 0x00010194
132−#define CS35L41_IRQ1_FRC3 0x00010198
133−#define CS35L41_IRQ1_FRC4 0x0001019C
134−#define CS35L41_IRQ1_EDGE1 0x00010210
135−#define CS35L41_IRQ1_EDGE4 0x0001021C
136−#define CS35L41_IRQ1_POL1 0x00010290
137−#define CS35L41_IRQ1_POL2 0x00010294
138−#define CS35L41_IRQ1_POL3 0x00010298
139−#define CS35L41_IRQ1_POL4 0x0001029C
140−#define CS35L41_IRQ1_DB3 0x00010318
141−#define CS35L41_IRQ2_CFG 0x00010800
142−#define CS35L41_IRQ2_STATUS 0x00010804
143−#define CS35L41_IRQ2_STATUS1 0x00010810
144−#define CS35L41_IRQ2_STATUS2 0x00010814
145−#define CS35L41_IRQ2_STATUS3 0x00010818
146−#define CS35L41_IRQ2_STATUS4 0x0001081C
147−#define CS35L41_IRQ2_RAW_STATUS1 0x00010890
148−#define CS35L41_IRQ2_RAW_STATUS2 0x00010894
149−#define CS35L41_IRQ2_RAW_STATUS3 0x00010898
150−#define CS35L41_IRQ2_RAW_STATUS4 0x0001089C
151−#define CS35L41_IRQ2_MASK1 0x00010910
152−#define CS35L41_IRQ2_MASK2 0x00010914
153−#define CS35L41_IRQ2_MASK3 0x00010918
154−#define CS35L41_IRQ2_MASK4 0x0001091C
155−#define CS35L41_IRQ2_FRC1 0x00010990
156−#define CS35L41_IRQ2_FRC2 0x00010994
157−#define CS35L41_IRQ2_FRC3 0x00010998
158−#define CS35L41_IRQ2_FRC4 0x0001099C
159−#define CS35L41_IRQ2_EDGE1 0x00010A10
160−#define CS35L41_IRQ2_EDGE4 0x00010A1C
161−#define CS35L41_IRQ2_POL1 0x00010A90
162−#define CS35L41_IRQ2_POL2 0x00010A94
163−#define CS35L41_IRQ2_POL3 0x00010A98
164−#define CS35L41_IRQ2_POL4 0x00010A9C
165−#define CS35L41_IRQ2_DB3 0x00010B18
166−#define CS35L41_GPIO_STATUS1 0x00011000
167−#define CS35L41_GPIO1_CTRL1 0x00011008
168−#define CS35L41_GPIO2_CTRL1 0x0001100C
169−#define CS35L41_MIXER_NGATE_CFG 0x00012000
170−#define CS35L41_MIXER_NGATE_CH1_CFG 0x00012004
171−#define CS35L41_MIXER_NGATE_CH2_CFG 0x00012008
172−#define CS35L41_DSP_MBOX_1 0x00013000
173−#define CS35L41_DSP_MBOX_2 0x00013004
174−#define CS35L41_DSP_MBOX_3 0x00013008
175−#define CS35L41_DSP_MBOX_4 0x0001300C
176−#define CS35L41_DSP_MBOX_5 0x00013010
177−#define CS35L41_DSP_MBOX_6 0x00013014
178−#define CS35L41_DSP_MBOX_7 0x00013018
179−#define CS35L41_DSP_MBOX_8 0x0001301C
180−#define CS35L41_DSP_VIRT1_MBOX_1 0x00013020
181−#define CS35L41_DSP_VIRT1_MBOX_2 0x00013024
182−#define CS35L41_DSP_VIRT1_MBOX_3 0x00013028
183−#define CS35L41_DSP_VIRT1_MBOX_4 0x0001302C
184−#define CS35L41_DSP_VIRT1_MBOX_5 0x00013030
185−#define CS35L41_DSP_VIRT1_MBOX_6 0x00013034
186−#define CS35L41_DSP_VIRT1_MBOX_7 0x00013038
187−#define CS35L41_DSP_VIRT1_MBOX_8 0x0001303C
188−#define CS35L41_DSP_VIRT2_MBOX_1 0x00013040
189−#define CS35L41_DSP_VIRT2_MBOX_2 0x00013044
190−#define CS35L41_DSP_VIRT2_MBOX_3 0x00013048
191−#define CS35L41_DSP_VIRT2_MBOX_4 0x0001304C
192−#define CS35L41_DSP_VIRT2_MBOX_5 0x00013050
193−#define CS35L41_DSP_VIRT2_MBOX_6 0x00013054
194−#define CS35L41_DSP_VIRT2_MBOX_7 0x00013058
195−#define CS35L41_DSP_VIRT2_MBOX_8 0x0001305C
196−#define CS35L41_CLOCK_DETECT_1 0x00014000
197−#define CS35L41_TIMER1_CONTROL 0x00015000
198−#define CS35L41_TIMER1_COUNT_PRESET 0x00015004
199−#define CS35L41_TIMER1_START_STOP 0x0001500C
200−#define CS35L41_TIMER1_STATUS 0x00015010
201−#define CS35L41_TIMER1_COUNT_READBACK 0x00015014
202−#define CS35L41_TIMER1_DSP_CLK_CFG 0x00015018
203−#define CS35L41_TIMER1_DSP_CLK_STATUS 0x0001501C
204−#define CS35L41_TIMER2_CONTROL 0x00015100
205−#define CS35L41_TIMER2_COUNT_PRESET 0x00015104
206−#define CS35L41_TIMER2_START_STOP 0x0001510C
207−#define CS35L41_TIMER2_STATUS 0x00015110
208−#define CS35L41_TIMER2_COUNT_READBACK 0x00015114
209−#define CS35L41_TIMER2_DSP_CLK_CFG 0x00015118
210−#define CS35L41_TIMER2_DSP_CLK_STATUS 0x0001511C
211−#define CS35L41_DFT_JTAG_CONTROL 0x00016000
212−#define CS35L41_DIE_STS1 0x00017040
213−#define CS35L41_DIE_STS2 0x00017044
214−#define CS35L41_TEMP_CAL1 0x00017048
215−#define CS35L41_TEMP_CAL2 0x0001704C
216−#define CS35L41_DSP1_XMEM_PACK_0 0x02000000
217−#define CS35L41_DSP1_XMEM_PACK_3068 0x02002FF0
218−#define CS35L41_DSP1_XMEM_UNPACK32_0 0x02400000
219−#define CS35L41_DSP1_XMEM_UNPACK32_2046 0x02401FF8
220−#define CS35L41_DSP1_TIMESTAMP_COUNT 0x025C0800
221−#define CS35L41_DSP1_SYS_ID 0x025E0000
222−#define CS35L41_DSP1_SYS_VERSION 0x025E0004
223−#define CS35L41_DSP1_SYS_CORE_ID 0x025E0008
224−#define CS35L41_DSP1_SYS_AHB_ADDR 0x025E000C
225−#define CS35L41_DSP1_SYS_XSRAM_SIZE 0x025E0010
226−#define CS35L41_DSP1_SYS_YSRAM_SIZE 0x025E0018
227−#define CS35L41_DSP1_SYS_PSRAM_SIZE 0x025E0020
228−#define CS35L41_DSP1_SYS_PM_BOOT_SIZE 0x025E0028
229−#define CS35L41_DSP1_SYS_FEATURES 0x025E002C
230−#define CS35L41_DSP1_SYS_FIR_FILTERS 0x025E0030
231−#define CS35L41_DSP1_SYS_LMS_FILTERS 0x025E0034
232−#define CS35L41_DSP1_SYS_XM_BANK_SIZE 0x025E0038
233−#define CS35L41_DSP1_SYS_YM_BANK_SIZE 0x025E003C
234−#define CS35L41_DSP1_SYS_PM_BANK_SIZE 0x025E0040
235−#define CS35L41_DSP1_AHBM_WIN0_CTRL0 0x025E2000
236−#define CS35L41_DSP1_AHBM_WIN0_CTRL1 0x025E2004
237−#define CS35L41_DSP1_AHBM_WIN1_CTRL0 0x025E2008
238−#define CS35L41_DSP1_AHBM_WIN1_CTRL1 0x025E200C
239−#define CS35L41_DSP1_AHBM_WIN2_CTRL0 0x025E2010
240−#define CS35L41_DSP1_AHBM_WIN2_CTRL1 0x025E2014
241−#define CS35L41_DSP1_AHBM_WIN3_CTRL0 0x025E2018
242−#define CS35L41_DSP1_AHBM_WIN3_CTRL1 0x025E201C
243−#define CS35L41_DSP1_AHBM_WIN4_CTRL0 0x025E2020
244−#define CS35L41_DSP1_AHBM_WIN4_CTRL1 0x025E2024
245−#define CS35L41_DSP1_AHBM_WIN5_CTRL0 0x025E2028
246−#define CS35L41_DSP1_AHBM_WIN5_CTRL1 0x025E202C
247−#define CS35L41_DSP1_AHBM_WIN6_CTRL0 0x025E2030
248−#define CS35L41_DSP1_AHBM_WIN6_CTRL1 0x025E2034
249−#define CS35L41_DSP1_AHBM_WIN7_CTRL0 0x025E2038
250−#define CS35L41_DSP1_AHBM_WIN7_CTRL1 0x025E203C
251−#define CS35L41_DSP1_AHBM_WIN_DBG_CTRL0 0x025E2040
252−#define CS35L41_DSP1_AHBM_WIN_DBG_CTRL1 0x025E2044
253−#define CS35L41_DSP1_XMEM_UNPACK24_0 0x02800000
254−#define CS35L41_DSP1_XMEM_UNPACK24_4093 0x02803FF4
255−#define CS35L41_DSP1_CTRL_BASE 0x02B80000
256−#define CS35L41_DSP1_CORE_SOFT_RESET 0x02B80010
257−#define CS35L41_DSP1_DEBUG 0x02B80040
258−#define CS35L41_DSP1_TIMER_CTRL 0x02B80048
259−#define CS35L41_DSP1_STREAM_ARB_CTRL 0x02B80050
260−#define CS35L41_DSP1_RX1_RATE 0x02B80080
261−#define CS35L41_DSP1_RX2_RATE 0x02B80088
262−#define CS35L41_DSP1_RX3_RATE 0x02B80090
263−#define CS35L41_DSP1_RX4_RATE 0x02B80098
264−#define CS35L41_DSP1_RX5_RATE 0x02B800A0
265−#define CS35L41_DSP1_RX6_RATE 0x02B800A8
266−#define CS35L41_DSP1_RX7_RATE 0x02B800B0
267−#define CS35L41_DSP1_RX8_RATE 0x02B800B8
268−#define CS35L41_DSP1_TX1_RATE 0x02B80280
269−#define CS35L41_DSP1_TX2_RATE 0x02B80288
270−#define CS35L41_DSP1_TX3_RATE 0x02B80290
271−#define CS35L41_DSP1_TX4_RATE 0x02B80298
272−#define CS35L41_DSP1_TX5_RATE 0x02B802A0
273−#define CS35L41_DSP1_TX6_RATE 0x02B802A8
274−#define CS35L41_DSP1_TX7_RATE 0x02B802B0
275−#define CS35L41_DSP1_TX8_RATE 0x02B802B8
276−#define CS35L41_DSP1_NMI_CTRL1 0x02B80480
277−#define CS35L41_DSP1_NMI_CTRL2 0x02B80488
278−#define CS35L41_DSP1_NMI_CTRL3 0x02B80490
279−#define CS35L41_DSP1_NMI_CTRL4 0x02B80498
280−#define CS35L41_DSP1_NMI_CTRL5 0x02B804A0
281−#define CS35L41_DSP1_NMI_CTRL6 0x02B804A8
282−#define CS35L41_DSP1_NMI_CTRL7 0x02B804B0
283−#define CS35L41_DSP1_NMI_CTRL8 0x02B804B8
284−#define CS35L41_DSP1_RESUME_CTRL 0x02B80500
285−#define CS35L41_DSP1_IRQ1_CTRL 0x02B80508
286−#define CS35L41_DSP1_IRQ2_CTRL 0x02B80510
287−#define CS35L41_DSP1_IRQ3_CTRL 0x02B80518
288−#define CS35L41_DSP1_IRQ4_CTRL 0x02B80520
289−#define CS35L41_DSP1_IRQ5_CTRL 0x02B80528
290−#define CS35L41_DSP1_IRQ6_CTRL 0x02B80530
291−#define CS35L41_DSP1_IRQ7_CTRL 0x02B80538
292−#define CS35L41_DSP1_IRQ8_CTRL 0x02B80540
293−#define CS35L41_DSP1_IRQ9_CTRL 0x02B80548
294−#define CS35L41_DSP1_IRQ10_CTRL 0x02B80550
295−#define CS35L41_DSP1_IRQ11_CTRL 0x02B80558
296−#define CS35L41_DSP1_IRQ12_CTRL 0x02B80560
297−#define CS35L41_DSP1_IRQ13_CTRL 0x02B80568
298−#define CS35L41_DSP1_IRQ14_CTRL 0x02B80570
299−#define CS35L41_DSP1_IRQ15_CTRL 0x02B80578
300−#define CS35L41_DSP1_IRQ16_CTRL 0x02B80580
301−#define CS35L41_DSP1_IRQ17_CTRL 0x02B80588
302−#define CS35L41_DSP1_IRQ18_CTRL 0x02B80590
303−#define CS35L41_DSP1_IRQ19_CTRL 0x02B80598
304−#define CS35L41_DSP1_IRQ20_CTRL 0x02B805A0
305−#define CS35L41_DSP1_IRQ21_CTRL 0x02B805A8
306−#define CS35L41_DSP1_IRQ22_CTRL 0x02B805B0
307−#define CS35L41_DSP1_IRQ23_CTRL 0x02B805B8
308−#define CS35L41_DSP1_SCRATCH1 0x02B805C0
309−#define CS35L41_DSP1_SCRATCH2 0x02B805C8
310−#define CS35L41_DSP1_SCRATCH3 0x02B805D0
311−#define CS35L41_DSP1_SCRATCH4 0x02B805D8
312−#define CS35L41_DSP1_CCM_CORE_CTRL 0x02BC1000
313−#define CS35L41_DSP1_CCM_CLK_OVERRIDE 0x02BC1008
314−#define CS35L41_DSP1_XM_MSTR_EN 0x02BC2000
315−#define CS35L41_DSP1_XM_CORE_PRI 0x02BC2008
316−#define CS35L41_DSP1_XM_AHB_PACK_PL_PRI 0x02BC2010
317−#define CS35L41_DSP1_XM_AHB_UP_PL_PRI 0x02BC2018
318−#define CS35L41_DSP1_XM_ACCEL_PL0_PRI 0x02BC2020
319−#define CS35L41_DSP1_XM_NPL0_PRI 0x02BC2078
320−#define CS35L41_DSP1_YM_MSTR_EN 0x02BC20C0
321−#define CS35L41_DSP1_YM_CORE_PRI 0x02BC20C8
322−#define CS35L41_DSP1_YM_AHB_PACK_PL_PRI 0x02BC20D0
323−#define CS35L41_DSP1_YM_AHB_UP_PL_PRI 0x02BC20D8
324−#define CS35L41_DSP1_YM_ACCEL_PL0_PRI 0x02BC20E0
325−#define CS35L41_DSP1_YM_NPL0_PRI 0x02BC2138
326−#define CS35L41_DSP1_PM_MSTR_EN 0x02BC2180
327−#define CS35L41_DSP1_PM_PATCH0_ADDR 0x02BC2188
328−#define CS35L41_DSP1_PM_PATCH0_EN 0x02BC218C
329−#define CS35L41_DSP1_PM_PATCH0_DATA_LO 0x02BC2190
330−#define CS35L41_DSP1_PM_PATCH0_DATA_HI 0x02BC2194
331−#define CS35L41_DSP1_PM_PATCH1_ADDR 0x02BC2198
332−#define CS35L41_DSP1_PM_PATCH1_EN 0x02BC219C
333−#define CS35L41_DSP1_PM_PATCH1_DATA_LO 0x02BC21A0
334−#define CS35L41_DSP1_PM_PATCH1_DATA_HI 0x02BC21A4
335−#define CS35L41_DSP1_PM_PATCH2_ADDR 0x02BC21A8
336−#define CS35L41_DSP1_PM_PATCH2_EN 0x02BC21AC
337−#define CS35L41_DSP1_PM_PATCH2_DATA_LO 0x02BC21B0
338−#define CS35L41_DSP1_PM_PATCH2_DATA_HI 0x02BC21B4
339−#define CS35L41_DSP1_PM_PATCH3_ADDR 0x02BC21B8
340−#define CS35L41_DSP1_PM_PATCH3_EN 0x02BC21BC
341−#define CS35L41_DSP1_PM_PATCH3_DATA_LO 0x02BC21C0
342−#define CS35L41_DSP1_PM_PATCH3_DATA_HI 0x02BC21C4
343−#define CS35L41_DSP1_PM_PATCH4_ADDR 0x02BC21C8
344−#define CS35L41_DSP1_PM_PATCH4_EN 0x02BC21CC
345−#define CS35L41_DSP1_PM_PATCH4_DATA_LO 0x02BC21D0
346−#define CS35L41_DSP1_PM_PATCH4_DATA_HI 0x02BC21D4
347−#define CS35L41_DSP1_PM_PATCH5_ADDR 0x02BC21D8
348−#define CS35L41_DSP1_PM_PATCH5_EN 0x02BC21DC
349−#define CS35L41_DSP1_PM_PATCH5_DATA_LO 0x02BC21E0
350−#define CS35L41_DSP1_PM_PATCH5_DATA_HI 0x02BC21E4
351−#define CS35L41_DSP1_PM_PATCH6_ADDR 0x02BC21E8
352−#define CS35L41_DSP1_PM_PATCH6_EN 0x02BC21EC
353−#define CS35L41_DSP1_PM_PATCH6_DATA_LO 0x02BC21F0
354−#define CS35L41_DSP1_PM_PATCH6_DATA_HI 0x02BC21F4
355−#define CS35L41_DSP1_PM_PATCH7_ADDR 0x02BC21F8
356−#define CS35L41_DSP1_PM_PATCH7_EN 0x02BC21FC
357−#define CS35L41_DSP1_PM_PATCH7_DATA_LO 0x02BC2200
358−#define CS35L41_DSP1_PM_PATCH7_DATA_HI 0x02BC2204
359−#define CS35L41_DSP1_MPU_XM_ACCESS0 0x02BC3000
360−#define CS35L41_DSP1_MPU_YM_ACCESS0 0x02BC3004
361−#define CS35L41_DSP1_MPU_WNDW_ACCESS0 0x02BC3008
362−#define CS35L41_DSP1_MPU_XREG_ACCESS0 0x02BC300C
363−#define CS35L41_DSP1_MPU_YREG_ACCESS0 0x02BC3014
364−#define CS35L41_DSP1_MPU_XM_ACCESS1 0x02BC3018
365−#define CS35L41_DSP1_MPU_YM_ACCESS1 0x02BC301C
366−#define CS35L41_DSP1_MPU_WNDW_ACCESS1 0x02BC3020
367−#define CS35L41_DSP1_MPU_XREG_ACCESS1 0x02BC3024
368−#define CS35L41_DSP1_MPU_YREG_ACCESS1 0x02BC302C
369−#define CS35L41_DSP1_MPU_XM_ACCESS2 0x02BC3030
370−#define CS35L41_DSP1_MPU_YM_ACCESS2 0x02BC3034
371−#define CS35L41_DSP1_MPU_WNDW_ACCESS2 0x02BC3038
372−#define CS35L41_DSP1_MPU_XREG_ACCESS2 0x02BC303C
373−#define CS35L41_DSP1_MPU_YREG_ACCESS2 0x02BC3044
374−#define CS35L41_DSP1_MPU_XM_ACCESS3 0x02BC3048
375−#define CS35L41_DSP1_MPU_YM_ACCESS3 0x02BC304C
376−#define CS35L41_DSP1_MPU_WNDW_ACCESS3 0x02BC3050
377−#define CS35L41_DSP1_MPU_XREG_ACCESS3 0x02BC3054
378−#define CS35L41_DSP1_MPU_YREG_ACCESS3 0x02BC305C
379−#define CS35L41_DSP1_MPU_XM_VIO_ADDR 0x02BC3100
380−#define CS35L41_DSP1_MPU_XM_VIO_STATUS 0x02BC3104
381−#define CS35L41_DSP1_MPU_YM_VIO_ADDR 0x02BC3108
382−#define CS35L41_DSP1_MPU_YM_VIO_STATUS 0x02BC310C
383−#define CS35L41_DSP1_MPU_PM_VIO_ADDR 0x02BC3110
384−#define CS35L41_DSP1_MPU_PM_VIO_STATUS 0x02BC3114
385−#define CS35L41_DSP1_MPU_LOCK_CONFIG 0x02BC3140
386−#define CS35L41_DSP1_MPU_WDT_RST_CTRL 0x02BC3180
387−#define CS35L41_DSP1_STRMARB_MSTR0_CFG0 0x02BC5000
388−#define CS35L41_DSP1_STRMARB_MSTR0_CFG1 0x02BC5004
389−#define CS35L41_DSP1_STRMARB_MSTR0_CFG2 0x02BC5008
390−#define CS35L41_DSP1_STRMARB_MSTR1_CFG0 0x02BC5010
391−#define CS35L41_DSP1_STRMARB_MSTR1_CFG1 0x02BC5014
392−#define CS35L41_DSP1_STRMARB_MSTR1_CFG2 0x02BC5018
393−#define CS35L41_DSP1_STRMARB_MSTR2_CFG0 0x02BC5020
394−#define CS35L41_DSP1_STRMARB_MSTR2_CFG1 0x02BC5024
395−#define CS35L41_DSP1_STRMARB_MSTR2_CFG2 0x02BC5028
396−#define CS35L41_DSP1_STRMARB_MSTR3_CFG0 0x02BC5030
397−#define CS35L41_DSP1_STRMARB_MSTR3_CFG1 0x02BC5034
398−#define CS35L41_DSP1_STRMARB_MSTR3_CFG2 0x02BC5038
399−#define CS35L41_DSP1_STRMARB_MSTR4_CFG0 0x02BC5040
400−#define CS35L41_DSP1_STRMARB_MSTR4_CFG1 0x02BC5044
401−#define CS35L41_DSP1_STRMARB_MSTR4_CFG2 0x02BC5048
402−#define CS35L41_DSP1_STRMARB_MSTR5_CFG0 0x02BC5050
403−#define CS35L41_DSP1_STRMARB_MSTR5_CFG1 0x02BC5054
404−#define CS35L41_DSP1_STRMARB_MSTR5_CFG2 0x02BC5058
405−#define CS35L41_DSP1_STRMARB_MSTR6_CFG0 0x02BC5060
406−#define CS35L41_DSP1_STRMARB_MSTR6_CFG1 0x02BC5064
407−#define CS35L41_DSP1_STRMARB_MSTR6_CFG2 0x02BC5068
408−#define CS35L41_DSP1_STRMARB_MSTR7_CFG0 0x02BC5070
409−#define CS35L41_DSP1_STRMARB_MSTR7_CFG1 0x02BC5074
410−#define CS35L41_DSP1_STRMARB_MSTR7_CFG2 0x02BC5078
411−#define CS35L41_DSP1_STRMARB_TX0_CFG0 0x02BC5200
412−#define CS35L41_DSP1_STRMARB_TX0_CFG1 0x02BC5204
413−#define CS35L41_DSP1_STRMARB_TX1_CFG0 0x02BC5208
414−#define CS35L41_DSP1_STRMARB_TX1_CFG1 0x02BC520C
415−#define CS35L41_DSP1_STRMARB_TX2_CFG0 0x02BC5210
416−#define CS35L41_DSP1_STRMARB_TX2_CFG1 0x02BC5214
417−#define CS35L41_DSP1_STRMARB_TX3_CFG0 0x02BC5218
418−#define CS35L41_DSP1_STRMARB_TX3_CFG1 0x02BC521C
419−#define CS35L41_DSP1_STRMARB_TX4_CFG0 0x02BC5220
420−#define CS35L41_DSP1_STRMARB_TX4_CFG1 0x02BC5224
421−#define CS35L41_DSP1_STRMARB_TX5_CFG0 0x02BC5228
422−#define CS35L41_DSP1_STRMARB_TX5_CFG1 0x02BC522C
423−#define CS35L41_DSP1_STRMARB_TX6_CFG0 0x02BC5230
424−#define CS35L41_DSP1_STRMARB_TX6_CFG1 0x02BC5234
425−#define CS35L41_DSP1_STRMARB_TX7_CFG0 0x02BC5238
426−#define CS35L41_DSP1_STRMARB_TX7_CFG1 0x02BC523C
427−#define CS35L41_DSP1_STRMARB_RX0_CFG0 0x02BC5400
428−#define CS35L41_DSP1_STRMARB_RX0_CFG1 0x02BC5404
429−#define CS35L41_DSP1_STRMARB_RX1_CFG0 0x02BC5408
430−#define CS35L41_DSP1_STRMARB_RX1_CFG1 0x02BC540C
431−#define CS35L41_DSP1_STRMARB_RX2_CFG0 0x02BC5410
432−#define CS35L41_DSP1_STRMARB_RX2_CFG1 0x02BC5414
433−#define CS35L41_DSP1_STRMARB_RX3_CFG0 0x02BC5418
434−#define CS35L41_DSP1_STRMARB_RX3_CFG1 0x02BC541C
435−#define CS35L41_DSP1_STRMARB_RX4_CFG0 0x02BC5420
436−#define CS35L41_DSP1_STRMARB_RX4_CFG1 0x02BC5424
437−#define CS35L41_DSP1_STRMARB_RX5_CFG0 0x02BC5428
438−#define CS35L41_DSP1_STRMARB_RX5_CFG1 0x02BC542C
439−#define CS35L41_DSP1_STRMARB_RX6_CFG0 0x02BC5430
440−#define CS35L41_DSP1_STRMARB_RX6_CFG1 0x02BC5434
441−#define CS35L41_DSP1_STRMARB_RX7_CFG0 0x02BC5438
442−#define CS35L41_DSP1_STRMARB_RX7_CFG1 0x02BC543C
443−#define CS35L41_DSP1_STRMARB_IRQ0_CFG0 0x02BC5600
444−#define CS35L41_DSP1_STRMARB_IRQ0_CFG1 0x02BC5604
445−#define CS35L41_DSP1_STRMARB_IRQ0_CFG2 0x02BC5608
446−#define CS35L41_DSP1_STRMARB_IRQ1_CFG0 0x02BC5610
447−#define CS35L41_DSP1_STRMARB_IRQ1_CFG1 0x02BC5614
448−#define CS35L41_DSP1_STRMARB_IRQ1_CFG2 0x02BC5618
449−#define CS35L41_DSP1_STRMARB_IRQ2_CFG0 0x02BC5620
450−#define CS35L41_DSP1_STRMARB_IRQ2_CFG1 0x02BC5624
451−#define CS35L41_DSP1_STRMARB_IRQ2_CFG2 0x02BC5628
452−#define CS35L41_DSP1_STRMARB_IRQ3_CFG0 0x02BC5630
453−#define CS35L41_DSP1_STRMARB_IRQ3_CFG1 0x02BC5634
454−#define CS35L41_DSP1_STRMARB_IRQ3_CFG2 0x02BC5638
455−#define CS35L41_DSP1_STRMARB_IRQ4_CFG0 0x02BC5640
456−#define CS35L41_DSP1_STRMARB_IRQ4_CFG1 0x02BC5644
457−#define CS35L41_DSP1_STRMARB_IRQ4_CFG2 0x02BC5648
458−#define CS35L41_DSP1_STRMARB_IRQ5_CFG0 0x02BC5650
459−#define CS35L41_DSP1_STRMARB_IRQ5_CFG1 0x02BC5654
460−#define CS35L41_DSP1_STRMARB_IRQ5_CFG2 0x02BC5658
461−#define CS35L41_DSP1_STRMARB_IRQ6_CFG0 0x02BC5660
462−#define CS35L41_DSP1_STRMARB_IRQ6_CFG1 0x02BC5664
463−#define CS35L41_DSP1_STRMARB_IRQ6_CFG2 0x02BC5668
464−#define CS35L41_DSP1_STRMARB_IRQ7_CFG0 0x02BC5670
465−#define CS35L41_DSP1_STRMARB_IRQ7_CFG1 0x02BC5674
466−#define CS35L41_DSP1_STRMARB_IRQ7_CFG2 0x02BC5678
467−#define CS35L41_DSP1_STRMARB_RESYNC_MSK 0x02BC5A00
468−#define CS35L41_DSP1_STRMARB_ERR_STATUS 0x02BC5A08
469−#define CS35L41_DSP1_INTPCTL_RES_STATIC 0x02BC6000
470−#define CS35L41_DSP1_INTPCTL_RES_DYN 0x02BC6004
471−#define CS35L41_DSP1_INTPCTL_NMI_CTRL 0x02BC6008
472−#define CS35L41_DSP1_INTPCTL_IRQ_INV 0x02BC6010
473−#define CS35L41_DSP1_INTPCTL_IRQ_MODE 0x02BC6014
474−#define CS35L41_DSP1_INTPCTL_IRQ_EN 0x02BC6018
475−#define CS35L41_DSP1_INTPCTL_IRQ_MSK 0x02BC601C
476−#define CS35L41_DSP1_INTPCTL_IRQ_FLUSH 0x02BC6020
477−#define CS35L41_DSP1_INTPCTL_IRQ_MSKCLR 0x02BC6024
478−#define CS35L41_DSP1_INTPCTL_IRQ_FRC 0x02BC6028
479−#define CS35L41_DSP1_INTPCTL_IRQ_MSKSET 0x02BC602C
480−#define CS35L41_DSP1_INTPCTL_IRQ_ERR 0x02BC6030
481−#define CS35L41_DSP1_INTPCTL_IRQ_PEND 0x02BC6034
482−#define CS35L41_DSP1_INTPCTL_IRQ_GEN 0x02BC6038
483−#define CS35L41_DSP1_INTPCTL_TESTBITS 0x02BC6040
484−#define CS35L41_DSP1_WDT_CONTROL 0x02BC7000
485−#define CS35L41_DSP1_WDT_STATUS 0x02BC7008
486−#define CS35L41_DSP1_YMEM_PACK_0 0x02C00000
487−#define CS35L41_DSP1_YMEM_PACK_1532 0x02C017F0
488−#define CS35L41_DSP1_YMEM_UNPACK32_0 0x03000000
489−#define CS35L41_DSP1_YMEM_UNPACK32_1022 0x03000FF8
490−#define CS35L41_DSP1_YMEM_UNPACK24_0 0x03400000
491−#define CS35L41_DSP1_YMEM_UNPACK24_2045 0x03401FF4
492−#define CS35L41_DSP1_PMEM_0 0x03800000
493−#define CS35L41_DSP1_PMEM_5114 0x03804FE8
494−
495−/*test regs for emulation bringup*/
496−#define CS35L41_PLL_OVR 0x00003018
497−#define CS35L41_BST_TEST_DUTY 0x00003900
498−#define CS35L41_DIGPWM_IOCTRL 0x0000706C
499−
500−/*registers populated by OTP*/
501−#define CS35L41_OTP_TRIM_1 0x0000208c
502−#define CS35L41_OTP_TRIM_2 0x00002090
503−#define CS35L41_OTP_TRIM_3 0x00003010
504−#define CS35L41_OTP_TRIM_4 0x0000300C
505−#define CS35L41_OTP_TRIM_5 0x0000394C
506−#define CS35L41_OTP_TRIM_6 0x00003950
507−#define CS35L41_OTP_TRIM_7 0x00003954
508−#define CS35L41_OTP_TRIM_8 0x00003958
509−#define CS35L41_OTP_TRIM_9 0x0000395C
510−#define CS35L41_OTP_TRIM_10 0x0000416C
511−#define CS35L41_OTP_TRIM_11 0x00004160
512−#define CS35L41_OTP_TRIM_12 0x00004170
513−#define CS35L41_OTP_TRIM_13 0x00004360
514−#define CS35L41_OTP_TRIM_14 0x00004448
515−#define CS35L41_OTP_TRIM_15 0x0000444C
516−#define CS35L41_OTP_TRIM_16 0x00006E30
517−#define CS35L41_OTP_TRIM_17 0x00006E34
518−#define CS35L41_OTP_TRIM_18 0x00006E38
519−#define CS35L41_OTP_TRIM_19 0x00006E3C
520−#define CS35L41_OTP_TRIM_20 0x00006E40
521−#define CS35L41_OTP_TRIM_21 0x00006E44
522−#define CS35L41_OTP_TRIM_22 0x00006E48
523−#define CS35L41_OTP_TRIM_23 0x00006E4C
524−#define CS35L41_OTP_TRIM_24 0x00006E50
525−#define CS35L41_OTP_TRIM_25 0x00006E54
526−#define CS35L41_OTP_TRIM_26 0x00006E58
527−#define CS35L41_OTP_TRIM_27 0x00006E5C
528−#define CS35L41_OTP_TRIM_28 0x00006E60
529−#define CS35L41_OTP_TRIM_29 0x00006E64
530−#define CS35L41_OTP_TRIM_30 0x00007418
531−#define CS35L41_OTP_TRIM_31 0x0000741C
532−#define CS35L41_OTP_TRIM_32 0x00007434
533−#define CS35L41_OTP_TRIM_33 0x00007068
534−#define CS35L41_OTP_TRIM_34 0x0000410C
535−#define CS35L41_OTP_TRIM_35 0x0000400C
536−#define CS35L41_OTP_TRIM_36 0x00002030
537−
538−#define CS35L41_MAX_CACHE_REG 36
539−#define CS35L41_OTP_SIZE_WORDS 32
540−#define CS35L41_NUM_OTP_ELEM 100
541−#define CS35L41_NUM_OTP_MAPS 5
542−
543−#define CS35L41_VALID_PDATA 0x80000000
544−#define CS35L41_NUM_SUPPLIES 2
545−
546−#define CS35L41_SCLK_MSTR_MASK 0x10
547−#define CS35L41_SCLK_MSTR_SHIFT 4
548−#define CS35L41_LRCLK_MSTR_MASK 0x01
549−#define CS35L41_LRCLK_MSTR_SHIFT 0
550−#define CS35L41_SCLK_INV_MASK 0x40
551−#define CS35L41_SCLK_INV_SHIFT 6
552−#define CS35L41_LRCLK_INV_MASK 0x04
553−#define CS35L41_LRCLK_INV_SHIFT 2
554−#define CS35L41_SCLK_FRC_MASK 0x20
555−#define CS35L41_SCLK_FRC_SHIFT 5
556−#define CS35L41_LRCLK_FRC_MASK 0x02
557−#define CS35L41_LRCLK_FRC_SHIFT 1
558−
559−#define CS35L41_AMP_GAIN_PCM_MASK 0x3E0
560−#define CS35L41_AMP_GAIN_ZC_MASK 0x0400
561−#define CS35L41_AMP_GAIN_ZC_SHIFT 10
562−
563−#define CS35L41_BST_CTL_MASK 0xFF
564−#define CS35L41_BST_CTL_SEL_MASK 0x03
565−#define CS35L41_BST_CTL_SEL_REG 0x00
566−#define CS35L41_BST_CTL_SEL_CLASSH 0x01
567−#define CS35L41_BST_IPK_MASK 0x7F
568−#define CS35L41_BST_IPK_SHIFT 0
569−#define CS35L41_BST_LIM_MASK 0x4
570−#define CS35L41_BST_LIM_SHIFT 2
571−#define CS35L41_BST_K1_MASK 0x000000FF
572−#define CS35L41_BST_K1_SHIFT 0
573−#define CS35L41_BST_K2_MASK 0x0000FF00
574−#define CS35L41_BST_K2_SHIFT 8
575−#define CS35L41_BST_SLOPE_MASK 0x0000FF00
576−#define CS35L41_BST_SLOPE_SHIFT 8
577−#define CS35L41_BST_LBST_VAL_MASK 0x00000003
578−#define CS35L41_BST_LBST_VAL_SHIFT 0
579−
580−#define CS35L41_TEMP_THLD_MASK 0x03
581−#define CS35L41_VMON_IMON_VOL_MASK 0x07FF07FF
582−#define CS35L41_PDM_MODE_MASK 0x01
583−#define CS35L41_PDM_MODE_SHIFT 0
584−
585−#define CS35L41_CH_MEM_DEPTH_MASK 0x07
586−#define CS35L41_CH_MEM_DEPTH_SHIFT 0
587−#define CS35L41_CH_HDRM_CTL_MASK 0x007F0000
588−#define CS35L41_CH_HDRM_CTL_SHIFT 16
589−#define CS35L41_CH_REL_RATE_MASK 0xFF00
590−#define CS35L41_CH_REL_RATE_SHIFT 8
591−#define CS35L41_CH_WKFET_DLY_MASK 0x001C
592−#define CS35L41_CH_WKFET_DLY_SHIFT 2
593−#define CS35L41_CH_WKFET_THLD_MASK 0x0F00
594−#define CS35L41_CH_WKFET_THLD_SHIFT 8
595−
596−#define CS35L41_HW_NG_SEL_MASK 0x3F00
597−#define CS35L41_HW_NG_SEL_SHIFT 8
598−#define CS35L41_HW_NG_DLY_MASK 0x0070
599−#define CS35L41_HW_NG_DLY_SHIFT 4
600−#define CS35L41_HW_NG_THLD_MASK 0x0007
601−#define CS35L41_HW_NG_THLD_SHIFT 0
602−
603−#define CS35L41_DSP_NG_ENABLE_MASK 0x00010000
604−#define CS35L41_DSP_NG_ENABLE_SHIFT 16
605−#define CS35L41_DSP_NG_THLD_MASK 0x7
606−#define CS35L41_DSP_NG_THLD_SHIFT 0
607−#define CS35L41_DSP_NG_DELAY_MASK 0x0F00
608−#define CS35L41_DSP_NG_DELAY_SHIFT 8
609−
610−#define CS35L41_ASP_FMT_MASK 0x0700
611−#define CS35L41_ASP_FMT_SHIFT 8
612−#define CS35L41_ASP_DOUT_HIZ_MASK 0x03
613−#define CS35L41_ASP_DOUT_HIZ_SHIFT 0
614−#define CS35L41_ASP_WIDTH_16 0x10
615−#define CS35L41_ASP_WIDTH_24 0x18
616−#define CS35L41_ASP_WIDTH_32 0x20
617−#define CS35L41_ASP_WIDTH_TX_MASK 0xFF0000
618−#define CS35L41_ASP_WIDTH_TX_SHIFT 16
619−#define CS35L41_ASP_WIDTH_RX_MASK 0xFF000000
620−#define CS35L41_ASP_WIDTH_RX_SHIFT 24
621−#define CS35L41_ASP_RX1_SLOT_MASK 0x3F
622−#define CS35L41_ASP_RX1_SLOT_SHIFT 0
623−#define CS35L41_ASP_RX2_SLOT_MASK 0x3F00
624−#define CS35L41_ASP_RX2_SLOT_SHIFT 8
625−#define CS35L41_ASP_RX_WL_MASK 0x3F
626−#define CS35L41_ASP_TX_WL_MASK 0x3F
627−#define CS35L41_ASP_RX_WL_SHIFT 0
628−#define CS35L41_ASP_TX_WL_SHIFT 0
629−#define CS35L41_ASP_SOURCE_MASK 0x7F
630−
631−#define CS35L41_INPUT_SRC_ASPRX1 0x08
632−#define CS35L41_INPUT_SRC_ASPRX2 0x09
633−#define CS35L41_INPUT_SRC_VMON 0x18
634−#define CS35L41_INPUT_SRC_IMON 0x19
635−#define CS35L41_INPUT_SRC_CLASSH 0x21
636−#define CS35L41_INPUT_SRC_VPMON 0x28
637−#define CS35L41_INPUT_SRC_VBSTMON 0x29
638−#define CS35L41_INPUT_SRC_TEMPMON 0x3A
639−#define CS35L41_INPUT_SRC_RSVD 0x3B
640−#define CS35L41_INPUT_DSP_TX1 0x32
641−#define CS35L41_INPUT_DSP_TX2 0x33
642−
643−#define CS35L41_PLL_CLK_SEL_MASK 0x07
644−#define CS35L41_PLL_CLK_SEL_SHIFT 0
645−#define CS35L41_PLL_CLK_EN_MASK 0x10
646−#define CS35L41_PLL_CLK_EN_SHIFT 4
647−#define CS35L41_PLL_OPENLOOP_MASK 0x0800
648−#define CS35L41_PLL_OPENLOOP_SHIFT 11
649−#define CS35L41_PLLSRC_SCLK 0
650−#define CS35L41_PLLSRC_LRCLK 1
651−#define CS35L41_PLLSRC_SELF 3
652−#define CS35L41_PLLSRC_PDMCLK 4
653−#define CS35L41_PLLSRC_MCLK 5
654−#define CS35L41_PLLSRC_SWIRE 7
655−#define CS35L41_REFCLK_FREQ_MASK 0x7E0
656−#define CS35L41_REFCLK_FREQ_SHIFT 5
657−
658−#define CS35L41_GLOBAL_FS_MASK 0x1F
659−#define CS35L41_GLOBAL_FS_SHIFT 0
660−
661−#define CS35L41_GLOBAL_EN_MASK 0x01
662−#define CS35L41_GLOBAL_EN_SHIFT 0
663−#define CS35L41_BST_EN_MASK 0x0030
664−#define CS35L41_BST_EN_SHIFT 4
665−#define CS35L41_BST_EN_DEFAULT 0x2
666−#define CS35L41_AMP_EN_SHIFT 0
667−#define CS35L41_AMP_EN_MASK 1
668−
669−#define CS35L41_PDN_DONE_MASK 0x00800000
670−#define CS35L41_PDN_DONE_SHIFT 23
671−#define CS35L41_PUP_DONE_MASK 0x01000000
672−#define CS35L41_PUP_DONE_SHIFT 24
673−
674−#define CS35L36_PUP_DONE_IRQ_UNMASK 0x5F
675−#define CS35L36_PUP_DONE_IRQ_MASK 0xBF
676−
677−#define CS35L41_AMP_SHORT_ERR 0x80000000
678−#define CS35L41_BST_SHORT_ERR 0x0100
679−#define CS35L41_TEMP_WARN 0x8000
680−#define CS35L41_TEMP_ERR 0x00020000
681−#define CS35L41_BST_OVP_ERR 0x40
682−#define CS35L41_BST_DCM_UVP_ERR 0x80
683−#define CS35L41_OTP_BOOT_DONE 0x02
684−#define CS35L41_PLL_UNLOCK 0x10
685−#define CS35L41_OTP_BOOT_ERR 0x80000000
686−
687−#define CS35L41_AMP_SHORT_ERR_RLS 0x02
688−#define CS35L41_BST_SHORT_ERR_RLS 0x04
689−#define CS35L41_BST_OVP_ERR_RLS 0x08
690−#define CS35L41_BST_UVP_ERR_RLS 0x10
691−#define CS35L41_TEMP_WARN_ERR_RLS 0x20
692−#define CS35L41_TEMP_ERR_RLS 0x40
693−
694−#define CS35L41_INT1_MASK_DEFAULT 0x7FFCFE3F
695−#define CS35L41_INT1_UNMASK_PUP 0xFEFFFFFF
696−#define CS35L41_INT1_UNMASK_PDN 0xFF7FFFFF
697−
698−#define CS35L41_GPIO_DIR_MASK 0x80000000
699−#define CS35L41_GPIO_DIR_SHIFT 31
700−#define CS35L41_GPIO1_CTRL_MASK 0x00030000
701−#define CS35L41_GPIO1_CTRL_SHIFT 16
702−#define CS35L41_GPIO2_CTRL_MASK 0x07000000
703−#define CS35L41_GPIO2_CTRL_SHIFT 24
704−#define CS35L41_GPIO_CTRL_OPEN_INT 2
705−#define CS35L41_GPIO_CTRL_ACTV_LO 4
706−#define CS35L41_GPIO_CTRL_ACTV_HI 5
707−#define CS35L41_GPIO_POL_MASK 0x1000
708−#define CS35L41_GPIO_POL_SHIFT 12
709−
710−#define CS35L41_AMP_INV_PCM_SHIFT 14
711−#define CS35L41_AMP_INV_PCM_MASK BIT(CS35L41_AMP_INV_PCM_SHIFT)
712−#define CS35L41_AMP_PCM_VOL_SHIFT 3
713−#define CS35L41_AMP_PCM_VOL_MASK (0x7FF << 3)
714−#define CS35L41_AMP_PCM_VOL_MUTE 0x4CF
715−
716−#define CS35L41_CHIP_ID 0x35a40
717−#define CS35L41R_CHIP_ID 0x35b40
718−#define CS35L41_MTLREVID_MASK 0x0F
719−#define CS35L41_REVID_A0 0xA0
720−#define CS35L41_REVID_B0 0xB0
721−#define CS35L41_REVID_B2 0xB2
722−
723−#define CS35L41_HALO_CORE_RESET 0x00000200
724−
725−#define CS35L41_FS1_WINDOW_MASK 0x000007FF
726−#define CS35L41_FS2_WINDOW_MASK 0x00FFF800
727−#define CS35L41_FS2_WINDOW_SHIFT 12
728−
729−#define CS35L41_SPI_MAX_FREQ 4000000
19+#include "wm_adsp.h"
73020
73121 #define CS35L41_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
73222 #define CS35L41_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
73323
734−bool cs35l41_readable_reg(struct device *dev, unsigned int reg);
735−bool cs35l41_precious_reg(struct device *dev, unsigned int reg);
736−bool cs35l41_volatile_reg(struct device *dev, unsigned int reg);
24+extern const struct dev_pm_ops cs35l41_pm_ops;
73725
738−struct cs35l41_otp_packed_element_t {
739− u32 reg;
740− u8 shift;
741− u8 size;
26+enum cs35l41_cspl_mbox_status {
27+ CSPL_MBOX_STS_RUNNING = 0,
28+ CSPL_MBOX_STS_PAUSED = 1,
29+ CSPL_MBOX_STS_RDY_FOR_REINIT = 2,
74230 };
74331
744−struct cs35l41_otp_map_element_t {
745− u32 id;
746− u32 num_elements;
747− const struct cs35l41_otp_packed_element_t *map;
748− u32 bit_offset;
749− u32 word_offset;
32+enum cs35l41_cspl_mbox_cmd {
33+ CSPL_MBOX_CMD_NONE = 0,
34+ CSPL_MBOX_CMD_PAUSE = 1,
35+ CSPL_MBOX_CMD_RESUME = 2,
36+ CSPL_MBOX_CMD_REINIT = 3,
37+ CSPL_MBOX_CMD_STOP_PRE_REINIT = 4,
38+ CSPL_MBOX_CMD_HIBERNATE = 5,
39+ CSPL_MBOX_CMD_OUT_OF_HIBERNATE = 6,
40+ CSPL_MBOX_CMD_UNKNOWN_CMD = -1,
41+ CSPL_MBOX_CMD_INVALID_SEQUENCE = -2,
75042 };
75143
752−extern const struct reg_default cs35l41_reg[CS35L41_MAX_CACHE_REG];
753−extern const struct cs35l41_otp_map_element_t
754− cs35l41_otp_map_map[CS35L41_NUM_OTP_MAPS];
755−
756−#define CS35L41_REGSTRIDE 4
757−
75844 struct cs35l41_private {
45+ struct wm_adsp dsp; /* needs to be first member */
75946 struct snd_soc_codec *codec;
76047 struct cs35l41_platform_data pdata;
76148 struct device *dev;
sound/soc/codecs/cs4265.c+13−2
@@ -611,8 +611,8 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, · 610 unmodified lines
611611 if (devid != CS4265_CHIP_ID_VAL) {
612612 ret = -ENODEV;
613613 dev_err(&i2c_client->dev,
614− "CS4265 Device ID (%X). Expected %X\n",
615− devid, CS4265_CHIP_ID);
614+ "CS4265 Part Number ID: 0x%x Expected: 0x%x\n",
615+ devid >> 4, CS4265_CHIP_ID_VAL >> 4);
616616 return ret;
617617 }
618618 dev_info(&i2c_client->dev,
@@ -626,6 +626,16 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, · 7 unmodified lines
626626 ARRAY_SIZE(cs4265_dai));
627627 }
628628
629+static int cs4265_i2c_remove(struct i2c_client *i2c)
630+{
631+ struct cs4265_private *cs4265 = i2c_get_clientdata(i2c);
632+
633+ if (cs4265->reset_gpio)
634+ gpiod_set_value_cansleep(cs4265->reset_gpio, 0);
635+
636+ return 0;
637+}
638+
629639 static const struct of_device_id cs4265_of_match[] = {
630640 { .compatible = "cirrus,cs4265", },
631641 { }
@@ -645,6 +655,7 @@ static struct i2c_driver cs4265_i2c_driver = { · 13 unmodified lines
645655 },
646656 .id_table = cs4265_id,
647657 .probe = cs4265_i2c_probe,
658+ .remove = cs4265_i2c_remove,
648659 };
649660
650661 module_i2c_driver(cs4265_i2c_driver);
sound/soc/codecs/cs42l42.c+58−36
@@ -42,6 +42,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { · 41 unmodified lines
4242 { CS42L42_SRC_CTL, 0x10 },
4343 { CS42L42_MCLK_CTL, 0x02 },
4444 { CS42L42_SFTRAMP_RATE, 0xA4 },
45+ { CS42L42_SLOW_START_ENABLE, 0x70 },
4546 { CS42L42_I2C_DEBOUNCE, 0x88 },
4647 { CS42L42_I2C_STRETCH, 0x03 },
4748 { CS42L42_I2C_TIMEOUT, 0xB7 },
@@ -177,6 +178,7 @@ static bool cs42l42_readable_register(struct device *dev, unsigned int reg) · 129 unmodified lines
177178 case CS42L42_MCLK_STATUS:
178179 case CS42L42_MCLK_CTL:
179180 case CS42L42_SFTRAMP_RATE:
181+ case CS42L42_SLOW_START_ENABLE:
180182 case CS42L42_I2C_DEBOUNCE:
181183 case CS42L42_I2C_STRETCH:
182184 case CS42L42_I2C_TIMEOUT:
@@ -387,6 +389,28 @@ static const struct regmap_config cs42l42_regmap = { · 204 unmodified lines
387389 static DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 100, true);
388390 static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true);
389391
392+static int cs42l42_slow_start_put(struct snd_kcontrol *kcontrol,
393+ struct snd_ctl_elem_value *ucontrol)
394+{
395+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
396+ u8 val;
397+
398+ /* all bits of SLOW_START_EN much change together */
399+ switch (ucontrol->value.integer.value[0]) {
400+ case 0:
401+ val = 0;
402+ break;
403+ case 1:
404+ val = CS42L42_SLOW_START_EN_MASK;
405+ break;
406+ default:
407+ return -EINVAL;
408+ }
409+
410+ return snd_soc_component_update_bits(component, CS42L42_SLOW_START_ENABLE,
411+ CS42L42_SLOW_START_EN_MASK, val);
412+}
413+
390414 static const char * const cs42l42_hpf_freq_text[] = {
391415 "1.86Hz", "120Hz", "235Hz", "466Hz"
392416 };
@@ -431,7 +455,11 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = { · 38 unmodified lines
431455 CS42L42_DAC_HPF_EN_SHIFT, true, false),
432456 SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL,
433457 CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT,
434− 0x3f, 1, mixer_tlv)
458+ 0x3f, 1, mixer_tlv),
459+
460+ SOC_SINGLE_EXT("Slow Start Switch", CS42L42_SLOW_START_ENABLE,
461+ CS42L42_SLOW_START_EN_SHIFT, true, false,
462+ snd_soc_get_volsw, cs42l42_slow_start_put),
435463 };
436464
437465 static int cs42l42_hp_adc_ev(struct snd_soc_dapm_widget *w,
@@ -521,8 +549,25 @@ static int cs42l42_set_jack(struct snd_soc_component *component, struct snd_soc_ · 83 unmodified lines
521549 {
522550 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
523551
552+ /* Prevent race with interrupt handler */
553+ mutex_lock(&cs42l42->jack_detect_mutex);
524554 cs42l42->jack = jk;
525555
556+ if (jk) {
557+ switch (cs42l42->hs_type) {
558+ case CS42L42_PLUG_CTIA:
559+ case CS42L42_PLUG_OMTP:
560+ snd_soc_jack_report(jk, SND_JACK_HEADSET, SND_JACK_HEADSET);
561+ break;
562+ case CS42L42_PLUG_HEADPHONE:
563+ snd_soc_jack_report(jk, SND_JACK_HEADPHONE, SND_JACK_HEADPHONE);
564+ break;
565+ default:
566+ break;
567+ }
568+ }
569+ mutex_unlock(&cs42l42->jack_detect_mutex);
570+
526571 return 0;
527572 }
528573
@@ -706,10 +751,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) · 177 unmodified lines
706751 CS42L42_PLL_DIVOUT_MASK,
707752 (pll_ratio_table[i].pll_divout * pll_ratio_table[i].n)
708753 << CS42L42_PLL_DIVOUT_SHIFT);
709− if (pll_ratio_table[i].n != 1)
710− cs42l42->pll_divout = pll_ratio_table[i].pll_divout;
711− else
712− cs42l42->pll_divout = 0;
713754 snd_soc_component_update_bits(component,
714755 CS42L42_PLL_CAL_RATIO,
715756 CS42L42_PLL_CAL_RATIO_MASK,
@@ -976,12 +1017,13 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream) · 260 unmodified lines
9761017 snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
9771018 CS42L42_PLL_START_MASK, 1);
9781019
979− if (cs42l42->pll_divout) {
1020+ if (pll_ratio_table[cs42l42->pll_config].n > 1) {
9801021 usleep_range(CS42L42_PLL_DIVOUT_TIME_US,
9811022 CS42L42_PLL_DIVOUT_TIME_US * 2);
1023+ regval = pll_ratio_table[cs42l42->pll_config].pll_divout;
9821024 snd_soc_component_update_bits(component, CS42L42_PLL_CTL3,
9831025 CS42L42_PLL_DIVOUT_MASK,
984− cs42l42->pll_divout <<
1026+ regval <<
9851027 CS42L42_PLL_DIVOUT_SHIFT);
9861028 }
9871029
@@ -1242,10 +1284,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42) · 254 unmodified lines
12421284 /* Turn on level detect circuitry */
12431285 regmap_update_bits(cs42l42->regmap,
12441286 CS42L42_MISC_DET_CTL,
1245− CS42L42_DETECT_MODE_MASK |
12461287 CS42L42_HSBIAS_CTL_MASK |
12471288 CS42L42_PDN_MIC_LVL_DET_MASK,
1248− (0 << CS42L42_DETECT_MODE_SHIFT) |
12491289 (3 << CS42L42_HSBIAS_CTL_SHIFT) |
12501290 (0 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
12511291
@@ -1272,10 +1312,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42) · 20 unmodified lines
12721312 /* Make sure button detect and HS bias circuits are off */
12731313 regmap_update_bits(cs42l42->regmap,
12741314 CS42L42_MISC_DET_CTL,
1275− CS42L42_DETECT_MODE_MASK |
12761315 CS42L42_HSBIAS_CTL_MASK |
12771316 CS42L42_PDN_MIC_LVL_DET_MASK,
1278− (0 << CS42L42_DETECT_MODE_SHIFT) |
12791317 (1 << CS42L42_HSBIAS_CTL_SHIFT) |
12801318 (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
12811319 }
@@ -1296,12 +1334,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42) · 14 unmodified lines
12961334 /* Unmask tip sense interrupts */
12971335 regmap_update_bits(cs42l42->regmap,
12981336 CS42L42_TSRS_PLUG_INT_MASK,
1299− CS42L42_RS_PLUG_MASK |
1300− CS42L42_RS_UNPLUG_MASK |
13011337 CS42L42_TS_PLUG_MASK |
13021338 CS42L42_TS_UNPLUG_MASK,
1303− (1 << CS42L42_RS_PLUG_SHIFT) |
1304− (1 << CS42L42_RS_UNPLUG_SHIFT) |
13051339 (0 << CS42L42_TS_PLUG_SHIFT) |
13061340 (0 << CS42L42_TS_UNPLUG_SHIFT));
13071341 }
@@ -1311,22 +1345,16 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42) · 3 unmodified lines
13111345 /* Mask tip sense interrupts */
13121346 regmap_update_bits(cs42l42->regmap,
13131347 CS42L42_TSRS_PLUG_INT_MASK,
1314− CS42L42_RS_PLUG_MASK |
1315− CS42L42_RS_UNPLUG_MASK |
13161348 CS42L42_TS_PLUG_MASK |
13171349 CS42L42_TS_UNPLUG_MASK,
1318− (1 << CS42L42_RS_PLUG_SHIFT) |
1319− (1 << CS42L42_RS_UNPLUG_SHIFT) |
13201350 (1 << CS42L42_TS_PLUG_SHIFT) |
13211351 (1 << CS42L42_TS_UNPLUG_SHIFT));
13221352
13231353 /* Make sure button detect and HS bias circuits are off */
13241354 regmap_update_bits(cs42l42->regmap,
13251355 CS42L42_MISC_DET_CTL,
1326− CS42L42_DETECT_MODE_MASK |
13271356 CS42L42_HSBIAS_CTL_MASK |
13281357 CS42L42_PDN_MIC_LVL_DET_MASK,
1329− (0 << CS42L42_DETECT_MODE_SHIFT) |
13301358 (1 << CS42L42_HSBIAS_CTL_SHIFT) |
13311359 (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
13321360
@@ -1370,10 +1398,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42) · 37 unmodified lines
13701398 /* Power up HS bias to 2.7V */
13711399 regmap_update_bits(cs42l42->regmap,
13721400 CS42L42_MISC_DET_CTL,
1373− CS42L42_DETECT_MODE_MASK |
13741401 CS42L42_HSBIAS_CTL_MASK |
13751402 CS42L42_PDN_MIC_LVL_DET_MASK,
1376− (0 << CS42L42_DETECT_MODE_SHIFT) |
13771403 (3 << CS42L42_HSBIAS_CTL_SHIFT) |
13781404 (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
13791405
@@ -1420,10 +1446,8 @@ static void cs42l42_cancel_hs_type_detect(struct cs42l42_private *cs42l42) · 40 unmodified lines
14201446 /* Ground HS bias */
14211447 regmap_update_bits(cs42l42->regmap,
14221448 CS42L42_MISC_DET_CTL,
1423− CS42L42_DETECT_MODE_MASK |
14241449 CS42L42_HSBIAS_CTL_MASK |
14251450 CS42L42_PDN_MIC_LVL_DET_MASK,
1426− (0 << CS42L42_DETECT_MODE_SHIFT) |
14271451 (1 << CS42L42_HSBIAS_CTL_SHIFT) |
14281452 (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
14291453
@@ -1611,6 +1635,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data) · 181 unmodified lines
16111635 CS42L42_M_DETECT_FT_MASK |
16121636 CS42L42_M_HSBIAS_HIZ_MASK);
16131637
1638+ mutex_lock(&cs42l42->jack_detect_mutex);
1639+
16141640 /* Check auto-detect status */
16151641 if ((~masks[5]) & irq_params_table[5].mask) {
16161642 if (stickies[5] & CS42L42_HSDET_AUTO_DONE_MASK) {
@@ -1647,18 +1673,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data) · 30 unmodified lines
16471673 cs42l42->plug_state = CS42L42_TS_UNPLUG;
16481674 cs42l42_cancel_hs_type_detect(cs42l42);
16491675
1650− switch (cs42l42->hs_type) {
1651− case CS42L42_PLUG_CTIA:
1652− case CS42L42_PLUG_OMTP:
1653− snd_soc_jack_report(cs42l42->jack, 0, SND_JACK_HEADSET);
1654− break;
1655− case CS42L42_PLUG_HEADPHONE:
1656− snd_soc_jack_report(cs42l42->jack, 0, SND_JACK_HEADPHONE);
1657− break;
1658− default:
1659− break;
1660− }
16611676 snd_soc_jack_report(cs42l42->jack, 0,
1677+ SND_JACK_HEADSET |
16621678 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
16631679 SND_JACK_BTN_2 | SND_JACK_BTN_3);
16641680
@@ -1689,6 +1705,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data) · 24 unmodified lines
16891705 }
16901706 }
16911707
1708+ mutex_unlock(&cs42l42->jack_detect_mutex);
1709+
16921710 return IRQ_HANDLED;
16931711 }
16941712
@@ -1801,6 +1819,9 @@ static void cs42l42_setup_hs_type_detect(struct cs42l42_private *cs42l42) · 106 unmodified lines
18011819
18021820 cs42l42->hs_type = CS42L42_PLUG_INVALID;
18031821
1822+ regmap_update_bits(cs42l42->regmap, CS42L42_MISC_DET_CTL,
1823+ CS42L42_DETECT_MODE_MASK, 0);
1824+
18041825 /* Latch analog controls to VP power domain */
18051826 regmap_update_bits(cs42l42->regmap, CS42L42_MIC_DET_CTL1,
18061827 CS42L42_LATCH_TO_VP_MASK |
@@ -2033,6 +2054,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, · 226 unmodified lines
20332054
20342055 cs42l42->dev = &i2c_client->dev;
20352056 i2c_set_clientdata(i2c_client, cs42l42);
2057+ mutex_init(&cs42l42->jack_detect_mutex);
20362058
20372059 cs42l42->regmap = devm_regmap_init_i2c(i2c_client, &cs42l42_regmap);
20382060 if (IS_ERR(cs42l42->regmap)) {
sound/soc/codecs/cs42l42.h+5−1
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #ifndef __CS42L42_H__
1313 #define __CS42L42_H__
1414
15+#include <linux/mutex.h>
1516 #include <sound/jack.h>
1617
1718 #define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */
@@ -62,6 +63,9 @@ · 44 unmodified lines
6263 #define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT)
6364
6465 #define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A)
66+#define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B)
67+#define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4)
68+#define CS42L42_SLOW_START_EN_SHIFT 4
6569 #define CS42L42_I2C_DEBOUNCE (CS42L42_PAGE_10 + 0x0E)
6670 #define CS42L42_I2C_STRETCH (CS42L42_PAGE_10 + 0x0F)
6771 #define CS42L42_I2C_TIMEOUT (CS42L42_PAGE_10 + 0x10)
@@ -838,11 +842,11 @@ struct cs42l42_private { · 770 unmodified lines
838842 struct gpio_desc *reset_gpio;
839843 struct completion pdn_done;
840844 struct snd_soc_jack *jack;
845+ struct mutex jack_detect_mutex;
841846 int pll_config;
842847 int bclk;
843848 u32 sclk;
844849 u32 srate;
845− u8 pll_divout;
846850 u8 plug_state;
847851 u8 hs_type;
848852 u8 ts_inv;
sound/soc/codecs/es7241.c+9−19
@@ -255,7 +255,6 @@ static int es7241_probe(struct platform_device *pdev) · 254 unmodified lines
255255 {
256256 struct device *dev = &pdev->dev;
257257 struct es7241_data *priv;
258− int err;
259258
260259 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
261260 if (!priv)
@@ -271,28 +270,19 @@ static int es7241_probe(struct platform_device *pdev) · 9 unmodified lines
271270 es7241_parse_fmt(dev, priv);
272271
273272 priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
274− if (IS_ERR(priv->reset)) {
275− err = PTR_ERR(priv->reset);
276− if (err != -EPROBE_DEFER)
277− dev_err(dev, "Failed to get 'reset' gpio: %d", err);
278− return err;
279− }
273+ if (IS_ERR(priv->reset))
274+ return dev_err_probe(dev, PTR_ERR(priv->reset),
275+ "Failed to get 'reset' gpio");
280276
281277 priv->m0 = devm_gpiod_get_optional(dev, "m0", GPIOD_OUT_LOW);
282− if (IS_ERR(priv->m0)) {
283− err = PTR_ERR(priv->m0);
284− if (err != -EPROBE_DEFER)
285− dev_err(dev, "Failed to get 'm0' gpio: %d", err);
286− return err;
287− }
278+ if (IS_ERR(priv->m0))
279+ return dev_err_probe(dev, PTR_ERR(priv->m0),
280+ "Failed to get 'm0' gpio");
288281
289282 priv->m1 = devm_gpiod_get_optional(dev, "m1", GPIOD_OUT_LOW);
290− if (IS_ERR(priv->m1)) {
291− err = PTR_ERR(priv->m1);
292− if (err != -EPROBE_DEFER)
293− dev_err(dev, "Failed to get 'm1' gpio: %d", err);
294− return err;
295− }
283+ if (IS_ERR(priv->m1))
284+ return dev_err_probe(dev, PTR_ERR(priv->m1),
285+ "Failed to get 'm1' gpio");
296286
297287 return devm_snd_soc_register_component(&pdev->dev,
298288 &es7241_component_driver,
sound/soc/codecs/hdac_hda.c+11−11
@@ -46,9 +46,8 @@ static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, · 45 unmodified lines
4646 struct snd_soc_dai *dai);
4747 static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
4848 struct snd_soc_dai *dai);
49−static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai,
50− unsigned int tx_mask, unsigned int rx_mask,
51− int slots, int slot_width);
49+static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai, void *stream,
50+ int direction);
5251 static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt,
5352 struct snd_soc_dai *dai);
5453
@@ -58,7 +57,7 @@ static const struct snd_soc_dai_ops hdac_hda_dai_ops = { · 3 unmodified lines
5857 .prepare = hdac_hda_dai_prepare,
5958 .hw_params = hdac_hda_dai_hw_params,
6059 .hw_free = hdac_hda_dai_hw_free,
61− .set_tdm_slot = hdac_hda_dai_set_tdm_slot,
60+ .set_stream = hdac_hda_dai_set_stream,
6261 };
6362
6463 static struct snd_soc_dai_driver hdac_hda_dais[] = {
@@ -180,21 +179,22 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = { · 115 unmodified lines
180179
181180 };
182181
183−static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai,
184− unsigned int tx_mask, unsigned int rx_mask,
185− int slots, int slot_width)
182+static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai,
183+ void *stream, int direction)
186184 {
187185 struct snd_soc_component *component = dai->component;
188186 struct hdac_hda_priv *hda_pvt;
189187 struct hdac_hda_pcm *pcm;
188+ struct hdac_stream *hstream;
189+
190+ if (!stream)
191+ return -EINVAL;
190192
191193 hda_pvt = snd_soc_component_get_drvdata(component);
192194 pcm = &hda_pvt->pcm[dai->id];
195+ hstream = (struct hdac_stream *)stream;
193196
194− if (tx_mask)
195− pcm->stream_tag[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask;
196− else
197− pcm->stream_tag[SNDRV_PCM_STREAM_CAPTURE] = rx_mask;
197+ pcm->stream_tag[direction] = hstream->stream_tag;
198198
199199 return 0;
200200 }
sound/soc/codecs/jz4770.c+9−0
@@ -307,6 +307,7 @@ static const DECLARE_TLV_DB_MINMAX_MUTE(dac_tlv, -3100, 0); · 306 unmodified lines
307307 static const DECLARE_TLV_DB_SCALE(adc_tlv, 0, 100, 0);
308308 static const DECLARE_TLV_DB_MINMAX(out_tlv, -2500, 600);
309309 static const DECLARE_TLV_DB_SCALE(linein_tlv, -2500, 100, 0);
310+static const DECLARE_TLV_DB_MINMAX(mixer_tlv, -3100, 0);
310311
311312 /* Unconditional controls. */
312313 static const struct snd_kcontrol_new jz4770_codec_snd_controls[] = {
@@ -319,6 +320,14 @@ static const struct snd_kcontrol_new jz4770_codec_snd_controls[] = { · 6 unmodified lines
319320 SOC_DOUBLE_R_TLV("Line In Bypass Playback Volume",
320321 JZ4770_CODEC_REG_GCR_LIBYL, JZ4770_CODEC_REG_GCR_LIBYR,
321322 REG_GCR_GAIN_OFFSET, REG_GCR_GAIN_MAX, 1, linein_tlv),
323+
324+ SOC_SINGLE_TLV("Mixer Capture Volume",
325+ JZ4770_CODEC_REG_GCR_MIXADC,
326+ REG_GCR_GAIN_OFFSET, REG_GCR_GAIN_MAX, 1, mixer_tlv),
327+
328+ SOC_SINGLE_TLV("Mixer Playback Volume",
329+ JZ4770_CODEC_REG_GCR_MIXDAC,
330+ REG_GCR_GAIN_OFFSET, REG_GCR_GAIN_MAX, 1, mixer_tlv),
322331 };
323332
324333 static const struct snd_kcontrol_new jz4770_codec_pcm_playback_controls[] = {
sound/soc/codecs/max9759.c+9−19
@@ -140,7 +140,6 @@ static int max9759_probe(struct platform_device *pdev) · 139 unmodified lines
140140 {
141141 struct device *dev = &pdev->dev;
142142 struct max9759 *priv;
143− int err;
144143
145144 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
146145 if (!priv)
@@ -149,29 +148,20 @@ static int max9759_probe(struct platform_device *pdev) · 2 unmodified lines
149148 platform_set_drvdata(pdev, priv);
150149
151150 priv->gpiod_shutdown = devm_gpiod_get(dev, "shutdown", GPIOD_OUT_HIGH);
152− if (IS_ERR(priv->gpiod_shutdown)) {
153− err = PTR_ERR(priv->gpiod_shutdown);
154− if (err != -EPROBE_DEFER)
155− dev_err(dev, "Failed to get 'shutdown' gpio: %d", err);
156− return err;
157− }
151+ if (IS_ERR(priv->gpiod_shutdown))
152+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_shutdown),
153+ "Failed to get 'shutdown' gpio");
158154
159155 priv->gpiod_mute = devm_gpiod_get(dev, "mute", GPIOD_OUT_HIGH);
160− if (IS_ERR(priv->gpiod_mute)) {
161− err = PTR_ERR(priv->gpiod_mute);
162− if (err != -EPROBE_DEFER)
163− dev_err(dev, "Failed to get 'mute' gpio: %d", err);
164− return err;
165− }
156+ if (IS_ERR(priv->gpiod_mute))
157+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_mute),
158+ "Failed to get 'mute' gpio");
166159 priv->is_mute = true;
167160
168161 priv->gpiod_gain = devm_gpiod_get_array(dev, "gain", GPIOD_OUT_HIGH);
169− if (IS_ERR(priv->gpiod_gain)) {
170− err = PTR_ERR(priv->gpiod_gain);
171− if (err != -EPROBE_DEFER)
172− dev_err(dev, "Failed to get 'gain' gpios: %d", err);
173− return err;
174− }
162+ if (IS_ERR(priv->gpiod_gain))
163+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_gain),
164+ "Failed to get 'gain' gpios");
175165 priv->gain = 0;
176166
177167 if (priv->gpiod_gain->ndescs != 2) {
sound/soc/codecs/max98373-sdw.c+1−1
@@ -741,7 +741,7 @@ static int max98373_sdw_set_tdm_slot(struct snd_soc_dai *dai, · 740 unmodified lines
741741 static const struct snd_soc_dai_ops max98373_dai_sdw_ops = {
742742 .hw_params = max98373_sdw_dai_hw_params,
743743 .hw_free = max98373_pcm_hw_free,
744− .set_sdw_stream = max98373_set_sdw_stream,
744+ .set_stream = max98373_set_sdw_stream,
745745 .shutdown = max98373_shutdown,
746746 .set_tdm_slot = max98373_sdw_set_tdm_slot,
747747 };
sound/soc/codecs/max9860.c+4−8
@@ -606,12 +606,9 @@ static int max9860_probe(struct i2c_client *i2c) · 605 unmodified lines
606606 return -ENOMEM;
607607
608608 max9860->dvddio = devm_regulator_get(dev, "DVDDIO");
609− if (IS_ERR(max9860->dvddio)) {
610− ret = PTR_ERR(max9860->dvddio);
611− if (ret != -EPROBE_DEFER)
612− dev_err(dev, "Failed to get DVDDIO supply: %d\n", ret);
613− return ret;
614− }
609+ if (IS_ERR(max9860->dvddio))
610+ return dev_err_probe(dev, PTR_ERR(max9860->dvddio),
611+ "Failed to get DVDDIO supply\n");
615612
616613 max9860->dvddio_nb.notifier_call = max9860_dvddio_event;
617614
@@ -643,8 +640,7 @@ static int max9860_probe(struct i2c_client *i2c) · 25 unmodified lines
643640
644641 if (IS_ERR(mclk)) {
645642 ret = PTR_ERR(mclk);
646− if (ret != -EPROBE_DEFER)
647− dev_err(dev, "Failed to get MCLK: %d\n", ret);
643+ dev_err_probe(dev, ret, "Failed to get MCLK\n");
648644 goto err_regulator;
649645 }
650646
sound/soc/codecs/msm8916-wcd-analog.c+4−3
@@ -822,8 +822,8 @@ static const struct snd_soc_dapm_route pm8916_wcd_analog_audio_map[] = { · 821 unmodified lines
822822 {"EAR PA", NULL, "EAR CP"},
823823
824824 /* Headset (RX MIX1 and RX MIX2) */
825− {"HEADPHONE", NULL, "HPHL PA"},
826− {"HEADPHONE", NULL, "HPHR PA"},
825+ {"HPH_L", NULL, "HPHL PA"},
826+ {"HPH_R", NULL, "HPHR PA"},
827827
828828 {"HPHL DAC", NULL, "EAR_HPHL_CLK"},
829829 {"HPHR DAC", NULL, "EAR_HPHR_CLK"},
@@ -870,7 +870,8 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { · 40 unmodified lines
870870 SND_SOC_DAPM_INPUT("AMIC3"),
871871 SND_SOC_DAPM_INPUT("AMIC2"),
872872 SND_SOC_DAPM_OUTPUT("EAR"),
873− SND_SOC_DAPM_OUTPUT("HEADPHONE"),
873+ SND_SOC_DAPM_OUTPUT("HPH_L"),
874+ SND_SOC_DAPM_OUTPUT("HPH_R"),
874875
875876 /* RX stuff */
876877 SND_SOC_DAPM_SUPPLY("INT_LDO_H", SND_SOC_NOPM, 1, 0, NULL, 0),
sound/soc/codecs/mt6660.c+2−3
@@ -47,13 +47,12 @@ static int mt6660_reg_write(void *context, unsigned int reg, unsigned int val) · 46 unmodified lines
4747 struct mt6660_chip *chip = context;
4848 int size = mt6660_get_reg_size(reg);
4949 u8 reg_data[4];
50− int i, ret;
50+ int i;
5151
5252 for (i = 0; i < size; i++)
5353 reg_data[size - i - 1] = (val >> (8 * i)) & 0xff;
5454
55− ret = i2c_smbus_write_i2c_block_data(chip->i2c, reg, size, reg_data);
56− return ret;
55+ return i2c_smbus_write_i2c_block_data(chip->i2c, reg, size, reg_data);
5756 }
5857
5958 static int mt6660_reg_read(void *context, unsigned int reg, unsigned int *val)
sound/soc/codecs/pcm3168a.c+7−15
@@ -751,21 +751,14 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) · 750 unmodified lines
751751 pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "reset",
752752 GPIOD_OUT_LOW |
753753 GPIOD_FLAGS_BIT_NONEXCLUSIVE);
754− if (IS_ERR(pcm3168a->gpio_rst)) {
755− ret = PTR_ERR(pcm3168a->gpio_rst);
756− if (ret != -EPROBE_DEFER )
757− dev_err(dev, "failed to acquire RST gpio: %d\n", ret);
758−
759− return ret;
760− }
754+ if (IS_ERR(pcm3168a->gpio_rst))
755+ return dev_err_probe(dev, PTR_ERR(pcm3168a->gpio_rst),
756+ "failed to acquire RST gpio\n");
761757
762758 pcm3168a->scki = devm_clk_get(dev, "scki");
763− if (IS_ERR(pcm3168a->scki)) {
764− ret = PTR_ERR(pcm3168a->scki);
765− if (ret != -EPROBE_DEFER)
766− dev_err(dev, "failed to acquire clock 'scki': %d\n", ret);
767− return ret;
768− }
759+ if (IS_ERR(pcm3168a->scki))
760+ return dev_err_probe(dev, PTR_ERR(pcm3168a->scki),
761+ "failed to acquire clock 'scki'\n");
769762
770763 ret = clk_prepare_enable(pcm3168a->scki);
771764 if (ret) {
@@ -781,8 +774,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) · 9 unmodified lines
781774 ret = devm_regulator_bulk_get(dev,
782775 ARRAY_SIZE(pcm3168a->supplies), pcm3168a->supplies);
783776 if (ret) {
784− if (ret != -EPROBE_DEFER)
785− dev_err(dev, "failed to request supplies: %d\n", ret);
777+ dev_err_probe(dev, ret, "failed to request supplies\n");
786778 goto err_clk;
787779 }
788780
sound/soc/codecs/rt1308-sdw.c+1−1
@@ -613,7 +613,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1308 = { · 612 unmodified lines
613613 static const struct snd_soc_dai_ops rt1308_aif_dai_ops = {
614614 .hw_params = rt1308_sdw_hw_params,
615615 .hw_free = rt1308_sdw_pcm_hw_free,
616− .set_sdw_stream = rt1308_set_sdw_stream,
616+ .set_stream = rt1308_set_sdw_stream,
617617 .shutdown = rt1308_sdw_shutdown,
618618 .set_tdm_slot = rt1308_sdw_set_tdm_slot,
619619 };
sound/soc/codecs/rt1316-sdw.c+1−1
@@ -602,7 +602,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1316 = { · 601 unmodified lines
602602 static const struct snd_soc_dai_ops rt1316_aif_dai_ops = {
603603 .hw_params = rt1316_sdw_hw_params,
604604 .hw_free = rt1316_sdw_pcm_hw_free,
605− .set_sdw_stream = rt1316_set_sdw_stream,
605+ .set_stream = rt1316_set_sdw_stream,
606606 .shutdown = rt1316_sdw_shutdown,
607607 };
608608
sound/soc/codecs/rt5640.c+152−17
@@ -195,6 +195,7 @@ static bool rt5640_volatile_register(struct device *dev, unsigned int reg) · 194 unmodified lines
195195 case RT5640_PRIV_DATA:
196196 case RT5640_PGM_REG_ARR1:
197197 case RT5640_PGM_REG_ARR3:
198+ case RT5640_DUMMY2:
198199 case RT5640_VENDOR_ID:
199200 case RT5640_VENDOR_ID1:
200201 case RT5640_VENDOR_ID2:
@@ -1972,7 +1973,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 1771 unmodified lines
19721973 RT5640_PWR_FV1 | RT5640_PWR_FV2,
19731974 RT5640_PWR_FV1 | RT5640_PWR_FV2);
19741975 snd_soc_component_update_bits(component, RT5640_DUMMY1,
1975− 0x0301, 0x0301);
1976+ 0x1, 0x1);
19761977 snd_soc_component_update_bits(component, RT5640_MICBIAS,
19771978 0x0030, 0x0030);
19781979 }
@@ -2159,7 +2160,11 @@ static bool rt5640_jack_inserted(struct snd_soc_component *component) · 180 unmodified lines
21592160 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
21602161 int val;
21612162
2162− val = snd_soc_component_read(component, RT5640_INT_IRQ_ST);
2163+ if (rt5640->jd_gpio)
2164+ val = gpiod_get_value(rt5640->jd_gpio) ? RT5640_JD_STATUS : 0;
2165+ else
2166+ val = snd_soc_component_read(component, RT5640_INT_IRQ_ST);
2167+
21632168 dev_dbg(component->dev, "irq status %#04x\n", val);
21642169
21652170 if (rt5640->jd_inverted)
@@ -2297,10 +2302,42 @@ EXPORT_SYMBOL_GPL(rt5640_detect_headset); · 131 unmodified lines
22972302 static void rt5640_jack_work(struct work_struct *work)
22982303 {
22992304 struct rt5640_priv *rt5640 =
2300− container_of(work, struct rt5640_priv, jack_work);
2305+ container_of(work, struct rt5640_priv, jack_work.work);
23012306 struct snd_soc_component *component = rt5640->component;
23022307 int status;
23032308
2309+ if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
2310+ int val, jack_type = 0, hda_mic_plugged, hda_hp_plugged;
2311+
2312+ /* mic jack */
2313+ val = snd_soc_component_read(component, RT5640_INT_IRQ_ST);
2314+ hda_mic_plugged = !(val & RT5640_JD_STATUS);
2315+ dev_dbg(component->dev, "mic jack status %d\n",
2316+ hda_mic_plugged);
2317+
2318+ snd_soc_component_update_bits(component, RT5640_IRQ_CTRL1,
2319+ RT5640_JD_P_MASK, !hda_mic_plugged << RT5640_JD_P_SFT);
2320+
2321+ if (hda_mic_plugged)
2322+ jack_type |= SND_JACK_MICROPHONE;
2323+
2324+ /* headphone jack */
2325+ val = snd_soc_component_read(component, RT5640_DUMMY2);
2326+ hda_hp_plugged = !(val & (0x1 << 11));
2327+ dev_dbg(component->dev, "headphone jack status %d\n",
2328+ hda_hp_plugged);
2329+
2330+ snd_soc_component_update_bits(component, RT5640_DUMMY2,
2331+ (0x1 << 10), !hda_hp_plugged << 10);
2332+
2333+ if (hda_hp_plugged)
2334+ jack_type |= SND_JACK_HEADPHONE;
2335+
2336+ snd_soc_jack_report(rt5640->jack, jack_type, SND_JACK_HEADSET);
2337+
2338+ return;
2339+ }
2340+
23042341 if (!rt5640_jack_inserted(component)) {
23052342 /* Jack removed, or spurious IRQ? */
23062343 if (rt5640->jack->status & SND_JACK_HEADPHONE) {
@@ -2348,7 +2385,7 @@ static void rt5640_jack_work(struct work_struct *work) · 41 unmodified lines
23482385 * disabled the OVCD IRQ, the IRQ pin will stay high and as
23492386 * we react to edges, we miss the unplug event -> recheck.
23502387 */
2351− queue_work(system_long_wq, &rt5640->jack_work);
2388+ queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
23522389 }
23532390 }
23542391
@@ -2357,7 +2394,17 @@ static irqreturn_t rt5640_irq(int irq, void *data) · 2 unmodified lines
23572394 struct rt5640_priv *rt5640 = data;
23582395
23592396 if (rt5640->jack)
2360− queue_work(system_long_wq, &rt5640->jack_work);
2397+ queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
2398+
2399+ return IRQ_HANDLED;
2400+}
2401+
2402+static irqreturn_t rt5640_jd_gpio_irq(int irq, void *data)
2403+{
2404+ struct rt5640_priv *rt5640 = data;
2405+
2406+ queue_delayed_work(system_long_wq, &rt5640->jack_work,
2407+ msecs_to_jiffies(JACK_SETTLE_TIME));
23612408
23622409 return IRQ_HANDLED;
23632410 }
@@ -2366,7 +2413,7 @@ static void rt5640_cancel_work(void *data) · 2 unmodified lines
23662413 {
23672414 struct rt5640_priv *rt5640 = data;
23682415
2369− cancel_work_sync(&rt5640->jack_work);
2416+ cancel_delayed_work_sync(&rt5640->jack_work);
23702417 cancel_delayed_work_sync(&rt5640->bp_work);
23712418 }
23722419
@@ -2406,7 +2453,12 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) · 33 unmodified lines
24062453 if (!rt5640->jack)
24072454 return;
24082455
2409− free_irq(rt5640->irq, rt5640);
2456+ if (rt5640->jd_gpio_irq_requested)
2457+ free_irq(rt5640->jd_gpio_irq, rt5640);
2458+
2459+ if (rt5640->irq_requested)
2460+ free_irq(rt5640->irq, rt5640);
2461+
24102462 rt5640_cancel_work(rt5640);
24112463
24122464 if (rt5640->jack->status & SND_JACK_MICROPHONE) {
@@ -2415,11 +2467,15 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) · 2 unmodified lines
24152467 snd_soc_jack_report(rt5640->jack, 0, SND_JACK_BTN_0);
24162468 }
24172469
2470+ rt5640->jd_gpio_irq_requested = false;
2471+ rt5640->irq_requested = false;
2472+ rt5640->jd_gpio = NULL;
24182473 rt5640->jack = NULL;
24192474 }
24202475
24212476 static void rt5640_enable_jack_detect(struct snd_soc_component *component,
2422− struct snd_soc_jack *jack)
2477+ struct snd_soc_jack *jack,
2478+ struct rt5640_set_jack_data *jack_data)
24232479 {
24242480 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
24252481 int ret;
@@ -2463,28 +2519,90 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component, · 37 unmodified lines
24632519 rt5640_enable_micbias1_ovcd_irq(component);
24642520 }
24652521
2522+ if (jack_data && jack_data->codec_irq_override)
2523+ rt5640->irq = jack_data->codec_irq_override;
2524+
2525+ if (jack_data && jack_data->jd_gpio) {
2526+ rt5640->jd_gpio = jack_data->jd_gpio;
2527+ rt5640->jd_gpio_irq = gpiod_to_irq(rt5640->jd_gpio);
2528+
2529+ ret = request_irq(rt5640->jd_gpio_irq, rt5640_jd_gpio_irq,
2530+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2531+ "rt5640-jd-gpio", rt5640);
2532+ if (ret) {
2533+ dev_warn(component->dev, "Failed to request jd GPIO IRQ %d: %d\n",
2534+ rt5640->jd_gpio_irq, ret);
2535+ rt5640_disable_jack_detect(component);
2536+ return;
2537+ }
2538+ rt5640->jd_gpio_irq_requested = true;
2539+ }
2540+
24662541 ret = request_irq(rt5640->irq, rt5640_irq,
24672542 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
24682543 "rt5640", rt5640);
24692544 if (ret) {
24702545 dev_warn(component->dev, "Failed to reguest IRQ %d: %d\n", rt5640->irq, ret);
2471− rt5640->irq = -ENXIO;
2472− /* Undo above settings */
24732546 rt5640_disable_jack_detect(component);
24742547 return;
24752548 }
2549+ rt5640->irq_requested = true;
2550+
2551+ /* sync initial jack state */
2552+ queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
2553+}
2554+
2555+static void rt5640_enable_hda_jack_detect(
2556+ struct snd_soc_component *component, struct snd_soc_jack *jack)
2557+{
2558+ struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
2559+ int ret;
2560+
2561+ /* Select JD1 for Mic */
2562+ snd_soc_component_update_bits(component, RT5640_JD_CTRL,
2563+ RT5640_JD_MASK, RT5640_JD_JD1_IN4P);
2564+ snd_soc_component_write(component, RT5640_IRQ_CTRL1, RT5640_IRQ_JD_NOR);
2565+
2566+ /* Select JD2 for Headphone */
2567+ snd_soc_component_update_bits(component, RT5640_DUMMY2, 0x1100, 0x1100);
2568+
2569+ /* Selecting GPIO01 as an interrupt */
2570+ snd_soc_component_update_bits(component, RT5640_GPIO_CTRL1,
2571+ RT5640_GP1_PIN_MASK, RT5640_GP1_PIN_IRQ);
2572+
2573+ /* Set GPIO1 output */
2574+ snd_soc_component_update_bits(component, RT5640_GPIO_CTRL3,
2575+ RT5640_GP1_PF_MASK, RT5640_GP1_PF_OUT);
2576+
2577+ snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0);
2578+
2579+ rt5640->jack = jack;
2580+
2581+ ret = request_irq(rt5640->irq, rt5640_irq,
2582+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, "rt5640", rt5640);
2583+ if (ret) {
2584+ dev_warn(component->dev, "Failed to reguest IRQ %d: %d\n", rt5640->irq, ret);
2585+ rt5640->irq = -ENXIO;
2586+ return;
2587+ }
24762588
24772589 /* sync initial jack state */
2478− queue_work(system_long_wq, &rt5640->jack_work);
2590+ queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
24792591 }
24802592
24812593 static int rt5640_set_jack(struct snd_soc_component *component,
24822594 struct snd_soc_jack *jack, void *data)
24832595 {
2484− if (jack)
2485− rt5640_enable_jack_detect(component, jack);
2486− else
2596+ struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
2597+
2598+ if (jack) {
2599+ if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
2600+ rt5640_enable_hda_jack_detect(component, jack);
2601+ else
2602+ rt5640_enable_jack_detect(component, jack, data);
2603+ } else {
24872604 rt5640_disable_jack_detect(component);
2605+ }
24882606
24892607 return 0;
24902608 }
@@ -2574,11 +2692,16 @@ static int rt5640_probe(struct snd_soc_component *component) · 83 unmodified lines
25742692
25752693 if (device_property_read_u32(component->dev,
25762694 "realtek,jack-detect-source", &val) == 0) {
2577− if (val <= RT5640_JD_SRC_GPIO4)
2695+ if (val <= RT5640_JD_SRC_GPIO4) {
25782696 rt5640->jd_src = val << RT5640_JD_SFT;
2579− else
2697+ } else if (val == RT5640_JD_SRC_HDA_HEADER) {
2698+ rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
2699+ snd_soc_component_update_bits(component, RT5640_DUMMY1,
2700+ 0x0300, 0x0);
2701+ } else {
25802702 dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
25812703 val);
2704+ }
25822705 }
25832706
25842707 if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted"))
@@ -2632,6 +2755,7 @@ static int rt5640_suspend(struct snd_soc_component *component) · 47 unmodified lines
26322755 {
26332756 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
26342757
2758+ rt5640_cancel_work(rt5640);
26352759 snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
26362760 rt5640_reset(component);
26372761 regcache_cache_only(rt5640->regmap, true);
@@ -2654,6 +2778,17 @@ static int rt5640_resume(struct snd_soc_component *component) · 16 unmodified lines
26542778 regcache_cache_only(rt5640->regmap, false);
26552779 regcache_sync(rt5640->regmap);
26562780
2781+ if (rt5640->jack) {
2782+ if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
2783+ snd_soc_component_update_bits(component,
2784+ RT5640_DUMMY2, 0x1100, 0x1100);
2785+ else
2786+ snd_soc_component_write(component, RT5640_DUMMY2,
2787+ 0x4001);
2788+
2789+ queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
2790+ }
2791+
26572792 return 0;
26582793 }
26592794 #else
@@ -2856,7 +2991,7 @@ static int rt5640_i2c_probe(struct i2c_client *i2c, · 196 unmodified lines
28562991 rt5640->hp_mute = true;
28572992 rt5640->irq = i2c->irq;
28582993 INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work);
2859− INIT_WORK(&rt5640->jack_work, rt5640_jack_work);
2994+ INIT_DELAYED_WORK(&rt5640->jack_work, rt5640_jack_work);
28602995
28612996 /* Make sure work is stopped on probe-error / remove */
28622997 ret = devm_add_action_or_reset(&i2c->dev, rt5640_cancel_work, rt5640);
sound/soc/codecs/rt5640.h+10−1
@@ -2124,6 +2124,7 @@ struct rt5640_priv { · 2123 unmodified lines
21242124
21252125 int ldo1_en; /* GPIO for LDO1_EN */
21262126 int irq;
2127+ int jd_gpio_irq;
21272128 int sysclk;
21282129 int sysclk_src;
21292130 int lrck[RT5640_AIFS];
@@ -2136,6 +2137,8 @@ struct rt5640_priv { · 6 unmodified lines
21362137
21372138 bool hp_mute;
21382139 bool asrc_en;
2140+ bool irq_requested;
2141+ bool jd_gpio_irq_requested;
21392142
21402143 /* Jack and button detect data */
21412144 bool ovcd_irq_enabled;
@@ -2145,14 +2148,20 @@ struct rt5640_priv { · 3 unmodified lines
21452148 int release_count;
21462149 int poll_count;
21472150 struct delayed_work bp_work;
2148− struct work_struct jack_work;
2151+ struct delayed_work jack_work;
21492152 struct snd_soc_jack *jack;
2153+ struct gpio_desc *jd_gpio;
21502154 unsigned int jd_src;
21512155 bool jd_inverted;
21522156 unsigned int ovcd_th;
21532157 unsigned int ovcd_sf;
21542158 };
21552159
2160+struct rt5640_set_jack_data {
2161+ int codec_irq_override;
2162+ struct gpio_desc *jd_gpio;
2163+};
2164+
21562165 int rt5640_dmic_enable(struct snd_soc_component *component,
21572166 bool dmic1_data_pin, bool dmic2_data_pin);
21582167 int rt5640_sel_asrc_clk_src(struct snd_soc_component *component,
sound/soc/codecs/rt5663.c+9−3
@@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663) · 3460 unmodified lines
34613461 static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev)
34623462 {
34633463 int table_size;
3464+ int ret;
34643465
34653466 device_property_read_u32(dev, "realtek,dc_offset_l_manual",
34663467 &rt5663->pdata.dc_offset_l_manual);
@@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) · 10 unmodified lines
34773478 table_size = sizeof(struct impedance_mapping_table) *
34783479 rt5663->pdata.impedance_sensing_num;
34793480 rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL);
3480− device_property_read_u32_array(dev,
3481+ ret = device_property_read_u32_array(dev,
34813482 "realtek,impedance_sensing_table",
34823483 (u32 *)rt5663->imp_table, table_size);
3484+ if (ret)
3485+ return ret;
34833486 }
34843487
34853488 return 0;
@@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, · 18 unmodified lines
35043507
35053508 if (pdata)
35063509 rt5663->pdata = *pdata;
3507− else
3508− rt5663_parse_dp(rt5663, &i2c->dev);
3510+ else {
3511+ ret = rt5663_parse_dp(rt5663, &i2c->dev);
3512+ if (ret)
3513+ return ret;
3514+ }
35093515
35103516 for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++)
35113517 rt5663->supplies[i].supply = rt5663_supply_names[i];
sound/soc/codecs/rt5682-sdw.c+1−1
@@ -272,7 +272,7 @@ static int rt5682_sdw_hw_free(struct snd_pcm_substream *substream, · 271 unmodified lines
272272 static const struct snd_soc_dai_ops rt5682_sdw_ops = {
273273 .hw_params = rt5682_sdw_hw_params,
274274 .hw_free = rt5682_sdw_hw_free,
275− .set_sdw_stream = rt5682_set_sdw_stream,
275+ .set_stream = rt5682_set_sdw_stream,
276276 .shutdown = rt5682_sdw_shutdown,
277277 };
278278
sound/soc/codecs/rt5682.c+2−5
@@ -2862,7 +2862,6 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 2861 unmodified lines
28622862
28632863 for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) {
28642864 struct clk_init_data init = { };
2865− struct clk_parent_data parent_data;
28662865 const struct clk_hw *parent;
28672866
28682867 dai_clk_hw = &rt5682->dai_clks_hw[i];
@@ -2871,10 +2870,8 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 2 unmodified lines
28712870 case RT5682_DAI_WCLK_IDX:
28722871 /* Make MCLK the parent of WCLK */
28732872 if (rt5682->mclk) {
2874− parent_data = (struct clk_parent_data){
2875− .fw_name = "mclk",
2876− };
2877− init.parent_data = &parent_data;
2873+ parent = __clk_get_hw(rt5682->mclk);
2874+ init.parent_hws = &parent;
28782875 init.num_parents = 1;
28792876 }
28802877 break;
sound/soc/codecs/rt5682s.c+31−3
@@ -1367,6 +1367,31 @@ static int rt5682s_hp_amp_event(struct snd_soc_dapm_widget *w, · 1366 unmodified lines
13671367 return 0;
13681368 }
13691369
1370+static int rt5682s_stereo1_adc_mixl_event(struct snd_soc_dapm_widget *w,
1371+ struct snd_kcontrol *kcontrol, int event)
1372+{
1373+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1374+ struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1375+ unsigned int delay = 0;
1376+
1377+ if (rt5682s->pdata.amic_delay)
1378+ delay = rt5682s->pdata.amic_delay;
1379+
1380+ switch (event) {
1381+ case SND_SOC_DAPM_POST_PMU:
1382+ msleep(delay);
1383+ snd_soc_component_update_bits(component, RT5682S_STO1_ADC_DIG_VOL,
1384+ RT5682S_L_MUTE, 0);
1385+ break;
1386+ case SND_SOC_DAPM_PRE_PMD:
1387+ snd_soc_component_update_bits(component, RT5682S_STO1_ADC_DIG_VOL,
1388+ RT5682S_L_MUTE, RT5682S_L_MUTE);
1389+ break;
1390+ }
1391+
1392+ return 0;
1393+}
1394+
13701395 static int sar_power_event(struct snd_soc_dapm_widget *w,
13711396 struct snd_kcontrol *kcontrol, int event)
13721397 {
@@ -1680,9 +1705,10 @@ static const struct snd_soc_dapm_widget rt5682s_dapm_widgets[] = { · 307 unmodified lines
16801705 /* ADC Mixer */
16811706 SND_SOC_DAPM_SUPPLY("ADC Stereo1 Filter", RT5682S_PWR_DIG_2,
16821707 RT5682S_PWR_ADC_S1F_BIT, 0, set_filter_clk, SND_SOC_DAPM_PRE_PMU),
1683− SND_SOC_DAPM_MIXER("Stereo1 ADC MIXL", RT5682S_STO1_ADC_DIG_VOL,
1684− RT5682S_L_MUTE_SFT, 1, rt5682s_sto1_adc_l_mix,
1685− ARRAY_SIZE(rt5682s_sto1_adc_l_mix)),
1708+ SND_SOC_DAPM_MIXER_E("Stereo1 ADC MIXL", SND_SOC_NOPM, 0, 0,
1709+ rt5682s_sto1_adc_l_mix, ARRAY_SIZE(rt5682s_sto1_adc_l_mix),
1710+ rt5682s_stereo1_adc_mixl_event,
1711+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
16861712 SND_SOC_DAPM_MIXER("Stereo1 ADC MIXR", RT5682S_STO1_ADC_DIG_VOL,
16871713 RT5682S_R_MUTE_SFT, 1, rt5682s_sto1_adc_r_mix,
16881714 ARRAY_SIZE(rt5682s_sto1_adc_r_mix)),
@@ -2885,6 +2911,8 @@ static int rt5682s_parse_dt(struct rt5682s_priv *rt5682s, struct device *dev) · 1196 unmodified lines
28852911 &rt5682s->pdata.dmic_clk_rate);
28862912 device_property_read_u32(dev, "realtek,dmic-delay-ms",
28872913 &rt5682s->pdata.dmic_delay);
2914+ device_property_read_u32(dev, "realtek,amic-delay-ms",
2915+ &rt5682s->pdata.amic_delay);
28882916
28892917 rt5682s->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
28902918 "realtek,ldo1-en-gpios", 0);
sound/soc/codecs/rt700.c+1−1
@@ -1005,7 +1005,7 @@ static int rt700_pcm_hw_free(struct snd_pcm_substream *substream, · 1004 unmodified lines
10051005 static const struct snd_soc_dai_ops rt700_ops = {
10061006 .hw_params = rt700_pcm_hw_params,
10071007 .hw_free = rt700_pcm_hw_free,
1008− .set_sdw_stream = rt700_set_sdw_stream,
1008+ .set_stream = rt700_set_sdw_stream,
10091009 .shutdown = rt700_shutdown,
10101010 };
10111011
sound/soc/codecs/rt711-sdca.c+1−1
@@ -1358,7 +1358,7 @@ static int rt711_sdca_pcm_hw_free(struct snd_pcm_substream *substream, · 1357 unmodified lines
13581358 static const struct snd_soc_dai_ops rt711_sdca_ops = {
13591359 .hw_params = rt711_sdca_pcm_hw_params,
13601360 .hw_free = rt711_sdca_pcm_hw_free,
1361− .set_sdw_stream = rt711_sdca_set_sdw_stream,
1361+ .set_stream = rt711_sdca_set_sdw_stream,
13621362 .shutdown = rt711_sdca_shutdown,
13631363 };
13641364
sound/soc/codecs/rt711.c+1−1
@@ -1089,7 +1089,7 @@ static int rt711_pcm_hw_free(struct snd_pcm_substream *substream, · 1088 unmodified lines
10891089 static const struct snd_soc_dai_ops rt711_ops = {
10901090 .hw_params = rt711_pcm_hw_params,
10911091 .hw_free = rt711_pcm_hw_free,
1092− .set_sdw_stream = rt711_set_sdw_stream,
1092+ .set_stream = rt711_set_sdw_stream,
10931093 .shutdown = rt711_shutdown,
10941094 };
10951095
sound/soc/codecs/rt715-sdca.c+1−1
@@ -938,7 +938,7 @@ static int rt715_sdca_pcm_hw_free(struct snd_pcm_substream *substream, · 937 unmodified lines
938938 static const struct snd_soc_dai_ops rt715_sdca_ops = {
939939 .hw_params = rt715_sdca_pcm_hw_params,
940940 .hw_free = rt715_sdca_pcm_hw_free,
941− .set_sdw_stream = rt715_sdca_set_sdw_stream,
941+ .set_stream = rt715_sdca_set_sdw_stream,
942942 .shutdown = rt715_sdca_shutdown,
943943 };
944944
sound/soc/codecs/rt715.c+1−1
@@ -909,7 +909,7 @@ static int rt715_pcm_hw_free(struct snd_pcm_substream *substream, · 908 unmodified lines
909909 static const struct snd_soc_dai_ops rt715_ops = {
910910 .hw_params = rt715_pcm_hw_params,
911911 .hw_free = rt715_pcm_hw_free,
912− .set_sdw_stream = rt715_set_sdw_stream,
912+ .set_stream = rt715_set_sdw_stream,
913913 .shutdown = rt715_shutdown,
914914 };
915915
sound/soc/codecs/sdw-mockup.c+1−1
@@ -138,7 +138,7 @@ static int sdw_mockup_pcm_hw_free(struct snd_pcm_substream *substream, · 137 unmodified lines
138138 static const struct snd_soc_dai_ops sdw_mockup_ops = {
139139 .hw_params = sdw_mockup_pcm_hw_params,
140140 .hw_free = sdw_mockup_pcm_hw_free,
141− .set_sdw_stream = sdw_mockup_set_sdw_stream,
141+ .set_stream = sdw_mockup_set_sdw_stream,
142142 .shutdown = sdw_mockup_shutdown,
143143 };
144144
sound/soc/codecs/sgtl5000.c+2−3
@@ -1612,9 +1612,8 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, · 1611 unmodified lines
16121612 if (ret == -ENOENT)
16131613 ret = -EPROBE_DEFER;
16141614
1615− if (ret != -EPROBE_DEFER)
1616− dev_err(&client->dev, "Failed to get mclock: %d\n",
1617− ret);
1615+ dev_err_probe(&client->dev, ret, "Failed to get mclock\n");
1616+
16181617 goto disable_regs;
16191618 }
16201619
sound/soc/codecs/simple-amplifier.c+3−7
@@ -69,7 +69,6 @@ static int simple_amp_probe(struct platform_device *pdev) · 68 unmodified lines
6969 {
7070 struct device *dev = &pdev->dev;
7171 struct simple_amp *priv;
72− int err;
7372
7473 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
7574 if (priv == NULL)
@@ -78,12 +77,9 @@ static int simple_amp_probe(struct platform_device *pdev) · 2 unmodified lines
7877
7978 priv->gpiod_enable = devm_gpiod_get_optional(dev, "enable",
8079 GPIOD_OUT_LOW);
81− if (IS_ERR(priv->gpiod_enable)) {
82− err = PTR_ERR(priv->gpiod_enable);
83− if (err != -EPROBE_DEFER)
84− dev_err(dev, "Failed to get 'enable' gpio: %d", err);
85− return err;
86− }
80+ if (IS_ERR(priv->gpiod_enable))
81+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_enable),
82+ "Failed to get 'enable' gpio");
8783
8884 return devm_snd_soc_register_component(dev,
8985 &simple_amp_component_driver,
sound/soc/codecs/simple-mux.c+3−7
@@ -82,7 +82,6 @@ static int simple_mux_probe(struct platform_device *pdev) · 81 unmodified lines
8282 {
8383 struct device *dev = &pdev->dev;
8484 struct simple_mux *priv;
85− int err;
8685
8786 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
8887 if (!priv)
@@ -91,12 +90,9 @@ static int simple_mux_probe(struct platform_device *pdev) · 2 unmodified lines
9190 dev_set_drvdata(dev, priv);
9291
9392 priv->gpiod_mux = devm_gpiod_get(dev, "mux", GPIOD_OUT_LOW);
94− if (IS_ERR(priv->gpiod_mux)) {
95− err = PTR_ERR(priv->gpiod_mux);
96− if (err != -EPROBE_DEFER)
97− dev_err(dev, "Failed to get 'mux' gpio: %d", err);
98− return err;
99− }
93+ if (IS_ERR(priv->gpiod_mux))
94+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_mux),
95+ "Failed to get 'mux' gpio");
10096
10197 return devm_snd_soc_register_component(dev, &simple_mux_component_driver, NULL, 0);
10298 }
sound/soc/codecs/ssm2305.c+3−8
@@ -57,7 +57,6 @@ static int ssm2305_probe(struct platform_device *pdev) · 56 unmodified lines
5757 {
5858 struct device *dev = &pdev->dev;
5959 struct ssm2305 *priv;
60− int err;
6160
6261 /* Allocate the private data */
6362 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -69,13 +68,9 @@ static int ssm2305_probe(struct platform_device *pdev) · 5 unmodified lines
6968 /* Get shutdown gpio */
7069 priv->gpiod_shutdown = devm_gpiod_get(dev, "shutdown",
7170 GPIOD_OUT_LOW);
72− if (IS_ERR(priv->gpiod_shutdown)) {
73− err = PTR_ERR(priv->gpiod_shutdown);
74− if (err != -EPROBE_DEFER)
75− dev_err(dev, "Failed to get 'shutdown' gpio: %d\n",
76− err);
77− return err;
78− }
71+ if (IS_ERR(priv->gpiod_shutdown))
72+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_shutdown),
73+ "Failed to get 'shutdown' gpio\n");
7974
8075 return devm_snd_soc_register_component(dev, &ssm2305_component_driver,
8176 NULL, 0);
sound/soc/codecs/sta350.h+1−1
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414 #ifndef _ASOC_STA_350_H
1515 #define _ASOC_STA_350_H
1616
17−/* STA50 register addresses */
17+/* STA350 register addresses */
1818
1919 #define STA350_REGISTER_COUNT 0x4D
2020 #define STA350_COEF_COUNT 62
sound/soc/codecs/tfa989x.c+19−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 * Copyright (C) 2013 Sony Mobile Communications Inc.
88 */
99
10+#include <linux/gpio/consumer.h>
1011 #include <linux/i2c.h>
1112 #include <linux/module.h>
1213 #include <linux/regmap.h>
@@ -56,6 +57,7 @@ struct tfa989x_rev { · 43 unmodified lines
5657 struct tfa989x {
5758 const struct tfa989x_rev *rev;
5859 struct regulator *vddd_supply;
60+ struct gpio_desc *rcv_gpiod;
5961 };
6062
6163 static bool tfa989x_writeable_reg(struct device *dev, unsigned int reg)
@@ -99,10 +101,20 @@ static const struct snd_soc_dapm_route tfa989x_dapm_routes[] = { · 37 unmodified lines
99101 {"Amp Input", "Right", "AIFINR"},
100102 };
101103
104+static int tfa989x_put_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
105+{
106+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
107+ struct tfa989x *tfa989x = snd_soc_component_get_drvdata(component);
108+
109+ gpiod_set_value_cansleep(tfa989x->rcv_gpiod, ucontrol->value.enumerated.item[0]);
110+
111+ return snd_soc_put_enum_double(kcontrol, ucontrol);
112+}
113+
102114 static const char * const mode_text[] = { "Speaker", "Receiver" };
103115 static SOC_ENUM_SINGLE_DECL(mode_enum, TFA989X_I2SREG, TFA989X_I2SREG_RCV, mode_text);
104116 static const struct snd_kcontrol_new tfa989x_mode_controls[] = {
105− SOC_ENUM("Mode", mode_enum),
117+ SOC_ENUM_EXT("Mode", mode_enum, snd_soc_get_enum_double, tfa989x_put_mode),
106118 };
107119
108120 static int tfa989x_probe(struct snd_soc_component *component)
@@ -301,6 +313,12 @@ static int tfa989x_i2c_probe(struct i2c_client *i2c) · 192 unmodified lines
301313 return dev_err_probe(dev, PTR_ERR(tfa989x->vddd_supply),
302314 "Failed to get vddd regulator\n");
303315
316+ if (tfa989x->rev->rev == TFA9897_REVISION) {
317+ tfa989x->rcv_gpiod = devm_gpiod_get_optional(dev, "rcv", GPIOD_OUT_LOW);
318+ if (IS_ERR(tfa989x->rcv_gpiod))
319+ return PTR_ERR(tfa989x->rcv_gpiod);
320+ }
321+
304322 regmap = devm_regmap_init_i2c(i2c, &tfa989x_regmap);
305323 if (IS_ERR(regmap))
306324 return PTR_ERR(regmap);
sound/soc/codecs/tlv320adc3xxx.c+1317−0
@@ -0,0 +1,1317 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+//
3+// Based on sound/soc/codecs/tlv320aic3x.c by Vladimir Barinov
4+//
5+// Copyright (C) 2010 Mistral Solutions Pvt Ltd.
6+// Author: Shahina Shaik <shahina.s@mistralsolutions.com>
7+//
8+// Copyright (C) 2014-2018, Ambarella, Inc.
9+// Author: Dongge wu <dgwu@ambarella.com>
10+//
11+// Copyright (C) 2021 Axis Communications AB
12+// Author: Ricard Wanderlof <ricardw@axis.com>
13+//
14+
15+#include <dt-bindings/sound/tlv320adc3xxx.h>
16+#include <linux/clk.h>
17+#include <linux/module.h>
18+#include <linux/moduleparam.h>
19+#include <linux/io.h>
20+#include <linux/init.h>
21+#include <linux/delay.h>
22+#include <linux/gpio/driver.h>
23+#include <linux/pm.h>
24+#include <linux/i2c.h>
25+#include <linux/platform_device.h>
26+#include <linux/cdev.h>
27+#include <linux/of_gpio.h>
28+#include <linux/slab.h>
29+#include <sound/core.h>
30+#include <sound/pcm.h>
31+#include <sound/pcm_params.h>
32+#include <sound/soc.h>
33+#include <sound/soc-dapm.h>
34+#include <sound/tlv.h>
35+#include <sound/initval.h>
36+
37+/*
38+ * General definitions defining exported functionality.
39+ */
40+
41+#define ADC3XXX_MICBIAS_PINS 2
42+
43+/* Number of GPIO pins exposed via the gpiolib interface */
44+#define ADC3XXX_GPIOS_MAX 2
45+
46+#define ADC3XXX_RATES SNDRV_PCM_RATE_8000_96000
47+#define ADC3XXX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
48+ SNDRV_PCM_FMTBIT_S20_3LE | \
49+ SNDRV_PCM_FMTBIT_S24_3LE | \
50+ SNDRV_PCM_FMTBIT_S32_LE)
51+
52+/*
53+ * PLL modes, to be used for clk_id for set_sysclk callback.
54+ *
55+ * The default behavior (AUTO) is to take the first matching entry in the clock
56+ * table, which is intended to be the PLL based one if there is more than one.
57+ *
58+ * Setting the clock source using simple-card (clocks or
59+ * system-clock-frequency property) sets clk_id = 0 = ADC3XXX_PLL_AUTO.
60+ */
61+#define ADC3XXX_PLL_AUTO 0 /* Use first available mode */
62+#define ADC3XXX_PLL_ENABLE 1 /* Use PLL for clock generation */
63+#define ADC3XXX_PLL_BYPASS 2 /* Don't use PLL for clock generation */
64+
65+/* Register definitions. */
66+
67+#define ADC3XXX_PAGE_SIZE 128
68+#define ADC3XXX_REG(page, reg) ((page * ADC3XXX_PAGE_SIZE) + reg)
69+
70+/*
71+ * Page 0 registers.
72+ */
73+
74+#define ADC3XXX_PAGE_SELECT ADC3XXX_REG(0, 0)
75+#define ADC3XXX_RESET ADC3XXX_REG(0, 1)
76+
77+/* 2-3 Reserved */
78+
79+#define ADC3XXX_CLKGEN_MUX ADC3XXX_REG(0, 4)
80+#define ADC3XXX_PLL_PROG_PR ADC3XXX_REG(0, 5)
81+#define ADC3XXX_PLL_PROG_J ADC3XXX_REG(0, 6)
82+#define ADC3XXX_PLL_PROG_D_MSB ADC3XXX_REG(0, 7)
83+#define ADC3XXX_PLL_PROG_D_LSB ADC3XXX_REG(0, 8)
84+
85+/* 9-17 Reserved */
86+
87+#define ADC3XXX_ADC_NADC ADC3XXX_REG(0, 18)
88+#define ADC3XXX_ADC_MADC ADC3XXX_REG(0, 19)
89+#define ADC3XXX_ADC_AOSR ADC3XXX_REG(0, 20)
90+#define ADC3XXX_ADC_IADC ADC3XXX_REG(0, 21)
91+
92+/* 23-24 Reserved */
93+
94+#define ADC3XXX_CLKOUT_MUX ADC3XXX_REG(0, 25)
95+#define ADC3XXX_CLKOUT_M_DIV ADC3XXX_REG(0, 26)
96+#define ADC3XXX_INTERFACE_CTRL_1 ADC3XXX_REG(0, 27)
97+#define ADC3XXX_CH_OFFSET_1 ADC3XXX_REG(0, 28)
98+#define ADC3XXX_INTERFACE_CTRL_2 ADC3XXX_REG(0, 29)
99+#define ADC3XXX_BCLK_N_DIV ADC3XXX_REG(0, 30)
100+#define ADC3XXX_INTERFACE_CTRL_3 ADC3XXX_REG(0, 31)
101+#define ADC3XXX_INTERFACE_CTRL_4 ADC3XXX_REG(0, 32)
102+#define ADC3XXX_INTERFACE_CTRL_5 ADC3XXX_REG(0, 33)
103+#define ADC3XXX_I2S_SYNC ADC3XXX_REG(0, 34)
104+/* 35 Reserved */
105+#define ADC3XXX_ADC_FLAG ADC3XXX_REG(0, 36)
106+#define ADC3XXX_CH_OFFSET_2 ADC3XXX_REG(0, 37)
107+#define ADC3XXX_I2S_TDM_CTRL ADC3XXX_REG(0, 38)
108+/* 39-41 Reserved */
109+#define ADC3XXX_INTR_FLAG_1 ADC3XXX_REG(0, 42)
110+#define ADC3XXX_INTR_FLAG_2 ADC3XXX_REG(0, 43)
111+/* 44 Reserved */
112+#define ADC3XXX_INTR_FLAG_ADC1 ADC3XXX_REG(0, 45)
113+/* 46 Reserved */
114+#define ADC3XXX_INTR_FLAG_ADC2 ADC3XXX_REG(0, 47)
115+#define ADC3XXX_INT1_CTRL ADC3XXX_REG(0, 48)
116+#define ADC3XXX_INT2_CTRL ADC3XXX_REG(0, 49)
117+/* 50 Reserved */
118+#define ADC3XXX_GPIO2_CTRL ADC3XXX_REG(0, 51)
119+#define ADC3XXX_GPIO1_CTRL ADC3XXX_REG(0, 52)
120+#define ADC3XXX_DOUT_CTRL ADC3XXX_REG(0, 53)
121+/* 54-56 Reserved */
122+#define ADC3XXX_SYNC_CTRL_1 ADC3XXX_REG(0, 57)
123+#define ADC3XXX_SYNC_CTRL_2 ADC3XXX_REG(0, 58)
124+#define ADC3XXX_CIC_GAIN_CTRL ADC3XXX_REG(0, 59)
125+/* 60 Reserved */
126+#define ADC3XXX_PRB_SELECT ADC3XXX_REG(0, 61)
127+#define ADC3XXX_INST_MODE_CTRL ADC3XXX_REG(0, 62)
128+/* 63-79 Reserved */
129+#define ADC3XXX_MIC_POLARITY_CTRL ADC3XXX_REG(0, 80)
130+#define ADC3XXX_ADC_DIGITAL ADC3XXX_REG(0, 81)
131+#define ADC3XXX_ADC_FGA ADC3XXX_REG(0, 82)
132+#define ADC3XXX_LADC_VOL ADC3XXX_REG(0, 83)
133+#define ADC3XXX_RADC_VOL ADC3XXX_REG(0, 84)
134+#define ADC3XXX_ADC_PHASE_COMP ADC3XXX_REG(0, 85)
135+#define ADC3XXX_LEFT_CHN_AGC_1 ADC3XXX_REG(0, 86)
136+#define ADC3XXX_LEFT_CHN_AGC_2 ADC3XXX_REG(0, 87)
137+#define ADC3XXX_LEFT_CHN_AGC_3 ADC3XXX_REG(0, 88)
138+#define ADC3XXX_LEFT_CHN_AGC_4 ADC3XXX_REG(0, 89)
139+#define ADC3XXX_LEFT_CHN_AGC_5 ADC3XXX_REG(0, 90)
140+#define ADC3XXX_LEFT_CHN_AGC_6 ADC3XXX_REG(0, 91)
141+#define ADC3XXX_LEFT_CHN_AGC_7 ADC3XXX_REG(0, 92)
142+#define ADC3XXX_LEFT_AGC_GAIN ADC3XXX_REG(0, 93)
143+#define ADC3XXX_RIGHT_CHN_AGC_1 ADC3XXX_REG(0, 94)
144+#define ADC3XXX_RIGHT_CHN_AGC_2 ADC3XXX_REG(0, 95)
145+#define ADC3XXX_RIGHT_CHN_AGC_3 ADC3XXX_REG(0, 96)
146+#define ADC3XXX_RIGHT_CHN_AGC_4 ADC3XXX_REG(0, 97)
147+#define ADC3XXX_RIGHT_CHN_AGC_5 ADC3XXX_REG(0, 98)
148+#define ADC3XXX_RIGHT_CHN_AGC_6 ADC3XXX_REG(0, 99)
149+#define ADC3XXX_RIGHT_CHN_AGC_7 ADC3XXX_REG(0, 100)
150+#define ADC3XXX_RIGHT_AGC_GAIN ADC3XXX_REG(0, 101)
151+/* 102-127 Reserved */
152+
153+/*
154+ * Page 1 registers.
155+ */
156+
157+/* 1-25 Reserved */
158+#define ADC3XXX_DITHER_CTRL ADC3XXX_REG(1, 26)
159+/* 27-50 Reserved */
160+#define ADC3XXX_MICBIAS_CTRL ADC3XXX_REG(1, 51)
161+#define ADC3XXX_LEFT_PGA_SEL_1 ADC3XXX_REG(1, 52)
162+/* 53 Reserved */
163+#define ADC3XXX_LEFT_PGA_SEL_2 ADC3XXX_REG(1, 54)
164+#define ADC3XXX_RIGHT_PGA_SEL_1 ADC3XXX_REG(1, 55)
165+#define ADC3XXX_RIGHT_PGA_SEL_2 ADC3XXX_REG(1, 57)
166+#define ADC3XXX_LEFT_APGA_CTRL ADC3XXX_REG(1, 59)
167+#define ADC3XXX_RIGHT_APGA_CTRL ADC3XXX_REG(1, 60)
168+#define ADC3XXX_LOW_CURRENT_MODES ADC3XXX_REG(1, 61)
169+#define ADC3XXX_ANALOG_PGA_FLAGS ADC3XXX_REG(1, 62)
170+/* 63-127 Reserved */
171+
172+/*
173+ * Register bits.
174+ */
175+
176+/* PLL Enable bits */
177+#define ADC3XXX_ENABLE_PLL_SHIFT 7
178+#define ADC3XXX_ENABLE_PLL (1 << ADC3XXX_ENABLE_PLL_SHIFT)
179+#define ADC3XXX_ENABLE_NADC_SHIFT 7
180+#define ADC3XXX_ENABLE_NADC (1 << ADC3XXX_ENABLE_NADC_SHIFT)
181+#define ADC3XXX_ENABLE_MADC_SHIFT 7
182+#define ADC3XXX_ENABLE_MADC (1 << ADC3XXX_ENABLE_MADC_SHIFT)
183+#define ADC3XXX_ENABLE_BCLK_SHIFT 7
184+#define ADC3XXX_ENABLE_BCLK (1 << ADC3XXX_ENABLE_BCLK_SHIFT)
185+
186+/* Power bits */
187+#define ADC3XXX_LADC_PWR_ON 0x80
188+#define ADC3XXX_RADC_PWR_ON 0x40
189+
190+#define ADC3XXX_SOFT_RESET 0x01
191+#define ADC3XXX_BCLK_MASTER 0x08
192+#define ADC3XXX_WCLK_MASTER 0x04
193+
194+/* Interface register masks */
195+#define ADC3XXX_FORMAT_MASK 0xc0
196+#define ADC3XXX_FORMAT_SHIFT 6
197+#define ADC3XXX_WLENGTH_MASK 0x30
198+#define ADC3XXX_WLENGTH_SHIFT 4
199+#define ADC3XXX_CLKDIR_MASK 0x0c
200+#define ADC3XXX_CLKDIR_SHIFT 2
201+
202+/* Interface register bit patterns */
203+#define ADC3XXX_FORMAT_I2S (0 << ADC3XXX_FORMAT_SHIFT)
204+#define ADC3XXX_FORMAT_DSP (1 << ADC3XXX_FORMAT_SHIFT)
205+#define ADC3XXX_FORMAT_RJF (2 << ADC3XXX_FORMAT_SHIFT)
206+#define ADC3XXX_FORMAT_LJF (3 << ADC3XXX_FORMAT_SHIFT)
207+
208+#define ADC3XXX_IFACE_16BITS (0 << ADC3XXX_WLENGTH_SHIFT)
209+#define ADC3XXX_IFACE_20BITS (1 << ADC3XXX_WLENGTH_SHIFT)
210+#define ADC3XXX_IFACE_24BITS (2 << ADC3XXX_WLENGTH_SHIFT)
211+#define ADC3XXX_IFACE_32BITS (3 << ADC3XXX_WLENGTH_SHIFT)
212+
213+/* PLL P/R bit offsets */
214+#define ADC3XXX_PLLP_SHIFT 4
215+#define ADC3XXX_PLLR_SHIFT 0
216+#define ADC3XXX_PLL_PR_MASK 0x7f
217+#define ADC3XXX_PLLJ_MASK 0x3f
218+#define ADC3XXX_PLLD_MSB_MASK 0x3f
219+#define ADC3XXX_PLLD_LSB_MASK 0xff
220+#define ADC3XXX_NADC_MASK 0x7f
221+#define ADC3XXX_MADC_MASK 0x7f
222+#define ADC3XXX_AOSR_MASK 0xff
223+#define ADC3XXX_IADC_MASK 0xff
224+#define ADC3XXX_BDIV_MASK 0x7f
225+
226+/* PLL_CLKIN bits */
227+#define ADC3XXX_PLL_CLKIN_SHIFT 2
228+#define ADC3XXX_PLL_CLKIN_MCLK 0x0
229+#define ADC3XXX_PLL_CLKIN_BCLK 0x1
230+#define ADC3XXX_PLL_CLKIN_ZERO 0x3
231+
232+/* CODEC_CLKIN bits */
233+#define ADC3XXX_CODEC_CLKIN_SHIFT 0
234+#define ADC3XXX_CODEC_CLKIN_MCLK 0x0
235+#define ADC3XXX_CODEC_CLKIN_BCLK 0x1
236+#define ADC3XXX_CODEC_CLKIN_PLL_CLK 0x3
237+
238+#define ADC3XXX_USE_PLL ((ADC3XXX_PLL_CLKIN_MCLK << ADC3XXX_PLL_CLKIN_SHIFT) | \
239+ (ADC3XXX_CODEC_CLKIN_PLL_CLK << ADC3XXX_CODEC_CLKIN_SHIFT))
240+#define ADC3XXX_NO_PLL ((ADC3XXX_PLL_CLKIN_ZERO << ADC3XXX_PLL_CLKIN_SHIFT) | \
241+ (ADC3XXX_CODEC_CLKIN_MCLK << ADC3XXX_CODEC_CLKIN_SHIFT))
242+
243+/* Analog PGA control bits */
244+#define ADC3XXX_LPGA_MUTE 0x80
245+#define ADC3XXX_RPGA_MUTE 0x80
246+
247+#define ADC3XXX_LPGA_GAIN_MASK 0x7f
248+#define ADC3XXX_RPGA_GAIN_MASK 0x7f
249+
250+/* ADC current modes */
251+#define ADC3XXX_ADC_LOW_CURR_MODE 0x01
252+
253+/* Left ADC Input selection bits */
254+#define ADC3XXX_LCH_SEL1_SHIFT 0
255+#define ADC3XXX_LCH_SEL2_SHIFT 2
256+#define ADC3XXX_LCH_SEL3_SHIFT 4
257+#define ADC3XXX_LCH_SEL4_SHIFT 6
258+
259+#define ADC3XXX_LCH_SEL1X_SHIFT 0
260+#define ADC3XXX_LCH_SEL2X_SHIFT 2
261+#define ADC3XXX_LCH_SEL3X_SHIFT 4
262+#define ADC3XXX_LCH_COMMON_MODE 0x40
263+#define ADC3XXX_BYPASS_LPGA 0x80
264+
265+/* Right ADC Input selection bits */
266+#define ADC3XXX_RCH_SEL1_SHIFT 0
267+#define ADC3XXX_RCH_SEL2_SHIFT 2
268+#define ADC3XXX_RCH_SEL3_SHIFT 4
269+#define ADC3XXX_RCH_SEL4_SHIFT 6
270+
271+#define ADC3XXX_RCH_SEL1X_SHIFT 0
272+#define ADC3XXX_RCH_SEL2X_SHIFT 2
273+#define ADC3XXX_RCH_SEL3X_SHIFT 4
274+#define ADC3XXX_RCH_COMMON_MODE 0x40
275+#define ADC3XXX_BYPASS_RPGA 0x80
276+
277+/* MICBIAS control bits */
278+#define ADC3XXX_MICBIAS_MASK 0x2
279+#define ADC3XXX_MICBIAS1_SHIFT 5
280+#define ADC3XXX_MICBIAS2_SHIFT 3
281+
282+#define ADC3XXX_ADC_MAX_VOLUME 64
283+#define ADC3XXX_ADC_POS_VOL 24
284+
285+/* GPIO control bits (GPIO1_CTRL and GPIO2_CTRL) */
286+#define ADC3XXX_GPIO_CTRL_CFG_MASK 0x3c
287+#define ADC3XXX_GPIO_CTRL_CFG_SHIFT 2
288+#define ADC3XXX_GPIO_CTRL_OUTPUT_CTRL_MASK 0x01
289+#define ADC3XXX_GPIO_CTRL_OUTPUT_CTRL_SHIFT 0
290+#define ADC3XXX_GPIO_CTRL_INPUT_VALUE_MASK 0x02
291+#define ADC3XXX_GPIO_CTRL_INPUT_VALUE_SHIFT 1
292+
293+enum adc3xxx_type {
294+ ADC3001 = 0,
295+ ADC3101
296+};
297+
298+struct adc3xxx {
299+ struct device *dev;
300+ enum adc3xxx_type type;
301+ struct clk *mclk;
302+ struct regmap *regmap;
303+ struct gpio_desc *rst_pin;
304+ unsigned int pll_mode;
305+ unsigned int sysclk;
306+ unsigned int gpio_cfg[ADC3XXX_GPIOS_MAX]; /* value+1 (0 => not set) */
307+ unsigned int micbias_vg[ADC3XXX_MICBIAS_PINS];
308+ int master;
309+ u8 page_no;
310+ int use_pll;
311+ struct gpio_chip gpio_chip;
312+};
313+
314+static const unsigned int adc3xxx_gpio_ctrl_reg[ADC3XXX_GPIOS_MAX] = {
315+ ADC3XXX_GPIO1_CTRL,
316+ ADC3XXX_GPIO2_CTRL
317+};
318+
319+static const unsigned int adc3xxx_micbias_shift[ADC3XXX_MICBIAS_PINS] = {
320+ ADC3XXX_MICBIAS1_SHIFT,
321+ ADC3XXX_MICBIAS2_SHIFT
322+};
323+
324+static const struct reg_default adc3xxx_defaults[] = {
325+ /* Page 0 */
326+ { 0, 0x00 }, { 1, 0x00 }, { 2, 0x00 }, { 3, 0x00 },
327+ { 4, 0x00 }, { 5, 0x11 }, { 6, 0x04 }, { 7, 0x00 },
328+ { 8, 0x00 }, { 9, 0x00 }, { 10, 0x00 }, { 11, 0x00 },
329+ { 12, 0x00 }, { 13, 0x00 }, { 14, 0x00 }, { 15, 0x00 },
330+ { 16, 0x00 }, { 17, 0x00 }, { 18, 0x01 }, { 19, 0x01 },
331+ { 20, 0x80 }, { 21, 0x80 }, { 22, 0x04 }, { 23, 0x00 },
332+ { 24, 0x00 }, { 25, 0x00 }, { 26, 0x01 }, { 27, 0x00 },
333+ { 28, 0x00 }, { 29, 0x02 }, { 30, 0x01 }, { 31, 0x00 },
334+ { 32, 0x00 }, { 33, 0x10 }, { 34, 0x00 }, { 35, 0x00 },
335+ { 36, 0x00 }, { 37, 0x00 }, { 38, 0x02 }, { 39, 0x00 },
336+ { 40, 0x00 }, { 41, 0x00 }, { 42, 0x00 }, { 43, 0x00 },
337+ { 44, 0x00 }, { 45, 0x00 }, { 46, 0x00 }, { 47, 0x00 },
338+ { 48, 0x00 }, { 49, 0x00 }, { 50, 0x00 }, { 51, 0x00 },
339+ { 52, 0x00 }, { 53, 0x12 }, { 54, 0x00 }, { 55, 0x00 },
340+ { 56, 0x00 }, { 57, 0x00 }, { 58, 0x00 }, { 59, 0x44 },
341+ { 60, 0x00 }, { 61, 0x01 }, { 62, 0x00 }, { 63, 0x00 },
342+ { 64, 0x00 }, { 65, 0x00 }, { 66, 0x00 }, { 67, 0x00 },
343+ { 68, 0x00 }, { 69, 0x00 }, { 70, 0x00 }, { 71, 0x00 },
344+ { 72, 0x00 }, { 73, 0x00 }, { 74, 0x00 }, { 75, 0x00 },
345+ { 76, 0x00 }, { 77, 0x00 }, { 78, 0x00 }, { 79, 0x00 },
346+ { 80, 0x00 }, { 81, 0x00 }, { 82, 0x88 }, { 83, 0x00 },
347+ { 84, 0x00 }, { 85, 0x00 }, { 86, 0x00 }, { 87, 0x00 },
348+ { 88, 0x7f }, { 89, 0x00 }, { 90, 0x00 }, { 91, 0x00 },
349+ { 92, 0x00 }, { 93, 0x00 }, { 94, 0x00 }, { 95, 0x00 },
350+ { 96, 0x7f }, { 97, 0x00 }, { 98, 0x00 }, { 99, 0x00 },
351+ { 100, 0x00 }, { 101, 0x00 }, { 102, 0x00 }, { 103, 0x00 },
352+ { 104, 0x00 }, { 105, 0x00 }, { 106, 0x00 }, { 107, 0x00 },
353+ { 108, 0x00 }, { 109, 0x00 }, { 110, 0x00 }, { 111, 0x00 },
354+ { 112, 0x00 }, { 113, 0x00 }, { 114, 0x00 }, { 115, 0x00 },
355+ { 116, 0x00 }, { 117, 0x00 }, { 118, 0x00 }, { 119, 0x00 },
356+ { 120, 0x00 }, { 121, 0x00 }, { 122, 0x00 }, { 123, 0x00 },
357+ { 124, 0x00 }, { 125, 0x00 }, { 126, 0x00 }, { 127, 0x00 },
358+
359+ /* Page 1 */
360+ { 128, 0x00 }, { 129, 0x00 }, { 130, 0x00 }, { 131, 0x00 },
361+ { 132, 0x00 }, { 133, 0x00 }, { 134, 0x00 }, { 135, 0x00 },
362+ { 136, 0x00 }, { 137, 0x00 }, { 138, 0x00 }, { 139, 0x00 },
363+ { 140, 0x00 }, { 141, 0x00 }, { 142, 0x00 }, { 143, 0x00 },
364+ { 144, 0x00 }, { 145, 0x00 }, { 146, 0x00 }, { 147, 0x00 },
365+ { 148, 0x00 }, { 149, 0x00 }, { 150, 0x00 }, { 151, 0x00 },
366+ { 152, 0x00 }, { 153, 0x00 }, { 154, 0x00 }, { 155, 0x00 },
367+ { 156, 0x00 }, { 157, 0x00 }, { 158, 0x00 }, { 159, 0x00 },
368+ { 160, 0x00 }, { 161, 0x00 }, { 162, 0x00 }, { 163, 0x00 },
369+ { 164, 0x00 }, { 165, 0x00 }, { 166, 0x00 }, { 167, 0x00 },
370+ { 168, 0x00 }, { 169, 0x00 }, { 170, 0x00 }, { 171, 0x00 },
371+ { 172, 0x00 }, { 173, 0x00 }, { 174, 0x00 }, { 175, 0x00 },
372+ { 176, 0x00 }, { 177, 0x00 }, { 178, 0x00 }, { 179, 0x00 },
373+ { 180, 0xff }, { 181, 0x00 }, { 182, 0x3f }, { 183, 0xff },
374+ { 184, 0x00 }, { 185, 0x3f }, { 186, 0x00 }, { 187, 0x80 },
375+ { 188, 0x80 }, { 189, 0x00 }, { 190, 0x00 }, { 191, 0x00 },
376+};
377+
378+static bool adc3xxx_volatile_reg(struct device *dev, unsigned int reg)
379+{
380+ switch (reg) {
381+ case ADC3XXX_RESET:
382+ return true;
383+ default:
384+ return false;
385+ }
386+}
387+
388+static const struct regmap_range_cfg adc3xxx_ranges[] = {
389+ {
390+ .range_min = 0,
391+ .range_max = 2 * ADC3XXX_PAGE_SIZE,
392+ .selector_reg = ADC3XXX_PAGE_SELECT,
393+ .selector_mask = 0xff,
394+ .selector_shift = 0,
395+ .window_start = 0,
396+ .window_len = ADC3XXX_PAGE_SIZE,
397+ }
398+};
399+
400+static const struct regmap_config adc3xxx_regmap = {
401+ .reg_bits = 8,
402+ .val_bits = 8,
403+
404+ .reg_defaults = adc3xxx_defaults,
405+ .num_reg_defaults = ARRAY_SIZE(adc3xxx_defaults),
406+
407+ .volatile_reg = adc3xxx_volatile_reg,
408+
409+ .cache_type = REGCACHE_RBTREE,
410+
411+ .ranges = adc3xxx_ranges,
412+ .num_ranges = ARRAY_SIZE(adc3xxx_ranges),
413+ .max_register = 2 * ADC3XXX_PAGE_SIZE,
414+};
415+
416+struct adc3xxx_rate_divs {
417+ u32 mclk;
418+ u32 rate;
419+ u8 pll_p;
420+ u8 pll_r;
421+ u8 pll_j;
422+ u16 pll_d;
423+ u8 nadc;
424+ u8 madc;
425+ u8 aosr;
426+};
427+
428+/*
429+ * PLL and Clock settings.
430+ * If p member is 0, PLL is not used.
431+ * The order of the entries in this table have the PLL entries before
432+ * the non-PLL entries, so that the PLL modes are preferred unless
433+ * the PLL mode setting says otherwise.
434+ */
435+static const struct adc3xxx_rate_divs adc3xxx_divs[] = {
436+ /* mclk, rate, p, r, j, d, nadc, madc, aosr */
437+ /* 8k rate */
438+ { 12000000, 8000, 1, 1, 7, 1680, 42, 2, 128 },
439+ { 12288000, 8000, 1, 1, 7, 0000, 42, 2, 128 },
440+ /* 11.025k rate */
441+ { 12000000, 11025, 1, 1, 6, 8208, 29, 2, 128 },
442+ /* 16k rate */
443+ { 12000000, 16000, 1, 1, 7, 1680, 21, 2, 128 },
444+ { 12288000, 16000, 1, 1, 7, 0000, 21, 2, 128 },
445+ /* 22.05k rate */
446+ { 12000000, 22050, 1, 1, 7, 560, 15, 2, 128 },
447+ /* 32k rate */
448+ { 12000000, 32000, 1, 1, 8, 1920, 12, 2, 128 },
449+ { 12288000, 32000, 1, 1, 8, 0000, 12, 2, 128 },
450+ /* 44.1k rate */
451+ { 12000000, 44100, 1, 1, 7, 5264, 8, 2, 128 },
452+ /* 48k rate */
453+ { 12000000, 48000, 1, 1, 7, 1680, 7, 2, 128 },
454+ { 12288000, 48000, 1, 1, 7, 0000, 7, 2, 128 },
455+ { 24576000, 48000, 1, 1, 3, 5000, 7, 2, 128 }, /* With PLL */
456+ { 24576000, 48000, 0, 0, 0, 0000, 2, 2, 128 }, /* Without PLL */
457+ /* 88.2k rate */
458+ { 12000000, 88200, 1, 1, 7, 5264, 4, 4, 64 },
459+ /* 96k rate */
460+ { 12000000, 96000, 1, 1, 8, 1920, 4, 4, 64 },
461+};
462+
463+static int adc3xxx_get_divs(struct device *dev, int mclk, int rate, int pll_mode)
464+{
465+ int i;
466+
467+ dev_dbg(dev, "mclk = %d, rate = %d, clock mode %u\n",
468+ mclk, rate, pll_mode);
469+ for (i = 0; i < ARRAY_SIZE(adc3xxx_divs); i++) {
470+ const struct adc3xxx_rate_divs *mode = &adc3xxx_divs[i];
471+
472+ /* Skip this entry if it doesn't fulfill the intended clock
473+ * mode requirement. We consider anything besides the two
474+ * modes below to be the same as ADC3XXX_PLL_AUTO.
475+ */
476+ if ((pll_mode == ADC3XXX_PLL_BYPASS && mode->pll_p) ||
477+ (pll_mode == ADC3XXX_PLL_ENABLE && !mode->pll_p))
478+ continue;
479+
480+ if (mode->rate == rate && mode->mclk == mclk)
481+ return i;
482+ }
483+
484+ dev_info(dev, "Master clock rate %d and sample rate %d is not supported\n",
485+ mclk, rate);
486+ return -EINVAL;
487+}
488+
489+static int adc3xxx_pll_delay(struct snd_soc_dapm_widget *w,
490+ struct snd_kcontrol *kcontrol, int event)
491+{
492+ /* 10msec delay needed after PLL power-up to allow
493+ * PLL and dividers to stabilize (datasheet p13).
494+ */
495+ usleep_range(10000, 20000);
496+
497+ return 0;
498+}
499+
500+static const char * const adc_softstepping_text[] = { "1 step", "2 step", "off" };
501+static SOC_ENUM_SINGLE_DECL(adc_softstepping_enum, ADC3XXX_ADC_DIGITAL, 0,
502+ adc_softstepping_text);
503+
504+static const char * const multiplier_text[] = { "1", "2", "4", "8", "16", "32", "64", "128" };
505+static SOC_ENUM_SINGLE_DECL(left_agc_attack_mult_enum,
506+ ADC3XXX_LEFT_CHN_AGC_4, 0, multiplier_text);
507+static SOC_ENUM_SINGLE_DECL(right_agc_attack_mult_enum,
508+ ADC3XXX_RIGHT_CHN_AGC_4, 0, multiplier_text);
509+static SOC_ENUM_SINGLE_DECL(left_agc_decay_mult_enum,
510+ ADC3XXX_LEFT_CHN_AGC_5, 0, multiplier_text);
511+static SOC_ENUM_SINGLE_DECL(right_agc_decay_mult_enum,
512+ ADC3XXX_RIGHT_CHN_AGC_5, 0, multiplier_text);
513+
514+static const char * const dither_dc_offset_text[] = {
515+ "0mV", "15mV", "30mV", "45mV", "60mV", "75mV", "90mV", "105mV",
516+ "-15mV", "-30mV", "-45mV", "-60mV", "-75mV", "-90mV", "-105mV"
517+};
518+static const unsigned int dither_dc_offset_values[] = {
519+ 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15
520+};
521+static SOC_VALUE_ENUM_DOUBLE_DECL(dither_dc_offset_enum,
522+ ADC3XXX_DITHER_CTRL,
523+ 4, 0, 0xf, dither_dc_offset_text,
524+ dither_dc_offset_values);
525+
526+static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 50, 0);
527+static const DECLARE_TLV_DB_SCALE(adc_tlv, -1200, 50, 0);
528+static const DECLARE_TLV_DB_SCALE(adc_fine_tlv, -40, 10, 0);
529+/* AGC target: 8 values: -5.5, -8, -10, -12, -14, -17, -20, -24 dB */
530+/* It would be nice to declare these in the order above, but empirically
531+ * TLV_DB_SCALE_ITEM doesn't take lightly to the increment (second) parameter
532+ * being negative, despite there being examples to the contrary in other
533+ * drivers. So declare these in the order from lowest to highest, and
534+ * set the invert flag in the SOC_DOUBLE_R_TLV declaration instead.
535+ */
536+static const DECLARE_TLV_DB_RANGE(agc_target_tlv,
537+ 0, 0, TLV_DB_SCALE_ITEM(-2400, 0, 0),
538+ 1, 3, TLV_DB_SCALE_ITEM(-2000, 300, 0),
539+ 4, 6, TLV_DB_SCALE_ITEM(-1200, 200, 0),
540+ 7, 7, TLV_DB_SCALE_ITEM(-550, 0, 0));
541+/* Since the 'disabled' value (mute) is at the highest value in the dB
542+ * range (i.e. just before -32 dB) rather than the lowest, we need to resort
543+ * to using a TLV_DB_RANGE in order to get the mute value in the right place.
544+ */
545+static const DECLARE_TLV_DB_RANGE(agc_thresh_tlv,
546+ 0, 30, TLV_DB_SCALE_ITEM(-9000, 200, 0),
547+ 31, 31, TLV_DB_SCALE_ITEM(0, 0, 1)); /* disabled = mute */
548+/* AGC hysteresis: 4 values: 1, 2, 4 dB, disabled (= mute) */
549+static const DECLARE_TLV_DB_RANGE(agc_hysteresis_tlv,
550+ 0, 1, TLV_DB_SCALE_ITEM(100, 100, 0),
551+ 2, 2, TLV_DB_SCALE_ITEM(400, 0, 0),
552+ 3, 3, TLV_DB_SCALE_ITEM(0, 0, 1)); /* disabled = mute */
553+static const DECLARE_TLV_DB_SCALE(agc_max_tlv, 0, 50, 0);
554+/* Input attenuation: -6 dB or 0 dB */
555+static const DECLARE_TLV_DB_SCALE(input_attenuation_tlv, -600, 600, 0);
556+
557+static const struct snd_kcontrol_new adc3xxx_snd_controls[] = {
558+ SOC_DOUBLE_R_TLV("PGA Capture Volume", ADC3XXX_LEFT_APGA_CTRL,
559+ ADC3XXX_RIGHT_APGA_CTRL, 0, 80, 0, pga_tlv),
560+ SOC_DOUBLE("PGA Capture Switch", ADC3XXX_ADC_FGA, 7, 3, 1, 1),
561+ SOC_DOUBLE_R("AGC Capture Switch", ADC3XXX_LEFT_CHN_AGC_1,
562+ ADC3XXX_RIGHT_CHN_AGC_1, 7, 1, 0),
563+ SOC_DOUBLE_R_TLV("AGC Target Level Capture Volume", ADC3XXX_LEFT_CHN_AGC_1,
564+ ADC3XXX_RIGHT_CHN_AGC_2, 4, 0x07, 1, agc_target_tlv),
565+ SOC_DOUBLE_R_TLV("AGC Noise Threshold Capture Volume", ADC3XXX_LEFT_CHN_AGC_2,
566+ ADC3XXX_RIGHT_CHN_AGC_2, 1, 0x1f, 1, agc_thresh_tlv),
567+ SOC_DOUBLE_R_TLV("AGC Hysteresis Capture Volume", ADC3XXX_LEFT_CHN_AGC_2,
568+ ADC3XXX_RIGHT_CHN_AGC_2, 6, 3, 0, agc_hysteresis_tlv),
569+ SOC_DOUBLE_R("AGC Clip Stepping Capture Switch", ADC3XXX_LEFT_CHN_AGC_2,
570+ ADC3XXX_RIGHT_CHN_AGC_2, 0, 1, 0),
571+ /*
572+ * Oddly enough, the data sheet says the default value
573+ * for the left/right AGC maximum gain register field
574+ * (ADC3XXX_LEFT/RIGHT_CHN_AGC_3 bits 0..6) is 0x7f = 127
575+ * (verified empirically) even though this value (indeed, above
576+ * 0x50) is specified as 'Reserved. Do not use.' in the accompanying
577+ * table in the data sheet.
578+ */
579+ SOC_DOUBLE_R_TLV("AGC Maximum Capture Volume", ADC3XXX_LEFT_CHN_AGC_3,
580+ ADC3XXX_RIGHT_CHN_AGC_3, 0, 0x50, 0, agc_max_tlv),
581+ SOC_DOUBLE_R("AGC Attack Time", ADC3XXX_LEFT_CHN_AGC_4,
582+ ADC3XXX_RIGHT_CHN_AGC_4, 3, 0x1f, 0),
583+ /* Would like to have the multipliers as LR pairs, but there is
584+ * no SOC_ENUM_foo which accepts two values in separate registers.
585+ */
586+ SOC_ENUM("AGC Left Attack Time Multiplier", left_agc_attack_mult_enum),
587+ SOC_ENUM("AGC Right Attack Time Multiplier", right_agc_attack_mult_enum),
588+ SOC_DOUBLE_R("AGC Decay Time", ADC3XXX_LEFT_CHN_AGC_5,
589+ ADC3XXX_RIGHT_CHN_AGC_5, 3, 0x1f, 0),
590+ SOC_ENUM("AGC Left Decay Time Multiplier", left_agc_decay_mult_enum),
591+ SOC_ENUM("AGC Right Decay Time Multiplier", right_agc_decay_mult_enum),
592+ SOC_DOUBLE_R("AGC Noise Debounce", ADC3XXX_LEFT_CHN_AGC_6,
593+ ADC3XXX_RIGHT_CHN_AGC_6, 0, 0x1f, 0),
594+ SOC_DOUBLE_R("AGC Signal Debounce", ADC3XXX_LEFT_CHN_AGC_7,
595+ ADC3XXX_RIGHT_CHN_AGC_7, 0, 0x0f, 0),
596+ /* Read only register */
597+ SOC_DOUBLE_R_S_TLV("AGC Applied Capture Volume", ADC3XXX_LEFT_AGC_GAIN,
598+ ADC3XXX_RIGHT_AGC_GAIN, 0, -24, 40, 6, 0, adc_tlv),
599+ /* ADC soft stepping */
600+ SOC_ENUM("ADC Soft Stepping", adc_softstepping_enum),
601+ /* Left/Right Input attenuation */
602+ SOC_SINGLE_TLV("Left Input IN_1L Capture Volume",
603+ ADC3XXX_LEFT_PGA_SEL_1, 0, 1, 1, input_attenuation_tlv),
604+ SOC_SINGLE_TLV("Left Input IN_2L Capture Volume",
605+ ADC3XXX_LEFT_PGA_SEL_1, 2, 1, 1, input_attenuation_tlv),
606+ SOC_SINGLE_TLV("Left Input IN_3L Capture Volume",
607+ ADC3XXX_LEFT_PGA_SEL_1, 4, 1, 1, input_attenuation_tlv),
608+ SOC_SINGLE_TLV("Left Input IN_1R Capture Volume",
609+ ADC3XXX_LEFT_PGA_SEL_2, 0, 1, 1, input_attenuation_tlv),
610+ SOC_SINGLE_TLV("Left Input DIF_2L_3L Capture Volume",
611+ ADC3XXX_LEFT_PGA_SEL_1, 6, 1, 1, input_attenuation_tlv),
612+ SOC_SINGLE_TLV("Left Input DIF_1L_1R Capture Volume",
613+ ADC3XXX_LEFT_PGA_SEL_2, 4, 1, 1, input_attenuation_tlv),
614+ SOC_SINGLE_TLV("Left Input DIF_2R_3R Capture Volume",
615+ ADC3XXX_LEFT_PGA_SEL_2, 2, 1, 1, input_attenuation_tlv),
616+ SOC_SINGLE_TLV("Right Input IN_1R Capture Volume",
617+ ADC3XXX_RIGHT_PGA_SEL_1, 0, 1, 1, input_attenuation_tlv),
618+ SOC_SINGLE_TLV("Right Input IN_2R Capture Volume",
619+ ADC3XXX_RIGHT_PGA_SEL_1, 2, 1, 1, input_attenuation_tlv),
620+ SOC_SINGLE_TLV("Right Input IN_3R Capture Volume",
621+ ADC3XXX_RIGHT_PGA_SEL_1, 4, 1, 1, input_attenuation_tlv),
622+ SOC_SINGLE_TLV("Right Input IN_1L Capture Volume",
623+ ADC3XXX_RIGHT_PGA_SEL_2, 0, 1, 1, input_attenuation_tlv),
624+ SOC_SINGLE_TLV("Right Input DIF_2R_3R Capture Volume",
625+ ADC3XXX_RIGHT_PGA_SEL_1, 6, 1, 1, input_attenuation_tlv),
626+ SOC_SINGLE_TLV("Right Input DIF_1L_1R Capture Volume",
627+ ADC3XXX_RIGHT_PGA_SEL_2, 4, 1, 1, input_attenuation_tlv),
628+ SOC_SINGLE_TLV("Right Input DIF_2L_3L Capture Volume",
629+ ADC3XXX_RIGHT_PGA_SEL_2, 2, 1, 1, input_attenuation_tlv),
630+ SOC_DOUBLE_R_S_TLV("ADC Volume Control Capture Volume", ADC3XXX_LADC_VOL,
631+ ADC3XXX_RADC_VOL, 0, -24, 40, 6, 0, adc_tlv),
632+ /* Empirically, the following doesn't work the way it's supposed
633+ * to. Values 0, -0.1, -0.2 and -0.3 dB result in the same level, and
634+ * -0.4 dB drops about 0.12 dB on a specific chip.
635+ */
636+ SOC_DOUBLE_TLV("ADC Fine Volume Control Capture Volume", ADC3XXX_ADC_FGA,
637+ 4, 0, 4, 1, adc_fine_tlv),
638+ SOC_SINGLE("Left ADC Unselected CM Bias Capture Switch",
639+ ADC3XXX_LEFT_PGA_SEL_2, 6, 1, 0),
640+ SOC_SINGLE("Right ADC Unselected CM Bias Capture Switch",
641+ ADC3XXX_RIGHT_PGA_SEL_2, 6, 1, 0),
642+ SOC_ENUM("Dither Control DC Offset", dither_dc_offset_enum),
643+};
644+
645+/* Left input selection, Single Ended inputs and Differential inputs */
646+static const struct snd_kcontrol_new left_input_mixer_controls[] = {
647+ SOC_DAPM_SINGLE("IN_1L Capture Switch",
648+ ADC3XXX_LEFT_PGA_SEL_1, 1, 0x1, 1),
649+ SOC_DAPM_SINGLE("IN_2L Capture Switch",
650+ ADC3XXX_LEFT_PGA_SEL_1, 3, 0x1, 1),
651+ SOC_DAPM_SINGLE("IN_3L Capture Switch",
652+ ADC3XXX_LEFT_PGA_SEL_1, 5, 0x1, 1),
653+ SOC_DAPM_SINGLE("DIF_2L_3L Capture Switch",
654+ ADC3XXX_LEFT_PGA_SEL_1, 7, 0x1, 1),
655+ SOC_DAPM_SINGLE("DIF_1L_1R Capture Switch",
656+ ADC3XXX_LEFT_PGA_SEL_2, 5, 0x1, 1),
657+ SOC_DAPM_SINGLE("DIF_2R_3R Capture Switch",
658+ ADC3XXX_LEFT_PGA_SEL_2, 3, 0x1, 1),
659+ SOC_DAPM_SINGLE("IN_1R Capture Switch",
660+ ADC3XXX_LEFT_PGA_SEL_2, 1, 0x1, 1),
661+};
662+
663+/* Right input selection, Single Ended inputs and Differential inputs */
664+static const struct snd_kcontrol_new right_input_mixer_controls[] = {
665+ SOC_DAPM_SINGLE("IN_1R Capture Switch",
666+ ADC3XXX_RIGHT_PGA_SEL_1, 1, 0x1, 1),
667+ SOC_DAPM_SINGLE("IN_2R Capture Switch",
668+ ADC3XXX_RIGHT_PGA_SEL_1, 3, 0x1, 1),
669+ SOC_DAPM_SINGLE("IN_3R Capture Switch",
670+ ADC3XXX_RIGHT_PGA_SEL_1, 5, 0x1, 1),
671+ SOC_DAPM_SINGLE("DIF_2R_3R Capture Switch",
672+ ADC3XXX_RIGHT_PGA_SEL_1, 7, 0x1, 1),
673+ SOC_DAPM_SINGLE("DIF_1L_1R Capture Switch",
674+ ADC3XXX_RIGHT_PGA_SEL_2, 5, 0x1, 1),
675+ SOC_DAPM_SINGLE("DIF_2L_3L Capture Switch",
676+ ADC3XXX_RIGHT_PGA_SEL_2, 3, 0x1, 1),
677+ SOC_DAPM_SINGLE("IN_1L Capture Switch",
678+ ADC3XXX_RIGHT_PGA_SEL_2, 1, 0x1, 1),
679+};
680+
681+/* Left Digital Mic input for left ADC */
682+static const struct snd_kcontrol_new left_input_dmic_controls[] = {
683+ SOC_DAPM_SINGLE("Left ADC Capture Switch",
684+ ADC3XXX_ADC_DIGITAL, 3, 0x1, 0),
685+};
686+
687+/* Right Digital Mic input for Right ADC */
688+static const struct snd_kcontrol_new right_input_dmic_controls[] = {
689+ SOC_DAPM_SINGLE("Right ADC Capture Switch",
690+ ADC3XXX_ADC_DIGITAL, 2, 0x1, 0),
691+};
692+
693+/* DAPM widgets */
694+static const struct snd_soc_dapm_widget adc3xxx_dapm_widgets[] = {
695+
696+ /* Left Input Selection */
697+ SND_SOC_DAPM_MIXER("Left Input", SND_SOC_NOPM, 0, 0,
698+ &left_input_mixer_controls[0],
699+ ARRAY_SIZE(left_input_mixer_controls)),
700+ /* Right Input Selection */
701+ SND_SOC_DAPM_MIXER("Right Input", SND_SOC_NOPM, 0, 0,
702+ &right_input_mixer_controls[0],
703+ ARRAY_SIZE(right_input_mixer_controls)),
704+ /* PGA selection */
705+ SND_SOC_DAPM_PGA("Left PGA", ADC3XXX_LEFT_APGA_CTRL, 7, 1, NULL, 0),
706+ SND_SOC_DAPM_PGA("Right PGA", ADC3XXX_RIGHT_APGA_CTRL, 7, 1, NULL, 0),
707+
708+ /* Digital Microphone Input Control for Left/Right ADC */
709+ SND_SOC_DAPM_MIXER("Left DMic Input", SND_SOC_NOPM, 0, 0,
710+ &left_input_dmic_controls[0],
711+ ARRAY_SIZE(left_input_dmic_controls)),
712+ SND_SOC_DAPM_MIXER("Right DMic Input", SND_SOC_NOPM, 0, 0,
713+ &right_input_dmic_controls[0],
714+ ARRAY_SIZE(right_input_dmic_controls)),
715+
716+ /* Left/Right ADC */
717+ SND_SOC_DAPM_ADC("Left ADC", "Left Capture", ADC3XXX_ADC_DIGITAL, 7, 0),
718+ SND_SOC_DAPM_ADC("Right ADC", "Right Capture", ADC3XXX_ADC_DIGITAL, 6, 0),
719+
720+ /* Inputs */
721+ SND_SOC_DAPM_INPUT("IN_1L"),
722+ SND_SOC_DAPM_INPUT("IN_1R"),
723+ SND_SOC_DAPM_INPUT("IN_2L"),
724+ SND_SOC_DAPM_INPUT("IN_2R"),
725+ SND_SOC_DAPM_INPUT("IN_3L"),
726+ SND_SOC_DAPM_INPUT("IN_3R"),
727+ SND_SOC_DAPM_INPUT("DIFL_1L_1R"),
728+ SND_SOC_DAPM_INPUT("DIFL_2L_3L"),
729+ SND_SOC_DAPM_INPUT("DIFL_2R_3R"),
730+ SND_SOC_DAPM_INPUT("DIFR_1L_1R"),
731+ SND_SOC_DAPM_INPUT("DIFR_2L_3L"),
732+ SND_SOC_DAPM_INPUT("DIFR_2R_3R"),
733+ SND_SOC_DAPM_INPUT("DMic_L"),
734+ SND_SOC_DAPM_INPUT("DMic_R"),
735+
736+ /* Digital audio interface output */
737+ SND_SOC_DAPM_AIF_OUT("AIF_OUT", "Capture", 0, SND_SOC_NOPM, 0, 0),
738+
739+ /* Clocks */
740+ SND_SOC_DAPM_SUPPLY("PLL_CLK", ADC3XXX_PLL_PROG_PR, ADC3XXX_ENABLE_PLL_SHIFT,
741+ 0, adc3xxx_pll_delay, SND_SOC_DAPM_POST_PMU),
742+
743+ SND_SOC_DAPM_SUPPLY("ADC_CLK", ADC3XXX_ADC_NADC, ADC3XXX_ENABLE_NADC_SHIFT,
744+ 0, NULL, 0),
745+ SND_SOC_DAPM_SUPPLY("ADC_MOD_CLK", ADC3XXX_ADC_MADC, ADC3XXX_ENABLE_MADC_SHIFT,
746+ 0, NULL, 0),
747+
748+ /* This refers to the generated BCLK in master mode. */
749+ SND_SOC_DAPM_SUPPLY("BCLK", ADC3XXX_BCLK_N_DIV, ADC3XXX_ENABLE_BCLK_SHIFT,
750+ 0, NULL, 0),
751+};
752+
753+static const struct snd_soc_dapm_route adc3xxx_intercon[] = {
754+ /* Left input selection from switches */
755+ { "Left Input", "IN_1L Capture Switch", "IN_1L" },
756+ { "Left Input", "IN_2L Capture Switch", "IN_2L" },
757+ { "Left Input", "IN_3L Capture Switch", "IN_3L" },
758+ { "Left Input", "DIF_2L_3L Capture Switch", "DIFL_2L_3L" },
759+ { "Left Input", "DIF_1L_1R Capture Switch", "DIFL_1L_1R" },
760+ { "Left Input", "DIF_2R_3R Capture Switch", "DIFL_2R_3R" },
761+ { "Left Input", "IN_1R Capture Switch", "IN_1R" },
762+
763+ /* Left input selection to left PGA */
764+ { "Left PGA", NULL, "Left Input" },
765+
766+ /* Left PGA to left ADC */
767+ { "Left ADC", NULL, "Left PGA" },
768+
769+ /* Right input selection from switches */
770+ { "Right Input", "IN_1R Capture Switch", "IN_1R" },
771+ { "Right Input", "IN_2R Capture Switch", "IN_2R" },
772+ { "Right Input", "IN_3R Capture Switch", "IN_3R" },
773+ { "Right Input", "DIF_2R_3R Capture Switch", "DIFR_2R_3R" },
774+ { "Right Input", "DIF_1L_1R Capture Switch", "DIFR_1L_1R" },
775+ { "Right Input", "DIF_2L_3L Capture Switch", "DIFR_2L_3L" },
776+ { "Right Input", "IN_1L Capture Switch", "IN_1L" },
777+
778+ /* Right input selection to right PGA */
779+ { "Right PGA", NULL, "Right Input" },
780+
781+ /* Right PGA to right ADC */
782+ { "Right ADC", NULL, "Right PGA" },
783+
784+ /* Left DMic Input selection from switch */
785+ { "Left DMic Input", "Left ADC Capture Switch", "DMic_L" },
786+
787+ /* Left DMic to left ADC */
788+ { "Left ADC", NULL, "Left DMic Input" },
789+
790+ /* Right DMic Input selection from switch */
791+ { "Right DMic Input", "Right ADC Capture Switch", "DMic_R" },
792+
793+ /* Right DMic to right ADC */
794+ { "Right ADC", NULL, "Right DMic Input" },
795+
796+ /* ADC to AIF output */
797+ { "AIF_OUT", NULL, "Left ADC" },
798+ { "AIF_OUT", NULL, "Right ADC" },
799+
800+ /* Clocking */
801+ { "ADC_MOD_CLK", NULL, "ADC_CLK" },
802+ { "Left ADC", NULL, "ADC_MOD_CLK" },
803+ { "Right ADC", NULL, "ADC_MOD_CLK" },
804+
805+ { "BCLK", NULL, "ADC_CLK" },
806+};
807+
808+static const struct snd_soc_dapm_route adc3xxx_pll_intercon[] = {
809+ { "ADC_CLK", NULL, "PLL_CLK" },
810+};
811+
812+static const struct snd_soc_dapm_route adc3xxx_bclk_out_intercon[] = {
813+ { "AIF_OUT", NULL, "BCLK" }
814+};
815+
816+static int adc3xxx_gpio_request(struct gpio_chip *chip, unsigned int offset)
817+{
818+ struct adc3xxx *adc3xxx = gpiochip_get_data(chip);
819+
820+ if (offset >= ADC3XXX_GPIOS_MAX)
821+ return -EINVAL;
822+
823+ /* GPIO1 is offset 0, GPIO2 is offset 1 */
824+ /* We check here that the GPIO pins are either not configured in the
825+ * DT, or that they purposely are set as outputs.
826+ * (Input mode not yet implemented).
827+ */
828+ if (adc3xxx->gpio_cfg[offset] != 0 &&
829+ adc3xxx->gpio_cfg[offset] != ADC3XXX_GPIO_GPO + 1)
830+ return -EINVAL;
831+
832+ return 0;
833+}
834+
835+static int adc3xxx_gpio_direction_out(struct gpio_chip *chip,
836+ unsigned int offset, int value)
837+{
838+ struct adc3xxx *adc3xxx = gpiochip_get_data(chip);
839+
840+ /* Set GPIO output function. */
841+ return regmap_update_bits(adc3xxx->regmap,
842+ adc3xxx_gpio_ctrl_reg[offset],
843+ ADC3XXX_GPIO_CTRL_CFG_MASK |
844+ ADC3XXX_GPIO_CTRL_OUTPUT_CTRL_MASK,
845+ ADC3XXX_GPIO_GPO << ADC3XXX_GPIO_CTRL_CFG_SHIFT |
846+ !!value << ADC3XXX_GPIO_CTRL_OUTPUT_CTRL_SHIFT);
847+}
848+
849+/* With only GPIO outputs configured, we never get the .direction_out call,
850+ * so we set the output mode and output value in the same call. Hence
851+ * .set in practice does the same thing as .direction_out .
852+ */
853+static void adc3xxx_gpio_set(struct gpio_chip *chip, unsigned int offset,
854+ int value)
855+{
856+ (void) adc3xxx_gpio_direction_out(chip, offset, value);
857+}
858+
859+/* Even though we only support GPIO output for now, some GPIO clients
860+ * want to read the current pin state using the .get callback.
861+ */
862+static int adc3xxx_gpio_get(struct gpio_chip *chip, unsigned int offset)
863+{
864+ struct adc3xxx *adc3xxx = gpiochip_get_data(chip);
865+ unsigned int regval;
866+ int ret;
867+
868+ /* We only allow output pins, so just read the value set in the output
869+ * pin register field.
870+ */
871+ ret = regmap_read(adc3xxx->regmap, adc3xxx_gpio_ctrl_reg[offset], &regval);
872+ if (ret)
873+ return ret;
874+ return !!(regval & ADC3XXX_GPIO_CTRL_OUTPUT_CTRL_MASK);
875+}
876+
877+static const struct gpio_chip adc3xxx_gpio_chip = {
878+ .label = "adc3xxx",
879+ .owner = THIS_MODULE,
880+ .request = adc3xxx_gpio_request,
881+ .direction_output = adc3xxx_gpio_direction_out,
882+ .set = adc3xxx_gpio_set,
883+ .get = adc3xxx_gpio_get,
884+ .can_sleep = 1,
885+};
886+
887+static void adc3xxx_free_gpio(struct adc3xxx *adc3xxx)
888+{
889+ gpiochip_remove(&adc3xxx->gpio_chip);
890+}
891+
892+static void adc3xxx_init_gpio(struct adc3xxx *adc3xxx)
893+{
894+ int gpio, micbias;
895+ int ret;
896+
897+ adc3xxx->gpio_chip = adc3xxx_gpio_chip;
898+ adc3xxx->gpio_chip.ngpio = ADC3XXX_GPIOS_MAX;
899+ adc3xxx->gpio_chip.parent = adc3xxx->dev;
900+ adc3xxx->gpio_chip.base = -1;
901+
902+ ret = gpiochip_add_data(&adc3xxx->gpio_chip, adc3xxx);
903+ if (ret)
904+ dev_err(adc3xxx->dev, "Failed to add gpios: %d\n", ret);
905+
906+ /* Set up potential GPIO configuration from the devicetree.
907+ * This allows us to set up things which are not software
908+ * controllable GPIOs, such as PDM microphone I/O,
909+ */
910+ for (gpio = 0; gpio < ADC3XXX_GPIOS_MAX; gpio++) {
911+ unsigned int cfg = adc3xxx->gpio_cfg[gpio];
912+
913+ if (cfg) {
914+ cfg--; /* actual value to use is stored +1 */
915+ regmap_update_bits(adc3xxx->regmap,
916+ adc3xxx_gpio_ctrl_reg[gpio],
917+ ADC3XXX_GPIO_CTRL_CFG_MASK,
918+ cfg << ADC3XXX_GPIO_CTRL_CFG_SHIFT);
919+ }
920+ }
921+
922+ /* Set up micbias voltage */
923+ for (micbias = 0; micbias < ADC3XXX_MICBIAS_PINS; micbias++) {
924+ unsigned int vg = adc3xxx->micbias_vg[micbias];
925+
926+ regmap_update_bits(adc3xxx->regmap,
927+ ADC3XXX_MICBIAS_CTRL,
928+ ADC3XXX_MICBIAS_MASK << adc3xxx_micbias_shift[micbias],
929+ vg << adc3xxx_micbias_shift[micbias]);
930+ }
931+}
932+
933+static int adc3xxx_parse_dt_gpio(struct adc3xxx *adc3xxx,
934+ const char *propname, unsigned int *cfg)
935+{
936+ struct device *dev = adc3xxx->dev;
937+ struct device_node *np = dev->of_node;
938+ unsigned int val;
939+
940+ if (!of_property_read_u32(np, propname, &val)) {
941+ if (val & ~15 || val == 7 || val >= 11) {
942+ dev_err(dev, "Invalid property value for '%s'\n", propname);
943+ return -EINVAL;
944+ }
945+ if (val == ADC3XXX_GPIO_GPI)
946+ dev_warn(dev, "GPIO Input read not yet implemented\n");
947+ *cfg = val + 1; /* 0 => not set up, all others shifted +1 */
948+ }
949+ return 0;
950+}
951+
952+static int adc3xxx_parse_dt_micbias(struct adc3xxx *adc3xxx,
953+ const char *propname, unsigned int *vg)
954+{
955+ struct device *dev = adc3xxx->dev;
956+ struct device_node *np = dev->of_node;
957+ unsigned int val;
958+
959+ if (!of_property_read_u32(np, propname, &val)) {
960+ if (val >= ADC3XXX_MICBIAS_AVDD) {
961+ dev_err(dev, "Invalid property value for '%s'\n", propname);
962+ return -EINVAL;
963+ }
964+ *vg = val;
965+ }
966+ return 0;
967+}
968+
969+static int adc3xxx_parse_pll_mode(uint32_t val, unsigned int *pll_mode)
970+{
971+ if (val != ADC3XXX_PLL_ENABLE && val != ADC3XXX_PLL_BYPASS &&
972+ val != ADC3XXX_PLL_AUTO)
973+ return -EINVAL;
974+
975+ *pll_mode = val;
976+
977+ return 0;
978+}
979+
980+static void adc3xxx_setup_pll(struct snd_soc_component *component,
981+ int div_entry)
982+{
983+ int i = div_entry;
984+
985+ /* P & R values */
986+ snd_soc_component_write(component, ADC3XXX_PLL_PROG_PR,
987+ (adc3xxx_divs[i].pll_p << ADC3XXX_PLLP_SHIFT) |
988+ (adc3xxx_divs[i].pll_r << ADC3XXX_PLLR_SHIFT));
989+ /* J value */
990+ snd_soc_component_write(component, ADC3XXX_PLL_PROG_J,
991+ adc3xxx_divs[i].pll_j & ADC3XXX_PLLJ_MASK);
992+ /* D value */
993+ snd_soc_component_write(component, ADC3XXX_PLL_PROG_D_LSB,
994+ adc3xxx_divs[i].pll_d & ADC3XXX_PLLD_LSB_MASK);
995+ snd_soc_component_write(component, ADC3XXX_PLL_PROG_D_MSB,
996+ (adc3xxx_divs[i].pll_d >> 8) & ADC3XXX_PLLD_MSB_MASK);
997+}
998+
999+static int adc3xxx_hw_params(struct snd_pcm_substream *substream,
1000+ struct snd_pcm_hw_params *params,
1001+ struct snd_soc_dai *dai)
1002+{
1003+ struct snd_soc_component *component = dai->component;
1004+ struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(dai->component);
1005+ struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component);
1006+ int i, width = 16;
1007+ u8 iface_len, bdiv;
1008+
1009+ i = adc3xxx_get_divs(component->dev, adc3xxx->sysclk,
1010+ params_rate(params), adc3xxx->pll_mode);
1011+
1012+ if (i < 0)
1013+ return i;
1014+
1015+ /* select data word length */
1016+ switch (params_format(params)) {
1017+ case SNDRV_PCM_FORMAT_S16_LE:
1018+ iface_len = ADC3XXX_IFACE_16BITS;
1019+ width = 16;
1020+ break;
1021+ case SNDRV_PCM_FORMAT_S20_3LE:
1022+ iface_len = ADC3XXX_IFACE_20BITS;
1023+ width = 20;
1024+ break;
1025+ case SNDRV_PCM_FORMAT_S24_LE:
1026+ iface_len = ADC3XXX_IFACE_24BITS;
1027+ width = 24;
1028+ break;
1029+ case SNDRV_PCM_FORMAT_S32_LE:
1030+ iface_len = ADC3XXX_IFACE_32BITS;
1031+ width = 32;
1032+ break;
1033+ default:
1034+ dev_err(component->dev, "Unsupported serial data format\n");
1035+ return -EINVAL;
1036+ }
1037+ snd_soc_component_update_bits(component, ADC3XXX_INTERFACE_CTRL_1,
1038+ ADC3XXX_WLENGTH_MASK, iface_len);
1039+ if (adc3xxx_divs[i].pll_p) { /* If PLL used for this mode */
1040+ adc3xxx_setup_pll(component, i);
1041+ snd_soc_component_write(component, ADC3XXX_CLKGEN_MUX, ADC3XXX_USE_PLL);
1042+ if (!adc3xxx->use_pll) {
1043+ snd_soc_dapm_add_routes(dapm, adc3xxx_pll_intercon,
1044+ ARRAY_SIZE(adc3xxx_pll_intercon));
1045+ adc3xxx->use_pll = 1;
1046+ }
1047+ } else {
1048+ snd_soc_component_write(component, ADC3XXX_CLKGEN_MUX, ADC3XXX_NO_PLL);
1049+ if (adc3xxx->use_pll) {
1050+ snd_soc_dapm_del_routes(dapm, adc3xxx_pll_intercon,
1051+ ARRAY_SIZE(adc3xxx_pll_intercon));
1052+ adc3xxx->use_pll = 0;
1053+ }
1054+ }
1055+
1056+ /* NADC */
1057+ snd_soc_component_update_bits(component, ADC3XXX_ADC_NADC,
1058+ ADC3XXX_NADC_MASK, adc3xxx_divs[i].nadc);
1059+ /* MADC */
1060+ snd_soc_component_update_bits(component, ADC3XXX_ADC_MADC,
1061+ ADC3XXX_MADC_MASK, adc3xxx_divs[i].madc);
1062+ /* AOSR */
1063+ snd_soc_component_update_bits(component, ADC3XXX_ADC_AOSR,
1064+ ADC3XXX_AOSR_MASK, adc3xxx_divs[i].aosr);
1065+ /* BDIV N Value */
1066+ /* BCLK is (by default) set up to be derived from ADC_CLK */
1067+ bdiv = (adc3xxx_divs[i].aosr * adc3xxx_divs[i].madc) / (2 * width);
1068+ snd_soc_component_update_bits(component, ADC3XXX_BCLK_N_DIV,
1069+ ADC3XXX_BDIV_MASK, bdiv);
1070+
1071+ return 0;
1072+}
1073+
1074+static const char *adc3xxx_pll_mode_text(int pll_mode)
1075+{
1076+ switch (pll_mode) {
1077+ case ADC3XXX_PLL_AUTO:
1078+ return "PLL auto";
1079+ case ADC3XXX_PLL_ENABLE:
1080+ return "PLL enable";
1081+ case ADC3XXX_PLL_BYPASS:
1082+ return "PLL bypass";
1083+ default:
1084+ break;
1085+ }
1086+
1087+ return "PLL unknown";
1088+}
1089+
1090+static int adc3xxx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1091+ int clk_id, unsigned int freq, int dir)
1092+{
1093+ struct snd_soc_component *component = codec_dai->component;
1094+ struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component);
1095+ int ret;
1096+
1097+ ret = adc3xxx_parse_pll_mode(clk_id, &adc3xxx->pll_mode);
1098+ if (ret < 0)
1099+ return ret;
1100+
1101+ adc3xxx->sysclk = freq;
1102+ dev_dbg(component->dev, "Set sysclk to %u Hz, %s\n",
1103+ freq, adc3xxx_pll_mode_text(adc3xxx->pll_mode));
1104+ return 0;
1105+}
1106+
1107+static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1108+{
1109+ struct snd_soc_component *component = codec_dai->component;
1110+ struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1111+ struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component);
1112+ u8 clkdir = 0, format = 0;
1113+ int master = 0;
1114+
1115+ /* set master/slave audio interface */
1116+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1117+ case SND_SOC_DAIFMT_CBP_CFP:
1118+ master = 1;
1119+ clkdir = ADC3XXX_BCLK_MASTER | ADC3XXX_WCLK_MASTER;
1120+ break;
1121+ case SND_SOC_DAIFMT_CBC_CFC:
1122+ master = 0;
1123+ break;
1124+ default:
1125+ dev_err(component->dev, "Invalid DAI clock setup\n");
1126+ return -EINVAL;
1127+ }
1128+
1129+ /*
1130+ * match both interface format and signal polarities since they
1131+ * are fixed
1132+ */
1133+ switch (fmt & (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK)) {
1134+ case SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF:
1135+ format = ADC3XXX_FORMAT_I2S;
1136+ break;
1137+ case SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF:
1138+ format = ADC3XXX_FORMAT_DSP;
1139+ break;
1140+ case SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF:
1141+ format = ADC3XXX_FORMAT_DSP;
1142+ break;
1143+ case SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF:
1144+ format = ADC3XXX_FORMAT_RJF;
1145+ break;
1146+ case SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF:
1147+ format = ADC3XXX_FORMAT_LJF;
1148+ break;
1149+ default:
1150+ dev_err(component->dev, "Invalid DAI format\n");
1151+ return -EINVAL;
1152+ }
1153+
1154+ /* Add/del route enabling BCLK output as applicable */
1155+ if (master && !adc3xxx->master)
1156+ snd_soc_dapm_add_routes(dapm, adc3xxx_bclk_out_intercon,
1157+ ARRAY_SIZE(adc3xxx_bclk_out_intercon));
1158+ else if (!master && adc3xxx->master)
1159+ snd_soc_dapm_del_routes(dapm, adc3xxx_bclk_out_intercon,
1160+ ARRAY_SIZE(adc3xxx_bclk_out_intercon));
1161+ adc3xxx->master = master;
1162+
1163+ /* set clock direction and format */
1164+ return snd_soc_component_update_bits(component,
1165+ ADC3XXX_INTERFACE_CTRL_1,
1166+ ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
1167+ clkdir | format);
1168+}
1169+
1170+static const struct snd_soc_dai_ops adc3xxx_dai_ops = {
1171+ .hw_params = adc3xxx_hw_params,
1172+ .set_sysclk = adc3xxx_set_dai_sysclk,
1173+ .set_fmt = adc3xxx_set_dai_fmt,
1174+};
1175+
1176+static struct snd_soc_dai_driver adc3xxx_dai = {
1177+ .name = "tlv320adc3xxx-hifi",
1178+ .capture = {
1179+ .stream_name = "Capture",
1180+ .channels_min = 1,
1181+ .channels_max = 2,
1182+ .rates = ADC3XXX_RATES,
1183+ .formats = ADC3XXX_FORMATS,
1184+ },
1185+ .ops = &adc3xxx_dai_ops,
1186+};
1187+
1188+static const struct snd_soc_component_driver soc_component_dev_adc3xxx = {
1189+ .controls = adc3xxx_snd_controls,
1190+ .num_controls = ARRAY_SIZE(adc3xxx_snd_controls),
1191+ .dapm_widgets = adc3xxx_dapm_widgets,
1192+ .num_dapm_widgets = ARRAY_SIZE(adc3xxx_dapm_widgets),
1193+ .dapm_routes = adc3xxx_intercon,
1194+ .num_dapm_routes = ARRAY_SIZE(adc3xxx_intercon),
1195+};
1196+
1197+static int adc3xxx_i2c_probe(struct i2c_client *i2c,
1198+ const struct i2c_device_id *id)
1199+{
1200+ struct device *dev = &i2c->dev;
1201+ struct adc3xxx *adc3xxx = NULL;
1202+ int ret;
1203+
1204+ adc3xxx = devm_kzalloc(dev, sizeof(struct adc3xxx), GFP_KERNEL);
1205+ if (!adc3xxx)
1206+ return -ENOMEM;
1207+ adc3xxx->dev = dev;
1208+
1209+ adc3xxx->rst_pin = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
1210+ if (IS_ERR(adc3xxx->rst_pin)) {
1211+ return dev_err_probe(dev, PTR_ERR(adc3xxx->rst_pin),
1212+ "Failed to request rst_pin\n");
1213+ }
1214+
1215+ adc3xxx->mclk = devm_clk_get(dev, NULL);
1216+ if (IS_ERR(adc3xxx->mclk)) {
1217+ /*
1218+ * The chip itself supports running off the BCLK either
1219+ * directly or via the PLL, but the driver does not (yet), so
1220+ * having a specified mclk is required. Otherwise, we could
1221+ * use the lack of a clocks property to indicate when BCLK is
1222+ * intended as the clock source.
1223+ */
1224+ return dev_err_probe(dev, PTR_ERR(adc3xxx->mclk),
1225+ "Failed to acquire MCLK\n");
1226+ } else if (adc3xxx->mclk) {
1227+ ret = clk_prepare_enable(adc3xxx->mclk);
1228+ if (ret < 0)
1229+ return ret;
1230+ dev_dbg(dev, "Enabled MCLK, freq %lu Hz\n", clk_get_rate(adc3xxx->mclk));
1231+ }
1232+
1233+ ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmdin-gpio1", &adc3xxx->gpio_cfg[0]);
1234+ if (ret < 0)
1235+ goto err_unprepare_mclk;
1236+ ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmclk-gpio2", &adc3xxx->gpio_cfg[1]);
1237+ if (ret < 0)
1238+ goto err_unprepare_mclk;
1239+ ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias1-vg", &adc3xxx->micbias_vg[0]);
1240+ if (ret < 0)
1241+ goto err_unprepare_mclk;
1242+ ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias2-vg", &adc3xxx->micbias_vg[1]);
1243+ if (ret < 0)
1244+ goto err_unprepare_mclk;
1245+
1246+ adc3xxx->regmap = devm_regmap_init_i2c(i2c, &adc3xxx_regmap);
1247+ if (IS_ERR(adc3xxx->regmap)) {
1248+ ret = PTR_ERR(adc3xxx->regmap);
1249+ goto err_unprepare_mclk;
1250+ }
1251+
1252+ i2c_set_clientdata(i2c, adc3xxx);
1253+
1254+ adc3xxx->type = id->driver_data;
1255+
1256+ /* Reset codec chip */
1257+ gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
1258+ usleep_range(2000, 100000); /* Requirement: > 10 ns (datasheet p13) */
1259+ gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
1260+
1261+ /* Potentially set up pins used as GPIOs */
1262+ adc3xxx_init_gpio(adc3xxx);
1263+
1264+ ret = snd_soc_register_component(dev,
1265+ &soc_component_dev_adc3xxx, &adc3xxx_dai, 1);
1266+ if (ret < 0) {
1267+ dev_err(dev, "Failed to register codec: %d\n", ret);
1268+ goto err_unprepare_mclk;
1269+ }
1270+
1271+ return 0;
1272+
1273+err_unprepare_mclk:
1274+ clk_disable_unprepare(adc3xxx->mclk);
1275+ return ret;
1276+}
1277+
1278+static int __exit adc3xxx_i2c_remove(struct i2c_client *client)
1279+{
1280+ struct adc3xxx *adc3xxx = i2c_get_clientdata(client);
1281+
1282+ if (adc3xxx->mclk)
1283+ clk_disable_unprepare(adc3xxx->mclk);
1284+ adc3xxx_free_gpio(adc3xxx);
1285+ snd_soc_unregister_component(&client->dev);
1286+ return 0;
1287+}
1288+
1289+static const struct of_device_id tlv320adc3xxx_of_match[] = {
1290+ { .compatible = "ti,tlv320adc3001", },
1291+ { .compatible = "ti,tlv320adc3101", },
1292+ {},
1293+};
1294+MODULE_DEVICE_TABLE(of, tlv320adc3xxx_of_match);
1295+
1296+static const struct i2c_device_id adc3xxx_i2c_id[] = {
1297+ { "tlv320adc3001", ADC3001 },
1298+ { "tlv320adc3101", ADC3101 },
1299+ {}
1300+};
1301+MODULE_DEVICE_TABLE(i2c, adc3xxx_i2c_id);
1302+
1303+static struct i2c_driver adc3xxx_i2c_driver = {
1304+ .driver = {
1305+ .name = "tlv320adc3xxx-codec",
1306+ .of_match_table = tlv320adc3xxx_of_match,
1307+ },
1308+ .probe = adc3xxx_i2c_probe,
1309+ .remove = adc3xxx_i2c_remove,
1310+ .id_table = adc3xxx_i2c_id,
1311+};
1312+
1313+module_i2c_driver(adc3xxx_i2c_driver);
1314+
1315+MODULE_DESCRIPTION("ASoC TLV320ADC3xxx codec driver");
1316+MODULE_AUTHOR("shahina.s@mistralsolutions.com");
1317+MODULE_LICENSE("GPL v2");
sound/soc/codecs/tlv320aic26.h+3−3
@@ -6,8 +6,8 @@ · 5 unmodified lines
66 * Copyright (C) 2008 Secret Lab Technologies Ltd.
77 */
88
9−#ifndef _TLV320AIC16_H_
10−#define _TLV320AIC16_H_
9+#ifndef _TLV320AIC26_H_
10+#define _TLV320AIC26_H_
1111
1212 /* AIC26 Registers */
1313 #define AIC26_PAGE_ADDR(page, offset) ((page << 11) | offset << 5)
@@ -88,4 +88,4 @@ enum aic26_wlen { · 74 unmodified lines
8888 AIC26_WLEN_32 = 3 << 10,
8989 };
9090
91−#endif /* _TLV320AIC16_H_ */
91+#endif /* _TLV320AIC26_H_ */
sound/soc/codecs/tlv320aic31xx.c+75−46
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/module.h>
1616 #include <linux/moduleparam.h>
1717 #include <linux/init.h>
18+#include <linux/clk.h>
1819 #include <linux/delay.h>
1920 #include <linux/pm.h>
2021 #include <linux/i2c.h>
@@ -169,6 +170,7 @@ struct aic31xx_priv { · 148 unmodified lines
169170 struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
170171 struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
171172 struct snd_soc_jack *jack;
173+ u32 sysclk_id;
172174 unsigned int sysclk;
173175 u8 p_div;
174176 int rate_div_line;
@@ -180,6 +182,7 @@ struct aic31xx_priv { · 5 unmodified lines
180182 struct aic31xx_rate_divs {
181183 u32 mclk_p;
182184 u32 rate;
185+ u8 pll_r;
183186 u8 pll_j;
184187 u16 pll_d;
185188 u16 dosr;
@@ -192,51 +195,71 @@ struct aic31xx_rate_divs { · 6 unmodified lines
192195
193196 /* ADC dividers can be disabled by configuring them to 0 */
194197 static const struct aic31xx_rate_divs aic31xx_divs[] = {
195− /* mclk/p rate pll: j d dosr ndac mdac aors nadc madc */
198+ /* mclk/p rate pll: r j d dosr ndac mdac aors nadc madc */
196199 /* 8k rate */
197− {12000000, 8000, 8, 1920, 128, 48, 2, 128, 48, 2},
198− {12000000, 8000, 8, 1920, 128, 32, 3, 128, 32, 3},
199− {12500000, 8000, 7, 8643, 128, 48, 2, 128, 48, 2},
200+ { 512000, 8000, 4, 48, 0, 128, 48, 2, 128, 48, 2},
201+ {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2},
202+ {12000000, 8000, 1, 8, 1920, 128, 32, 3, 128, 32, 3},
203+ {12500000, 8000, 1, 7, 8643, 128, 48, 2, 128, 48, 2},
200204 /* 11.025k rate */
201− {12000000, 11025, 7, 5264, 128, 32, 2, 128, 32, 2},
202− {12000000, 11025, 8, 4672, 128, 24, 3, 128, 24, 3},
203− {12500000, 11025, 7, 2253, 128, 32, 2, 128, 32, 2},
205+ { 705600, 11025, 3, 48, 0, 128, 24, 3, 128, 24, 3},
206+ {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2},
207+ {12000000, 11025, 1, 8, 4672, 128, 24, 3, 128, 24, 3},
208+ {12500000, 11025, 1, 7, 2253, 128, 32, 2, 128, 32, 2},
204209 /* 16k rate */
205− {12000000, 16000, 8, 1920, 128, 24, 2, 128, 24, 2},
206− {12000000, 16000, 8, 1920, 128, 16, 3, 128, 16, 3},
207− {12500000, 16000, 7, 8643, 128, 24, 2, 128, 24, 2},
210+ { 512000, 16000, 4, 48, 0, 128, 16, 3, 128, 16, 3},
211+ { 1024000, 16000, 2, 48, 0, 128, 16, 3, 128, 16, 3},
212+ {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2},
213+ {12000000, 16000, 1, 8, 1920, 128, 16, 3, 128, 16, 3},
214+ {12500000, 16000, 1, 7, 8643, 128, 24, 2, 128, 24, 2},
208215 /* 22.05k rate */
209− {12000000, 22050, 7, 5264, 128, 16, 2, 128, 16, 2},
210− {12000000, 22050, 8, 4672, 128, 12, 3, 128, 12, 3},
211− {12500000, 22050, 7, 2253, 128, 16, 2, 128, 16, 2},
216+ { 705600, 22050, 4, 36, 0, 128, 12, 3, 128, 12, 3},
217+ { 1411200, 22050, 2, 36, 0, 128, 12, 3, 128, 12, 3},
218+ {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2},
219+ {12000000, 22050, 1, 8, 4672, 128, 12, 3, 128, 12, 3},
220+ {12500000, 22050, 1, 7, 2253, 128, 16, 2, 128, 16, 2},
212221 /* 32k rate */
213− {12000000, 32000, 8, 1920, 128, 12, 2, 128, 12, 2},
214− {12000000, 32000, 8, 1920, 128, 8, 3, 128, 8, 3},
215− {12500000, 32000, 7, 8643, 128, 12, 2, 128, 12, 2},
222+ { 1024000, 32000, 2, 48, 0, 128, 12, 2, 128, 12, 2},
223+ { 2048000, 32000, 1, 48, 0, 128, 12, 2, 128, 12, 2},
224+ {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2},
225+ {12000000, 32000, 1, 8, 1920, 128, 8, 3, 128, 8, 3},
226+ {12500000, 32000, 1, 7, 8643, 128, 12, 2, 128, 12, 2},
216227 /* 44.1k rate */
217− {12000000, 44100, 7, 5264, 128, 8, 2, 128, 8, 2},
218− {12000000, 44100, 8, 4672, 128, 6, 3, 128, 6, 3},
219− {12500000, 44100, 7, 2253, 128, 8, 2, 128, 8, 2},
228+ { 1411200, 44100, 2, 32, 0, 128, 8, 2, 128, 8, 2},
229+ { 2822400, 44100, 1, 32, 0, 128, 8, 2, 128, 8, 2},
230+ {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2},
231+ {12000000, 44100, 1, 8, 4672, 128, 6, 3, 128, 6, 3},
232+ {12500000, 44100, 1, 7, 2253, 128, 8, 2, 128, 8, 2},
220233 /* 48k rate */
221− {12000000, 48000, 8, 1920, 128, 8, 2, 128, 8, 2},
222− {12000000, 48000, 7, 6800, 96, 5, 4, 96, 5, 4},
223− {12500000, 48000, 7, 8643, 128, 8, 2, 128, 8, 2},
234+ { 1536000, 48000, 2, 32, 0, 128, 8, 2, 128, 8, 2},
235+ { 3072000, 48000, 1, 32, 0, 128, 8, 2, 128, 8, 2},
236+ {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2},
237+ {12000000, 48000, 1, 7, 6800, 96, 5, 4, 96, 5, 4},
238+ {12500000, 48000, 1, 7, 8643, 128, 8, 2, 128, 8, 2},
224239 /* 88.2k rate */
225− {12000000, 88200, 7, 5264, 64, 8, 2, 64, 8, 2},
226− {12000000, 88200, 8, 4672, 64, 6, 3, 64, 6, 3},
227− {12500000, 88200, 7, 2253, 64, 8, 2, 64, 8, 2},
240+ { 2822400, 88200, 2, 16, 0, 64, 8, 2, 64, 8, 2},
241+ { 5644800, 88200, 1, 16, 0, 64, 8, 2, 64, 8, 2},
242+ {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2},
243+ {12000000, 88200, 1, 8, 4672, 64, 6, 3, 64, 6, 3},
244+ {12500000, 88200, 1, 7, 2253, 64, 8, 2, 64, 8, 2},
228245 /* 96k rate */
229− {12000000, 96000, 8, 1920, 64, 8, 2, 64, 8, 2},
230− {12000000, 96000, 7, 6800, 48, 5, 4, 48, 5, 4},
231− {12500000, 96000, 7, 8643, 64, 8, 2, 64, 8, 2},
246+ { 3072000, 96000, 2, 16, 0, 64, 8, 2, 64, 8, 2},
247+ { 6144000, 96000, 1, 16, 0, 64, 8, 2, 64, 8, 2},
248+ {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2},
249+ {12000000, 96000, 1, 7, 6800, 48, 5, 4, 48, 5, 4},
250+ {12500000, 96000, 1, 7, 8643, 64, 8, 2, 64, 8, 2},
232251 /* 176.4k rate */
233− {12000000, 176400, 7, 5264, 32, 8, 2, 32, 8, 2},
234− {12000000, 176400, 8, 4672, 32, 6, 3, 32, 6, 3},
235− {12500000, 176400, 7, 2253, 32, 8, 2, 32, 8, 2},
252+ { 5644800, 176400, 2, 8, 0, 32, 8, 2, 32, 8, 2},
253+ {11289600, 176400, 1, 8, 0, 32, 8, 2, 32, 8, 2},
254+ {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2},
255+ {12000000, 176400, 1, 8, 4672, 32, 6, 3, 32, 6, 3},
256+ {12500000, 176400, 1, 7, 2253, 32, 8, 2, 32, 8, 2},
236257 /* 192k rate */
237− {12000000, 192000, 8, 1920, 32, 8, 2, 32, 8, 2},
238− {12000000, 192000, 7, 6800, 24, 5, 4, 24, 5, 4},
239− {12500000, 192000, 7, 8643, 32, 8, 2, 32, 8, 2},
258+ { 6144000, 192000, 2, 8, 0, 32, 8, 2, 32, 8, 2},
259+ {12288000, 192000, 1, 8, 0, 32, 8, 2, 32, 8, 2},
260+ {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2},
261+ {12000000, 192000, 1, 7, 6800, 24, 5, 4, 24, 5, 4},
262+ {12500000, 192000, 1, 7, 8643, 32, 8, 2, 32, 8, 2},
240263 };
241264
242265 static const char * const ldac_in_text[] = {
@@ -888,7 +911,7 @@ static int aic31xx_setup_pll(struct snd_soc_component *component, · 645 unmodified lines
888911
889912 /* PLL configuration */
890913 snd_soc_component_update_bits(component, AIC31XX_PLLPR, AIC31XX_PLL_MASK,
891− (aic31xx->p_div << 4) | 0x01);
914+ (aic31xx->p_div << 4) | aic31xx_divs[i].pll_r);
892915 snd_soc_component_write(component, AIC31XX_PLLJ, aic31xx_divs[i].pll_j);
893916
894917 snd_soc_component_write(component, AIC31XX_PLLDMSB,
@@ -941,6 +964,7 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream, · 46 unmodified lines
941964 struct snd_soc_dai *dai)
942965 {
943966 struct snd_soc_component *component = dai->component;
967+ struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
944968 u8 data = 0;
945969
946970 dev_dbg(component->dev, "## %s: width %d rate %d\n",
@@ -972,6 +996,16 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream, · 25 unmodified lines
972996 AIC31XX_IFACE1_DATALEN_MASK,
973997 data);
974998
999+ /*
1000+ * If BCLK is used as PLL input, the sysclk is determined by the hw
1001+ * params. So it must be updated here to match the input frequency.
1002+ */
1003+ if (aic31xx->sysclk_id == AIC31XX_PLL_CLKIN_BCLK) {
1004+ aic31xx->sysclk = params_rate(params) * params_width(params) *
1005+ params_channels(params);
1006+ aic31xx->p_div = 1;
1007+ }
1008+
9751009 return aic31xx_setup_pll(component, params);
9761010 }
9771011
@@ -1156,6 +1190,7 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai, · 178 unmodified lines
11561190 snd_soc_component_update_bits(component, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK,
11571191 clk_id << AIC31XX_PLL_CLKIN_SHIFT);
11581192
1193+ aic31xx->sysclk_id = clk_id;
11591194 aic31xx->sysclk = freq;
11601195
11611196 return 0;
@@ -1645,11 +1680,9 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c, · 483 unmodified lines
16451680
16461681 aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
16471682 GPIOD_OUT_LOW);
1648− if (IS_ERR(aic31xx->gpio_reset)) {
1649− if (PTR_ERR(aic31xx->gpio_reset) != -EPROBE_DEFER)
1650− dev_err(aic31xx->dev, "not able to acquire gpio\n");
1651− return PTR_ERR(aic31xx->gpio_reset);
1652− }
1683+ if (IS_ERR(aic31xx->gpio_reset))
1684+ return dev_err_probe(aic31xx->dev, PTR_ERR(aic31xx->gpio_reset),
1685+ "not able to acquire gpio\n");
16531686
16541687 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
16551688 aic31xx->supplies[i].supply = aic31xx_supply_names[i];
@@ -1657,12 +1690,8 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c, · 1 unmodified line
16571690 ret = devm_regulator_bulk_get(aic31xx->dev,
16581691 ARRAY_SIZE(aic31xx->supplies),
16591692 aic31xx->supplies);
1660− if (ret) {
1661− if (ret != -EPROBE_DEFER)
1662− dev_err(aic31xx->dev,
1663− "Failed to request supplies: %d\n", ret);
1664− return ret;
1665− }
1693+ if (ret)
1694+ return dev_err_probe(aic31xx->dev, ret, "Failed to request supplies\n");
16661695
16671696 aic31xx_configure_ocmv(aic31xx);
16681697
sound/soc/codecs/tlv320aic31xx.h+1−1
@@ -118,7 +118,7 @@ struct aic31xx_pdata { · 117 unmodified lines
118118 #define AIC31XX_PLL_CLKIN_MASK GENMASK(3, 2)
119119 #define AIC31XX_PLL_CLKIN_SHIFT (2)
120120 #define AIC31XX_PLL_CLKIN_MCLK 0x00
121−#define AIC31XX_PLL_CLKIN_BCKL 0x01
121+#define AIC31XX_PLL_CLKIN_BCLK 0x01
122122 #define AIC31XX_PLL_CLKIN_GPIO1 0x02
123123 #define AIC31XX_PLL_CLKIN_DIN 0x03
124124 #define AIC31XX_CODEC_CLKIN_MASK GENMASK(1, 0)
sound/soc/codecs/wcd-mbhc-v2.c+67−9
@@ -1022,6 +1022,52 @@ static int wcd_mbhc_get_plug_from_adc(struct wcd_mbhc *mbhc, int adc_result) · 1021 unmodified lines
10221022 return plug_type;
10231023 }
10241024
1025+static int wcd_mbhc_get_spl_hs_thres(struct wcd_mbhc *mbhc)
1026+{
1027+ int hs_threshold, micbias_mv;
1028+
1029+ micbias_mv = wcd_mbhc_get_micbias(mbhc);
1030+ if (mbhc->cfg->hs_thr && mbhc->cfg->micb_mv != WCD_MBHC_ADC_MICBIAS_MV) {
1031+ if (mbhc->cfg->micb_mv == micbias_mv)
1032+ hs_threshold = mbhc->cfg->hs_thr;
1033+ else
1034+ hs_threshold = (mbhc->cfg->hs_thr * micbias_mv) / mbhc->cfg->micb_mv;
1035+ } else {
1036+ hs_threshold = ((WCD_MBHC_ADC_HS_THRESHOLD_MV * micbias_mv) /
1037+ WCD_MBHC_ADC_MICBIAS_MV);
1038+ }
1039+ return hs_threshold;
1040+}
1041+
1042+static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
1043+{
1044+ bool is_spl_hs = false;
1045+ int output_mv, hs_threshold, hph_threshold;
1046+
1047+ if (!mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
1048+ return false;
1049+
1050+ /* Bump up MIC_BIAS2 to 2.7V */
1051+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, true);
1052+ usleep_range(10000, 10100);
1053+
1054+ output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
1055+ hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
1056+ hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
1057+
1058+ if (!(output_mv > hs_threshold || output_mv < hph_threshold))
1059+ is_spl_hs = true;
1060+
1061+ /* Back MIC_BIAS2 to 1.8v if the type is not special headset */
1062+ if (!is_spl_hs) {
1063+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, false);
1064+ /* Add 10ms delay for micbias to settle */
1065+ usleep_range(10000, 10100);
1066+ }
1067+
1068+ return is_spl_hs;
1069+}
1070+
10251071 static void wcd_correct_swch_plug(struct work_struct *work)
10261072 {
10271073 struct wcd_mbhc *mbhc;
@@ -1029,12 +1075,14 @@ static void wcd_correct_swch_plug(struct work_struct *work) · 1 unmodified line
10291075 enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
10301076 unsigned long timeout;
10311077 int pt_gnd_mic_swap_cnt = 0;
1032− int output_mv, cross_conn, hs_threshold, try = 0;
1078+ int output_mv, cross_conn, hs_threshold, try = 0, micbias_mv;
1079+ bool is_spl_hs = false;
10331080 bool is_pa_on;
10341081
10351082 mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
10361083 component = mbhc->component;
10371084
1085+ micbias_mv = wcd_mbhc_get_micbias(mbhc);
10381086 hs_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
10391087
10401088 /* Mask ADC COMPLETE interrupt */
@@ -1097,6 +1145,16 @@ correct_plug_type: · 56 unmodified lines
10971145 plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
10981146 is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
10991147
1148+ if (output_mv > hs_threshold && !is_spl_hs) {
1149+ is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
1150+ output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
1151+
1152+ if (is_spl_hs) {
1153+ hs_threshold *= wcd_mbhc_get_micbias(mbhc);
1154+ hs_threshold /= micbias_mv;
1155+ }
1156+ }
1157+
11001158 if ((output_mv <= hs_threshold) && !is_pa_on) {
11011159 /* Check for cross connection*/
11021160 cross_conn = wcd_check_cross_conn(mbhc);
@@ -1122,14 +1180,19 @@ correct_plug_type: · 19 unmodified lines
11221180 }
11231181 }
11241182
1125− if (output_mv > hs_threshold) /* cable is extension cable */
1183+ /* cable is extension cable */
1184+ if (output_mv > hs_threshold || mbhc->force_linein)
11261185 plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
11271186 }
11281187
11291188 wcd_mbhc_bcs_enable(mbhc, plug_type, true);
11301189
1131− if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH)
1132− wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
1190+ if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH) {
1191+ if (is_spl_hs)
1192+ plug_type = MBHC_PLUG_TYPE_HEADSET;
1193+ else
1194+ wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
1195+ }
11331196
11341197 wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
11351198 wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);
@@ -1176,7 +1239,6 @@ static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data) · 40 unmodified lines
11761239 struct wcd_mbhc *mbhc = data;
11771240 unsigned long timeout;
11781241 int adc_threshold, output_mv, retry = 0;
1179− bool hphpa_on = false;
11801242
11811243 mutex_lock(&mbhc->lock);
11821244 timeout = jiffies + msecs_to_jiffies(WCD_FAKE_REMOVAL_MIN_PERIOD_MS);
@@ -1210,10 +1272,6 @@ static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data) · 27 unmodified lines
12101272 wcd_mbhc_elec_hs_report_unplug(mbhc);
12111273 wcd_mbhc_write_field(mbhc, WCD_MBHC_BTN_ISRC_CTL, 0);
12121274
1213− if (hphpa_on) {
1214− hphpa_on = false;
1215− wcd_mbhc_write_field(mbhc, WCD_MBHC_HPH_PA_EN, 3);
1216− }
12171275 exit:
12181276 mutex_unlock(&mbhc->lock);
12191277 return IRQ_HANDLED;
sound/soc/codecs/wcd9335.c+9−8
@@ -341,7 +341,7 @@ struct wcd9335_codec { · 340 unmodified lines
341341 int reset_gpio;
342342 struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
343343
344− unsigned int rx_port_value;
344+ unsigned int rx_port_value[WCD9335_RX_MAX];
345345 unsigned int tx_port_value;
346346 int hph_l_gain;
347347 int hph_r_gain;
@@ -1269,10 +1269,11 @@ static const struct snd_kcontrol_new sb_tx8_mux = · 921 unmodified lines
12691269 static int slim_rx_mux_get(struct snd_kcontrol *kc,
12701270 struct snd_ctl_elem_value *ucontrol)
12711271 {
1272− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc);
1273− struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev);
1272+ struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kc);
1273+ struct wcd9335_codec *wcd = dev_get_drvdata(w->dapm->dev);
1274+ u32 port_id = w->shift;
12741275
1275− ucontrol->value.enumerated.item[0] = wcd->rx_port_value;
1276+ ucontrol->value.enumerated.item[0] = wcd->rx_port_value[port_id];
12761277
12771278 return 0;
12781279 }
@@ -1286,9 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, · 7 unmodified lines
12861287 struct snd_soc_dapm_update *update = NULL;
12871288 u32 port_id = w->shift;
12881289
1289− wcd->rx_port_value = ucontrol->value.enumerated.item[0];
1290+ wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
12901291
1291− switch (wcd->rx_port_value) {
1292+ switch (wcd->rx_port_value[port_id]) {
12921293 case 0:
12931294 list_del_init(&wcd->rx_chs[port_id].list);
12941295 break;
@@ -1309,11 +1310,11 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, · 14 unmodified lines
13091310 &wcd->dai[AIF4_PB].slim_ch_list);
13101311 break;
13111312 default:
1312− dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value);
1313+ dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value[port_id]);
13131314 goto err;
13141315 }
13151316
1316− snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value,
1317+ snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
13171318 e, update);
13181319
13191320 return 0;
sound/soc/codecs/wcd934x.c+2−4
@@ -3423,7 +3423,7 @@ static int wcd934x_int_dem_inp_mux_put(struct snd_kcontrol *kc, · 3422 unmodified lines
34233423 {
34243424 struct soc_enum *e = (struct soc_enum *)kc->private_value;
34253425 struct snd_soc_component *component;
3426− int reg, val, ret;
3426+ int reg, val;
34273427
34283428 component = snd_soc_dapm_kcontrol_component(kc);
34293429 val = ucontrol->value.enumerated.item[0];
@@ -3446,9 +3446,7 @@ static int wcd934x_int_dem_inp_mux_put(struct snd_kcontrol *kc, · 16 unmodified lines
34463446 WCD934X_RX_DLY_ZN_EN_MASK,
34473447 WCD934X_RX_DLY_ZN_DISABLE);
34483448
3449− ret = snd_soc_dapm_put_enum_double(kc, ucontrol);
3450−
3451− return ret;
3449+ return snd_soc_dapm_put_enum_double(kc, ucontrol);
34523450 }
34533451
34543452 static int wcd934x_dec_enum_put(struct snd_kcontrol *kcontrol,
sound/soc/codecs/wcd938x.c+3−5
@@ -3086,7 +3086,7 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon · 3085 unmodified lines
30863086 int micb_num, bool req_en)
30873087 {
30883088 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
3089− int rc, micb_mv;
3089+ int micb_mv;
30903090
30913091 if (micb_num != MIC_BIAS_2)
30923092 return -EINVAL;
@@ -3100,9 +3100,7 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon · 7 unmodified lines
31003100
31013101 micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : wcd938x->micb2_mv;
31023102
3103− rc = wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
3104−
3105− return rc;
3103+ return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
31063104 }
31073105
31083106 static inline void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x,
@@ -4287,7 +4285,7 @@ static int wcd938x_codec_set_sdw_stream(struct snd_soc_dai *dai, · 1178 unmodified lines
42874285 static const struct snd_soc_dai_ops wcd938x_sdw_dai_ops = {
42884286 .hw_params = wcd938x_codec_hw_params,
42894287 .hw_free = wcd938x_codec_free,
4290− .set_sdw_stream = wcd938x_codec_set_sdw_stream,
4288+ .set_stream = wcd938x_codec_set_sdw_stream,
42914289 };
42924290
42934291 static struct snd_soc_dai_driver wcd938x_dais[] = {
sound/soc/codecs/wm_adsp.c+27−34
@@ -401,7 +401,7 @@ static int wm_coeff_put(struct snd_kcontrol *kctl, · 400 unmodified lines
401401 int ret = 0;
402402
403403 mutex_lock(&cs_ctl->dsp->pwr_lock);
404− ret = cs_dsp_coeff_write_ctrl(cs_ctl, p, cs_ctl->len);
404+ ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, p, cs_ctl->len);
405405 mutex_unlock(&cs_ctl->dsp->pwr_lock);
406406
407407 return ret;
@@ -421,7 +421,7 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl, · 13 unmodified lines
421421 if (copy_from_user(cs_ctl->cache, bytes, size))
422422 ret = -EFAULT;
423423 else
424− ret = cs_dsp_coeff_write_ctrl(cs_ctl, cs_ctl->cache, size);
424+ ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, cs_ctl->cache, size);
425425
426426 mutex_unlock(&cs_ctl->dsp->pwr_lock);
427427
@@ -464,7 +464,7 @@ static int wm_coeff_get(struct snd_kcontrol *kctl, · 36 unmodified lines
464464 int ret;
465465
466466 mutex_lock(&cs_ctl->dsp->pwr_lock);
467− ret = cs_dsp_coeff_read_ctrl(cs_ctl, p, cs_ctl->len);
467+ ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, p, cs_ctl->len);
468468 mutex_unlock(&cs_ctl->dsp->pwr_lock);
469469
470470 return ret;
@@ -481,7 +481,7 @@ static int wm_coeff_tlv_get(struct snd_kcontrol *kctl, · 10 unmodified lines
481481
482482 mutex_lock(&cs_ctl->dsp->pwr_lock);
483483
484− ret = cs_dsp_coeff_read_ctrl(cs_ctl, cs_ctl->cache, size);
484+ ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, cs_ctl->cache, size);
485485
486486 if (!ret && copy_to_user(bytes, cs_ctl->cache, size))
487487 ret = -EFAULT;
@@ -537,15 +537,20 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) · 49 unmodified lines
537537 return out;
538538 }
539539
540−static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl)
540+static void wm_adsp_ctl_work(struct work_struct *work)
541541 {
542+ struct wm_coeff_ctl *ctl = container_of(work,
543+ struct wm_coeff_ctl,
544+ work);
542545 struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
546+ struct wm_adsp *dsp = container_of(cs_ctl->dsp,
547+ struct wm_adsp,
548+ cs_dsp);
543549 struct snd_kcontrol_new *kcontrol;
544− int ret;
545550
546551 kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
547552 if (!kcontrol)
548− return -ENOMEM;
553+ return;
549554
550555 kcontrol->name = ctl->name;
551556 kcontrol->info = wm_coeff_info;
@@ -571,29 +576,9 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl) · 19 unmodified lines
571576 break;
572577 }
573578
574− ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1);
575− if (ret < 0)
576− goto err_kcontrol;
577−
578− kfree(kcontrol);
579−
580− return 0;
579+ snd_soc_add_component_controls(dsp->component, kcontrol, 1);
581580
582−err_kcontrol:
583581 kfree(kcontrol);
584− return ret;
585−}
586−
587−static void wm_adsp_ctl_work(struct work_struct *work)
588−{
589− struct wm_coeff_ctl *ctl = container_of(work,
590− struct wm_coeff_ctl,
591− work);
592− struct wm_adsp *dsp = container_of(ctl->cs_ctl->dsp,
593− struct wm_adsp,
594− cs_dsp);
595−
596− wmfw_add_ctl(dsp, ctl);
597582 }
598583
599584 static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
@@ -700,7 +685,7 @@ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, · 100 unmodified lines
700685 if (len > cs_ctl->len)
701686 return -EINVAL;
702687
703− ret = cs_dsp_coeff_write_ctrl(cs_ctl, buf, len);
688+ ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len);
704689 if (ret)
705690 return ret;
706691
@@ -739,7 +724,7 @@ int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type, · 32 unmodified lines
739724 if (len > cs_ctl->len)
740725 return -EINVAL;
741726
742− return cs_dsp_coeff_read_ctrl(cs_ctl, buf, len);
727+ return cs_dsp_coeff_read_ctrl(cs_ctl, 0, buf, len);
743728 }
744729 EXPORT_SYMBOL_GPL(wm_adsp_read_ctl);
745730
@@ -911,11 +896,12 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, · 165 unmodified lines
911896 struct wm_adsp *dsp = &dsps[mc->shift - 1];
912897 char preload[32];
913898
914− snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
899+ if (dsp->preloaded == ucontrol->value.integer.value[0])
900+ return 0;
915901
916− dsp->preloaded = ucontrol->value.integer.value[0];
902+ snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
917903
918− if (ucontrol->value.integer.value[0])
904+ if (ucontrol->value.integer.value[0] || dsp->toggle_preload)
919905 snd_soc_component_force_enable_pin(component, preload);
920906 else
921907 snd_soc_component_disable_pin(component, preload);
@@ -924,6 +910,13 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, · 2 unmodified lines
924910
925911 flush_work(&dsp->boot_work);
926912
913+ dsp->preloaded = ucontrol->value.integer.value[0];
914+
915+ if (dsp->toggle_preload) {
916+ snd_soc_component_disable_pin(component, preload);
917+ snd_soc_dapm_sync(dapm);
918+ }
919+
927920 return 0;
928921 }
929922 EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put);
@@ -1448,7 +1441,7 @@ static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl) · 518 unmodified lines
14481441 int ret, i;
14491442
14501443 for (i = 0; i < 5; ++i) {
1451− ret = cs_dsp_coeff_read_ctrl(cs_ctl, &coeff_v1, sizeof(coeff_v1));
1444+ ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, sizeof(coeff_v1));
14521445 if (ret < 0)
14531446 return ret;
14541447
sound/soc/codecs/wm_adsp.h+8−0
@@ -41,6 +41,14 @@ struct wm_adsp { · 40 unmodified lines
4141
4242 struct list_head compr_list;
4343 struct list_head buffer_list;
44+
45+ /*
46+ * Flag indicating the preloader widget only needs power toggled
47+ * on state change rather than held on for the duration of the
48+ * preload, useful for devices that can retain firmware memory
49+ * across power down.
50+ */
51+ bool toggle_preload;
4452 };
4553
4654 #define WM_ADSP1(wname, num) \
sound/soc/codecs/wsa881x.c+1−1
@@ -1026,7 +1026,7 @@ static const struct snd_soc_dai_ops wsa881x_dai_ops = { · 1025 unmodified lines
10261026 .hw_params = wsa881x_hw_params,
10271027 .hw_free = wsa881x_hw_free,
10281028 .mute_stream = wsa881x_digital_mute,
1029− .set_sdw_stream = wsa881x_set_sdw_stream,
1029+ .set_stream = wsa881x_set_sdw_stream,
10301030 };
10311031
10321032 static struct snd_soc_dai_driver wsa881x_dais[] = {
sound/soc/codecs/zl38060.c+1−3
@@ -589,9 +589,7 @@ static int zl38_spi_probe(struct spi_device *spi) · 588 unmodified lines
589589 sizeof(template_chip), GFP_KERNEL);
590590 if (!priv->gpio_chip)
591591 return -ENOMEM;
592−#ifdef CONFIG_OF_GPIO
593− priv->gpio_chip->of_node = dev->of_node;
594−#endif
592+ priv->gpio_chip->parent = dev;
595593 err = devm_gpiochip_add_data(dev, priv->gpio_chip, priv->regmap);
596594 if (err)
597595 return err;
sound/soc/fsl/Kconfig+1−0
@@ -311,6 +311,7 @@ config SND_SOC_FSL_ASOC_CARD · 310 unmodified lines
311311 select SND_SOC_FSL_ESAI
312312 select SND_SOC_FSL_SAI
313313 select SND_SOC_FSL_SSI
314+ select SND_SOC_TLV320AIC31XX
314315 select SND_SOC_WM8994
315316 select MFD_WM8994
316317 help
sound/soc/fsl/fsl-asoc-card.c+13−2
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include "../codecs/wm8962.h"
2727 #include "../codecs/wm8960.h"
2828 #include "../codecs/wm8994.h"
29+#include "../codecs/tlv320aic31xx.h"
2930
3031 #define CS427x_SYSCLK_MCLK 0
3132
@@ -629,6 +630,16 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) · 597 unmodified lines
629630 } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic32x4")) {
630631 codec_dai_name = "tlv320aic32x4-hifi";
631632 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
633+ } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) {
634+ codec_dai_name = "tlv320dac31xx-hifi";
635+ priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
636+ priv->dai_link[1].dpcm_capture = 0;
637+ priv->dai_link[2].dpcm_capture = 0;
638+ priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
639+ priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
640+ priv->codec_priv.mclk_id = AIC31XX_PLL_CLKIN_BCLK;
641+ priv->card.dapm_routes = audio_map_tx;
642+ priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
632643 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
633644 codec_dai_name = "wm8962";
634645 priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK;
@@ -842,8 +853,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) · 207 unmodified lines
842853
843854 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
844855 if (ret) {
845− if (ret != -EPROBE_DEFER)
846− dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
856+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
847857 goto asrc_fail;
848858 }
849859
@@ -888,6 +898,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = { · 38 unmodified lines
888898 { .compatible = "fsl,imx-audio-cs42888", },
889899 { .compatible = "fsl,imx-audio-cs427x", },
890900 { .compatible = "fsl,imx-audio-tlv320aic32x4", },
901+ { .compatible = "fsl,imx-audio-tlv320aic31xx", },
891902 { .compatible = "fsl,imx-audio-sgtl5000", },
892903 { .compatible = "fsl,imx-audio-wm8962", },
893904 { .compatible = "fsl,imx-audio-wm8960", },
sound/soc/fsl/fsl_asrc.c+58−11
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include "fsl_asrc.h"
2020
2121 #define IDEAL_RATIO_DECIMAL_DEPTH 26
22+#define DIVIDER_NUM 64
2223
2324 #define pair_err(fmt, ...) \
2425 dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
@@ -101,6 +102,55 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = { · 76 unmodified lines
101102 },
102103 };
103104
105+/*
106+ * According to RM, the divider range is 1 ~ 8,
107+ * prescaler is power of 2 from 1 ~ 128.
108+ */
109+static int asrc_clk_divider[DIVIDER_NUM] = {
110+ 1, 2, 4, 8, 16, 32, 64, 128, /* divider = 1 */
111+ 2, 4, 8, 16, 32, 64, 128, 256, /* divider = 2 */
112+ 3, 6, 12, 24, 48, 96, 192, 384, /* divider = 3 */
113+ 4, 8, 16, 32, 64, 128, 256, 512, /* divider = 4 */
114+ 5, 10, 20, 40, 80, 160, 320, 640, /* divider = 5 */
115+ 6, 12, 24, 48, 96, 192, 384, 768, /* divider = 6 */
116+ 7, 14, 28, 56, 112, 224, 448, 896, /* divider = 7 */
117+ 8, 16, 32, 64, 128, 256, 512, 1024, /* divider = 8 */
118+};
119+
120+/*
121+ * Check if the divider is available for internal ratio mode
122+ */
123+static bool fsl_asrc_divider_avail(int clk_rate, int rate, int *div)
124+{
125+ u32 rem, i;
126+ u64 n;
127+
128+ if (div)
129+ *div = 0;
130+
131+ if (clk_rate == 0 || rate == 0)
132+ return false;
133+
134+ n = clk_rate;
135+ rem = do_div(n, rate);
136+
137+ if (div)
138+ *div = n;
139+
140+ if (rem != 0)
141+ return false;
142+
143+ for (i = 0; i < DIVIDER_NUM; i++) {
144+ if (n == asrc_clk_divider[i])
145+ break;
146+ }
147+
148+ if (i == DIVIDER_NUM)
149+ return false;
150+
151+ return true;
152+}
153+
104154 /**
105155 * fsl_asrc_sel_proc - Select the pre-processing and post-processing options
106156 * @inrate: input sample rate
@@ -330,12 +380,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) · 223 unmodified lines
330380 enum asrc_word_width input_word_width;
331381 enum asrc_word_width output_word_width;
332382 u32 inrate, outrate, indiv, outdiv;
333− u32 clk_index[2], div[2], rem[2];
383+ u32 clk_index[2], div[2];
334384 u64 clk_rate;
335385 int in, out, channels;
336386 int pre_proc, post_proc;
337387 struct clk *clk;
338− bool ideal;
388+ bool ideal, div_avail;
339389
340390 if (!config) {
341391 pair_err("invalid pair config\n");
@@ -415,8 +465,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) · 73 unmodified lines
415465 clk = asrc_priv->asrck_clk[clk_index[ideal ? OUT : IN]];
416466
417467 clk_rate = clk_get_rate(clk);
418− rem[IN] = do_div(clk_rate, inrate);
419− div[IN] = (u32)clk_rate;
468+ div_avail = fsl_asrc_divider_avail(clk_rate, inrate, &div[IN]);
420469
421470 /*
422471 * The divider range is [1, 1024], defined by the hardware. For non-
@@ -425,7 +474,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) · 2 unmodified lines
425474 * only result in different converting speeds. So remainder does not
426475 * matter, as long as we keep the divider within its valid range.
427476 */
428− if (div[IN] == 0 || (!ideal && (div[IN] > 1024 || rem[IN] != 0))) {
477+ if (div[IN] == 0 || (!ideal && !div_avail)) {
429478 pair_err("failed to support input sample rate %dHz by asrck_%x\n",
430479 inrate, clk_index[ideal ? OUT : IN]);
431480 return -EINVAL;
@@ -436,13 +485,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) · 4 unmodified lines
436485 clk = asrc_priv->asrck_clk[clk_index[OUT]];
437486 clk_rate = clk_get_rate(clk);
438487 if (ideal && use_ideal_rate)
439− rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE);
488+ div_avail = fsl_asrc_divider_avail(clk_rate, IDEAL_RATIO_RATE, &div[OUT]);
440489 else
441− rem[OUT] = do_div(clk_rate, outrate);
442− div[OUT] = clk_rate;
490+ div_avail = fsl_asrc_divider_avail(clk_rate, outrate, &div[OUT]);
443491
444492 /* Output divider has the same limitation as the input one */
445− if (div[OUT] == 0 || (!ideal && (div[OUT] > 1024 || rem[OUT] != 0))) {
493+ if (div[OUT] == 0 || (!ideal && !div_avail)) {
446494 pair_err("failed to support output sample rate %dHz by asrck_%x\n",
447495 outrate, clk_index[OUT]);
448496 return -EINVAL;
@@ -621,8 +669,7 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv, · 172 unmodified lines
621669 clk_index = asrc_priv->clk_map[j][i];
622670 clk_rate = clk_get_rate(asrc_priv->asrck_clk[clk_index]);
623671 /* Only match a perfect clock source with no remainder */
624− if (clk_rate != 0 && (clk_rate / rate[j]) <= 1024 &&
625− (clk_rate % rate[j]) == 0)
672+ if (fsl_asrc_divider_avail(clk_rate, rate[j], NULL))
626673 break;
627674 }
628675
sound/soc/fsl/fsl_mqs.c+1−1
@@ -337,4 +337,4 @@ module_platform_driver(fsl_mqs_driver); · 336 unmodified lines
337337 MODULE_AUTHOR("Shengjiu Wang <Shengjiu.Wang@nxp.com>");
338338 MODULE_DESCRIPTION("MQS codec driver");
339339 MODULE_LICENSE("GPL v2");
340−MODULE_ALIAS("platform: fsl-mqs");
340+MODULE_ALIAS("platform:fsl-mqs");
sound/soc/fsl/imx-card.c+30−19
@@ -120,7 +120,7 @@ struct imx_card_data { · 119 unmodified lines
120120
121121 static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {
122122 /* Normal, < 32kHz */
123− { .rmin = 8000, .rmax = 24000, .wmin = 1024, .wmax = 1024, },
123+ { .rmin = 8000, .rmax = 24000, .wmin = 256, .wmax = 1024, },
124124 /* Normal, 32kHz */
125125 { .rmin = 32000, .rmax = 32000, .wmin = 256, .wmax = 1024, },
126126 /* Normal */
@@ -151,8 +151,8 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = { · 24 unmodified lines
151151 * Table 7 - mapping multiplier and speed mode
152152 * Tables 8 & 9 - mapping speed mode and LRCK fs
153153 */
154− { .rmin = 8000, .rmax = 32000, .wmin = 1024, .wmax = 1024, }, /* Normal, <= 32kHz */
155− { .rmin = 44100, .rmax = 48000, .wmin = 512, .wmax = 512, }, /* Normal */
154+ { .rmin = 8000, .rmax = 32000, .wmin = 256, .wmax = 1024, }, /* Normal, <= 32kHz */
155+ { .rmin = 44100, .rmax = 48000, .wmin = 256, .wmax = 512, }, /* Normal */
156156 { .rmin = 88200, .rmax = 96000, .wmin = 256, .wmax = 256, }, /* Double */
157157 { .rmin = 176400, .rmax = 192000, .wmin = 128, .wmax = 128, }, /* Quad */
158158 { .rmin = 352800, .rmax = 384000, .wmin = 128, .wmax = 128, }, /* Oct */
@@ -164,7 +164,7 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = { · 5 unmodified lines
164164 * (Table 4 from datasheet)
165165 */
166166 static struct imx_akcodec_fs_mul ak5558_fs_mul[] = {
167− { .rmin = 8000, .rmax = 32000, .wmin = 1024, .wmax = 1024, },
167+ { .rmin = 8000, .rmax = 32000, .wmin = 512, .wmax = 1024, },
168168 { .rmin = 44100, .rmax = 48000, .wmin = 512, .wmax = 512, },
169169 { .rmin = 88200, .rmax = 96000, .wmin = 256, .wmax = 256, },
170170 { .rmin = 176400, .rmax = 192000, .wmin = 128, .wmax = 128, },
@@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type) · 76 unmodified lines
247247 }
248248
249249 static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
250− struct snd_pcm_hw_params *params)
250+ struct snd_pcm_hw_params *params,
251+ int slots, int slot_width)
251252 {
252253 struct snd_soc_pcm_runtime *rtd = substream->private_data;
253254 struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
254255 const struct imx_card_plat_data *plat_data = data->plat_data;
255256 struct dai_link_data *link_data = &data->link_data[rtd->num];
256− unsigned int width = link_data->slots * link_data->slot_width;
257+ unsigned int width = slots * slot_width;
257258 unsigned int rate = params_rate(params);
258259 int i;
259260
@@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream, · 89 unmodified lines
349350
350351 /* Set MCLK freq */
351352 if (codec_is_akcodec(plat_data->type))
352− mclk_freq = akcodec_get_mclk_rate(substream, params);
353+ mclk_freq = akcodec_get_mclk_rate(substream, params, slots, slot_width);
353354 else
354355 mclk_freq = params_rate(params) * slots * slot_width;
355356 /* Use the maximum freq from DSD512 (512*44100 = 22579200) */
@@ -553,8 +554,23 @@ static int imx_card_parse_of(struct imx_card_data *data) · 197 unmodified lines
553554 link_data->cpu_sysclk_id = FSL_SAI_CLK_MAST1;
554555
555556 /* sai may support mclk/bclk = 1 */
556− if (of_find_property(np, "fsl,mclk-equal-bclk", NULL))
557+ if (of_find_property(np, "fsl,mclk-equal-bclk", NULL)) {
557558 link_data->one2one_ratio = true;
559+ } else {
560+ int i;
561+
562+ /*
563+ * i.MX8MQ don't support one2one ratio, then
564+ * with ak4497 only 16bit case is supported.
565+ */
566+ for (i = 0; i < ARRAY_SIZE(ak4497_fs_mul); i++) {
567+ if (ak4497_fs_mul[i].rmin == 705600 &&
568+ ak4497_fs_mul[i].rmax == 768000) {
569+ ak4497_fs_mul[i].wmin = 32;
570+ ak4497_fs_mul[i].wmax = 32;
571+ }
572+ }
573+ }
558574 }
559575
560576 link->cpus->of_node = args.np;
@@ -563,9 +579,8 @@ static int imx_card_parse_of(struct imx_card_data *data) · 2 unmodified lines
563579
564580 ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
565581 if (ret) {
566− if (ret != -EPROBE_DEFER)
567− dev_err(card->dev, "%s: error getting cpu dai name: %d\n",
568− link->name, ret);
582+ dev_err_probe(card->dev, ret,
583+ "%s: error getting cpu dai name\n", link->name);
569584 goto err;
570585 }
571586
@@ -573,9 +588,8 @@ static int imx_card_parse_of(struct imx_card_data *data) · 1 unmodified line
573588 if (codec) {
574589 ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
575590 if (ret < 0) {
576− if (ret != -EPROBE_DEFER)
577− dev_err(dev, "%s: codec dai not found: %d\n",
578− link->name, ret);
591+ dev_err_probe(dev, ret, "%s: codec dai not found\n",
592+ link->name);
579593 goto err;
580594 }
581595
@@ -814,11 +828,8 @@ static int imx_card_probe(struct platform_device *pdev) · 232 unmodified lines
814828 }
815829
816830 ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
817− if (ret) {
818− if (ret != -EPROBE_DEFER)
819− dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
820− return ret;
821− }
831+ if (ret)
832+ return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
822833
823834 return 0;
824835 }
sound/soc/fsl/imx-hdmi.c+2−0
@@ -145,6 +145,8 @@ static int imx_hdmi_probe(struct platform_device *pdev) · 144 unmodified lines
145145 data->dai.capture_only = false;
146146 data->dai.init = imx_hdmi_init;
147147
148+ put_device(&cpu_pdev->dev);
149+
148150 if (of_node_name_eq(cpu_np, "sai")) {
149151 data->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1;
150152 data->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1;
sound/soc/fsl/imx-sgtl5000.c+1−3
@@ -173,9 +173,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) · 172 unmodified lines
173173
174174 ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
175175 if (ret) {
176− if (ret != -EPROBE_DEFER)
177− dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
178− ret);
176+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
179177 goto fail;
180178 }
181179
sound/soc/fsl/imx-spdif.c+2−2
@@ -70,8 +70,8 @@ static int imx_spdif_audio_probe(struct platform_device *pdev) · 69 unmodified lines
7070 goto end;
7171
7272 ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
73− if (ret && ret != -EPROBE_DEFER)
74− dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret);
73+ if (ret)
74+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
7575
7676 end:
7777 of_node_put(spdif_np);
sound/soc/generic/audio-graph-card.c+1−4
@@ -593,10 +593,7 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev) · 592 unmodified lines
593593 err:
594594 asoc_simple_clean_reference(card);
595595
596− if (ret != -EPROBE_DEFER)
597− dev_err(dev, "parse error %d\n", ret);
598−
599− return ret;
596+ return dev_err_probe(dev, ret, "parse error\n");
600597 }
601598 EXPORT_SYMBOL_GPL(audio_graph_parse_of);
602599
sound/soc/generic/audio-graph-card2.c+2−2
@@ -1238,8 +1238,8 @@ int audio_graph2_parse_of(struct asoc_simple_priv *priv, struct device *dev, · 1237 unmodified lines
12381238 err:
12391239 devm_kfree(dev, li);
12401240
1241− if ((ret < 0) && (ret != -EPROBE_DEFER))
1242− dev_err(dev, "parse error %d\n", ret);
1241+ if (ret < 0)
1242+ dev_err_probe(dev, ret, "parse error\n");
12431243
12441244 return ret;
12451245 }
sound/soc/generic/simple-card-utils.c+1−44
@@ -499,57 +499,14 @@ EXPORT_SYMBOL_GPL(asoc_simple_parse_widgets); · 498 unmodified lines
499499 int asoc_simple_parse_pin_switches(struct snd_soc_card *card,
500500 char *prefix)
501501 {
502− const unsigned int nb_controls_max = 16;
503− const char **strings, *control_name;
504− struct snd_kcontrol_new *controls;
505− struct device *dev = card->dev;
506− unsigned int i, nb_controls;
507502 char prop[128];
508− int ret;
509503
510504 if (!prefix)
511505 prefix = "";
512506
513507 snprintf(prop, sizeof(prop), "%s%s", prefix, "pin-switches");
514508
515− if (!of_property_read_bool(dev->of_node, prop))
516− return 0;
517−
518− strings = devm_kcalloc(dev, nb_controls_max,
519− sizeof(*strings), GFP_KERNEL);
520− if (!strings)
521− return -ENOMEM;
522−
523− ret = of_property_read_string_array(dev->of_node, prop,
524− strings, nb_controls_max);
525− if (ret < 0)
526− return ret;
527−
528− nb_controls = (unsigned int)ret;
529−
530− controls = devm_kcalloc(dev, nb_controls,
531− sizeof(*controls), GFP_KERNEL);
532− if (!controls)
533− return -ENOMEM;
534−
535− for (i = 0; i < nb_controls; i++) {
536− control_name = devm_kasprintf(dev, GFP_KERNEL,
537− "%s Switch", strings[i]);
538− if (!control_name)
539− return -ENOMEM;
540−
541− controls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
542− controls[i].name = control_name;
543− controls[i].info = snd_soc_dapm_info_pin_switch;
544− controls[i].get = snd_soc_dapm_get_pin_switch;
545− controls[i].put = snd_soc_dapm_put_pin_switch;
546− controls[i].private_value = (unsigned long)strings[i];
547− }
548−
549− card->controls = controls;
550− card->num_controls = nb_controls;
551−
552− return 0;
509+ return snd_soc_of_parse_pin_switches(card, prop);
553510 }
554511 EXPORT_SYMBOL_GPL(asoc_simple_parse_pin_switches);
555512
sound/soc/generic/simple-card.c+1−2
@@ -642,8 +642,7 @@ static int asoc_simple_probe(struct platform_device *pdev) · 641 unmodified lines
642642
643643 ret = simple_parse_of(priv, li);
644644 if (ret < 0) {
645− if (ret != -EPROBE_DEFER)
646− dev_err(dev, "parse error %d\n", ret);
645+ dev_err_probe(dev, ret, "parse error\n");
647646 goto err;
648647 }
649648
sound/soc/generic/test-component.c+2−3
@@ -531,8 +531,7 @@ static int test_driver_probe(struct platform_device *pdev) · 530 unmodified lines
531531 struct device *dev = &pdev->dev;
532532 struct device_node *node = dev->of_node;
533533 struct device_node *ep;
534− const struct of_device_id *of_id = of_match_device(test_of_match, &pdev->dev);
535− const struct test_adata *adata = of_id->data;
534+ const struct test_adata *adata = of_device_get_match_data(&pdev->dev);
536535 struct snd_soc_component_driver *cdriv;
537536 struct snd_soc_dai_driver *ddriv;
538537 struct test_dai_name *dname;
@@ -549,7 +548,7 @@ static int test_driver_probe(struct platform_device *pdev) · 10 unmodified lines
549548 cdriv = devm_kzalloc(dev, sizeof(*cdriv), GFP_KERNEL);
550549 ddriv = devm_kzalloc(dev, sizeof(*ddriv) * num, GFP_KERNEL);
551550 dname = devm_kzalloc(dev, sizeof(*dname) * num, GFP_KERNEL);
552− if (!priv || !cdriv || !ddriv || !dname)
551+ if (!priv || !cdriv || !ddriv || !dname || !adata)
553552 return -EINVAL;
554553
555554 priv->dev = dev;
sound/soc/img/img-i2s-in.c+3−5
@@ -451,11 +451,9 @@ static int img_i2s_in_probe(struct platform_device *pdev) · 450 unmodified lines
451451 i2s->channel_base = base + (max_i2s_chan_pow_2 * 0x20);
452452
453453 i2s->clk_sys = devm_clk_get(dev, "sys");
454− if (IS_ERR(i2s->clk_sys)) {
455− if (PTR_ERR(i2s->clk_sys) != -EPROBE_DEFER)
456− dev_err(dev, "Failed to acquire clock 'sys'\n");
457− return PTR_ERR(i2s->clk_sys);
458− }
454+ if (IS_ERR(i2s->clk_sys))
455+ return dev_err_probe(dev, PTR_ERR(i2s->clk_sys),
456+ "Failed to acquire clock 'sys'\n");
459457
460458 pm_runtime_enable(&pdev->dev);
461459 if (!pm_runtime_enabled(&pdev->dev)) {
sound/soc/img/img-i2s-out.c+9−15
@@ -457,25 +457,19 @@ static int img_i2s_out_probe(struct platform_device *pdev) · 456 unmodified lines
457457 i2s->channel_base = base + (max_i2s_chan_pow_2 * 0x20);
458458
459459 i2s->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
460− if (IS_ERR(i2s->rst)) {
461− if (PTR_ERR(i2s->rst) != -EPROBE_DEFER)
462− dev_err(&pdev->dev, "No top level reset found\n");
463− return PTR_ERR(i2s->rst);
464− }
460+ if (IS_ERR(i2s->rst))
461+ return dev_err_probe(&pdev->dev, PTR_ERR(i2s->rst),
462+ "No top level reset found\n");
465463
466464 i2s->clk_sys = devm_clk_get(&pdev->dev, "sys");
467− if (IS_ERR(i2s->clk_sys)) {
468− if (PTR_ERR(i2s->clk_sys) != -EPROBE_DEFER)
469− dev_err(dev, "Failed to acquire clock 'sys'\n");
470− return PTR_ERR(i2s->clk_sys);
471− }
465+ if (IS_ERR(i2s->clk_sys))
466+ return dev_err_probe(dev, PTR_ERR(i2s->clk_sys),
467+ "Failed to acquire clock 'sys'\n");
472468
473469 i2s->clk_ref = devm_clk_get(&pdev->dev, "ref");
474− if (IS_ERR(i2s->clk_ref)) {
475− if (PTR_ERR(i2s->clk_ref) != -EPROBE_DEFER)
476− dev_err(dev, "Failed to acquire clock 'ref'\n");
477− return PTR_ERR(i2s->clk_ref);
478− }
470+ if (IS_ERR(i2s->clk_ref))
471+ return dev_err_probe(dev, PTR_ERR(i2s->clk_ref),
472+ "Failed to acquire clock 'ref'\n");
479473
480474 i2s->suspend_ch_ctl = devm_kcalloc(dev,
481475 i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL);
sound/soc/img/img-parallel-out.c+9−15
@@ -229,25 +229,19 @@ static int img_prl_out_probe(struct platform_device *pdev) · 228 unmodified lines
229229 prl->base = base;
230230
231231 prl->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
232− if (IS_ERR(prl->rst)) {
233− if (PTR_ERR(prl->rst) != -EPROBE_DEFER)
234− dev_err(&pdev->dev, "No top level reset found\n");
235− return PTR_ERR(prl->rst);
236− }
232+ if (IS_ERR(prl->rst))
233+ return dev_err_probe(&pdev->dev, PTR_ERR(prl->rst),
234+ "No top level reset found\n");
237235
238236 prl->clk_sys = devm_clk_get(&pdev->dev, "sys");
239− if (IS_ERR(prl->clk_sys)) {
240− if (PTR_ERR(prl->clk_sys) != -EPROBE_DEFER)
241− dev_err(dev, "Failed to acquire clock 'sys'\n");
242− return PTR_ERR(prl->clk_sys);
243− }
237+ if (IS_ERR(prl->clk_sys))
238+ return dev_err_probe(dev, PTR_ERR(prl->clk_sys),
239+ "Failed to acquire clock 'sys'\n");
244240
245241 prl->clk_ref = devm_clk_get(&pdev->dev, "ref");
246− if (IS_ERR(prl->clk_ref)) {
247− if (PTR_ERR(prl->clk_ref) != -EPROBE_DEFER)
248− dev_err(dev, "Failed to acquire clock 'ref'\n");
249− return PTR_ERR(prl->clk_ref);
250− }
242+ if (IS_ERR(prl->clk_ref))
243+ return dev_err_probe(dev, PTR_ERR(prl->clk_ref),
244+ "Failed to acquire clock 'ref'\n");
251245
252246 ret = clk_prepare_enable(prl->clk_sys);
253247 if (ret)
sound/soc/img/img-spdif-in.c+3−5
@@ -739,11 +739,9 @@ static int img_spdif_in_probe(struct platform_device *pdev) · 738 unmodified lines
739739 spdif->base = base;
740740
741741 spdif->clk_sys = devm_clk_get(dev, "sys");
742− if (IS_ERR(spdif->clk_sys)) {
743− if (PTR_ERR(spdif->clk_sys) != -EPROBE_DEFER)
744− dev_err(dev, "Failed to acquire clock 'sys'\n");
745− return PTR_ERR(spdif->clk_sys);
746− }
742+ if (IS_ERR(spdif->clk_sys))
743+ return dev_err_probe(dev, PTR_ERR(spdif->clk_sys),
744+ "Failed to acquire clock 'sys'\n");
747745
748746 pm_runtime_enable(&pdev->dev);
749747 if (!pm_runtime_enabled(&pdev->dev)) {
sound/soc/img/img-spdif-out.c+9−15
@@ -342,25 +342,19 @@ static int img_spdif_out_probe(struct platform_device *pdev) · 341 unmodified lines
342342 spdif->base = base;
343343
344344 spdif->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
345− if (IS_ERR(spdif->rst)) {
346− if (PTR_ERR(spdif->rst) != -EPROBE_DEFER)
347− dev_err(&pdev->dev, "No top level reset found\n");
348− return PTR_ERR(spdif->rst);
349− }
345+ if (IS_ERR(spdif->rst))
346+ return dev_err_probe(&pdev->dev, PTR_ERR(spdif->rst),
347+ "No top level reset found\n");
350348
351349 spdif->clk_sys = devm_clk_get(&pdev->dev, "sys");
352− if (IS_ERR(spdif->clk_sys)) {
353− if (PTR_ERR(spdif->clk_sys) != -EPROBE_DEFER)
354− dev_err(dev, "Failed to acquire clock 'sys'\n");
355− return PTR_ERR(spdif->clk_sys);
356− }
350+ if (IS_ERR(spdif->clk_sys))
351+ return dev_err_probe(dev, PTR_ERR(spdif->clk_sys),
352+ "Failed to acquire clock 'sys'\n");
357353
358354 spdif->clk_ref = devm_clk_get(&pdev->dev, "ref");
359− if (IS_ERR(spdif->clk_ref)) {
360− if (PTR_ERR(spdif->clk_ref) != -EPROBE_DEFER)
361− dev_err(dev, "Failed to acquire clock 'ref'\n");
362− return PTR_ERR(spdif->clk_ref);
363− }
355+ if (IS_ERR(spdif->clk_ref))
356+ return dev_err_probe(dev, PTR_ERR(spdif->clk_ref),
357+ "Failed to acquire clock 'ref'\n");
364358
365359 pm_runtime_enable(&pdev->dev);
366360 if (!pm_runtime_enabled(&pdev->dev)) {
sound/soc/img/pistachio-internal-dac.c+3−6
@@ -161,12 +161,9 @@ static int pistachio_internal_dac_probe(struct platform_device *pdev) · 160 unmodified lines
161161 return PTR_ERR(dac->regmap);
162162
163163 dac->supply = devm_regulator_get(dev, "VDD");
164− if (IS_ERR(dac->supply)) {
165− ret = PTR_ERR(dac->supply);
166− if (ret != -EPROBE_DEFER)
167− dev_err(dev, "failed to acquire supply 'VDD-supply': %d\n", ret);
168− return ret;
169− }
164+ if (IS_ERR(dac->supply))
165+ return dev_err_probe(dev, PTR_ERR(dac->supply),
166+ "failed to acquire supply 'VDD-supply'\n");
170167
171168 ret = regulator_enable(dac->supply);
172169 if (ret) {
sound/soc/intel/atom/sst-mfld-platform-pcm.c+13−1
@@ -653,10 +653,21 @@ static snd_pcm_uframes_t sst_soc_pointer(struct snd_soc_component *component, · 652 unmodified lines
653653 dev_err(rtd->dev, "sst: error code = %d\n", ret_val);
654654 return ret_val;
655655 }
656− substream->runtime->delay = str_info->pcm_delay;
657656 return str_info->buffer_ptr;
658657 }
659658
659+static snd_pcm_sframes_t sst_soc_delay(struct snd_soc_component *component,
660+ struct snd_pcm_substream *substream)
661+{
662+ struct sst_runtime_stream *stream = substream->runtime->private_data;
663+ struct pcm_stream_info *str_info = &stream->stream_info;
664+
665+ if (sst_get_stream_status(stream) == SST_PLATFORM_INIT)
666+ return 0;
667+
668+ return str_info->pcm_delay;
669+}
670+
660671 static int sst_soc_pcm_new(struct snd_soc_component *component,
661672 struct snd_soc_pcm_runtime *rtd)
662673 {
@@ -695,6 +706,7 @@ static const struct snd_soc_component_driver sst_soc_platform_drv = { · 32 unmodified lines
695706 .open = sst_soc_open,
696707 .trigger = sst_soc_trigger,
697708 .pointer = sst_soc_pointer,
709+ .delay = sst_soc_delay,
698710 .compress_ops = &sst_platform_compress_ops,
699711 .pcm_construct = sst_soc_pcm_new,
700712 };
sound/soc/intel/boards/Kconfig+20−0
@@ -467,6 +467,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH · 466 unmodified lines
467467 (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
468468 (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST))
469469 select SND_SOC_MAX98373_I2C
470+ select SND_SOC_MAX98390
470471 select SND_SOC_RT1011
471472 select SND_SOC_RT1015
472473 select SND_SOC_RT1015P
@@ -527,6 +528,25 @@ config SND_SOC_INTEL_SOF_ES8336_MACH · 54 unmodified lines
527528 Say Y if you have such a device.
528529 If unsure select "N".
529530
531+config SND_SOC_INTEL_SOF_NAU8825_MACH
532+ tristate "SOF with nau8825 codec in I2S Mode"
533+ depends on I2C && ACPI && GPIOLIB
534+ depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\
535+ (MFD_INTEL_LPSS || COMPILE_TEST))
536+ select SND_SOC_NAU8825
537+ select SND_SOC_RT1015P
538+ select SND_SOC_MAX98373_I2C
539+ select SND_SOC_MAX98357A
540+ select SND_SOC_DMIC
541+ select SND_SOC_HDAC_HDMI
542+ select SND_SOC_INTEL_HDA_DSP_COMMON
543+ select SND_SOC_INTEL_SOF_MAXIM_COMMON
544+ help
545+ This adds support for ASoC machine driver for SOF platforms
546+ with nau8825 codec.
547+ Say Y if you have such a device.
548+ If unsure select "N".
549+
530550 endif ## SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL
531551
532552 if (SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK)
sound/soc/intel/boards/Makefile+2−0
@@ -22,6 +22,7 @@ snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o · 21 unmodified lines
2222 snd-soc-sof_rt5682-objs := sof_rt5682.o sof_realtek_common.o
2323 snd-soc-sof_cs42l42-objs := sof_cs42l42.o
2424 snd-soc-sof_es8336-objs := sof_es8336.o
25+snd-soc-sof_nau8825-objs := sof_nau8825.o sof_realtek_common.o
2526 snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o
2627 snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
2728 snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o
@@ -44,6 +45,7 @@ snd-soc-sof-sdw-objs += sof_sdw.o \ · 16 unmodified lines
4445 obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o
4546 obj-$(CONFIG_SND_SOC_INTEL_SOF_CS42L42_MACH) += snd-soc-sof_cs42l42.o
4647 obj-$(CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH) += snd-soc-sof_es8336.o
48+obj-$(CONFIG_SND_SOC_INTEL_SOF_NAU8825_MACH) += snd-soc-sof_nau8825.o
4749 obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o
4850 obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON) += snd-soc-sst-bxt-da7219_max98357a.o
4951 obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o
sound/soc/intel/boards/bytcht_cx2072x.c+1−1
@@ -147,7 +147,7 @@ static int byt_cht_cx2072x_aif1_startup(struct snd_pcm_substream *substream) · 146 unmodified lines
147147 SNDRV_PCM_HW_PARAM_RATE, 48000);
148148 }
149149
150−static struct snd_soc_ops byt_cht_cx2072x_aif1_ops = {
150+static const struct snd_soc_ops byt_cht_cx2072x_aif1_ops = {
151151 .startup = byt_cht_cx2072x_aif1_startup,
152152 };
153153
sound/soc/intel/boards/bytcht_nocodec.c+1−1
@@ -93,7 +93,7 @@ static int aif1_startup(struct snd_pcm_substream *substream) · 92 unmodified lines
9393 &constraints_48000);
9494 }
9595
96−static struct snd_soc_ops aif1_ops = {
96+static const struct snd_soc_ops aif1_ops = {
9797 .startup = aif1_startup,
9898 };
9999
sound/soc/intel/boards/bytcr_rt5640.c+80−6
@@ -40,6 +40,8 @@ enum { · 39 unmodified lines
4040 BYT_RT5640_NO_INTERNAL_MIC_MAP,
4141 };
4242
43+#define RT5640_JD_SRC_EXT_GPIO 0x0f
44+
4345 enum {
4446 BYT_RT5640_JD_SRC_GPIO1 = (RT5640_JD_SRC_GPIO1 << 4),
4547 BYT_RT5640_JD_SRC_JD1_IN4P = (RT5640_JD_SRC_JD1_IN4P << 4),
@@ -47,6 +49,7 @@ enum { · 1 unmodified line
4749 BYT_RT5640_JD_SRC_GPIO2 = (RT5640_JD_SRC_GPIO2 << 4),
4850 BYT_RT5640_JD_SRC_GPIO3 = (RT5640_JD_SRC_GPIO3 << 4),
4951 BYT_RT5640_JD_SRC_GPIO4 = (RT5640_JD_SRC_GPIO4 << 4),
52+ BYT_RT5640_JD_SRC_EXT_GPIO = (RT5640_JD_SRC_EXT_GPIO << 4)
5053 };
5154
5255 enum {
@@ -79,6 +82,7 @@ enum { · 26 unmodified lines
7982 #define BYT_RT5640_LINEOUT_AS_HP2 BIT(26)
8083 #define BYT_RT5640_HSMIC2_ON_IN1 BIT(27)
8184 #define BYT_RT5640_JD_HP_ELITEP_1000G2 BIT(28)
85+#define BYT_RT5640_USE_AMCR0F28 BIT(29)
8286
8387 #define BYTCR_INPUT_DEFAULTS \
8488 (BYT_RT5640_IN3_MAP | \
@@ -93,6 +97,7 @@ enum { · 8 unmodified lines
9397 struct byt_rt5640_private {
9498 struct snd_soc_jack jack;
9599 struct snd_soc_jack jack2;
100+ struct rt5640_set_jack_data jack_data;
96101 struct gpio_desc *hsmic_detect;
97102 struct clk *mclk;
98103 struct device *codec_dev;
@@ -597,7 +602,8 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { · 498 unmodified lines
597602 BYT_RT5640_OVCD_TH_2000UA |
598603 BYT_RT5640_OVCD_SF_0P75 |
599604 BYT_RT5640_SSP0_AIF1 |
600− BYT_RT5640_MCLK_EN),
605+ BYT_RT5640_MCLK_EN |
606+ BYT_RT5640_USE_AMCR0F28),
601607 },
602608 {
603609 .matches = {
@@ -624,6 +630,19 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { · 20 unmodified lines
624630 BYT_RT5640_SSP0_AIF2 |
625631 BYT_RT5640_MCLK_EN),
626632 },
633+ {
634+ .matches = {
635+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
636+ DMI_MATCH(DMI_PRODUCT_NAME, "TF103C"),
637+ },
638+ .driver_data = (void *)(BYT_RT5640_IN1_MAP |
639+ BYT_RT5640_JD_SRC_EXT_GPIO |
640+ BYT_RT5640_OVCD_TH_2000UA |
641+ BYT_RT5640_OVCD_SF_0P75 |
642+ BYT_RT5640_SSP0_AIF1 |
643+ BYT_RT5640_MCLK_EN |
644+ BYT_RT5640_USE_AMCR0F28),
645+ },
627646 { /* Chuwi Vi8 (CWI506) */
628647 .matches = {
629648 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
@@ -1080,9 +1099,11 @@ static int byt_rt5640_add_codec_device_props(struct device *i2c_dev, · 450 unmodified lines
10801099 }
10811100
10821101 if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
1083− props[cnt++] = PROPERTY_ENTRY_U32(
1084− "realtek,jack-detect-source",
1085− BYT_RT5640_JDSRC(byt_rt5640_quirk));
1102+ if (BYT_RT5640_JDSRC(byt_rt5640_quirk) != RT5640_JD_SRC_EXT_GPIO) {
1103+ props[cnt++] = PROPERTY_ENTRY_U32(
1104+ "realtek,jack-detect-source",
1105+ BYT_RT5640_JDSRC(byt_rt5640_quirk));
1106+ }
10861107
10871108 props[cnt++] = PROPERTY_ENTRY_U32(
10881109 "realtek,over-current-threshold-microamp",
@@ -1109,6 +1130,51 @@ static int byt_rt5640_add_codec_device_props(struct device *i2c_dev, · 20 unmodified lines
11091130 return ret;
11101131 }
11111132
1133+/* Some Android devs specify IRQs/GPIOS in a special AMCR0F28 ACPI device */
1134+static const struct acpi_gpio_params amcr0f28_jd_gpio = { 1, 0, false };
1135+
1136+static const struct acpi_gpio_mapping amcr0f28_gpios[] = {
1137+ { "rt5640-jd-gpios", &amcr0f28_jd_gpio, 1 },
1138+ { }
1139+};
1140+
1141+static int byt_rt5640_get_amcr0f28_settings(struct snd_soc_card *card)
1142+{
1143+ struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
1144+ struct rt5640_set_jack_data *data = &priv->jack_data;
1145+ struct acpi_device *adev;
1146+ int ret = 0;
1147+
1148+ adev = acpi_dev_get_first_match_dev("AMCR0F28", "1", -1);
1149+ if (!adev) {
1150+ dev_err(card->dev, "error cannot find AMCR0F28 adev\n");
1151+ return -ENOENT;
1152+ }
1153+
1154+ data->codec_irq_override = acpi_dev_gpio_irq_get(adev, 0);
1155+ if (data->codec_irq_override < 0) {
1156+ ret = data->codec_irq_override;
1157+ dev_err(card->dev, "error %d getting codec IRQ\n", ret);
1158+ goto put_adev;
1159+ }
1160+
1161+ if (BYT_RT5640_JDSRC(byt_rt5640_quirk) == RT5640_JD_SRC_EXT_GPIO) {
1162+ acpi_dev_add_driver_gpios(adev, amcr0f28_gpios);
1163+ data->jd_gpio = devm_fwnode_gpiod_get(card->dev, acpi_fwnode_handle(adev),
1164+ "rt5640-jd", GPIOD_IN, "rt5640-jd");
1165+ acpi_dev_remove_driver_gpios(adev);
1166+
1167+ if (IS_ERR(data->jd_gpio)) {
1168+ ret = PTR_ERR(data->jd_gpio);
1169+ dev_err(card->dev, "error %d getting jd GPIO\n", ret);
1170+ }
1171+ }
1172+
1173+put_adev:
1174+ acpi_dev_put(adev);
1175+ return ret;
1176+}
1177+
11121178 static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
11131179 {
11141180 struct snd_soc_card *card = runtime->card;
@@ -1244,7 +1310,14 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) · 129 unmodified lines
12441310 }
12451311 snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0,
12461312 KEY_PLAYPAUSE);
1247− snd_soc_component_set_jack(component, &priv->jack, NULL);
1313+
1314+ if (byt_rt5640_quirk & BYT_RT5640_USE_AMCR0F28) {
1315+ ret = byt_rt5640_get_amcr0f28_settings(card);
1316+ if (ret)
1317+ return ret;
1318+ }
1319+
1320+ snd_soc_component_set_jack(component, &priv->jack, &priv->jack_data);
12481321 }
12491322
12501323 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) {
@@ -1448,7 +1521,8 @@ static int byt_rt5640_resume(struct snd_soc_card *card) · 197 unmodified lines
14481521 for_each_card_components(card, component) {
14491522 if (!strcmp(component->name, byt_rt5640_codec_name)) {
14501523 dev_dbg(component->dev, "re-enabling jack detect after resume\n");
1451− snd_soc_component_set_jack(component, &priv->jack, NULL);
1524+ snd_soc_component_set_jack(component, &priv->jack,
1525+ &priv->jack_data);
14521526 break;
14531527 }
14541528 }
sound/soc/intel/boards/hda_dsp_common.c+1−1
@@ -68,7 +68,7 @@ int hda_dsp_hdmi_build_controls(struct snd_soc_card *card, · 67 unmodified lines
6868 hpcm->pcm = NULL;
6969 hpcm->device = SNDRV_PCM_INVALID_DEVICE;
7070 dev_warn(card->dev,
71− "%s: no PCM in topology for HDMI converter %d\n\n",
71+ "%s: no PCM in topology for HDMI converter %d\n",
7272 __func__, i);
7373 }
7474 i++;
sound/soc/intel/boards/sof_maxim_common.c+180−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/string.h>
66 #include <sound/pcm.h>
77 #include <sound/soc.h>
8+#include <sound/soc-acpi.h>
89 #include <sound/soc-dai.h>
910 #include <sound/soc-dapm.h>
1011 #include <uapi/sound/asound.h>
@@ -133,6 +134,185 @@ void max_98373_set_codec_conf(struct snd_soc_card *card) · 122 unmodified lines
133134 }
134135 EXPORT_SYMBOL_NS(max_98373_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON);
135136
137+/*
138+ * Maxim MAX98390
139+ */
140+static const struct snd_soc_dapm_route max_98390_dapm_routes[] = {
141+ /* speaker */
142+ { "Left Spk", NULL, "Left BE_OUT" },
143+ { "Right Spk", NULL, "Right BE_OUT" },
144+};
145+
146+static const struct snd_kcontrol_new max_98390_tt_kcontrols[] = {
147+ SOC_DAPM_PIN_SWITCH("TL Spk"),
148+ SOC_DAPM_PIN_SWITCH("TR Spk"),
149+};
150+
151+static const struct snd_soc_dapm_widget max_98390_tt_dapm_widgets[] = {
152+ SND_SOC_DAPM_SPK("TL Spk", NULL),
153+ SND_SOC_DAPM_SPK("TR Spk", NULL),
154+};
155+
156+static const struct snd_soc_dapm_route max_98390_tt_dapm_routes[] = {
157+ /* Tweeter speaker */
158+ { "TL Spk", NULL, "Tweeter Left BE_OUT" },
159+ { "TR Spk", NULL, "Tweeter Right BE_OUT" },
160+};
161+
162+static struct snd_soc_codec_conf max_98390_codec_conf[] = {
163+ {
164+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV0_NAME),
165+ .name_prefix = "Right",
166+ },
167+ {
168+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV1_NAME),
169+ .name_prefix = "Left",
170+ },
171+};
172+
173+static struct snd_soc_codec_conf max_98390_4spk_codec_conf[] = {
174+ {
175+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV0_NAME),
176+ .name_prefix = "Right",
177+ },
178+ {
179+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV1_NAME),
180+ .name_prefix = "Left",
181+ },
182+ {
183+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV2_NAME),
184+ .name_prefix = "Tweeter Right",
185+ },
186+ {
187+ .dlc = COMP_CODEC_CONF(MAX_98390_DEV3_NAME),
188+ .name_prefix = "Tweeter Left",
189+ },
190+};
191+
192+struct snd_soc_dai_link_component max_98390_components[] = {
193+ {
194+ .name = MAX_98390_DEV0_NAME,
195+ .dai_name = MAX_98390_CODEC_DAI,
196+ },
197+ {
198+ .name = MAX_98390_DEV1_NAME,
199+ .dai_name = MAX_98390_CODEC_DAI,
200+ },
201+};
202+EXPORT_SYMBOL_NS(max_98390_components, SND_SOC_INTEL_SOF_MAXIM_COMMON);
203+
204+struct snd_soc_dai_link_component max_98390_4spk_components[] = {
205+ {
206+ .name = MAX_98390_DEV0_NAME,
207+ .dai_name = MAX_98390_CODEC_DAI,
208+ },
209+ {
210+ .name = MAX_98390_DEV1_NAME,
211+ .dai_name = MAX_98390_CODEC_DAI,
212+ },
213+ {
214+ .name = MAX_98390_DEV2_NAME,
215+ .dai_name = MAX_98390_CODEC_DAI,
216+ },
217+ {
218+ .name = MAX_98390_DEV3_NAME,
219+ .dai_name = MAX_98390_CODEC_DAI,
220+ },
221+};
222+EXPORT_SYMBOL_NS(max_98390_4spk_components, SND_SOC_INTEL_SOF_MAXIM_COMMON);
223+
224+static int max_98390_hw_params(struct snd_pcm_substream *substream,
225+ struct snd_pcm_hw_params *params)
226+{
227+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
228+ struct snd_soc_dai *codec_dai;
229+ int i;
230+
231+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
232+ if (i >= ARRAY_SIZE(max_98390_4spk_components)) {
233+ dev_err(codec_dai->dev, "invalid codec index %d\n", i);
234+ return -ENODEV;
235+ }
236+
237+ if (!strcmp(codec_dai->component->name, MAX_98390_DEV0_NAME)) {
238+ /* DEV0 tdm slot configuration Right */
239+ snd_soc_dai_set_tdm_slot(codec_dai, 0x01, 3, 4, 32);
240+ }
241+ if (!strcmp(codec_dai->component->name, MAX_98390_DEV1_NAME)) {
242+ /* DEV1 tdm slot configuration Left */
243+ snd_soc_dai_set_tdm_slot(codec_dai, 0x02, 3, 4, 32);
244+ }
245+
246+ if (!strcmp(codec_dai->component->name, MAX_98390_DEV2_NAME)) {
247+ /* DEVi2 tdm slot configuration Tweeter Right */
248+ snd_soc_dai_set_tdm_slot(codec_dai, 0x04, 3, 4, 32);
249+ }
250+ if (!strcmp(codec_dai->component->name, MAX_98390_DEV3_NAME)) {
251+ /* DEV3 tdm slot configuration Tweeter Left */
252+ snd_soc_dai_set_tdm_slot(codec_dai, 0x08, 3, 4, 32);
253+ }
254+ }
255+ return 0;
256+}
257+
258+int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
259+{
260+ struct snd_soc_card *card = rtd->card;
261+ int ret;
262+
263+ /* add regular speakers dapm route */
264+ ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_dapm_routes,
265+ ARRAY_SIZE(max_98390_dapm_routes));
266+ if (ret) {
267+ dev_err(rtd->dev, "unable to add Left/Right Speaker dapm, ret %d\n", ret);
268+ return ret;
269+ }
270+
271+ /* add widgets/controls/dapm for tweeter speakers */
272+ if (acpi_dev_present("MX98390", "3", -1)) {
273+ ret = snd_soc_dapm_new_controls(&card->dapm, max_98390_tt_dapm_widgets,
274+ ARRAY_SIZE(max_98390_tt_dapm_widgets));
275+
276+ if (ret) {
277+ dev_err(rtd->dev, "unable to add tweeter dapm controls, ret %d\n", ret);
278+ /* Don't need to add routes if widget addition failed */
279+ return ret;
280+ }
281+
282+ ret = snd_soc_add_card_controls(card, max_98390_tt_kcontrols,
283+ ARRAY_SIZE(max_98390_tt_kcontrols));
284+ if (ret) {
285+ dev_err(rtd->dev, "unable to add tweeter card controls, ret %d\n", ret);
286+ return ret;
287+ }
288+
289+ ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_tt_dapm_routes,
290+ ARRAY_SIZE(max_98390_tt_dapm_routes));
291+ if (ret)
292+ dev_err(rtd->dev,
293+ "unable to add Tweeter Left/Right Speaker dapm, ret %d\n", ret);
294+ }
295+ return ret;
296+}
297+EXPORT_SYMBOL_NS(max_98390_spk_codec_init, SND_SOC_INTEL_SOF_MAXIM_COMMON);
298+
299+const struct snd_soc_ops max_98390_ops = {
300+ .hw_params = max_98390_hw_params,
301+};
302+EXPORT_SYMBOL_NS(max_98390_ops, SND_SOC_INTEL_SOF_MAXIM_COMMON);
303+
304+void max_98390_set_codec_conf(struct snd_soc_card *card, int ch)
305+{
306+ if (ch == ARRAY_SIZE(max_98390_4spk_codec_conf)) {
307+ card->codec_conf = max_98390_4spk_codec_conf;
308+ card->num_configs = ARRAY_SIZE(max_98390_4spk_codec_conf);
309+ } else {
310+ card->codec_conf = max_98390_codec_conf;
311+ card->num_configs = ARRAY_SIZE(max_98390_codec_conf);
312+ }
313+}
314+EXPORT_SYMBOL_NS(max_98390_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON);
315+
136316 /*
137317 * Maxim MAX98357A/MAX98360A
138318 */
sound/soc/intel/boards/sof_maxim_common.h+16−0
@@ -24,6 +24,22 @@ int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd); · 23 unmodified lines
2424 void max_98373_set_codec_conf(struct snd_soc_card *card);
2525 int max_98373_trigger(struct snd_pcm_substream *substream, int cmd);
2626
27+/*
28+ * Maxim MAX98390
29+ */
30+#define MAX_98390_CODEC_DAI "max98390-aif1"
31+#define MAX_98390_DEV0_NAME "i2c-MX98390:00"
32+#define MAX_98390_DEV1_NAME "i2c-MX98390:01"
33+#define MAX_98390_DEV2_NAME "i2c-MX98390:02"
34+#define MAX_98390_DEV3_NAME "i2c-MX98390:03"
35+
36+extern struct snd_soc_dai_link_component max_98390_components[2];
37+extern struct snd_soc_dai_link_component max_98390_4spk_components[4];
38+extern const struct snd_soc_ops max_98390_ops;
39+
40+void max_98390_set_codec_conf(struct snd_soc_card *card, int ch);
41+int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd);
42+
2743 /*
2844 * Maxim MAX98357A/MAX98360A
2945 */
sound/soc/intel/boards/sof_nau8825.c+651−0
@@ -0,0 +1,651 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+// Copyright(c) 2021 Intel Corporation.
3+// Copyright(c) 2021 Nuvoton Corporation.
4+
5+/*
6+ * Intel SOF Machine Driver with Nuvoton headphone codec NAU8825
7+ * and speaker codec RT1019P MAX98360a or MAX98373
8+ */
9+#include <linux/i2c.h>
10+#include <linux/input.h>
11+#include <linux/module.h>
12+#include <linux/platform_device.h>
13+#include <linux/dmi.h>
14+#include <sound/core.h>
15+#include <sound/jack.h>
16+#include <sound/pcm.h>
17+#include <sound/pcm_params.h>
18+#include <sound/soc.h>
19+#include <sound/sof.h>
20+#include <sound/soc-acpi.h>
21+#include "../../codecs/nau8825.h"
22+#include "../common/soc-intel-quirks.h"
23+#include "hda_dsp_common.h"
24+#include "sof_realtek_common.h"
25+#include "sof_maxim_common.h"
26+
27+#define NAME_SIZE 32
28+
29+#define SOF_NAU8825_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0))
30+#define SOF_NAU8825_SSP_CODEC_MASK (GENMASK(2, 0))
31+#define SOF_SPEAKER_AMP_PRESENT BIT(3)
32+#define SOF_NAU8825_SSP_AMP_SHIFT 4
33+#define SOF_NAU8825_SSP_AMP_MASK (GENMASK(6, 4))
34+#define SOF_NAU8825_SSP_AMP(quirk) \
35+ (((quirk) << SOF_NAU8825_SSP_AMP_SHIFT) & SOF_NAU8825_SSP_AMP_MASK)
36+#define SOF_NAU8825_NUM_HDMIDEV_SHIFT 7
37+#define SOF_NAU8825_NUM_HDMIDEV_MASK (GENMASK(9, 7))
38+#define SOF_NAU8825_NUM_HDMIDEV(quirk) \
39+ (((quirk) << SOF_NAU8825_NUM_HDMIDEV_SHIFT) & SOF_NAU8825_NUM_HDMIDEV_MASK)
40+
41+/* BT audio offload: reserve 3 bits for future */
42+#define SOF_BT_OFFLOAD_SSP_SHIFT 10
43+#define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(12, 10))
44+#define SOF_BT_OFFLOAD_SSP(quirk) \
45+ (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
46+#define SOF_SSP_BT_OFFLOAD_PRESENT BIT(13)
47+#define SOF_RT1019P_SPEAKER_AMP_PRESENT BIT(14)
48+#define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(15)
49+#define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(16)
50+
51+static unsigned long sof_nau8825_quirk = SOF_NAU8825_SSP_CODEC(0);
52+
53+struct sof_hdmi_pcm {
54+ struct list_head head;
55+ struct snd_soc_dai *codec_dai;
56+ int device;
57+};
58+
59+struct sof_card_private {
60+ struct clk *mclk;
61+ struct snd_soc_jack sof_headset;
62+ struct list_head hdmi_pcm_list;
63+};
64+
65+static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
66+{
67+ struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
68+ struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
69+ struct sof_hdmi_pcm *pcm;
70+
71+ pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
72+ if (!pcm)
73+ return -ENOMEM;
74+
75+ /* dai_link id is 1:1 mapped to the PCM device */
76+ pcm->device = rtd->dai_link->id;
77+ pcm->codec_dai = dai;
78+
79+ list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
80+
81+ return 0;
82+}
83+
84+static int sof_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
85+{
86+ struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
87+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
88+
89+ struct snd_soc_jack *jack;
90+ int ret;
91+
92+ /*
93+ * Headset buttons map to the google Reference headset.
94+ * These can be configured by userspace.
95+ */
96+ ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
97+ SND_JACK_HEADSET | SND_JACK_BTN_0 |
98+ SND_JACK_BTN_1 | SND_JACK_BTN_2 |
99+ SND_JACK_BTN_3,
100+ &ctx->sof_headset, NULL, 0);
101+ if (ret) {
102+ dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
103+ return ret;
104+ }
105+
106+ jack = &ctx->sof_headset;
107+
108+ snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
109+ snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
110+ snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
111+ snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
112+ ret = snd_soc_component_set_jack(component, jack, NULL);
113+
114+ if (ret) {
115+ dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
116+ return ret;
117+ }
118+
119+ return ret;
120+};
121+
122+static void sof_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd)
123+{
124+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
125+
126+ snd_soc_component_set_jack(component, NULL, NULL);
127+}
128+
129+static int sof_nau8825_hw_params(struct snd_pcm_substream *substream,
130+ struct snd_pcm_hw_params *params)
131+{
132+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
133+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
134+ int clk_freq, ret;
135+
136+ clk_freq = sof_dai_get_bclk(rtd); /* BCLK freq */
137+
138+ if (clk_freq <= 0) {
139+ dev_err(rtd->dev, "get bclk freq failed: %d\n", clk_freq);
140+ return -EINVAL;
141+ }
142+
143+ /* Configure clock for codec */
144+ ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_BLK, 0,
145+ SND_SOC_CLOCK_IN);
146+ if (ret < 0) {
147+ dev_err(codec_dai->dev, "can't set BCLK clock %d\n", ret);
148+ return ret;
149+ }
150+
151+ /* Configure pll for codec */
152+ ret = snd_soc_dai_set_pll(codec_dai, 0, 0, clk_freq,
153+ params_rate(params) * 256);
154+ if (ret < 0) {
155+ dev_err(codec_dai->dev, "can't set BCLK: %d\n", ret);
156+ return ret;
157+ }
158+
159+ return ret;
160+}
161+
162+static struct snd_soc_ops sof_nau8825_ops = {
163+ .hw_params = sof_nau8825_hw_params,
164+};
165+
166+static struct snd_soc_dai_link_component platform_component[] = {
167+ {
168+ /* name might be overridden during probe */
169+ .name = "0000:00:1f.3"
170+ }
171+};
172+
173+static int sof_card_late_probe(struct snd_soc_card *card)
174+{
175+ struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
176+ struct snd_soc_dapm_context *dapm = &card->dapm;
177+ struct sof_hdmi_pcm *pcm;
178+ int err;
179+
180+ if (list_empty(&ctx->hdmi_pcm_list))
181+ return -EINVAL;
182+
183+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head);
184+
185+ if (sof_nau8825_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {
186+ /* Disable Left and Right Spk pin after boot */
187+ snd_soc_dapm_disable_pin(dapm, "Left Spk");
188+ snd_soc_dapm_disable_pin(dapm, "Right Spk");
189+ err = snd_soc_dapm_sync(dapm);
190+ if (err < 0)
191+ return err;
192+ }
193+
194+ return hda_dsp_hdmi_build_controls(card, pcm->codec_dai->component);
195+}
196+
197+static const struct snd_kcontrol_new sof_controls[] = {
198+ SOC_DAPM_PIN_SWITCH("Headphone Jack"),
199+ SOC_DAPM_PIN_SWITCH("Headset Mic"),
200+ SOC_DAPM_PIN_SWITCH("Left Spk"),
201+ SOC_DAPM_PIN_SWITCH("Right Spk"),
202+};
203+
204+static const struct snd_kcontrol_new speaker_controls[] = {
205+ SOC_DAPM_PIN_SWITCH("Spk"),
206+};
207+
208+static const struct snd_soc_dapm_widget sof_widgets[] = {
209+ SND_SOC_DAPM_HP("Headphone Jack", NULL),
210+ SND_SOC_DAPM_MIC("Headset Mic", NULL),
211+ SND_SOC_DAPM_SPK("Left Spk", NULL),
212+ SND_SOC_DAPM_SPK("Right Spk", NULL),
213+};
214+
215+static const struct snd_soc_dapm_widget speaker_widgets[] = {
216+ SND_SOC_DAPM_SPK("Spk", NULL),
217+};
218+
219+static const struct snd_soc_dapm_widget dmic_widgets[] = {
220+ SND_SOC_DAPM_MIC("SoC DMIC", NULL),
221+};
222+
223+static const struct snd_soc_dapm_route sof_map[] = {
224+ /* HP jack connectors - unknown if we have jack detection */
225+ { "Headphone Jack", NULL, "HPOL" },
226+ { "Headphone Jack", NULL, "HPOR" },
227+
228+ /* other jacks */
229+ { "MIC", NULL, "Headset Mic" },
230+};
231+
232+static const struct snd_soc_dapm_route speaker_map[] = {
233+ /* speaker */
234+ { "Spk", NULL, "Speaker" },
235+};
236+
237+static const struct snd_soc_dapm_route dmic_map[] = {
238+ /* digital mics */
239+ {"DMic", NULL, "SoC DMIC"},
240+};
241+
242+static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd)
243+{
244+ struct snd_soc_card *card = rtd->card;
245+ int ret;
246+
247+ ret = snd_soc_dapm_new_controls(&card->dapm, speaker_widgets,
248+ ARRAY_SIZE(speaker_widgets));
249+ if (ret) {
250+ dev_err(rtd->dev, "unable to add dapm controls, ret %d\n", ret);
251+ /* Don't need to add routes if widget addition failed */
252+ return ret;
253+ }
254+
255+ ret = snd_soc_add_card_controls(card, speaker_controls,
256+ ARRAY_SIZE(speaker_controls));
257+ if (ret) {
258+ dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret);
259+ return ret;
260+ }
261+
262+ ret = snd_soc_dapm_add_routes(&card->dapm, speaker_map,
263+ ARRAY_SIZE(speaker_map));
264+
265+ if (ret)
266+ dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
267+ return ret;
268+}
269+
270+static int dmic_init(struct snd_soc_pcm_runtime *rtd)
271+{
272+ struct snd_soc_card *card = rtd->card;
273+ int ret;
274+
275+ ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
276+ ARRAY_SIZE(dmic_widgets));
277+ if (ret) {
278+ dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
279+ /* Don't need to add routes if widget addition failed */
280+ return ret;
281+ }
282+
283+ ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
284+ ARRAY_SIZE(dmic_map));
285+
286+ if (ret)
287+ dev_err(card->dev, "DMic map addition failed: %d\n", ret);
288+
289+ return ret;
290+}
291+
292+/* sof audio machine driver for nau8825 codec */
293+static struct snd_soc_card sof_audio_card_nau8825 = {
294+ .name = "nau8825", /* the sof- prefix is added by the core */
295+ .owner = THIS_MODULE,
296+ .controls = sof_controls,
297+ .num_controls = ARRAY_SIZE(sof_controls),
298+ .dapm_widgets = sof_widgets,
299+ .num_dapm_widgets = ARRAY_SIZE(sof_widgets),
300+ .dapm_routes = sof_map,
301+ .num_dapm_routes = ARRAY_SIZE(sof_map),
302+ .fully_routed = true,
303+ .late_probe = sof_card_late_probe,
304+};
305+
306+static struct snd_soc_dai_link_component nau8825_component[] = {
307+ {
308+ .name = "i2c-10508825:00",
309+ .dai_name = "nau8825-hifi",
310+ }
311+};
312+
313+static struct snd_soc_dai_link_component dmic_component[] = {
314+ {
315+ .name = "dmic-codec",
316+ .dai_name = "dmic-hifi",
317+ }
318+};
319+
320+static struct snd_soc_dai_link_component rt1019p_component[] = {
321+ {
322+ .name = "RTL1019:00",
323+ .dai_name = "HiFi",
324+ }
325+};
326+
327+static struct snd_soc_dai_link_component dummy_component[] = {
328+ {
329+ .name = "snd-soc-dummy",
330+ .dai_name = "snd-soc-dummy-dai",
331+ }
332+};
333+
334+static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
335+ int ssp_codec,
336+ int ssp_amp,
337+ int dmic_be_num,
338+ int hdmi_num)
339+{
340+ struct snd_soc_dai_link_component *idisp_components;
341+ struct snd_soc_dai_link_component *cpus;
342+ struct snd_soc_dai_link *links;
343+ int i, id = 0;
344+
345+ links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) *
346+ sof_audio_card_nau8825.num_links, GFP_KERNEL);
347+ cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component) *
348+ sof_audio_card_nau8825.num_links, GFP_KERNEL);
349+ if (!links || !cpus)
350+ goto devm_err;
351+
352+ /* codec SSP */
353+ links[id].name = devm_kasprintf(dev, GFP_KERNEL,
354+ "SSP%d-Codec", ssp_codec);
355+ if (!links[id].name)
356+ goto devm_err;
357+
358+ links[id].id = id;
359+ links[id].codecs = nau8825_component;
360+ links[id].num_codecs = ARRAY_SIZE(nau8825_component);
361+ links[id].platforms = platform_component;
362+ links[id].num_platforms = ARRAY_SIZE(platform_component);
363+ links[id].init = sof_nau8825_codec_init;
364+ links[id].exit = sof_nau8825_codec_exit;
365+ links[id].ops = &sof_nau8825_ops;
366+ links[id].dpcm_playback = 1;
367+ links[id].dpcm_capture = 1;
368+ links[id].no_pcm = 1;
369+ links[id].cpus = &cpus[id];
370+ links[id].num_cpus = 1;
371+
372+ links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
373+ "SSP%d Pin",
374+ ssp_codec);
375+ if (!links[id].cpus->dai_name)
376+ goto devm_err;
377+
378+ id++;
379+
380+ /* dmic */
381+ if (dmic_be_num > 0) {
382+ /* at least we have dmic01 */
383+ links[id].name = "dmic01";
384+ links[id].cpus = &cpus[id];
385+ links[id].cpus->dai_name = "DMIC01 Pin";
386+ links[id].init = dmic_init;
387+ if (dmic_be_num > 1) {
388+ /* set up 2 BE links at most */
389+ links[id + 1].name = "dmic16k";
390+ links[id + 1].cpus = &cpus[id + 1];
391+ links[id + 1].cpus->dai_name = "DMIC16k Pin";
392+ dmic_be_num = 2;
393+ }
394+ }
395+
396+ for (i = 0; i < dmic_be_num; i++) {
397+ links[id].id = id;
398+ links[id].num_cpus = 1;
399+ links[id].codecs = dmic_component;
400+ links[id].num_codecs = ARRAY_SIZE(dmic_component);
401+ links[id].platforms = platform_component;
402+ links[id].num_platforms = ARRAY_SIZE(platform_component);
403+ links[id].ignore_suspend = 1;
404+ links[id].dpcm_capture = 1;
405+ links[id].no_pcm = 1;
406+ id++;
407+ }
408+
409+ /* HDMI */
410+ if (hdmi_num > 0) {
411+ idisp_components = devm_kzalloc(dev,
412+ sizeof(struct snd_soc_dai_link_component) *
413+ hdmi_num, GFP_KERNEL);
414+ if (!idisp_components)
415+ goto devm_err;
416+ }
417+ for (i = 1; i <= hdmi_num; i++) {
418+ links[id].name = devm_kasprintf(dev, GFP_KERNEL,
419+ "iDisp%d", i);
420+ if (!links[id].name)
421+ goto devm_err;
422+
423+ links[id].id = id;
424+ links[id].cpus = &cpus[id];
425+ links[id].num_cpus = 1;
426+ links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
427+ "iDisp%d Pin", i);
428+ if (!links[id].cpus->dai_name)
429+ goto devm_err;
430+
431+ idisp_components[i - 1].name = "ehdaudio0D2";
432+ idisp_components[i - 1].dai_name = devm_kasprintf(dev,
433+ GFP_KERNEL,
434+ "intel-hdmi-hifi%d",
435+ i);
436+ if (!idisp_components[i - 1].dai_name)
437+ goto devm_err;
438+
439+ links[id].codecs = &idisp_components[i - 1];
440+ links[id].num_codecs = 1;
441+ links[id].platforms = platform_component;
442+ links[id].num_platforms = ARRAY_SIZE(platform_component);
443+ links[id].init = sof_hdmi_init;
444+ links[id].dpcm_playback = 1;
445+ links[id].no_pcm = 1;
446+ id++;
447+ }
448+
449+ /* speaker amp */
450+ if (sof_nau8825_quirk & SOF_SPEAKER_AMP_PRESENT) {
451+ links[id].name = devm_kasprintf(dev, GFP_KERNEL,
452+ "SSP%d-Codec", ssp_amp);
453+ if (!links[id].name)
454+ goto devm_err;
455+
456+ links[id].id = id;
457+ if (sof_nau8825_quirk & SOF_RT1019P_SPEAKER_AMP_PRESENT) {
458+ links[id].codecs = rt1019p_component;
459+ links[id].num_codecs = ARRAY_SIZE(rt1019p_component);
460+ links[id].init = speaker_codec_init;
461+ } else if (sof_nau8825_quirk &
462+ SOF_MAX98373_SPEAKER_AMP_PRESENT) {
463+ links[id].codecs = max_98373_components;
464+ links[id].num_codecs = ARRAY_SIZE(max_98373_components);
465+ links[id].init = max_98373_spk_codec_init;
466+ links[id].ops = &max_98373_ops;
467+ /* feedback stream */
468+ links[id].dpcm_capture = 1;
469+ } else if (sof_nau8825_quirk &
470+ SOF_MAX98360A_SPEAKER_AMP_PRESENT) {
471+ max_98360a_dai_link(&links[id]);
472+ } else {
473+ goto devm_err;
474+ }
475+
476+ links[id].platforms = platform_component;
477+ links[id].num_platforms = ARRAY_SIZE(platform_component);
478+ links[id].dpcm_playback = 1;
479+ links[id].no_pcm = 1;
480+ links[id].cpus = &cpus[id];
481+ links[id].num_cpus = 1;
482+ links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
483+ "SSP%d Pin",
484+ ssp_amp);
485+ if (!links[id].cpus->dai_name)
486+ goto devm_err;
487+ id++;
488+ }
489+
490+ /* BT audio offload */
491+ if (sof_nau8825_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) {
492+ int port = (sof_nau8825_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
493+ SOF_BT_OFFLOAD_SSP_SHIFT;
494+
495+ links[id].id = id;
496+ links[id].cpus = &cpus[id];
497+ links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
498+ "SSP%d Pin", port);
499+ if (!links[id].cpus->dai_name)
500+ goto devm_err;
501+ links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
502+ if (!links[id].name)
503+ goto devm_err;
504+ links[id].codecs = dummy_component;
505+ links[id].num_codecs = ARRAY_SIZE(dummy_component);
506+ links[id].platforms = platform_component;
507+ links[id].num_platforms = ARRAY_SIZE(platform_component);
508+ links[id].dpcm_playback = 1;
509+ links[id].dpcm_capture = 1;
510+ links[id].no_pcm = 1;
511+ links[id].num_cpus = 1;
512+ }
513+
514+ return links;
515+devm_err:
516+ return NULL;
517+}
518+
519+static int sof_audio_probe(struct platform_device *pdev)
520+{
521+ struct snd_soc_dai_link *dai_links;
522+ struct snd_soc_acpi_mach *mach;
523+ struct sof_card_private *ctx;
524+ int dmic_be_num, hdmi_num;
525+ int ret, ssp_amp, ssp_codec;
526+
527+ ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
528+ if (!ctx)
529+ return -ENOMEM;
530+
531+ if (pdev->id_entry && pdev->id_entry->driver_data)
532+ sof_nau8825_quirk = (unsigned long)pdev->id_entry->driver_data;
533+
534+ mach = pdev->dev.platform_data;
535+
536+ /* A speaker amp might not be present when the quirk claims one is.
537+ * Detect this via whether the machine driver match includes quirk_data.
538+ */
539+ if ((sof_nau8825_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data)
540+ sof_nau8825_quirk &= ~SOF_SPEAKER_AMP_PRESENT;
541+
542+ dev_dbg(&pdev->dev, "sof_nau8825_quirk = %lx\n", sof_nau8825_quirk);
543+
544+ /* default number of DMIC DAI's */
545+ dmic_be_num = 2;
546+ hdmi_num = (sof_nau8825_quirk & SOF_NAU8825_NUM_HDMIDEV_MASK) >>
547+ SOF_NAU8825_NUM_HDMIDEV_SHIFT;
548+ /* default number of HDMI DAI's */
549+ if (!hdmi_num)
550+ hdmi_num = 3;
551+
552+ ssp_amp = (sof_nau8825_quirk & SOF_NAU8825_SSP_AMP_MASK) >>
553+ SOF_NAU8825_SSP_AMP_SHIFT;
554+
555+ ssp_codec = sof_nau8825_quirk & SOF_NAU8825_SSP_CODEC_MASK;
556+
557+ /* compute number of dai links */
558+ sof_audio_card_nau8825.num_links = 1 + dmic_be_num + hdmi_num;
559+
560+ if (sof_nau8825_quirk & SOF_SPEAKER_AMP_PRESENT)
561+ sof_audio_card_nau8825.num_links++;
562+
563+ if (sof_nau8825_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT)
564+ max_98373_set_codec_conf(&sof_audio_card_nau8825);
565+
566+ if (sof_nau8825_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
567+ sof_audio_card_nau8825.num_links++;
568+
569+ dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp,
570+ dmic_be_num, hdmi_num);
571+ if (!dai_links)
572+ return -ENOMEM;
573+
574+ sof_audio_card_nau8825.dai_link = dai_links;
575+
576+ INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
577+
578+ sof_audio_card_nau8825.dev = &pdev->dev;
579+
580+ /* set platform name for each dailink */
581+ ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_nau8825,
582+ mach->mach_params.platform);
583+ if (ret)
584+ return ret;
585+
586+ snd_soc_card_set_drvdata(&sof_audio_card_nau8825, ctx);
587+
588+ return devm_snd_soc_register_card(&pdev->dev,
589+ &sof_audio_card_nau8825);
590+}
591+
592+static const struct platform_device_id board_ids[] = {
593+ {
594+ .name = "sof_nau8825",
595+ .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
596+ SOF_NAU8825_NUM_HDMIDEV(4) |
597+ SOF_BT_OFFLOAD_SSP(2) |
598+ SOF_SSP_BT_OFFLOAD_PRESENT),
599+
600+ },
601+ {
602+ .name = "adl_rt1019p_nau8825",
603+ .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
604+ SOF_SPEAKER_AMP_PRESENT |
605+ SOF_RT1019P_SPEAKER_AMP_PRESENT |
606+ SOF_NAU8825_SSP_AMP(2) |
607+ SOF_NAU8825_NUM_HDMIDEV(4)),
608+ },
609+ {
610+ .name = "adl_max98373_nau8825",
611+ .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
612+ SOF_SPEAKER_AMP_PRESENT |
613+ SOF_MAX98373_SPEAKER_AMP_PRESENT |
614+ SOF_NAU8825_SSP_AMP(1) |
615+ SOF_NAU8825_NUM_HDMIDEV(4) |
616+ SOF_BT_OFFLOAD_SSP(2) |
617+ SOF_SSP_BT_OFFLOAD_PRESENT),
618+ },
619+ {
620+ /* The limitation of length of char array, shorten the name */
621+ .name = "adl_mx98360a_nau8825",
622+ .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
623+ SOF_SPEAKER_AMP_PRESENT |
624+ SOF_MAX98360A_SPEAKER_AMP_PRESENT |
625+ SOF_NAU8825_SSP_AMP(1) |
626+ SOF_NAU8825_NUM_HDMIDEV(4) |
627+ SOF_BT_OFFLOAD_SSP(2) |
628+ SOF_SSP_BT_OFFLOAD_PRESENT),
629+
630+ },
631+ { }
632+};
633+MODULE_DEVICE_TABLE(platform, board_ids);
634+
635+static struct platform_driver sof_audio = {
636+ .probe = sof_audio_probe,
637+ .driver = {
638+ .name = "sof_nau8825",
639+ .pm = &snd_soc_pm_ops,
640+ },
641+ .id_table = board_ids,
642+};
643+module_platform_driver(sof_audio)
644+
645+/* Module information */
646+MODULE_DESCRIPTION("SOF Audio Machine driver for NAU8825");
647+MODULE_AUTHOR("David Lin <ctlin0@nuvoton.com>");
648+MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>");
649+MODULE_LICENSE("GPL");
650+MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
651+MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
sound/soc/intel/boards/sof_realtek_common.c+116−3
@@ -12,12 +12,13 @@ · 11 unmodified lines
1212 #include <sound/soc-dapm.h>
1313 #include <uapi/sound/asound.h>
1414 #include "../../codecs/rt1011.h"
15+#include "../../codecs/rt1015.h"
1516 #include "sof_realtek_common.h"
1617
1718 /*
1819 * Current only 2-amp configuration is supported for rt1011
1920 */
20−static const struct snd_soc_dapm_route rt1011_dapm_routes[] = {
21+static const struct snd_soc_dapm_route speaker_map_lr[] = {
2122 /* speaker */
2223 { "Left Spk", NULL, "Left SPO" },
2324 { "Right Spk", NULL, "Right SPO" },
@@ -117,8 +118,8 @@ static int rt1011_init(struct snd_soc_pcm_runtime *rtd) · 93 unmodified lines
117118 struct snd_soc_card *card = rtd->card;
118119 int ret;
119120
120− ret = snd_soc_dapm_add_routes(&card->dapm, rt1011_dapm_routes,
121− ARRAY_SIZE(rt1011_dapm_routes));
121+ ret = snd_soc_dapm_add_routes(&card->dapm, speaker_map_lr,
122+ ARRAY_SIZE(speaker_map_lr));
122123 if (ret)
123124 dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
124125 return ret;
@@ -241,3 +242,115 @@ void sof_rt1015p_codec_conf(struct snd_soc_card *card) · 116 unmodified lines
241242 card->codec_conf = rt1015p_codec_confs;
242243 card->num_configs = ARRAY_SIZE(rt1015p_codec_confs);
243244 }
245+
246+/*
247+ * RT1015 audio amplifier
248+ */
249+
250+static int rt1015_hw_params(struct snd_pcm_substream *substream,
251+ struct snd_pcm_hw_params *params)
252+{
253+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
254+ struct snd_soc_dai *codec_dai;
255+ int i, fs = 64, ret;
256+
257+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
258+ ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
259+ params_rate(params) * fs,
260+ params_rate(params) * 256);
261+ if (ret)
262+ return ret;
263+
264+ ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
265+ params_rate(params) * 256,
266+ SND_SOC_CLOCK_IN);
267+ if (ret)
268+ return ret;
269+ }
270+
271+ return 0;
272+}
273+
274+static int rt1015_hw_params_pll_and_tdm(struct snd_pcm_substream *substream,
275+ struct snd_pcm_hw_params *params)
276+{
277+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
278+ struct snd_soc_dai *codec_dai;
279+ int i, fs = 100, ret;
280+
281+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
282+ ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
283+ params_rate(params) * fs,
284+ params_rate(params) * 256);
285+ if (ret)
286+ return ret;
287+
288+ ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
289+ params_rate(params) * 256,
290+ SND_SOC_CLOCK_IN);
291+ if (ret)
292+ return ret;
293+ }
294+ /* rx slot 1 for RT1015_DEV0_NAME */
295+ ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0),
296+ 0x0, 0x1, 4, 24);
297+ if (ret)
298+ return ret;
299+
300+ /* rx slot 2 for RT1015_DEV1_NAME */
301+ ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 1),
302+ 0x0, 0x2, 4, 24);
303+ if (ret)
304+ return ret;
305+
306+ return 0;
307+}
308+
309+static struct snd_soc_ops rt1015_ops = {
310+ .hw_params = rt1015_hw_params,
311+};
312+
313+static struct snd_soc_codec_conf rt1015_amp_conf[] = {
314+ {
315+ .dlc = COMP_CODEC_CONF(RT1015_DEV0_NAME),
316+ .name_prefix = "Left",
317+ },
318+ {
319+ .dlc = COMP_CODEC_CONF(RT1015_DEV1_NAME),
320+ .name_prefix = "Right",
321+ },
322+};
323+
324+static struct snd_soc_dai_link_component rt1015_components[] = {
325+ {
326+ .name = RT1015_DEV0_NAME,
327+ .dai_name = RT1015_CODEC_DAI,
328+ },
329+ {
330+ .name = RT1015_DEV1_NAME,
331+ .dai_name = RT1015_CODEC_DAI,
332+ },
333+};
334+
335+static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd)
336+{
337+ return snd_soc_dapm_add_routes(&rtd->card->dapm, speaker_map_lr,
338+ ARRAY_SIZE(speaker_map_lr));
339+}
340+
341+void sof_rt1015_codec_conf(struct snd_soc_card *card)
342+{
343+ card->codec_conf = rt1015_amp_conf;
344+ card->num_configs = ARRAY_SIZE(rt1015_amp_conf);
345+}
346+
347+void sof_rt1015_dai_link(struct snd_soc_dai_link *link, unsigned int fs)
348+{
349+ link->codecs = rt1015_components;
350+ link->num_codecs = ARRAY_SIZE(rt1015_components);
351+ link->init = speaker_codec_init_lr;
352+ link->ops = &rt1015_ops;
353+
354+ if (fs == 100)
355+ rt1015_ops.hw_params = rt1015_hw_params_pll_and_tdm;
356+}
sound/soc/intel/boards/sof_realtek_common.h+7−0
@@ -28,4 +28,11 @@ void sof_rt1011_codec_conf(struct snd_soc_card *card); · 27 unmodified lines
2828 void sof_rt1015p_dai_link(struct snd_soc_dai_link *link);
2929 void sof_rt1015p_codec_conf(struct snd_soc_card *card);
3030
31+#define RT1015_CODEC_DAI "rt1015-aif"
32+#define RT1015_DEV0_NAME "i2c-10EC1015:00"
33+#define RT1015_DEV1_NAME "i2c-10EC1015:01"
34+
35+void sof_rt1015_dai_link(struct snd_soc_dai_link *link, unsigned int fs);
36+void sof_rt1015_codec_conf(struct snd_soc_card *card);
37+
3138 #endif /* __SOF_REALTEK_COMMON_H */
sound/soc/intel/boards/sof_rt5682.c+76−103
@@ -20,7 +20,6 @@ · 19 unmodified lines
2020 #include <sound/rt5682.h>
2121 #include <sound/rt5682s.h>
2222 #include <sound/soc-acpi.h>
23−#include "../../codecs/rt1015.h"
2423 #include "../../codecs/rt5682.h"
2524 #include "../../codecs/rt5682s.h"
2625 #include "../../codecs/hdac_hdmi.h"
@@ -59,6 +58,9 @@ · 32 unmodified lines
5958 (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
6059 #define SOF_SSP_BT_OFFLOAD_PRESENT BIT(22)
6160 #define SOF_RT5682S_HEADPHONE_CODEC_PRESENT BIT(23)
61+#define SOF_MAX98390_SPEAKER_AMP_PRESENT BIT(24)
62+#define SOF_MAX98390_TWEETER_SPEAKER_PRESENT BIT(25)
63+
6264
6365 /* Default: MCLK on, MCLK 19.2M, SSP0 */
6466 static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
@@ -179,6 +181,36 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { · 114 unmodified lines
179181 SOF_RT5682_SSP_AMP(2) |
180182 SOF_RT5682_NUM_HDMIDEV(4)),
181183 },
184+ {
185+ .callback = sof_rt5682_quirk_cb,
186+ .matches = {
187+ DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"),
188+ DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S"),
189+ },
190+ .driver_data = (void *)(SOF_RT5682_MCLK_EN |
191+ SOF_RT5682_SSP_CODEC(0) |
192+ SOF_SPEAKER_AMP_PRESENT |
193+ SOF_MAX98390_SPEAKER_AMP_PRESENT |
194+ SOF_RT5682_SSP_AMP(2) |
195+ SOF_RT5682_NUM_HDMIDEV(4)),
196+ },
197+ {
198+ .callback = sof_rt5682_quirk_cb,
199+ .matches = {
200+ DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"),
201+ DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S_4SPK"),
202+ },
203+ .driver_data = (void *)(SOF_RT5682_MCLK_EN |
204+ SOF_RT5682_SSP_CODEC(0) |
205+ SOF_SPEAKER_AMP_PRESENT |
206+ SOF_MAX98390_SPEAKER_AMP_PRESENT |
207+ SOF_MAX98390_TWEETER_SPEAKER_PRESENT |
208+ SOF_RT5682_SSP_AMP(1) |
209+ SOF_RT5682_NUM_HDMIDEV(4) |
210+ SOF_BT_OFFLOAD_SSP(2) |
211+ SOF_SSP_BT_OFFLOAD_PRESENT),
212+
213+ },
182214 {}
183215 };
184216
@@ -367,67 +399,6 @@ static struct snd_soc_ops sof_rt5682_ops = { · 182 unmodified lines
367399 .hw_params = sof_rt5682_hw_params,
368400 };
369401
370−static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
371− struct snd_pcm_hw_params *params)
372−{
373− struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
374− struct snd_soc_card *card = rtd->card;
375− struct snd_soc_dai *codec_dai;
376− int i, fs, ret;
377−
378− if (!snd_soc_card_get_codec_dai(card, "rt1015-aif"))
379− return 0;
380−
381− if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS)
382− fs = 100;
383− else
384− fs = 64;
385−
386− for_each_rtd_codec_dais(rtd, i, codec_dai) {
387− ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
388− params_rate(params) * fs,
389− params_rate(params) * 256);
390− if (ret < 0) {
391− dev_err(card->dev, "failed to set pll\n");
392− return ret;
393− }
394− /* Configure sysclk for codec */
395− ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
396− params_rate(params) * 256,
397− SND_SOC_CLOCK_IN);
398− if (ret < 0) {
399− dev_err(card->dev, "failed to set sysclk\n");
400− return ret;
401− }
402−
403− if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS) {
404− if (!strcmp(codec_dai->component->name, "i2c-10EC1015:00")) {
405− ret = snd_soc_dai_set_tdm_slot(codec_dai,
406− 0x0, 0x1, 4, 24);
407− if (ret < 0) {
408− dev_err(card->dev, "failed to set tdm slot\n");
409− return ret;
410− }
411− }
412−
413− if (!strcmp(codec_dai->component->name, "i2c-10EC1015:01")) {
414− ret = snd_soc_dai_set_tdm_slot(codec_dai,
415− 0x0, 0x2, 4, 24);
416− if (ret < 0) {
417− dev_err(card->dev, "failed to set tdm slot\n");
418− return ret;
419− }
420− }
421− }
422− }
423−
424− return 0;
425−}
426−
427−static struct snd_soc_ops sof_rt1015_ops = {
428− .hw_params = sof_rt1015_hw_params,
429−};
430−
431402 static struct snd_soc_dai_link_component platform_component[] = {
432403 {
433404 /* name might be overridden during probe */
@@ -486,6 +457,7 @@ static int sof_card_late_probe(struct snd_soc_card *card) · 52 unmodified lines
486457 if (err < 0)
487458 return err;
488459 }
460+
489461 return hdac_hdmi_jack_port_init(component, &card->dapm);
490462 }
491463
@@ -517,22 +489,11 @@ static const struct snd_soc_dapm_route sof_map[] = { · 25 unmodified lines
517489 { "IN1P", NULL, "Headset Mic" },
518490 };
519491
520−static const struct snd_soc_dapm_route speaker_map_lr[] = {
521− { "Left Spk", NULL, "Left SPO" },
522− { "Right Spk", NULL, "Right SPO" },
523−};
524−
525492 static const struct snd_soc_dapm_route dmic_map[] = {
526493 /* digital mics */
527494 {"DMic", NULL, "SoC DMIC"},
528495 };
529496
530−static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd)
531−{
532− return snd_soc_dapm_add_routes(&rtd->card->dapm, speaker_map_lr,
533− ARRAY_SIZE(speaker_map_lr));
534−}
535−
536497 static int dmic_init(struct snd_soc_pcm_runtime *rtd)
537498 {
538499 struct snd_soc_card *card = rtd->card;
@@ -555,17 +516,6 @@ static int dmic_init(struct snd_soc_pcm_runtime *rtd) · 16 unmodified lines
555516 return ret;
556517 }
557518
558−static struct snd_soc_codec_conf rt1015_amp_conf[] = {
559− {
560− .dlc = COMP_CODEC_CONF("i2c-10EC1015:00"),
561− .name_prefix = "Left",
562− },
563− {
564− .dlc = COMP_CODEC_CONF("i2c-10EC1015:01"),
565− .name_prefix = "Right",
566− },
567−};
568−
569519 /* sof audio machine driver for rt5682 codec */
570520 static struct snd_soc_card sof_audio_card_rt5682 = {
571521 .name = "rt5682", /* the sof- prefix is added by the core */
@@ -601,17 +551,6 @@ static struct snd_soc_dai_link_component dmic_component[] = { · 29 unmodified lines
601551 }
602552 };
603553
604−static struct snd_soc_dai_link_component rt1015_components[] = {
605− {
606− .name = "i2c-10EC1015:00",
607− .dai_name = "rt1015-aif",
608− },
609− {
610− .name = "i2c-10EC1015:01",
611− .dai_name = "rt1015-aif",
612− },
613−};
614−
615554 static struct snd_soc_dai_link_component dummy_component[] = {
616555 {
617556 .name = "snd-soc-dummy",
@@ -764,10 +703,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · 146 unmodified lines
764703
765704 links[id].id = id;
766705 if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) {
767− links[id].codecs = rt1015_components;
768− links[id].num_codecs = ARRAY_SIZE(rt1015_components);
769− links[id].init = speaker_codec_init_lr;
770− links[id].ops = &sof_rt1015_ops;
706+ sof_rt1015_dai_link(&links[id], (sof_rt5682_quirk &
707+ SOF_RT1015_SPEAKER_AMP_100FS) ? 100 : 64);
771708 } else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
772709 sof_rt1015p_dai_link(&links[id]);
773710 } else if (sof_rt5682_quirk &
@@ -784,6 +721,20 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · 10 unmodified lines
784721 } else if (sof_rt5682_quirk &
785722 SOF_RT1011_SPEAKER_AMP_PRESENT) {
786723 sof_rt1011_dai_link(&links[id]);
724+ } else if (sof_rt5682_quirk &
725+ SOF_MAX98390_SPEAKER_AMP_PRESENT) {
726+ if (sof_rt5682_quirk &
727+ SOF_MAX98390_TWEETER_SPEAKER_PRESENT) {
728+ links[id].codecs = max_98390_4spk_components;
729+ links[id].num_codecs = ARRAY_SIZE(max_98390_4spk_components);
730+ } else {
731+ links[id].codecs = max_98390_components;
732+ links[id].num_codecs = ARRAY_SIZE(max_98390_components);
733+ }
734+ links[id].init = max_98390_spk_codec_init;
735+ links[id].ops = &max_98390_ops;
736+ links[id].dpcm_capture = 1;
737+
787738 } else {
788739 max_98357a_dai_link(&links[id]);
789740 }
@@ -868,6 +819,10 @@ static int sof_audio_probe(struct platform_device *pdev) · 78 unmodified lines
868819 if (acpi_dev_present("RTL5682", NULL, -1))
869820 sof_rt5682_quirk |= SOF_RT5682S_HEADPHONE_CODEC_PRESENT;
870821
822+ /* Detect the headset codec variant to support machines in DMI quirk */
823+ if (acpi_dev_present("RTL5682", NULL, -1))
824+ sof_rt5682_quirk |= SOF_RT5682S_HEADPHONE_CODEC_PRESENT;
825+
871826 if (soc_intel_is_byt() || soc_intel_is_cht()) {
872827 is_legacy_cpu = 1;
873828 dmic_be_num = 0;
@@ -924,6 +879,14 @@ static int sof_audio_probe(struct platform_device *pdev) · 50 unmodified lines
924879 sof_rt1011_codec_conf(&sof_audio_card_rt5682);
925880 else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT)
926881 sof_rt1015p_codec_conf(&sof_audio_card_rt5682);
882+ else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT) {
883+ if (sof_rt5682_quirk & SOF_MAX98390_TWEETER_SPEAKER_PRESENT)
884+ max_98390_set_codec_conf(&sof_audio_card_rt5682,
885+ ARRAY_SIZE(max_98390_4spk_components));
886+ else
887+ max_98390_set_codec_conf(&sof_audio_card_rt5682,
888+ ARRAY_SIZE(max_98390_components));
889+ }
927890
928891 if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
929892 sof_audio_card_rt5682.num_links++;
@@ -935,10 +898,8 @@ static int sof_audio_probe(struct platform_device *pdev) · 5 unmodified lines
935898
936899 sof_audio_card_rt5682.dai_link = dai_links;
937900
938− if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) {
939− sof_audio_card_rt5682.codec_conf = rt1015_amp_conf;
940− sof_audio_card_rt5682.num_configs = ARRAY_SIZE(rt1015_amp_conf);
941− }
901+ if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT)
902+ sof_rt1015_codec_conf(&sof_audio_card_rt5682);
942903
943904 INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
944905
@@ -1050,6 +1011,17 @@ static const struct platform_device_id board_ids[] = { · 105 unmodified lines
10501011 SOF_RT5682_SSP_AMP(2) |
10511012 SOF_RT5682_NUM_HDMIDEV(4)),
10521013 },
1014+ {
1015+ .name = "adl_max98390_rt5682",
1016+ .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
1017+ SOF_RT5682_SSP_CODEC(0) |
1018+ SOF_SPEAKER_AMP_PRESENT |
1019+ SOF_MAX98390_SPEAKER_AMP_PRESENT |
1020+ SOF_RT5682_SSP_AMP(1) |
1021+ SOF_RT5682_NUM_HDMIDEV(4) |
1022+ SOF_BT_OFFLOAD_SSP(2) |
1023+ SOF_SSP_BT_OFFLOAD_PRESENT),
1024+ },
10531025 {
10541026 .name = "adl_mx98360_rt5682",
10551027 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
@@ -1080,6 +1052,7 @@ MODULE_DESCRIPTION("SOF Audio Machine driver"); · 24 unmodified lines
10801052 MODULE_AUTHOR("Bard Liao <bard.liao@intel.com>");
10811053 MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>");
10821054 MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
1055+MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>");
10831056 MODULE_LICENSE("GPL v2");
10841057 MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
10851058 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
sound/soc/intel/boards/sof_sdw.c+82−76
@@ -36,8 +36,6 @@ static void log_quirks(struct device *dev) · 35 unmodified lines
3636 if (SOF_SSP_GET_PORT(sof_sdw_quirk))
3737 dev_dbg(dev, "SSP port %ld\n",
3838 SOF_SSP_GET_PORT(sof_sdw_quirk));
39− if (sof_sdw_quirk & SOF_RT715_DAI_ID_FIX)
40− dev_dbg(dev, "quirk SOF_RT715_DAI_ID_FIX enabled\n");
4139 if (sof_sdw_quirk & SOF_SDW_NO_AGGREGATION)
4240 dev_dbg(dev, "quirk SOF_SDW_NO_AGGREGATION enabled\n");
4341 }
@@ -64,8 +62,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 20 unmodified lines
6462 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
6563 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "09C6")
6664 },
67− .driver_data = (void *)(RT711_JD2 |
68− SOF_RT715_DAI_ID_FIX),
65+ .driver_data = (void *)RT711_JD2,
6966 },
7067 {
7168 /* early version of SKU 09C6 */
@@ -74,8 +71,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 2 unmodified lines
7471 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
7572 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0983")
7673 },
77− .driver_data = (void *)(RT711_JD2 |
78− SOF_RT715_DAI_ID_FIX),
74+ .driver_data = (void *)RT711_JD2,
7975 },
8076 {
8177 .callback = sof_sdw_quirk_cb,
@@ -84,7 +80,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 2 unmodified lines
8480 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "098F"),
8581 },
8682 .driver_data = (void *)(RT711_JD2 |
87− SOF_RT715_DAI_ID_FIX |
8883 SOF_SDW_FOUR_SPK),
8984 },
9085 {
@@ -94,7 +89,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 3 unmodified lines
9489 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0990"),
9590 },
9691 .driver_data = (void *)(RT711_JD2 |
97− SOF_RT715_DAI_ID_FIX |
9892 SOF_SDW_FOUR_SPK),
9993 },
10094 /* IceLake devices */
@@ -126,8 +120,17 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 25 unmodified lines
126120 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
127121 },
128122 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
129− RT711_JD2 |
130− SOF_RT715_DAI_ID_FIX),
123+ RT711_JD2),
124+ },
125+ {
126+ /* another SKU of Dell Latitude 9520 */
127+ .callback = sof_sdw_quirk_cb,
128+ .matches = {
129+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
130+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3F")
131+ },
132+ .driver_data = (void *)(SOF_SDW_TGL_HDMI |
133+ RT711_JD2),
131134 },
132135 {
133136 /* Dell XPS 9710 */
@@ -138,7 +141,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 4 unmodified lines
138141 },
139142 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
140143 RT711_JD2 |
141− SOF_RT715_DAI_ID_FIX |
142144 SOF_SDW_FOUR_SPK),
143145 },
144146 {
@@ -149,7 +151,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 4 unmodified lines
149151 },
150152 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
151153 RT711_JD2 |
152− SOF_RT715_DAI_ID_FIX |
153154 SOF_SDW_FOUR_SPK),
154155 },
155156 {
@@ -188,7 +189,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 32 unmodified lines
188189 },
189190 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
190191 SOF_SDW_PCH_DMIC |
191− RT711_JD2),
192+ RT711_JD1),
192193 },
193194 {
194195 /* NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
@@ -210,7 +211,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 15 unmodified lines
210211 },
211212 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
212213 RT711_JD2 |
213− SOF_RT715_DAI_ID_FIX |
214214 SOF_SDW_FOUR_SPK),
215215 },
216216 {
@@ -220,8 +220,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 3 unmodified lines
220220 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A45")
221221 },
222222 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
223− RT711_JD2 |
224− SOF_RT715_DAI_ID_FIX),
223+ RT711_JD2),
225224 },
226225 /* AlderLake devices */
227226 {
@@ -232,7 +231,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 4 unmodified lines
232231 },
233232 .driver_data = (void *)(RT711_JD2_100K |
234233 SOF_SDW_TGL_HDMI |
235− SOF_RT715_DAI_ID_FIX |
236234 SOF_BT_OFFLOAD_SSP(2) |
237235 SOF_SSP_BT_OFFLOAD_PRESENT),
238236 },
@@ -349,7 +347,7 @@ int sdw_prepare(struct snd_pcm_substream *substream) · 110 unmodified lines
349347 /* Find stream from first CPU DAI */
350348 dai = asoc_rtd_to_cpu(rtd, 0);
351349
352− sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
350+ sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
353351
354352 if (IS_ERR(sdw_stream)) {
355353 dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
@@ -369,7 +367,7 @@ int sdw_trigger(struct snd_pcm_substream *substream, int cmd) · 13 unmodified lines
369367 /* Find stream from first CPU DAI */
370368 dai = asoc_rtd_to_cpu(rtd, 0);
371369
372− sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
370+ sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
373371
374372 if (IS_ERR(sdw_stream)) {
375373 dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
@@ -408,7 +406,7 @@ int sdw_hw_free(struct snd_pcm_substream *substream) · 32 unmodified lines
408406 /* Find stream from first CPU DAI */
409407 dai = asoc_rtd_to_cpu(rtd, 0);
410408
411− sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
409+ sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
412410
413411 if (IS_ERR(sdw_stream)) {
414412 dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
@@ -431,26 +429,13 @@ static const struct snd_soc_ops sdw_ops = { · 16 unmodified lines
431429 .shutdown = sdw_shutdown,
432430 };
433431
434−static int sof_sdw_mic_codec_mockup_init(struct snd_soc_card *card,
435− const struct snd_soc_acpi_link_adr *link,
436− struct snd_soc_dai_link *dai_links,
437− struct sof_sdw_codec_info *info,
438− bool playback)
439−{
440− /*
441− * force DAI link to use same ID as RT715 and DMIC
442− * to reuse topologies
443− */
444− dai_links->id = SDW_DMIC_DAI_ID;
445− return 0;
446−}
447−
448432 static struct sof_sdw_codec_info codec_info_list[] = {
449433 {
450434 .part_id = 0x700,
451435 .direction = {true, true},
452436 .dai_name = "rt700-aif1",
453437 .init = sof_sdw_rt700_init,
438+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
454439 },
455440 {
456441 .part_id = 0x711,
@@ -459,6 +444,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
459444 .dai_name = "rt711-sdca-aif1",
460445 .init = sof_sdw_rt711_sdca_init,
461446 .exit = sof_sdw_rt711_sdca_exit,
447+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
462448 },
463449 {
464450 .part_id = 0x711,
@@ -467,6 +453,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
467453 .dai_name = "rt711-aif1",
468454 .init = sof_sdw_rt711_init,
469455 .exit = sof_sdw_rt711_exit,
456+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
470457 },
471458 {
472459 .part_id = 0x1308,
@@ -475,12 +462,14 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
475462 .dai_name = "rt1308-aif",
476463 .ops = &sof_sdw_rt1308_i2s_ops,
477464 .init = sof_sdw_rt1308_init,
465+ .codec_type = SOF_SDW_CODEC_TYPE_AMP,
478466 },
479467 {
480468 .part_id = 0x1316,
481469 .direction = {true, true},
482470 .dai_name = "rt1316-aif",
483471 .init = sof_sdw_rt1316_init,
472+ .codec_type = SOF_SDW_CODEC_TYPE_AMP,
484473 },
485474 {
486475 .part_id = 0x714,
@@ -489,6 +478,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
489478 .ignore_pch_dmic = true,
490479 .dai_name = "rt715-aif2",
491480 .init = sof_sdw_rt715_sdca_init,
481+ .codec_type = SOF_SDW_CODEC_TYPE_MIC,
492482 },
493483 {
494484 .part_id = 0x715,
@@ -497,6 +487,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
497487 .ignore_pch_dmic = true,
498488 .dai_name = "rt715-aif2",
499489 .init = sof_sdw_rt715_sdca_init,
490+ .codec_type = SOF_SDW_CODEC_TYPE_MIC,
500491 },
501492 {
502493 .part_id = 0x714,
@@ -505,6 +496,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
505496 .ignore_pch_dmic = true,
506497 .dai_name = "rt715-aif2",
507498 .init = sof_sdw_rt715_init,
499+ .codec_type = SOF_SDW_CODEC_TYPE_MIC,
508500 },
509501 {
510502 .part_id = 0x715,
@@ -513,6 +505,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 2 unmodified lines
513505 .ignore_pch_dmic = true,
514506 .dai_name = "rt715-aif2",
515507 .init = sof_sdw_rt715_init,
508+ .codec_type = SOF_SDW_CODEC_TYPE_MIC,
516509 },
517510 {
518511 .part_id = 0x8373,
@@ -520,12 +513,14 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 1 unmodified line
520513 .dai_name = "max98373-aif1",
521514 .init = sof_sdw_mx8373_init,
522515 .codec_card_late_probe = sof_sdw_mx8373_late_probe,
516+ .codec_type = SOF_SDW_CODEC_TYPE_AMP,
523517 },
524518 {
525519 .part_id = 0x5682,
526520 .direction = {true, true},
527521 .dai_name = "rt5682-sdw",
528522 .init = sof_sdw_rt5682_init,
523+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
529524 },
530525 {
531526 .part_id = 0xaaaa, /* generic codec mockup */
@@ -533,6 +528,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 1 unmodified line
533528 .direction = {true, true},
534529 .dai_name = "sdw-mockup-aif1",
535530 .init = NULL,
531+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
536532 },
537533 {
538534 .part_id = 0xaa55, /* headset codec mockup */
@@ -540,6 +536,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 1 unmodified line
540536 .direction = {true, true},
541537 .dai_name = "sdw-mockup-aif1",
542538 .init = NULL,
539+ .codec_type = SOF_SDW_CODEC_TYPE_JACK,
543540 },
544541 {
545542 .part_id = 0x55aa, /* amplifier mockup */
@@ -547,13 +544,14 @@ static struct sof_sdw_codec_info codec_info_list[] = { · 1 unmodified line
547544 .direction = {true, false},
548545 .dai_name = "sdw-mockup-aif1",
549546 .init = NULL,
547+ .codec_type = SOF_SDW_CODEC_TYPE_AMP,
550548 },
551549 {
552550 .part_id = 0x5555,
553551 .version_id = 0,
554552 .direction = {false, true},
555553 .dai_name = "sdw-mockup-aif1",
556− .init = sof_sdw_mic_codec_mockup_init,
554+ .codec_type = SOF_SDW_CODEC_TYPE_MIC,
557555 },
558556 };
559557
@@ -601,10 +599,11 @@ static inline int find_codec_info_acpi(const u8 *acpi_id) · 41 unmodified lines
601599 * Since some sdw slaves may be aggregated, the CPU DAI number
602600 * may be larger than the number of BE dailinks.
603601 */
604−static int get_sdw_dailink_info(const struct snd_soc_acpi_link_adr *links,
602+static int get_sdw_dailink_info(struct device *dev, const struct snd_soc_acpi_link_adr *links,
605603 int *sdw_be_num, int *sdw_cpu_dai_num)
606604 {
607605 const struct snd_soc_acpi_link_adr *link;
606+ int _codec_type = SOF_SDW_CODEC_TYPE_JACK;
608607 bool group_visited[SDW_MAX_GROUPS];
609608 bool no_aggregation;
610609 int i;
@@ -630,6 +629,12 @@ static int get_sdw_dailink_info(const struct snd_soc_acpi_link_adr *links, · 19 unmodified lines
630629 if (codec_index < 0)
631630 return codec_index;
632631
632+ if (codec_info_list[codec_index].codec_type < _codec_type)
633+ dev_warn(dev,
634+ "Unexpected address table ordering. Expected order: jack -> amp -> mic\n");
635+
636+ _codec_type = codec_info_list[codec_index].codec_type;
637+
633638 endpoint = link->adr_d->endpoints;
634639
635640 /* count DAI number for playback and capture */
@@ -888,14 +893,14 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, · 252 unmodified lines
888893 }
889894
890895 static int create_sdw_dailink(struct snd_soc_card *card,
891− struct device *dev, int *be_index,
896+ struct device *dev, int *link_index,
892897 struct snd_soc_dai_link *dai_links,
893898 int sdw_be_num, int sdw_cpu_dai_num,
894899 struct snd_soc_dai_link_component *cpus,
895900 const struct snd_soc_acpi_link_adr *link,
896901 int *cpu_id, bool *group_generated,
897902 struct snd_soc_codec_conf *codec_conf,
898− int codec_count,
903+ int codec_count, int *link_id,
899904 int *codec_conf_index,
900905 bool *ignore_pch_dmic)
901906 {
@@ -953,6 +958,19 @@ static int create_sdw_dailink(struct snd_soc_card *card, · 51 unmodified lines
953958 if (codec_info_list[codec_index].ignore_pch_dmic)
954959 *ignore_pch_dmic = true;
955960
961+ /* Shift the first amplifier's *link_id to SDW_AMP_DAI_ID */
962+ if (codec_info_list[codec_index].codec_type == SOF_SDW_CODEC_TYPE_AMP &&
963+ *link_id < SDW_AMP_DAI_ID)
964+ *link_id = SDW_AMP_DAI_ID;
965+
966+ /*
967+ * DAI ID is fixed at SDW_DMIC_DAI_ID for MICs to
968+ * keep sdw DMIC and HDMI setting static in UCM
969+ */
970+ if (codec_info_list[codec_index].codec_type == SOF_SDW_CODEC_TYPE_MIC &&
971+ *link_id < SDW_DMIC_DAI_ID)
972+ *link_id = SDW_DMIC_DAI_ID;
973+
956974 cpu_dai_index = *cpu_id;
957975 for_each_pcm_streams(stream) {
958976 char *name, *cpu_name;
@@ -991,8 +1009,12 @@ static int create_sdw_dailink(struct snd_soc_card *card, · 32 unmodified lines
9911009 cpus[cpu_dai_index++].dai_name = cpu_name;
9921010 }
9931011
994− if (*be_index >= sdw_be_num) {
995− dev_err(dev, " invalid be dai index %d", *be_index);
1012+ /*
1013+ * We create sdw dai links at first stage, so link index should
1014+ * not be larger than sdw_be_num
1015+ */
1016+ if (*link_index >= sdw_be_num) {
1017+ dev_err(dev, "invalid dai link index %d", *link_index);
9961018 return -EINVAL;
9971019 }
9981020
@@ -1003,18 +1025,19 @@ static int create_sdw_dailink(struct snd_soc_card *card, · 4 unmodified lines
10031025
10041026 playback = (stream == SNDRV_PCM_STREAM_PLAYBACK);
10051027 capture = (stream == SNDRV_PCM_STREAM_CAPTURE);
1006− init_dai_link(dev, dai_links + *be_index, *be_index, name,
1028+ init_dai_link(dev, dai_links + *link_index, (*link_id)++, name,
10071029 playback, capture,
10081030 cpus + *cpu_id, cpu_dai_num,
10091031 codecs, codec_num,
10101032 NULL, &sdw_ops);
1033+
10111034 /*
10121035 * SoundWire DAILINKs use 'stream' functions and Bank Switch operations
10131036 * based on wait_for_completion(), tag them as 'nonatomic'.
10141037 */
1015− dai_links[*be_index].nonatomic = true;
1038+ dai_links[*link_index].nonatomic = true;
10161039
1017− ret = set_codec_init_func(card, link, dai_links + (*be_index)++,
1040+ ret = set_codec_init_func(card, link, dai_links + (*link_index)++,
10181041 playback, group_id);
10191042 if (ret < 0) {
10201043 dev_err(dev, "failed to init codec %d", codec_index);
@@ -1028,17 +1051,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, · 7 unmodified lines
10281051 return 0;
10291052 }
10301053
1031−/*
1032− * DAI link ID of SSP & DMIC & HDMI are based on last
1033− * link ID used by sdw link. Since be_id may be changed
1034− * in init func of sdw codec, it is not equal to be_id
1035− */
1036−static inline int get_next_be_id(struct snd_soc_dai_link *links,
1037− int be_id)
1038−{
1039− return links[be_id - 1].id + 1;
1040−}
1041−
10421054 #define IDISP_CODEC_MASK 0x4
10431055
10441056 static int sof_card_codec_conf_alloc(struct device *dev,
@@ -1095,7 +1107,7 @@ static int sof_card_dai_links_create(struct device *dev, · 50 unmodified lines
10951107 bool group_generated[SDW_MAX_GROUPS];
10961108 int ssp_codec_index, ssp_mask;
10971109 struct snd_soc_dai_link *links;
1098− int num_links, link_id = 0;
1110+ int num_links, link_index = 0;
10991111 char *name, *cpu_name;
11001112 int total_cpu_dai_num;
11011113 int sdw_cpu_dai_num;
@@ -1131,7 +1143,7 @@ static int sof_card_dai_links_create(struct device *dev, · 29 unmodified lines
11311143 ssp_num = ssp_codec_index >= 0 ? hweight_long(ssp_mask) : 0;
11321144 comp_num = hdmi_num + ssp_num;
11331145
1134− ret = get_sdw_dailink_info(mach_params->links,
1146+ ret = get_sdw_dailink_info(dev, mach_params->links,
11351147 &sdw_be_num, &sdw_cpu_dai_num);
11361148 if (ret < 0) {
11371149 dev_err(dev, "failed to get sdw link info %d", ret);
@@ -1195,24 +1207,18 @@ static int sof_card_dai_links_create(struct device *dev, · 57 unmodified lines
11951207 group_generated[endpoint->group_id])
11961208 continue;
11971209
1198− ret = create_sdw_dailink(card, dev, &be_id, links, sdw_be_num,
1210+ ret = create_sdw_dailink(card, dev, &link_index, links, sdw_be_num,
11991211 sdw_cpu_dai_num, cpus, adr_link,
12001212 &cpu_id, group_generated,
12011213 codec_conf, codec_conf_count,
1202− &codec_conf_index,
1214+ &be_id, &codec_conf_index,
12031215 &ignore_pch_dmic);
12041216 if (ret < 0) {
1205− dev_err(dev, "failed to create dai link %d", be_id);
1206− return -ENOMEM;
1217+ dev_err(dev, "failed to create dai link %d", link_index);
1218+ return ret;
12071219 }
12081220 }
12091221
1210− /* non-sdw DAI follows sdw DAI */
1211− link_id = be_id;
1212−
1213− /* get BE ID for non-sdw DAI */
1214− be_id = get_next_be_id(links, be_id);
1215−
12161222 SSP:
12171223 /* SSP */
12181224 if (!ssp_num)
@@ -1252,17 +1258,17 @@ SSP: · 33 unmodified lines
12521258
12531259 playback = info->direction[SNDRV_PCM_STREAM_PLAYBACK];
12541260 capture = info->direction[SNDRV_PCM_STREAM_CAPTURE];
1255− init_dai_link(dev, links + link_id, be_id, name,
1261+ init_dai_link(dev, links + link_index, be_id, name,
12561262 playback, capture,
12571263 cpus + cpu_id, 1,
12581264 ssp_components, 1,
12591265 NULL, info->ops);
12601266
1261− ret = info->init(card, NULL, links + link_id, info, 0);
1267+ ret = info->init(card, NULL, links + link_index, info, 0);
12621268 if (ret < 0)
12631269 return ret;
12641270
1265− INC_ID(be_id, cpu_id, link_id);
1271+ INC_ID(be_id, cpu_id, link_index);
12661272 }
12671273
12681274 DMIC:
@@ -1273,21 +1279,21 @@ DMIC: · 4 unmodified lines
12731279 goto HDMI;
12741280 }
12751281 cpus[cpu_id].dai_name = "DMIC01 Pin";
1276− init_dai_link(dev, links + link_id, be_id, "dmic01",
1282+ init_dai_link(dev, links + link_index, be_id, "dmic01",
12771283 0, 1, // DMIC only supports capture
12781284 cpus + cpu_id, 1,
12791285 dmic_component, 1,
12801286 sof_sdw_dmic_init, NULL);
1281− INC_ID(be_id, cpu_id, link_id);
1287+ INC_ID(be_id, cpu_id, link_index);
12821288
12831289 cpus[cpu_id].dai_name = "DMIC16k Pin";
1284− init_dai_link(dev, links + link_id, be_id, "dmic16k",
1290+ init_dai_link(dev, links + link_index, be_id, "dmic16k",
12851291 0, 1, // DMIC only supports capture
12861292 cpus + cpu_id, 1,
12871293 dmic_component, 1,
12881294 /* don't call sof_sdw_dmic_init() twice */
12891295 NULL, NULL);
1290− INC_ID(be_id, cpu_id, link_id);
1296+ INC_ID(be_id, cpu_id, link_index);
12911297 }
12921298
12931299 HDMI:
@@ -1325,12 +1331,12 @@ HDMI: · 31 unmodified lines
13251331 return -ENOMEM;
13261332
13271333 cpus[cpu_id].dai_name = cpu_name;
1328− init_dai_link(dev, links + link_id, be_id, name,
1334+ init_dai_link(dev, links + link_index, be_id, name,
13291335 1, 0, // HDMI only supports playback
13301336 cpus + cpu_id, 1,
13311337 idisp_components + i, 1,
13321338 sof_sdw_hdmi_init, NULL);
1333− INC_ID(be_id, cpu_id, link_id);
1339+ INC_ID(be_id, cpu_id, link_index);
13341340 }
13351341
13361342 if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) {
@@ -1354,7 +1360,7 @@ HDMI: · 17 unmodified lines
13541360 return -ENOMEM;
13551361
13561362 cpus[cpu_id].dai_name = cpu_name;
1357− init_dai_link(dev, links + link_id, be_id, name, 1, 1,
1363+ init_dai_link(dev, links + link_index, be_id, name, 1, 1,
13581364 cpus + cpu_id, 1, ssp_components, 1, NULL, NULL);
13591365 }
13601366
sound/soc/intel/boards/sof_sdw_common.h+6−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515
1616 #define MAX_NO_PROPS 2
1717 #define MAX_HDMI_NUM 4
18+#define SDW_AMP_DAI_ID 2
1819 #define SDW_DMIC_DAI_ID 4
1920 #define SDW_MAX_CPU_DAIS 16
2021 #define SDW_INTEL_BIDIR_PDI_BASE 2
@@ -42,7 +43,6 @@ enum { · 21 unmodified lines
4243 #define SOF_SDW_PCH_DMIC BIT(6)
4344 #define SOF_SSP_PORT(x) (((x) & GENMASK(5, 0)) << 7)
4445 #define SOF_SSP_GET_PORT(quirk) (((quirk) >> 7) & GENMASK(5, 0))
45−#define SOF_RT715_DAI_ID_FIX BIT(13)
4646 #define SOF_SDW_NO_AGGREGATION BIT(14)
4747
4848 /* BT audio offload: reserve 3 bits for future */
@@ -52,9 +52,14 @@ enum { · 3 unmodified lines
5252 (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
5353 #define SOF_SSP_BT_OFFLOAD_PRESENT BIT(18)
5454
55+#define SOF_SDW_CODEC_TYPE_JACK 0
56+#define SOF_SDW_CODEC_TYPE_AMP 1
57+#define SOF_SDW_CODEC_TYPE_MIC 2
58+
5559 struct sof_sdw_codec_info {
5660 const int part_id;
5761 const int version_id;
62+ const int codec_type;
5863 int amp_num;
5964 const u8 acpi_id[ACPI_ID_LEN];
6065 const bool direction[2]; // playback & capture support
sound/soc/intel/boards/sof_sdw_rt715.c+0−7
@@ -30,13 +30,6 @@ int sof_sdw_rt715_init(struct snd_soc_card *card, · 29 unmodified lines
3030 struct sof_sdw_codec_info *info,
3131 bool playback)
3232 {
33− /*
34− * DAI ID is fixed at SDW_DMIC_DAI_ID for 715 to
35− * keep sdw DMIC and HDMI setting static in UCM
36− */
37− if (sof_sdw_quirk & SOF_RT715_DAI_ID_FIX)
38− dai_links->id = SDW_DMIC_DAI_ID;
39−
4033 dai_links->init = rt715_rtd_init;
4134
4235 return 0;
sound/soc/intel/boards/sof_sdw_rt715_sdca.c+0−7
@@ -30,13 +30,6 @@ int sof_sdw_rt715_sdca_init(struct snd_soc_card *card, · 29 unmodified lines
3030 struct sof_sdw_codec_info *info,
3131 bool playback)
3232 {
33− /*
34− * DAI ID is fixed at SDW_DMIC_DAI_ID for 715-SDCA to
35− * keep sdw DMIC and HDMI setting static in UCM
36− */
37− if (sof_sdw_quirk & SOF_RT715_DAI_ID_FIX)
38− dai_links->id = SDW_DMIC_DAI_ID;
39−
4033 dai_links->init = rt715_sdca_rtd_init;
4134
4235 return 0;
sound/soc/intel/catpt/dsp.c+12−2
@@ -65,6 +65,7 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, · 64 unmodified lines
6565 {
6666 struct dma_async_tx_descriptor *desc;
6767 enum dma_status status;
68+ int ret;
6869
6970 desc = dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size,
7071 DMA_CTRL_ACK);
@@ -77,13 +78,22 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, · 6 unmodified lines
7778 catpt_updatel_shim(cdev, HMDC,
7879 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id),
7980 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id));
80− dmaengine_submit(desc);
81+
82+ ret = dma_submit_error(dmaengine_submit(desc));
83+ if (ret) {
84+ dev_err(cdev->dev, "submit tx failed: %d\n", ret);
85+ goto clear_hdda;
86+ }
87+
8188 status = dma_wait_for_async_tx(desc);
89+ ret = (status == DMA_COMPLETE) ? 0 : -EPROTO;
90+
91+clear_hdda:
8292 /* regardless of status, disable access to HOST memory in demand mode */
8393 catpt_updatel_shim(cdev, HMDC,
8494 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0);
8595
86− return (status == DMA_COMPLETE) ? 0 : -EPROTO;
96+ return ret;
8797 }
8898
8999 int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan,
sound/soc/intel/catpt/pcm.c+18−19
@@ -259,9 +259,9 @@ static enum catpt_channel_config catpt_get_channel_config(u32 num_channels) · 258 unmodified lines
259259 static int catpt_dai_startup(struct snd_pcm_substream *substream,
260260 struct snd_soc_dai *dai)
261261 {
262− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
263262 struct catpt_stream_template *template;
264263 struct catpt_stream_runtime *stream;
264+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
265265 struct resource *res;
266266 int ret;
267267
@@ -306,8 +306,8 @@ err_pgtbl: · 38 unmodified lines
306306 static void catpt_dai_shutdown(struct snd_pcm_substream *substream,
307307 struct snd_soc_dai *dai)
308308 {
309− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
310309 struct catpt_stream_runtime *stream;
310+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
311311
312312 stream = snd_soc_dai_get_dma_data(dai, substream);
313313
@@ -329,9 +329,9 @@ static int catpt_set_dspvol(struct catpt_dev *cdev, u8 stream_id, long *ctlvol); · 15 unmodified lines
329329 static int catpt_dai_apply_usettings(struct snd_soc_dai *dai,
330330 struct catpt_stream_runtime *stream)
331331 {
332− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
333332 struct snd_soc_component *component = dai->component;
334333 struct snd_kcontrol *pos;
334+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
335335 const char *name;
336336 int ret;
337337 u32 id = stream->info.stream_hw_id;
@@ -374,12 +374,12 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream, · 36 unmodified lines
374374 struct snd_pcm_hw_params *params,
375375 struct snd_soc_dai *dai)
376376 {
377− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
377+ struct snd_pcm_runtime *rtm = substream->runtime;
378+ struct snd_dma_buffer *dmab;
378379 struct catpt_stream_runtime *stream;
379380 struct catpt_audio_format afmt;
380381 struct catpt_ring_info rinfo;
381− struct snd_pcm_runtime *rtm = substream->runtime;
382− struct snd_dma_buffer *dmab;
382+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
383383 int ret;
384384
385385 stream = snd_soc_dai_get_dma_data(dai, substream);
@@ -427,8 +427,8 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream, · 41 unmodified lines
427427 static int catpt_dai_hw_free(struct snd_pcm_substream *substream,
428428 struct snd_soc_dai *dai)
429429 {
430− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
431430 struct catpt_stream_runtime *stream;
431+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
432432
433433 stream = snd_soc_dai_get_dma_data(dai, substream);
434434 if (!stream->allocated)
@@ -444,8 +444,8 @@ static int catpt_dai_hw_free(struct snd_pcm_substream *substream, · 9 unmodified lines
444444 static int catpt_dai_prepare(struct snd_pcm_substream *substream,
445445 struct snd_soc_dai *dai)
446446 {
447− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
448447 struct catpt_stream_runtime *stream;
448+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
449449 int ret;
450450
451451 stream = snd_soc_dai_get_dma_data(dai, substream);
@@ -467,9 +467,9 @@ static int catpt_dai_prepare(struct snd_pcm_substream *substream, · 15 unmodified lines
467467 static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd,
468468 struct snd_soc_dai *dai)
469469 {
470− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
471− struct catpt_stream_runtime *stream;
472470 struct snd_pcm_runtime *runtime = substream->runtime;
471+ struct catpt_stream_runtime *stream;
472+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
473473 snd_pcm_uframes_t pos;
474474 int ret;
475475
@@ -595,9 +595,8 @@ static int catpt_component_open(struct snd_soc_component *component, · 119 unmodified lines
595595 {
596596 struct snd_soc_pcm_runtime *rtm = substream->private_data;
597597
598− if (rtm->dai_link->no_pcm)
599− return 0;
600− snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware);
598+ if (!rtm->dai_link->no_pcm)
599+ snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware);
601600 return 0;
602601 }
603602
@@ -605,10 +604,10 @@ static snd_pcm_uframes_t · 1 unmodified line
605604 catpt_component_pointer(struct snd_soc_component *component,
606605 struct snd_pcm_substream *substream)
607606 {
608− struct catpt_dev *cdev = dev_get_drvdata(component->dev);
609− struct catpt_stream_runtime *stream;
610607 struct snd_soc_pcm_runtime *rtm = substream->private_data;
611608 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtm, 0);
609+ struct catpt_stream_runtime *stream;
610+ struct catpt_dev *cdev = dev_get_drvdata(component->dev);
612611 u32 pos;
613612
614613 if (rtm->dai_link->no_pcm)
@@ -633,8 +632,8 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm, · 18 unmodified lines
633632 struct snd_soc_dai *dai)
634633 {
635634 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtm, 0);
636− struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
637635 struct catpt_ssp_device_format devfmt;
636+ struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
638637 int ret;
639638
640639 devfmt.iface = dai->driver->id;
@@ -894,8 +893,8 @@ static int catpt_stream_volume_get(struct snd_kcontrol *kcontrol, · 253 unmodified lines
894893 {
895894 struct snd_soc_component *component =
896895 snd_soc_kcontrol_component(kcontrol);
897− struct catpt_dev *cdev = dev_get_drvdata(component->dev);
898896 struct catpt_stream_runtime *stream;
897+ struct catpt_dev *cdev = dev_get_drvdata(component->dev);
899898 long *ctlvol = (long *)kcontrol->private_value;
900899 u32 dspvol;
901900 int i;
@@ -926,8 +925,8 @@ static int catpt_stream_volume_put(struct snd_kcontrol *kcontrol, · 24 unmodified lines
926925 {
927926 struct snd_soc_component *component =
928927 snd_soc_kcontrol_component(kcontrol);
929− struct catpt_dev *cdev = dev_get_drvdata(component->dev);
930928 struct catpt_stream_runtime *stream;
929+ struct catpt_dev *cdev = dev_get_drvdata(component->dev);
931930 long *ctlvol = (long *)kcontrol->private_value;
932931 int ret, i;
933932
@@ -1002,8 +1001,8 @@ static int catpt_loopback_switch_put(struct snd_kcontrol *kcontrol, · 68 unmodified lines
10021001 {
10031002 struct snd_soc_component *component =
10041003 snd_soc_kcontrol_component(kcontrol);
1005− struct catpt_dev *cdev = dev_get_drvdata(component->dev);
10061004 struct catpt_stream_runtime *stream;
1005+ struct catpt_dev *cdev = dev_get_drvdata(component->dev);
10071006 bool mute;
10081007 int ret;
10091008
sound/soc/intel/common/soc-acpi-intel-adl-match.c+48−0
@@ -374,6 +374,16 @@ static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = { · 373 unmodified lines
374374 .codecs = {"10EC5682", "RTL5682"},
375375 };
376376
377+static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
378+ .num_codecs = 1,
379+ .codecs = {"RTL1019"}
380+};
381+
382+static const struct snd_soc_acpi_codecs adl_max98390_amp = {
383+ .num_codecs = 1,
384+ .codecs = {"MX98390"}
385+};
386+
377387 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
378388 {
379389 .comp_ids = &adl_rt5682_rt5682s_hp,
@@ -399,6 +409,44 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { · 19 unmodified lines
399409 .sof_fw_filename = "sof-adl.ri",
400410 .sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg",
401411 },
412+ {
413+ .id = "10508825",
414+ .drv_name = "adl_rt1019p_nau8825",
415+ .machine_quirk = snd_soc_acpi_codec_list,
416+ .quirk_data = &adl_rt1019p_amp,
417+ .sof_fw_filename = "sof-adl.ri",
418+ .sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg",
419+ },
420+ {
421+ .id = "10508825",
422+ .drv_name = "adl_max98373_nau8825",
423+ .machine_quirk = snd_soc_acpi_codec_list,
424+ .quirk_data = &adl_max98373_amp,
425+ .sof_fw_filename = "sof-adl.ri",
426+ .sof_tplg_filename = "sof-adl-max98373-nau8825.tplg",
427+ },
428+ {
429+ .id = "10508825",
430+ .drv_name = "adl_mx98360a_nau8825",
431+ .machine_quirk = snd_soc_acpi_codec_list,
432+ .quirk_data = &adl_max98360a_amp,
433+ .sof_fw_filename = "sof-adl.ri",
434+ .sof_tplg_filename = "sof-adl-mx98360a-nau8825.tplg",
435+ },
436+ {
437+ .id = "10508825",
438+ .drv_name = "sof_nau8825",
439+ .sof_fw_filename = "sof-adl.ri",
440+ .sof_tplg_filename = "sof-adl-nau8825.tplg",
441+ },
442+ {
443+ .comp_ids = &adl_rt5682_rt5682s_hp,
444+ .drv_name = "adl_max98390_rt5682",
445+ .machine_quirk = snd_soc_acpi_codec_list,
446+ .quirk_data = &adl_max98390_amp,
447+ .sof_fw_filename = "sof-adl.ri",
448+ .sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
449+ },
402450 {},
403451 };
404452 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
sound/soc/intel/skylake/skl-nhlt.c+0−102
@@ -13,108 +13,6 @@ · 12 unmodified lines
1313 #include "skl.h"
1414 #include "skl-i2s.h"
1515
16−static struct nhlt_specific_cfg *skl_get_specific_cfg(
17− struct device *dev, struct nhlt_fmt *fmt,
18− u8 no_ch, u32 rate, u16 bps, u8 linktype)
19−{
20− struct nhlt_specific_cfg *sp_config;
21− struct wav_fmt *wfmt;
22− struct nhlt_fmt_cfg *fmt_config = fmt->fmt_config;
23− int i;
24−
25− dev_dbg(dev, "Format count =%d\n", fmt->fmt_count);
26−
27− for (i = 0; i < fmt->fmt_count; i++) {
28− wfmt = &fmt_config->fmt_ext.fmt;
29− dev_dbg(dev, "ch=%d fmt=%d s_rate=%d\n", wfmt->channels,
30− wfmt->bits_per_sample, wfmt->samples_per_sec);
31− if (wfmt->channels == no_ch && wfmt->bits_per_sample == bps) {
32− /*
33− * if link type is dmic ignore rate check as the blob is
34− * generic for all rates
35− */
36− sp_config = &fmt_config->config;
37− if (linktype == NHLT_LINK_DMIC)
38− return sp_config;
39−
40− if (wfmt->samples_per_sec == rate)
41− return sp_config;
42− }
43−
44− fmt_config = (struct nhlt_fmt_cfg *)(fmt_config->config.caps +
45− fmt_config->config.size);
46− }
47−
48− return NULL;
49−}
50−
51−static void dump_config(struct device *dev, u32 instance_id, u8 linktype,
52− u8 s_fmt, u8 num_channels, u32 s_rate, u8 dirn, u16 bps)
53−{
54− dev_dbg(dev, "Input configuration\n");
55− dev_dbg(dev, "ch=%d fmt=%d s_rate=%d\n", num_channels, s_fmt, s_rate);
56− dev_dbg(dev, "vbus_id=%d link_type=%d\n", instance_id, linktype);
57− dev_dbg(dev, "bits_per_sample=%d\n", bps);
58−}
59−
60−static bool skl_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt,
61− u32 instance_id, u8 link_type, u8 dirn, u8 dev_type)
62−{
63− dev_dbg(dev, "vbus_id=%d link_type=%d dir=%d dev_type = %d\n",
64− epnt->virtual_bus_id, epnt->linktype,
65− epnt->direction, epnt->device_type);
66−
67− if ((epnt->virtual_bus_id == instance_id) &&
68− (epnt->linktype == link_type) &&
69− (epnt->direction == dirn)) {
70− /* do not check dev_type for DMIC link type */
71− if (epnt->linktype == NHLT_LINK_DMIC)
72− return true;
73−
74− if (epnt->device_type == dev_type)
75− return true;
76− }
77−
78− return false;
79−}
80−
81−struct nhlt_specific_cfg
82−*skl_get_ep_blob(struct skl_dev *skl, u32 instance, u8 link_type,
83− u8 s_fmt, u8 num_ch, u32 s_rate,
84− u8 dirn, u8 dev_type)
85−{
86− struct nhlt_fmt *fmt;
87− struct nhlt_endpoint *epnt;
88− struct hdac_bus *bus = skl_to_bus(skl);
89− struct device *dev = bus->dev;
90− struct nhlt_specific_cfg *sp_config;
91− struct nhlt_acpi_table *nhlt = skl->nhlt;
92− u16 bps = (s_fmt == 16) ? 16 : 32;
93− u8 j;
94−
95− dump_config(dev, instance, link_type, s_fmt, num_ch, s_rate, dirn, bps);
96−
97− epnt = (struct nhlt_endpoint *)nhlt->desc;
98−
99− dev_dbg(dev, "endpoint count =%d\n", nhlt->endpoint_count);
100−
101− for (j = 0; j < nhlt->endpoint_count; j++) {
102− if (skl_check_ep_match(dev, epnt, instance, link_type,
103− dirn, dev_type)) {
104− fmt = (struct nhlt_fmt *)(epnt->config.caps +
105− epnt->config.size);
106− sp_config = skl_get_specific_cfg(dev, fmt, num_ch,
107− s_rate, bps, link_type);
108− if (sp_config)
109− return sp_config;
110− }
111−
112− epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
113− }
114−
115− return NULL;
116−}
117−
11816 static void skl_nhlt_trim_space(char *trim)
11917 {
12018 char *s = trim;
sound/soc/intel/skylake/skl-pcm.c+5−6
@@ -317,6 +317,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream, · 316 unmodified lines
317317 dev_dbg(dai->dev, "dma_id=%d\n", dma_id);
318318
319319 p_params.s_fmt = snd_pcm_format_width(params_format(params));
320+ p_params.s_cont = snd_pcm_format_physical_width(params_format(params));
320321 p_params.ch = params_channels(params);
321322 p_params.s_freq = params_rate(params);
322323 p_params.host_dma_id = dma_id;
@@ -405,6 +406,7 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream, · 82 unmodified lines
405406 struct skl_pipe_params p_params = {0};
406407
407408 p_params.s_fmt = snd_pcm_format_width(params_format(params));
409+ p_params.s_cont = snd_pcm_format_physical_width(params_format(params));
408410 p_params.ch = params_channels(params);
409411 p_params.s_freq = params_rate(params);
410412 p_params.stream = substream->stream;
@@ -562,13 +564,11 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, · 151 unmodified lines
562564
563565 stream_tag = hdac_stream(link_dev)->stream_tag;
564566
565− /* set the stream tag in the codec dai dma params */
566− if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
567− snd_soc_dai_set_tdm_slot(codec_dai, stream_tag, 0, 0, 0);
568− else
569− snd_soc_dai_set_tdm_slot(codec_dai, 0, stream_tag, 0, 0);
567+ /* set the hdac_stream in the codec dai */
568+ snd_soc_dai_set_stream(codec_dai, hdac_stream(link_dev), substream->stream);
570569
571570 p_params.s_fmt = snd_pcm_format_width(params_format(params));
571+ p_params.s_cont = snd_pcm_format_physical_width(params_format(params));
572572 p_params.ch = params_channels(params);
573573 p_params.s_freq = params_rate(params);
574574 p_params.stream = substream->stream;
@@ -1251,7 +1251,6 @@ static int skl_platform_soc_get_time_info( · 676 unmodified lines
12511251 snd_pcm_gettime(substream->runtime, system_ts);
12521252
12531253 nsec = timecounter_read(&hstr->tc);
1254− nsec = div_u64(nsec, 3); /* can be optimized */
12551254 if (audio_tstamp_config->report_delay)
12561255 nsec = skl_adjust_codec_delay(substream, nsec);
12571256
sound/soc/intel/skylake/skl-topology.c+17−12
@@ -285,7 +285,7 @@ static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, · 284 unmodified lines
285285 {
286286 struct skl_module_cfg *m_cfg = w->priv;
287287 int link_type, dir;
288− u32 ch, s_freq, s_fmt;
288+ u32 ch, s_freq, s_fmt, s_cont;
289289 struct nhlt_specific_cfg *cfg;
290290 u8 dev_type = skl_tplg_be_dev_type(m_cfg->dev_type);
291291 int fmt_idx = m_cfg->fmt_idx;
@@ -301,7 +301,8 @@ static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, · 9 unmodified lines
301301 link_type = NHLT_LINK_DMIC;
302302 dir = SNDRV_PCM_STREAM_CAPTURE;
303303 s_freq = m_iface->inputs[0].fmt.s_freq;
304− s_fmt = m_iface->inputs[0].fmt.bit_depth;
304+ s_fmt = m_iface->inputs[0].fmt.valid_bit_depth;
305+ s_cont = m_iface->inputs[0].fmt.bit_depth;
305306 ch = m_iface->inputs[0].fmt.channels;
306307 break;
307308
@@ -310,12 +311,14 @@ static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, · 2 unmodified lines
310311 if (m_cfg->hw_conn_type == SKL_CONN_SOURCE) {
311312 dir = SNDRV_PCM_STREAM_PLAYBACK;
312313 s_freq = m_iface->outputs[0].fmt.s_freq;
313− s_fmt = m_iface->outputs[0].fmt.bit_depth;
314+ s_fmt = m_iface->outputs[0].fmt.valid_bit_depth;
315+ s_cont = m_iface->outputs[0].fmt.bit_depth;
314316 ch = m_iface->outputs[0].fmt.channels;
315317 } else {
316318 dir = SNDRV_PCM_STREAM_CAPTURE;
317319 s_freq = m_iface->inputs[0].fmt.s_freq;
318− s_fmt = m_iface->inputs[0].fmt.bit_depth;
320+ s_fmt = m_iface->inputs[0].fmt.valid_bit_depth;
321+ s_cont = m_iface->inputs[0].fmt.bit_depth;
319322 ch = m_iface->inputs[0].fmt.channels;
320323 }
321324 break;
@@ -325,16 +328,17 @@ static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, · 3 unmodified lines
325328 }
326329
327330 /* update the blob based on virtual bus_id and default params */
328− cfg = skl_get_ep_blob(skl, m_cfg->vbus_id, link_type,
329− s_fmt, ch, s_freq, dir, dev_type);
331+ cfg = intel_nhlt_get_endpoint_blob(skl->dev, skl->nhlt, m_cfg->vbus_id,
332+ link_type, s_fmt, s_cont, ch,
333+ s_freq, dir, dev_type);
330334 if (cfg) {
331335 m_cfg->formats_config[SKL_PARAM_INIT].caps_size = cfg->size;
332336 m_cfg->formats_config[SKL_PARAM_INIT].caps = (u32 *)&cfg->caps;
333337 } else {
334338 dev_err(skl->dev, "Blob NULL for id %x type %d dirn %d\n",
335339 m_cfg->vbus_id, link_type, dir);
336− dev_err(skl->dev, "PCM: ch %d, freq %d, fmt %d\n",
337− ch, s_freq, s_fmt);
340+ dev_err(skl->dev, "PCM: ch %d, freq %d, fmt %d/%d\n",
341+ ch, s_freq, s_fmt, s_cont);
338342 return -EIO;
339343 }
340344
@@ -1849,10 +1853,11 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, · 1508 unmodified lines
18491853 pipe_fmt = &pipe->configs[pipe->pipe_config_idx].in_fmt;
18501854
18511855 /* update the blob based on virtual bus_id*/
1852− cfg = skl_get_ep_blob(skl, mconfig->vbus_id, link_type,
1853− pipe_fmt->bps, pipe_fmt->channels,
1854− pipe_fmt->freq, pipe->direction,
1855− dev_type);
1856+ cfg = intel_nhlt_get_endpoint_blob(dai->dev, skl->nhlt,
1857+ mconfig->vbus_id, link_type,
1858+ pipe_fmt->bps, params->s_cont,
1859+ pipe_fmt->channels, pipe_fmt->freq,
1860+ pipe->direction, dev_type);
18561861 if (cfg) {
18571862 mconfig->formats_config[SKL_PARAM_INIT].caps_size = cfg->size;
18581863 mconfig->formats_config[SKL_PARAM_INIT].caps = (u32 *)&cfg->caps;
sound/soc/intel/skylake/skl-topology.h+1−0
@@ -284,6 +284,7 @@ struct skl_pipe_params { · 283 unmodified lines
284284 u32 ch;
285285 u32 s_freq;
286286 u32 s_fmt;
287+ u32 s_cont;
287288 u8 linktype;
288289 snd_pcm_format_t format;
289290 int link_index;
sound/soc/intel/skylake/skl.c+2−2
@@ -439,7 +439,7 @@ static int skl_free(struct hdac_bus *bus) · 438 unmodified lines
439439
440440 skl->init_done = 0; /* to be sure */
441441
442− snd_hdac_ext_stop_streams(bus);
442+ snd_hdac_stop_streams_and_chip(bus);
443443
444444 if (bus->irq >= 0)
445445 free_irq(bus->irq, (void *)bus);
@@ -1096,7 +1096,7 @@ static void skl_shutdown(struct pci_dev *pci) · 650 unmodified lines
10961096 if (!skl->init_done)
10971097 return;
10981098
1099− snd_hdac_ext_stop_streams(bus);
1099+ snd_hdac_stop_streams_and_chip(bus);
11001100 list_for_each_entry(s, &bus->stream_list, list) {
11011101 stream = stream_to_hdac_ext_stream(s);
11021102 snd_hdac_ext_stream_decouple(bus, stream, false);
sound/soc/intel/skylake/skl.h+0−4
@@ -165,10 +165,6 @@ struct skl_dsp_ops { · 164 unmodified lines
165165 int skl_platform_unregister(struct device *dev);
166166 int skl_platform_register(struct device *dev);
167167
168−struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
169− u8 link_type, u8 s_fmt, u8 num_ch,
170− u32 s_rate, u8 dirn, u8 dev_type);
171−
172168 int skl_nhlt_update_topology_bin(struct skl_dev *skl);
173169 int skl_init_dsp(struct skl_dev *skl);
174170 int skl_free_dsp(struct skl_dev *skl);
sound/soc/mediatek/Kconfig+2−0
@@ -205,6 +205,7 @@ config SND_SOC_MT8195_MT6359_RT1019_RT5682 · 204 unmodified lines
205205 select SND_SOC_MT6359
206206 select SND_SOC_RT1015P
207207 select SND_SOC_RT5682_I2C
208+ select SND_SOC_RT5682S
208209 select SND_SOC_DMIC
209210 select SND_SOC_HDMI_CODEC
210211 help
@@ -220,6 +221,7 @@ config SND_SOC_MT8195_MT6359_RT1011_RT5682 · 9 unmodified lines
220221 select SND_SOC_MT6359
221222 select SND_SOC_RT1011
222223 select SND_SOC_RT5682_I2C
224+ select SND_SOC_RT5682S
223225 select SND_SOC_DMIC
224226 select SND_SOC_HDMI_CODEC
225227 help
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c+0−2
@@ -1474,9 +1474,7 @@ static struct platform_driver mt2701_afe_pcm_driver = { · 1473 unmodified lines
14741474 .driver = {
14751475 .name = "mt2701-audio",
14761476 .of_match_table = mt2701_afe_pcm_dt_match,
1477−#ifdef CONFIG_PM
14781477 .pm = &mt2701_afe_pm_ops,
1479−#endif
14801478 },
14811479 .probe = mt2701_afe_pcm_dev_probe,
14821480 .remove = mt2701_afe_pcm_dev_remove,
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c+0−2
@@ -901,9 +901,7 @@ static struct platform_driver mt6797_afe_pcm_driver = { · 900 unmodified lines
901901 .driver = {
902902 .name = "mt6797-audio",
903903 .of_match_table = mt6797_afe_pcm_dt_match,
904−#ifdef CONFIG_PM
905904 .pm = &mt6797_afe_pm_ops,
906−#endif
907905 },
908906 .probe = mt6797_afe_pcm_dev_probe,
909907 .remove = mt6797_afe_pcm_dev_remove,
sound/soc/mediatek/mt8173/mt8173-max98090.c+3−5
@@ -177,9 +177,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) · 176 unmodified lines
177177 card->dev = &pdev->dev;
178178
179179 ret = devm_snd_soc_register_card(&pdev->dev, card);
180− if (ret)
181− dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
182− __func__, ret);
180+
181+ of_node_put(codec_node);
182+ of_node_put(platform_node);
183183 return ret;
184184 }
185185
@@ -193,9 +193,7 @@ static struct platform_driver mt8173_max98090_driver = { · 7 unmodified lines
193193 .driver = {
194194 .name = "mt8173-max98090",
195195 .of_match_table = mt8173_max98090_dt_match,
196−#ifdef CONFIG_PM
197196 .pm = &snd_soc_pm_ops,
198−#endif
199197 },
200198 .probe = mt8173_max98090_dev_probe,
201199 };
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c+2−5
@@ -215,9 +215,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) · 214 unmodified lines
215215 card->dev = &pdev->dev;
216216
217217 ret = devm_snd_soc_register_card(&pdev->dev, card);
218− if (ret)
219− dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
220− __func__, ret);
218+
219+ of_node_put(platform_node);
221220 return ret;
222221 }
223222
@@ -231,9 +230,7 @@ static struct platform_driver mt8173_rt5650_rt5514_driver = { · 7 unmodified lines
231230 .driver = {
232231 .name = "mtk-rt5650-rt5514",
233232 .of_match_table = mt8173_rt5650_rt5514_dt_match,
234−#ifdef CONFIG_PM
235233 .pm = &snd_soc_pm_ops,
236−#endif
237234 },
238235 .probe = mt8173_rt5650_rt5514_dev_probe,
239236 };
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c+2−5
@@ -282,9 +282,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) · 281 unmodified lines
282282 card->dev = &pdev->dev;
283283
284284 ret = devm_snd_soc_register_card(&pdev->dev, card);
285− if (ret)
286− dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
287− __func__, ret);
285+
286+ of_node_put(platform_node);
288287 return ret;
289288 }
290289
@@ -298,9 +297,7 @@ static struct platform_driver mt8173_rt5650_rt5676_driver = { · 7 unmodified lines
298297 .driver = {
299298 .name = "mtk-rt5650-rt5676",
300299 .of_match_table = mt8173_rt5650_rt5676_dt_match,
301−#ifdef CONFIG_PM
302300 .pm = &snd_soc_pm_ops,
303−#endif
304301 },
305302 .probe = mt8173_rt5650_rt5676_dev_probe,
306303 };
sound/soc/mediatek/mt8173/mt8173-rt5650.c+2−5
@@ -320,9 +320,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) · 319 unmodified lines
320320 card->dev = &pdev->dev;
321321
322322 ret = devm_snd_soc_register_card(&pdev->dev, card);
323− if (ret)
324− dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
325− __func__, ret);
323+
324+ of_node_put(platform_node);
326325 return ret;
327326 }
328327
@@ -336,9 +335,7 @@ static struct platform_driver mt8173_rt5650_driver = { · 7 unmodified lines
336335 .driver = {
337336 .name = "mtk-rt5650",
338337 .of_match_table = mt8173_rt5650_dt_match,
339−#ifdef CONFIG_PM
340338 .pm = &snd_soc_pm_ops,
341−#endif
342339 },
343340 .probe = mt8173_rt5650_dev_probe,
344341 };
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c+0−2
@@ -1279,9 +1279,7 @@ static struct platform_driver mt8183_afe_pcm_driver = { · 1278 unmodified lines
12791279 .driver = {
12801280 .name = "mt8183-audio",
12811281 .of_match_table = mt8183_afe_pcm_dt_match,
1282−#ifdef CONFIG_PM
12831282 .pm = &mt8183_afe_pm_ops,
1284−#endif
12851283 },
12861284 .probe = mt8183_afe_pcm_dev_probe,
12871285 .remove = mt8183_afe_pcm_dev_remove,
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c+11−10
@@ -155,9 +155,9 @@ static const struct snd_soc_ops mt8183_da7219_rt1015_i2s_ops = { · 154 unmodified lines
155155 static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
156156 struct snd_pcm_hw_params *params)
157157 {
158− /* fix BE i2s format to 32bit, clean param mask first */
158+ /* fix BE i2s format to S32_LE, clean param mask first */
159159 snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
160− 0, SNDRV_PCM_FORMAT_LAST);
160+ 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
161161
162162 params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
163163
@@ -167,9 +167,9 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, · 3 unmodified lines
167167 static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
168168 struct snd_pcm_hw_params *params)
169169 {
170− /* fix BE i2s format to 32bit, clean param mask first */
170+ /* fix BE i2s format to S24_LE, clean param mask first */
171171 snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
172− 0, SNDRV_PCM_FORMAT_LAST);
172+ 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
173173
174174 params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
175175
@@ -685,7 +685,6 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) · 509 unmodified lines
685685 struct snd_soc_dai_link *dai_link;
686686 struct mt8183_da7219_max98357_priv *priv;
687687 struct pinctrl *pinctrl;
688− const struct of_device_id *match;
689688 int ret, i;
690689
691690 platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -695,11 +694,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) · 3 unmodified lines
695694 return -EINVAL;
696695 }
697696
698− match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
699− if (!match || !match->data)
697+ card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
698+ if (!card)
700699 return -EINVAL;
701−
702− card = (struct snd_soc_card *)match->data;
703700 card->dev = &pdev->dev;
704701
705702 hdmi_codec = of_parse_phandle(pdev->dev.of_node,
@@ -781,7 +778,11 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) · 75 unmodified lines
781778 return ret;
782779 }
783780
784− return devm_snd_soc_register_card(&pdev->dev, card);
781+ ret = devm_snd_soc_register_card(&pdev->dev, card);
782+
783+ of_node_put(platform_node);
784+ of_node_put(hdmi_codec);
785+ return ret;
785786 }
786787
787788 #ifdef CONFIG_OF
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c+14−12
@@ -94,11 +94,11 @@ static const struct snd_soc_ops mt8183_mt6358_rt1015_i2s_ops = { · 93 unmodified lines
9494 static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
9595 struct snd_pcm_hw_params *params)
9696 {
97− dev_dbg(rtd->dev, "%s(), fix format to 32bit\n", __func__);
97+ dev_dbg(rtd->dev, "%s(), fix format to S32_LE\n", __func__);
9898
99− /* fix BE i2s format to 32bit, clean param mask first */
99+ /* fix BE i2s format to S32_LE, clean param mask first */
100100 snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
101− 0, SNDRV_PCM_FORMAT_LAST);
101+ 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
102102
103103 params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
104104 return 0;
@@ -107,11 +107,11 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, · 2 unmodified lines
107107 static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
108108 struct snd_pcm_hw_params *params)
109109 {
110− dev_dbg(rtd->dev, "%s(), fix format to 32bit\n", __func__);
110+ dev_dbg(rtd->dev, "%s(), fix format to S24_LE\n", __func__);
111111
112− /* fix BE i2s format to 32bit, clean param mask first */
112+ /* fix BE i2s format to S24_LE, clean param mask first */
113113 snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
114− 0, SNDRV_PCM_FORMAT_LAST);
114+ 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
115115
116116 params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
117117 return 0;
@@ -637,7 +637,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) · 519 unmodified lines
637637 struct device_node *platform_node, *ec_codec, *hdmi_codec;
638638 struct snd_soc_dai_link *dai_link;
639639 struct mt8183_mt6358_ts3a227_max98357_priv *priv;
640− const struct of_device_id *match;
641640 int ret, i;
642641
643642 platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -647,11 +646,9 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) · 3 unmodified lines
647646 return -EINVAL;
648647 }
649648
650− match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
651− if (!match || !match->data)
649+ card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
650+ if (!card)
652651 return -EINVAL;
653−
654− card = (struct snd_soc_card *)match->data;
655652 card->dev = &pdev->dev;
656653
657654 ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0);
@@ -780,7 +777,12 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) · 122 unmodified lines
780777 __func__, ret);
781778 }
782779
783− return devm_snd_soc_register_card(&pdev->dev, card);
780+ ret = devm_snd_soc_register_card(&pdev->dev, card);
781+
782+ of_node_put(platform_node);
783+ of_node_put(ec_codec);
784+ of_node_put(hdmi_codec);
785+ return ret;
784786 }
785787
786788 #ifdef CONFIG_OF
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c+0−2
@@ -2381,9 +2381,7 @@ static struct platform_driver mt8192_afe_pcm_driver = { · 2380 unmodified lines
23812381 .driver = {
23822382 .name = "mt8192-audio",
23832383 .of_match_table = mt8192_afe_pcm_dt_match,
2384−#ifdef CONFIG_PM
23852384 .pm = &mt8192_afe_pm_ops,
2386−#endif
23872385 },
23882386 .probe = mt8192_afe_pcm_dev_probe,
23892387 .remove = mt8192_afe_pcm_dev_remove,
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c+9−8
@@ -350,9 +350,9 @@ static int mt8192_mt6359_hdmi_init(struct snd_soc_pcm_runtime *rtd) · 349 unmodified lines
350350 static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
351351 struct snd_pcm_hw_params *params)
352352 {
353− /* fix BE i2s format to 32bit, clean param mask first */
353+ /* fix BE i2s format to S24_LE, clean param mask first */
354354 snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
355− 0, SNDRV_PCM_FORMAT_LAST);
355+ 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
356356
357357 params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
358358
@@ -1106,7 +1106,6 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) · 747 unmodified lines
11061106 struct device_node *platform_node, *hdmi_codec;
11071107 int ret, i;
11081108 struct snd_soc_dai_link *dai_link;
1109− const struct of_device_id *match;
11101109 struct mt8192_mt6359_priv *priv;
11111110
11121111 platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -1116,11 +1115,9 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) · 3 unmodified lines
11161115 return -EINVAL;
11171116 }
11181117
1119− match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
1120− if (!match || !match->data)
1118+ card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
1119+ if (!card)
11211120 return -EINVAL;
1122−
1123− card = (struct snd_soc_card *)match->data;
11241121 card->dev = &pdev->dev;
11251122
11261123 hdmi_codec = of_parse_phandle(pdev->dev.of_node,
@@ -1172,7 +1169,11 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) · 45 unmodified lines
11721169 return ret;
11731170 }
11741171
1175− return devm_snd_soc_register_card(&pdev->dev, card);
1172+ ret = devm_snd_soc_register_card(&pdev->dev, card);
1173+
1174+ of_node_put(platform_node);
1175+ of_node_put(hdmi_codec);
1176+ return ret;
11761177 }
11771178
11781179 #ifdef CONFIG_OF
sound/soc/mediatek/mt8195/mt8195-afe-clk.c+6−6
@@ -326,7 +326,7 @@ int mt8195_afe_enable_reg_rw_clk(struct mtk_base_afe *afe) · 325 unmodified lines
326326 {
327327 struct mt8195_afe_private *afe_priv = afe->platform_priv;
328328 int i;
329− unsigned int clk_array[] = {
329+ static const unsigned int clk_array[] = {
330330 MT8195_CLK_SCP_ADSP_AUDIODSP, /* bus clock for infra */
331331 MT8195_CLK_TOP_AUDIO_H_SEL, /* clock for ADSP bus */
332332 MT8195_CLK_TOP_AUDIO_LOCAL_BUS_SEL, /* bus clock for DRAM access */
@@ -347,7 +347,7 @@ int mt8195_afe_disable_reg_rw_clk(struct mtk_base_afe *afe) · 14 unmodified lines
347347 {
348348 struct mt8195_afe_private *afe_priv = afe->platform_priv;
349349 int i;
350− unsigned int clk_array[] = {
350+ static const unsigned int clk_array[] = {
351351 MT8195_CLK_AUD_A1SYS,
352352 MT8195_CLK_AUD_A1SYS_HP,
353353 MT8195_CLK_AUD_AFE,
@@ -380,11 +380,11 @@ static int mt8195_afe_enable_timing_sys(struct mtk_base_afe *afe) · 26 unmodified lines
380380 {
381381 struct mt8195_afe_private *afe_priv = afe->platform_priv;
382382 int i;
383− unsigned int clk_array[] = {
383+ static const unsigned int clk_array[] = {
384384 MT8195_CLK_AUD_A1SYS,
385385 MT8195_CLK_AUD_A2SYS,
386386 };
387− unsigned int cg_array[] = {
387+ static const unsigned int cg_array[] = {
388388 MT8195_TOP_CG_A1SYS_TIMING,
389389 MT8195_TOP_CG_A2SYS_TIMING,
390390 MT8195_TOP_CG_26M_TIMING,
@@ -403,11 +403,11 @@ static int mt8195_afe_disable_timing_sys(struct mtk_base_afe *afe) · 12 unmodified lines
403403 {
404404 struct mt8195_afe_private *afe_priv = afe->platform_priv;
405405 int i;
406− unsigned int clk_array[] = {
406+ static const unsigned int clk_array[] = {
407407 MT8195_CLK_AUD_A2SYS,
408408 MT8195_CLK_AUD_A1SYS,
409409 };
410− unsigned int cg_array[] = {
410+ static const unsigned int cg_array[] = {
411411 MT8195_TOP_CG_26M_TIMING,
412412 MT8195_TOP_CG_A2SYS_TIMING,
413413 MT8195_TOP_CG_A1SYS_TIMING,
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c+8−1
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/of.h>
1515 #include <linux/of_address.h>
1616 #include <linux/of_platform.h>
17+#include <linux/of_reserved_mem.h>
1718 #include <linux/pm_runtime.h>
1819 #include "mt8195-afe-common.h"
1920 #include "mt8195-afe-clk.h"
@@ -3028,7 +3029,7 @@ static const struct reg_sequence mt8195_afe_reg_defaults[] = { · 3008 unmodified lines
30283029
30293030 static const struct reg_sequence mt8195_cg_patch[] = {
30303031 { AUDIO_TOP_CON0, 0xfffffffb },
3031− { AUDIO_TOP_CON1, 0xfffffffa },
3032+ { AUDIO_TOP_CON1, 0xfffffff8 },
30323033 };
30333034
30343035 static int mt8195_afe_init_registers(struct mtk_base_afe *afe)
@@ -3061,6 +3062,12 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) · 26 unmodified lines
30613062 int i, irq_id, ret;
30623063 struct snd_soc_component *component;
30633064
3065+ ret = of_reserved_mem_device_init(dev);
3066+ if (ret) {
3067+ dev_err(dev, "failed to assign memory region: %d\n", ret);
3068+ return ret;
3069+ }
3070+
30643071 ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
30653072 if (ret)
30663073 return ret;
sound/soc/mediatek/mt8195/mt8195-dai-pcm.c+21−52
@@ -80,8 +80,15 @@ static const struct snd_soc_dapm_widget mtk_dai_pcm_widgets[] = { · 79 unmodified lines
8080 mtk_dai_pcm_o001_mix,
8181 ARRAY_SIZE(mtk_dai_pcm_o001_mix)),
8282
83+ SND_SOC_DAPM_SUPPLY("PCM_EN", PCM_INTF_CON1,
84+ PCM_INTF_CON1_PCM_EN_SHIFT, 0, NULL, 0),
85+
8386 SND_SOC_DAPM_INPUT("PCM1_INPUT"),
8487 SND_SOC_DAPM_OUTPUT("PCM1_OUTPUT"),
88+
89+ SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc11"),
90+ SND_SOC_DAPM_CLOCK_SUPPLY("aud_asrc12"),
91+ SND_SOC_DAPM_CLOCK_SUPPLY("aud_pcmif"),
8592 };
8693
8794 static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = {
@@ -97,22 +104,18 @@ static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = { · 9 unmodified lines
97104 {"PCM1 Playback", NULL, "O000"},
98105 {"PCM1 Playback", NULL, "O001"},
99106
107+ {"PCM1 Playback", NULL, "PCM_EN"},
108+ {"PCM1 Playback", NULL, "aud_asrc12"},
109+ {"PCM1 Playback", NULL, "aud_pcmif"},
110+
111+ {"PCM1 Capture", NULL, "PCM_EN"},
112+ {"PCM1 Capture", NULL, "aud_asrc11"},
113+ {"PCM1 Capture", NULL, "aud_pcmif"},
114+
100115 {"PCM1_OUTPUT", NULL, "PCM1 Playback"},
101116 {"PCM1 Capture", NULL, "PCM1_INPUT"},
102117 };
103118
104−static void mtk_dai_pcm_enable(struct mtk_base_afe *afe)
105−{
106− regmap_update_bits(afe->regmap, PCM_INTF_CON1,
107− PCM_INTF_CON1_PCM_EN, PCM_INTF_CON1_PCM_EN);
108−}
109−
110−static void mtk_dai_pcm_disable(struct mtk_base_afe *afe)
111−{
112− regmap_update_bits(afe->regmap, PCM_INTF_CON1,
113− PCM_INTF_CON1_PCM_EN, 0x0);
114−}
115−
116119 static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
117120 struct snd_soc_dai *dai)
118121 {
@@ -207,54 +210,22 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream, · 88 unmodified lines
207210 }
208211
209212 /* dai ops */
210−static int mtk_dai_pcm_startup(struct snd_pcm_substream *substream,
211− struct snd_soc_dai *dai)
212−{
213− struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
214− struct mt8195_afe_private *afe_priv = afe->platform_priv;
215−
216− if (dai->component->active)
217− return 0;
218−
219− mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11]);
220− mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12]);
221− mt8195_afe_enable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF]);
222−
223− return 0;
224−}
225−
226−static void mtk_dai_pcm_shutdown(struct snd_pcm_substream *substream,
227− struct snd_soc_dai *dai)
228−{
229− struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
230− struct mt8195_afe_private *afe_priv = afe->platform_priv;
231−
232− if (dai->component->active)
233− return;
234−
235− mtk_dai_pcm_disable(afe);
236−
237− mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF]);
238− mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12]);
239− mt8195_afe_disable_clk(afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11]);
240−}
241−
242213 static int mtk_dai_pcm_prepare(struct snd_pcm_substream *substream,
243214 struct snd_soc_dai *dai)
244215 {
245− struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
246− int ret = 0;
216+ int ret;
247217
248− if (snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK) &&
249− snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE))
218+ dev_dbg(dai->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n",
219+ __func__, dai->id, substream->stream,
220+ dai->playback_widget->active, dai->capture_widget->active);
221+
222+ if (dai->playback_widget->active || dai->capture_widget->active)
250223 return 0;
251224
252225 ret = mtk_dai_pcm_configure(substream, dai);
253226 if (ret)
254227 return ret;
255228
256− mtk_dai_pcm_enable(afe);
257−
258229 return 0;
259230 }
260231
@@ -316,8 +287,6 @@ static int mtk_dai_pcm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 55 unmodified lines
316287 }
317288
318289 static const struct snd_soc_dai_ops mtk_dai_pcm_ops = {
319− .startup = mtk_dai_pcm_startup,
320− .shutdown = mtk_dai_pcm_shutdown,
321290 .prepare = mtk_dai_pcm_prepare,
322291 .set_fmt = mtk_dai_pcm_set_fmt,
323292 };
sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c+95−52
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include "../../codecs/rt1011.h"
1919 #include "../../codecs/rt5682.h"
2020 #include "../common/mtk-afe-platform-driver.h"
21+#include "mt8195-afe-clk.h"
2122 #include "mt8195-afe-common.h"
2223
2324 #define RT1011_CODEC_DAI "rt1011-aif"
@@ -27,13 +28,14 @@ · 3 unmodified lines
2728 #define RT5682_CODEC_DAI "rt5682-aif1"
2829 #define RT5682_DEV0_NAME "rt5682.2-001a"
2930
31+#define RT5682S_CODEC_DAI "rt5682s-aif1"
32+#define RT5682S_DEV0_NAME "rt5682s.2-001a"
33+
3034 struct mt8195_mt6359_rt1011_rt5682_priv {
31− struct device_node *platform_node;
32− struct device_node *hdmi_node;
33− struct device_node *dp_node;
3435 struct snd_soc_jack headset_jack;
3536 struct snd_soc_jack dp_jack;
3637 struct snd_soc_jack hdmi_jack;
38+ struct clk *i2so1_mclk;
3739 };
3840
3941 static const struct snd_soc_dapm_widget
@@ -84,8 +86,8 @@ static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream *substream, · 44 unmodified lines
8486 return ret;
8587 }
8688
87− ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL1, RT5682_PLL1_S_BCLK1,
88− rate * 64, rate * 512);
89+ ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL1, RT5682_PLL1_S_MCLK,

260 more lines aren’t shown here.

sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c+400−70

This diff is large: its 683 lines aren’t shown here.

sound/soc/mediatek/mt8195/mt8195-reg.h+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/meson/aiu.c+11−25

This diff is large: its 58 lines aren’t shown here.

sound/soc/meson/axg-fifo.c+4−12

This diff is large: its 25 lines aren’t shown here.

sound/soc/meson/axg-pdm.c+6−19

This diff is large: its 43 lines aren’t shown here.

sound/soc/meson/axg-spdifin.c+4−13

This diff is large: its 33 lines aren’t shown here.

sound/soc/meson/axg-spdifout.c+4−13

This diff is large: its 33 lines aren’t shown here.

sound/soc/meson/axg-tdm-formatter.c+13−37

This diff is large: its 79 lines aren’t shown here.

sound/soc/meson/axg-tdm-interface.c+7−18

This diff is large: its 43 lines aren’t shown here.

sound/soc/meson/meson-card-utils.c+3−5

This diff is large: its 15 lines aren’t shown here.

sound/soc/meson/t9015.c+4−10

This diff is large: its 23 lines aren’t shown here.

sound/soc/mxs/mxs-sgtl5000.c+2−6

This diff is large: its 15 lines aren’t shown here.

sound/soc/qcom/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/qcom/apq8016_sbc.c+129−5

This diff is large: its 201 lines aren’t shown here.

sound/soc/qcom/common.c+14−6

This diff is large: its 48 lines aren’t shown here.

sound/soc/qcom/qdsp6/q6apm.c+8−6

This diff is large: its 31 lines aren’t shown here.

sound/soc/qcom/sc7180.c+19−5

This diff is large: its 51 lines aren’t shown here.

sound/soc/qcom/sdm845.c+11−3

This diff is large: its 50 lines aren’t shown here.

sound/soc/qcom/sm8250.c+2−2

This diff is large: its 11 lines aren’t shown here.

sound/soc/rockchip/rk3288_hdmi_analog.c+3−7

This diff is large: its 17 lines aren’t shown here.

sound/soc/samsung/aries_wm8994.c+7−10

This diff is large: its 27 lines aren’t shown here.

sound/soc/samsung/arndale.c+2−3

This diff is large: its 12 lines aren’t shown here.

sound/soc/samsung/idma.c+2−0

This diff is large: its 9 lines aren’t shown here.

sound/soc/samsung/littlemill.c+2−3

This diff is large: its 12 lines aren’t shown here.

sound/soc/samsung/lowland.c+2−3

This diff is large: its 12 lines aren’t shown here.

sound/soc/samsung/odroid.c+1−3

This diff is large: its 11 lines aren’t shown here.

sound/soc/samsung/smdk_wm8994.c+2−2

This diff is large: its 11 lines aren’t shown here.

sound/soc/samsung/smdk_wm8994pcm.c+2−2

This diff is large: its 11 lines aren’t shown here.

sound/soc/samsung/snow.c+3−6

This diff is large: its 16 lines aren’t shown here.

sound/soc/samsung/speyside.c+2−3

This diff is large: its 12 lines aren’t shown here.

sound/soc/samsung/tm2_wm5110.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/samsung/tobermory.c+2−3

This diff is large: its 12 lines aren’t shown here.

sound/soc/sh/rz-ssi.c+6−1

This diff is large: its 14 lines aren’t shown here.

sound/soc/soc-component.c+28−0

This diff is large: its 35 lines aren’t shown here.

sound/soc/soc-core.c+50−1

This diff is large: its 65 lines aren’t shown here.

sound/soc/soc-dai.c+28−12

This diff is large: its 54 lines aren’t shown here.

sound/soc/soc-pcm.c+249−131

This diff is large: its 940 lines aren’t shown here.

sound/soc/soc-topology.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/sof/Kconfig+15−3

This diff is large: its 52 lines aren’t shown here.

sound/soc/sof/Makefile+3−1

This diff is large: its 13 lines aren’t shown here.

sound/soc/sof/amd/Kconfig+33−0

This diff is large: its 34 lines aren’t shown here.

sound/soc/sof/amd/Makefile+11−0

This diff is large: its 12 lines aren’t shown here.

sound/soc/sof/amd/acp-dsp-offset.h+78−0

This diff is large: its 79 lines aren’t shown here.

sound/soc/sof/amd/acp-ipc.c+187−0

This diff is large: its 188 lines aren’t shown here.

sound/soc/sof/amd/acp-loader.c+199−0

This diff is large: its 200 lines aren’t shown here.

sound/soc/sof/amd/acp-pcm.c+82−0

This diff is large: its 83 lines aren’t shown here.

sound/soc/sof/amd/acp-stream.c+181−0

This diff is large: its 182 lines aren’t shown here.

sound/soc/sof/amd/acp-trace.c+84−0

This diff is large: its 85 lines aren’t shown here.

sound/soc/sof/amd/acp.c+446−0

This diff is large: its 447 lines aren’t shown here.

sound/soc/sof/amd/acp.h+226−0

This diff is large: its 227 lines aren’t shown here.

sound/soc/sof/amd/pci-rn.c+165−0

This diff is large: its 166 lines aren’t shown here.

sound/soc/sof/amd/renoir.c+186−0

This diff is large: its 187 lines aren’t shown here.

sound/soc/sof/control.c+17−44

This diff is large: its 158 lines aren’t shown here.

sound/soc/sof/core.c+82−53

This diff is large: its 219 lines aren’t shown here.

sound/soc/sof/debug.c+130−12

This diff is large: its 214 lines aren’t shown here.

sound/soc/sof/imx/Kconfig+13−33

This diff is large: its 67 lines aren’t shown here.

sound/soc/sof/imx/imx-common.c+26−2

This diff is large: its 36 lines aren’t shown here.

sound/soc/sof/imx/imx-common.h+11−0

This diff is large: its 23 lines aren’t shown here.

sound/soc/sof/imx/imx-ops.h+0−10

This diff is large: its 11 lines aren’t shown here.

sound/soc/sof/imx/imx8.c+178−42

This diff is large: its 318 lines aren’t shown here.

sound/soc/sof/imx/imx8m.c+220−40

This diff is large: its 367 lines aren’t shown here.

sound/soc/sof/intel/apl.c+4−3

This diff is large: its 27 lines aren’t shown here.

sound/soc/sof/intel/atom.c+12−52

This diff is large: its 137 lines aren’t shown here.

sound/soc/sof/intel/atom.h+2−2

This diff is large: its 11 lines aren’t shown here.

sound/soc/sof/intel/bdw.c+20−51

This diff is large: its 143 lines aren’t shown here.

sound/soc/sof/intel/byt.c+9−0

This diff is large: its 20 lines aren’t shown here.

sound/soc/sof/intel/cnl.c+28−6

This diff is large: its 62 lines aren’t shown here.

sound/soc/sof/intel/hda-codec.c+2−1

This diff is large: its 12 lines aren’t shown here.

sound/soc/sof/intel/hda-ctrl.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/sof/intel/hda-dai.c+47−50

This diff is large: its 179 lines aren’t shown here.

sound/soc/sof/intel/hda-dsp.c+50−2

This diff is large: its 76 lines aren’t shown here.

sound/soc/sof/intel/hda-ipc.c+19−29

This diff is large: its 72 lines aren’t shown here.

sound/soc/sof/intel/hda-loader.c+28−76

This diff is large: its 166 lines aren’t shown here.

sound/soc/sof/intel/hda-pcm.c+100−27

This diff is large: its 169 lines aren’t shown here.

sound/soc/sof/intel/hda-stream.c+67−42

This diff is large: its 183 lines aren’t shown here.

sound/soc/sof/intel/hda.c+66−73

This diff is large: its 408 lines aren’t shown here.

sound/soc/sof/intel/hda.h+15−7

This diff is large: its 70 lines aren’t shown here.

sound/soc/sof/intel/icl.c+68−5

This diff is large: its 107 lines aren’t shown here.

sound/soc/sof/intel/pci-tng.c+9−0

This diff is large: its 19 lines aren’t shown here.

sound/soc/sof/intel/shim.h+11−0

This diff is large: its 30 lines aren’t shown here.

sound/soc/sof/intel/tgl.c+44−3

This diff is large: its 68 lines aren’t shown here.

sound/soc/sof/ipc.c+105−29

This diff is large: its 253 lines aren’t shown here.

sound/soc/sof/loader.c+8−8

This diff is large: its 41 lines aren’t shown here.

sound/soc/sof/mediatek/Kconfig+33−0

This diff is large: its 34 lines aren’t shown here.

sound/soc/sof/mediatek/Makefile+2−0

This diff is large: its 3 lines aren’t shown here.

sound/soc/sof/mediatek/adsp_helper.h+49−0

This diff is large: its 50 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/Makefile+3−0

This diff is large: its 4 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/mt8195-clk.c+158−0

This diff is large: its 159 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/mt8195-clk.h+28−0

This diff is large: its 29 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/mt8195-loader.c+56−0

This diff is large: its 57 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/mt8195.c+463−0

This diff is large: its 464 lines aren’t shown here.

sound/soc/sof/mediatek/mt8195/mt8195.h+158−0

This diff is large: its 159 lines aren’t shown here.

sound/soc/sof/ops.c+34−13

This diff is large: its 60 lines aren’t shown here.

sound/soc/sof/ops.h+69−24

This diff is large: its 142 lines aren’t shown here.

sound/soc/sof/pcm.c+77−41

This diff is large: its 198 lines aren’t shown here.

sound/soc/sof/pm.c+10−0

This diff is large: its 31 lines aren’t shown here.

sound/soc/sof/sof-audio.c+195−44

This diff is large: its 432 lines aren’t shown here.

sound/soc/sof/sof-audio.h+5−12

This diff is large: its 43 lines aren’t shown here.

sound/soc/sof/sof-of-dev.c+8−60

This diff is large: its 113 lines aren’t shown here.

sound/soc/sof/sof-of-dev.h+17−0

This diff is large: its 18 lines aren’t shown here.

sound/soc/sof/sof-pci-dev.c+10−9

This diff is large: its 33 lines aren’t shown here.

sound/soc/sof/sof-priv.h+51−31

This diff is large: its 205 lines aren’t shown here.

sound/soc/sof/sof-probes.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/sof/sof-probes.h+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/sof/topology.c+180−112

This diff is large: its 411 lines aren’t shown here.

sound/soc/sof/trace.c+18−0

This diff is large: its 32 lines aren’t shown here.

sound/soc/sof/xtensa/core.c+25−19

This diff is large: its 75 lines aren’t shown here.

sound/soc/stm/stm32_adfsdm.c+4−1

This diff is large: its 26 lines aren’t shown here.

sound/soc/stm/stm32_i2s.c+25−41

This diff is large: its 109 lines aren’t shown here.

sound/soc/stm/stm32_sai.c+13−24

This diff is large: its 56 lines aren’t shown here.

sound/soc/stm/stm32_sai_sub.c+10−19

This diff is large: its 64 lines aren’t shown here.

sound/soc/stm/stm32_spdifrx.c+19−29

This diff is large: its 96 lines aren’t shown here.

sound/soc/sunxi/sun4i-codec.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/sunxi/sun4i-spdif.c+115−0

This diff is large: its 148 lines aren’t shown here.

sound/soc/sunxi/sun8i-codec.c+56−0

This diff is large: its 100 lines aren’t shown here.

sound/soc/tegra/tegra20_i2s.c+49−0

This diff is large: its 60 lines aren’t shown here.

sound/soc/tegra/tegra20_spdif.c+139−58

This diff is large: its 352 lines aren’t shown here.

sound/soc/tegra/tegra20_spdif.h+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/tegra/tegra210_mvc.c+164−45

This diff is large: its 302 lines aren’t shown here.

sound/soc/tegra/tegra210_mvc.h+5−0

This diff is large: its 19 lines aren’t shown here.

sound/soc/tegra/tegra_pcm.c+6−0

This diff is large: its 13 lines aren’t shown here.

sound/soc/tegra/tegra_pcm.h+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/ti/davinci-mcasp.c+6−15

This diff is large: its 43 lines aren’t shown here.

sound/soc/ti/j721e-evm.c+3−7

This diff is large: its 17 lines aren’t shown here.

sound/soc/uniphier/Kconfig+0−2

This diff is large: its 16 lines aren’t shown here.

sound/soc/xilinx/xlnx_spdif.c+3−7

This diff is large: its 25 lines aren’t shown here.

sound/sparc/dbri.c+3−3

This diff is large: its 27 lines aren’t shown here.

sound/usb/card.c+0−7

This diff is large: its 21 lines aren’t shown here.

sound/usb/format.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/usb/mixer.c+1−4

This diff is large: its 32 lines aren’t shown here.

sound/usb/mixer.h+0−2

This diff is large: its 11 lines aren’t shown here.

sound/usb/mixer_maps.c+15−2

This diff is large: its 38 lines aren’t shown here.

sound/usb/mixer_quirks.c+1−3

This diff is large: its 25 lines aren’t shown here.

sound/usb/mixer_quirks.h+0−2

This diff is large: its 10 lines aren’t shown here.

sound/usb/power.h+0−10

This diff is large: its 18 lines aren’t shown here.

sound/usb/quirks.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/usb/usx2y/usbusx2y.c+1−1

This diff is large: its 8 lines aren’t shown here.

sound/x86/intel_hdmi_audio.c+3−1

This diff is large: its 11 lines aren’t shown here.

tools/testing/selftests/Makefile+2−1

This diff is large: its 8 lines aren’t shown here.

tools/testing/selftests/alsa/.gitignore+1−0

This diff is large: its 2 lines aren’t shown here.

tools/testing/selftests/alsa/Makefile+9−0

This diff is large: its 10 lines aren’t shown here.

tools/testing/selftests/alsa/mixer-test.c+705−0

This diff is large: its 706 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t