History

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

Pull sound updates from Takashi Iwai: "The majority of changes at this time were about ASoC with a lot of code refactoring works. From the functionality POV, there isn't much to see, but we have a wide range of device-specific fixes and updates. Here are some highlights: - Continued ASoC API cleanup work, spanned over many files - Added a SoundWire SCDA generic class driver with regmap support - Enhancements and fixes for Cirrus, Intel, Maxim and Qualcomm. - Support for ASoC Allwinner A523, Mediatek MT8189, Qualcomm QCM2290, QRB2210 and SM6115, SpacemiT K1, and TI TAS2568, TAS5802, TAS5806, TAS5815, TAS5828 and TAS5830 - Usual HD-audio and USB-audio quirks and fixups - Support for Onkyo SE-300PCIE, TASCAM IF-FW/DM MkII Some gpiolib changes for shared GPIOs are included along with this PR for covering ASoC drivers changes" * tag 'sound-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (739 commits) ALSA: hda/realtek: Add PCI SSIDs to HP ProBook quirks ALSA: usb-audio: Simplify with usb_endpoint_max_periodic_payload() ALSA: hda/realtek: fix mute/micmute LEDs don't work for more HP laptops ALSA: rawmidi: Fix inconsistent indenting warning reported by smatch ALSA: dice: fix buffer overflow in detect_stream_formats() ASoC: codecs: Modify awinic amplifier dsp read and write functions ASoC: SDCA: Fixup some more Kconfig issues ASoC: cs35l56: Log a message if firmware is missing ASoC: nau8325: Delete a stray tab firmware: cs_dsp: Add test cases for client_ops == NULL firmware: cs_dsp: Don't require client to provide a struct cs_dsp_client_ops ASoC: fsl_micfil: Set channel range control ASoC: fsl_micfil: Add default quality for different platforms ASoC: intel: sof_sdw: Add codec_info for cs42l45 ASoC: sdw_utils: Add cs42l45 support functions ASoC: intel: sof_sdw: Add ability to have auxiliary devices ASoC: sdw_utils: Move codec_name to dai info ASoC: sdw_utils: Add codec_conf for every DAI ASoC: SDCA: Add terminal type into input/output widget name ASoC: SDCA: Align mute controls to ALSA expectations ...

Linus Torvalds committed 11 months ago

Commit 2aa680d2 parents 6dfafbd eaf526c615 files · +33147 −5677Browse files

Unified · Split

615 files
  1. Documentation/devicetree/bindings/sound/adi,max98363.yaml +0 −60
  2. Documentation/devicetree/bindings/sound/adi,ssm2602.txt +0 −19
  3. Documentation/devicetree/bindings/sound/adi,ssm3515.yaml +0 −49
  4. Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml +3 −1
  5. Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml +38 −6
  6. Documentation/devicetree/bindings/sound/cirrus,cs4271.yaml +10 −0
  7. Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +8 −0
  8. Documentation/devicetree/bindings/sound/cs4265.txt +0 −29
  9. Documentation/devicetree/bindings/sound/cs4341.txt +0 −22
  10. Documentation/devicetree/bindings/sound/cs4349.txt +0 −19
  11. Documentation/devicetree/bindings/sound/da9055.txt +0 −22
  12. Documentation/devicetree/bindings/sound/mediatek,mt8189-afe-pcm.yaml +178 −0
  13. Documentation/devicetree/bindings/sound/mediatek,mt8189-nau8825.yaml +101 −0
  14. Documentation/devicetree/bindings/sound/nuvoton,nau8540.yaml +0 −40
  15. Documentation/devicetree/bindings/sound/nuvoton,nau8810.yaml +0 −45
  16. Documentation/devicetree/bindings/sound/nvidia,tegra210-admaif.yaml +66 −40
  17. Documentation/devicetree/bindings/sound/nxp,tfa9879.yaml +0 −44
  18. Documentation/devicetree/bindings/sound/nxp,uda1342.yaml +0 −42
  19. Documentation/devicetree/bindings/sound/pcm1789.txt +0 −22
  20. Documentation/devicetree/bindings/sound/pcm179x.txt +0 −27
  21. Documentation/devicetree/bindings/sound/pcm186x.txt +0 −42
  22. Documentation/devicetree/bindings/sound/pcm5102a.txt +0 −13
  23. Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +19 −0
  24. Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml +1 −0
  25. Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +36 −14
  26. Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml +1 −0
  27. Documentation/devicetree/bindings/sound/qcom,sm8250.yaml +2 −0
  28. Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml +1 −1
  29. Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml +87 −0
  30. Documentation/devicetree/bindings/sound/ti,pcm1862.yaml +76 −0
  31. Documentation/devicetree/bindings/sound/ti,tas2781.yaml +54 −4
  32. Documentation/devicetree/bindings/sound/trivial-codec.yaml +79 −0
  33. Documentation/devicetree/bindings/sound/wlf,wm8510.yaml +0 −41
  34. Documentation/devicetree/bindings/sound/wlf,wm8523.yaml +0 −40
  35. Documentation/devicetree/bindings/sound/wlf,wm8580.yaml +0 −42
  36. Documentation/devicetree/bindings/sound/wlf,wm8711.yaml +0 −40
  37. Documentation/devicetree/bindings/sound/wlf,wm8728.yaml +0 −40
  38. Documentation/devicetree/bindings/sound/wlf,wm8737.yaml +0 −40
  39. Documentation/devicetree/bindings/sound/wlf,wm8750.yaml +0 −42
  40. Documentation/devicetree/bindings/sound/wlf,wm8753.yaml +0 −62
  41. Documentation/devicetree/bindings/sound/wlf,wm8776.yaml +0 −41
  42. Documentation/devicetree/bindings/sound/wlf,wm8961.yaml +0 −43
  43. Documentation/devicetree/bindings/sound/wlf,wm8974.yaml +0 −41
  44. Documentation/devicetree/bindings/sound/wm8770.txt +0 −16
  45. MAINTAINERS +5 −3
  46. drivers/base/regmap/regmap-sdw-mbq.c +12 −11
  47. drivers/firmware/cirrus/cs_dsp.c +72 −103
  48. drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c +1 −0
  49. drivers/gpio/Kconfig +17 −0
  50. drivers/gpio/Makefile +2 −0
  51. drivers/gpio/gpio-shared-proxy.c +333 −0
  52. drivers/gpio/gpiolib-shared.c +558 −0
  53. drivers/gpio/gpiolib-shared.h +71 −0
  54. drivers/gpio/gpiolib.c +61 −9
  55. drivers/gpio/gpiolib.h +2 −0
  56. drivers/input/misc/arizona-haptics.c +5 −9
  57. drivers/regulator/arizona-micsupp.c +2 −6
  58. drivers/staging/greybus/audio_codec.c +11 −5
  59. drivers/staging/greybus/audio_helper.c +5 −4
  60. drivers/staging/greybus/audio_topology.c +12 −12
  61. include/linux/firmware/cirrus/cs_dsp.h +3 −3
  62. include/linux/firmware/cirrus/cs_dsp_test_utils.h +9 −9
  63. include/linux/gpio/consumer.h +9 −0
  64. include/linux/pci_ids.h +1 −0
  65. include/linux/regmap.h +11 −10
  66. include/linux/soundwire/sdw_registers.h +2 −0
  67. include/linux/string.h +18 −0
  68. include/sound/cs-amp-lib.h +24 −1
  69. include/sound/cs35l56.h +50 −0
  70. include/sound/sdca.h +19 −0
  71. include/sound/sdca_fdl.h +105 −0
  72. include/sound/sdca_function.h +124 −2
  73. include/sound/sdca_hid.h +17 −4
  74. include/sound/sdca_interrupts.h +14 −5
  75. include/sound/sdca_regmap.h +2 −0
  76. include/sound/sdca_ump.h +50 −0
  77. include/sound/soc-acpi-intel-match.h +2 −0
  78. include/sound/soc-acpi.h +4 −4
  79. include/sound/soc.h +19 −20
  80. include/sound/soc_sdw_utils.h +16 −3
  81. include/sound/tas2781.h +7 −1
  82. include/trace/events/asoc.h +2 −2
  83. include/uapi/sound/intel/avs/tokens.h +6 −0
  84. lib/tests/string_kunit.c +13 −0
  85. sound/ac97_bus.c +8 −5
  86. sound/core/pcm_drm_eld.c +1 −1
  87. sound/core/rawmidi.c +1 −4
  88. sound/drivers/pcmtest.c +2 −2
  89. sound/firewire/dice/Makefile +1 −1
  90. sound/firewire/dice/dice-extension.c +2 −2
  91. sound/firewire/dice/dice-teac.c +43 −0
  92. sound/firewire/dice/dice.c +13 −0
  93. sound/firewire/dice/dice.h +1 −0
  94. sound/hda/codecs/hdmi/intelhdmi.c +1 −0
  95. sound/hda/codecs/realtek/alc269.c +101 −10
  96. sound/hda/codecs/senarytech.c +6 −3
  97. sound/hda/codecs/side-codecs/Kconfig +15 −0
  98. sound/hda/codecs/side-codecs/cs35l56_hda.c +110 −6
  99. sound/hda/codecs/side-codecs/cs35l56_hda.h +6 −0
  100. sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +25 −19
  101. sound/hda/controllers/intel.c +2 −0
  102. sound/hda/core/intel-dsp-config.c +8 −0
  103. sound/isa/gus/gus_reset.c +0 −3
  104. sound/isa/wavefront/wavefront_midi.c +2 −0
  105. sound/isa/wavefront/wavefront_synth.c +2 −2
  106. sound/pci/au88x0/au88x0_eq.c +1 −1
  107. sound/pci/ctxfi/ctatc.c +71 −26
  108. sound/pci/ctxfi/ctatc.h +4 −4
  109. sound/pci/ctxfi/ctdaio.c +10 −8
  110. sound/pci/ctxfi/ctdaio.h +3 −0
  111. sound/pci/ctxfi/cthardware.h +3 −1
  112. sound/pci/ctxfi/cthw20k1.c +2 −1
  113. sound/pci/ctxfi/cthw20k2.c +62 −19
  114. sound/pci/ctxfi/ctmixer.c +70 −3
  115. sound/pci/maestro3.c +3 −3
  116. sound/soc/Kconfig +1 −0
  117. sound/soc/Makefile +1 −0
  118. sound/soc/amd/acp/acp-mach-common.c +23 −17
  119. sound/soc/amd/acp/acp-sdw-legacy-mach.c +19 −4
  120. sound/soc/amd/acp/acp-sdw-sof-mach.c +10 −2
  121. sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +7 −3
  122. sound/soc/amd/ps/acp63.h +2 −0
  123. sound/soc/amd/ps/pci-ps.c +9 −0
  124. sound/soc/amd/vangogh/acp5x-mach.c +1 −2
  125. sound/soc/atmel/atmel-pdmic.c +2 −2
  126. sound/soc/atmel/sam9g20_wm8731.c +1 −1
  127. sound/soc/atmel/tse850-pcm5142.c +16 −16
  128. sound/soc/codecs/88pm860x-codec.c +6 −5
  129. sound/soc/codecs/Kconfig +50 −0
  130. sound/soc/codecs/Makefile +6 −2
  131. sound/soc/codecs/ab8500-codec.c +9 −9
  132. sound/soc/codecs/ad1836.c +1 −1
  133. sound/soc/codecs/ad193x.c +2 −2
  134. sound/soc/codecs/adau1761.c +5 −4
  135. sound/soc/codecs/adau1781.c +1 −1
  136. sound/soc/codecs/adau17x1.c +7 −7
  137. sound/soc/codecs/adau1977.c +3 −2
  138. sound/soc/codecs/adau7118.c +3 −4
  139. sound/soc/codecs/adav80x.c +5 −5
  140. sound/soc/codecs/ak4458.c +2 −2
  141. sound/soc/codecs/ak4619.c +2 −2
  142. sound/soc/codecs/ak4641.c +4 −3
  143. sound/soc/codecs/alc5623.c +1 −1
  144. sound/soc/codecs/arizona-jack.c +3 −5
  145. sound/soc/codecs/arizona.c +10 −12
  146. sound/soc/codecs/audio-iio-aux.c +1 −1
  147. sound/soc/codecs/aw87390.c +7 −7
  148. sound/soc/codecs/aw88081.c +12 −12
  149. sound/soc/codecs/aw88166.c +23 −136
  150. sound/soc/codecs/aw88166.h +0 −5
  151. sound/soc/codecs/aw88261.c +17 −17
  152. sound/soc/codecs/aw88395/aw88395.c +15 −15
  153. sound/soc/codecs/aw88395/aw88395_device.c +20 −19
  154. sound/soc/codecs/aw88395/aw88395_device.h +6 −2
  155. sound/soc/codecs/aw88399.c +38 −215
  156. sound/soc/codecs/aw88399.h +0 −5
  157. sound/soc/codecs/bd28623.c +2 −4
  158. sound/soc/codecs/cpcap.c +9 −12
  159. sound/soc/codecs/cros_ec_codec.c +4 −6
  160. sound/soc/codecs/cs-amp-lib-test.c +1485 −37
  161. sound/soc/codecs/cs-amp-lib.c +347 −25
  162. sound/soc/codecs/cs35l33.c +2 −2
  163. sound/soc/codecs/cs35l36.c +2 −4
  164. sound/soc/codecs/cs35l41.c +1 −1
  165. sound/soc/codecs/cs35l45.c +5 −7
  166. sound/soc/codecs/cs35l56-shared.c +412 −27
  167. sound/soc/codecs/cs35l56.c +251 −1
  168. sound/soc/codecs/cs35l56.h +6 −0
  169. sound/soc/codecs/cs4234.c +4 −3
  170. sound/soc/codecs/cs4270.c +1 −1
  171. sound/soc/codecs/cs4271.c +30 −6
  172. sound/soc/codecs/cs42l42.c +1 −1
  173. sound/soc/codecs/cs42l43-jack.c +7 −7
  174. sound/soc/codecs/cs42l43.c +19 −19
  175. sound/soc/codecs/cs42l51.c +3 −3
  176. sound/soc/codecs/cs42l52.c +3 −2
  177. sound/soc/codecs/cs42l56.c +3 −2
  178. sound/soc/codecs/cs42l73.c +2 −1
  179. sound/soc/codecs/cs42l84.c +2 −2
  180. sound/soc/codecs/cs42xx8.c +1 −1
  181. sound/soc/codecs/cs43130.c +1 −1
  182. sound/soc/codecs/cs47l15.c +5 −6
  183. sound/soc/codecs/cs47l24.c +2 −2
  184. sound/soc/codecs/cs47l35.c +3 −2
  185. sound/soc/codecs/cs47l85.c +3 −2
  186. sound/soc/codecs/cs47l90.c +3 −2
  187. sound/soc/codecs/cs47l92.c +5 −6
  188. sound/soc/codecs/cs48l32.c +20 −20
  189. sound/soc/codecs/cs530x-i2c.c +20 −4
  190. sound/soc/codecs/cs530x-spi.c +92 −0
  191. sound/soc/codecs/cs530x.c +449 −77
  192. sound/soc/codecs/cs530x.h +60 −30
  193. sound/soc/codecs/cs53l30.c +5 −4
  194. sound/soc/codecs/cx20442.c +3 −2
  195. sound/soc/codecs/cx2072x.c +3 −3
  196. sound/soc/codecs/da7210.c +2 −2
  197. sound/soc/codecs/da7213.c +11 −10
  198. sound/soc/codecs/da7218.c +11 −10
  199. sound/soc/codecs/da7219-aad.c +5 −5
  200. sound/soc/codecs/da7219.c +16 −13
  201. sound/soc/codecs/da732x.c +4 −3
  202. sound/soc/codecs/da9055.c +4 −2
  203. sound/soc/codecs/es7134.c +1 −1
  204. sound/soc/codecs/es8311.c +2 −1
  205. sound/soc/codecs/es8316.c +2 −2
  206. sound/soc/codecs/es8326.c +8 −8
  207. sound/soc/codecs/es8328.c +5 −3
  208. sound/soc/codecs/es8389.c +2 −2
  209. sound/soc/codecs/fs210x.c +1 −1
  210. sound/soc/codecs/hda.c +1 −1
  211. sound/soc/codecs/hdac_hda.c +1 −3
  212. sound/soc/codecs/hdac_hdmi.c +20 −15
  213. sound/soc/codecs/hdmi-codec.c +1 −1
  214. sound/soc/codecs/idt821034.c +4 −4
  215. sound/soc/codecs/jz4740.c +2 −1
  216. sound/soc/codecs/jz4760.c +4 −3
  217. sound/soc/codecs/jz4770.c +4 −4
  218. sound/soc/codecs/lm49453.c +2 −1
  219. sound/soc/codecs/lpass-rx-macro.c +56 −60
  220. sound/soc/codecs/lpass-tx-macro.c +10 −9
  221. sound/soc/codecs/lpass-va-macro.c +69 −35
  222. sound/soc/codecs/lpass-wsa-macro.c +30 −139
  223. sound/soc/codecs/madera.c +16 −32
  224. sound/soc/codecs/max9759.c +4 −4
  225. sound/soc/codecs/max9768.c +2 −2
  226. sound/soc/codecs/max98088.c +9 −9
  227. sound/soc/codecs/max98090.c +44 −10
  228. sound/soc/codecs/max98095.c +15 −12
  229. sound/soc/codecs/max98373.c +2 −1
  230. sound/soc/codecs/max98390.c +8 −14
  231. sound/soc/codecs/max98396.c +5 −6
  232. sound/soc/codecs/max9850.c +2 −1
  233. sound/soc/codecs/max9867.c +10 −5
  234. sound/soc/codecs/max98925.c +1 −1
  235. sound/soc/codecs/ml26124.c +2 −1
  236. sound/soc/codecs/msm8916-wcd-digital.c +2 −4
  237. sound/soc/codecs/mt6357.c +1 −1
  238. sound/soc/codecs/mt6358.c +12 −13
  239. sound/soc/codecs/mt6359.c +8 −10
  240. sound/soc/codecs/mt6660.c +1 −2
  241. sound/soc/codecs/nau8325.c +2 −3
  242. sound/soc/codecs/nau8810.c +4 −3
  243. sound/soc/codecs/nau8821.c +11 −17
  244. sound/soc/codecs/nau8822.c +10 −10
  245. sound/soc/codecs/nau8824.c +5 −5
  246. sound/soc/codecs/nau8825.c +3 −3
  247. sound/soc/codecs/ntp8835.c +2 −2
  248. sound/soc/codecs/pcm1681.c +2 −2
  249. sound/soc/codecs/pcm186x.c +4 −2
  250. sound/soc/codecs/pcm512x.c +14 −11
  251. sound/soc/codecs/pcm6240.c +3 −6
  252. sound/soc/codecs/peb2466.c +3 −3
  253. sound/soc/codecs/pm4125-sdw.c +7 −57
  254. sound/soc/codecs/pm4125.c +53 −72
  255. sound/soc/codecs/pm4125.h +2 −16
  256. sound/soc/codecs/rk3308_codec.c +2 −1
  257. sound/soc/codecs/rt1011.c +15 −21
  258. sound/soc/codecs/rt1015.c +7 −10
  259. sound/soc/codecs/rt1318.c +2 −2
  260. sound/soc/codecs/rt274.c +3 −2
  261. sound/soc/codecs/rt286.c +5 −3
  262. sound/soc/codecs/rt298.c +5 −4
  263. sound/soc/codecs/rt5514.c +5 −3
  264. sound/soc/codecs/rt5616.c +3 −2
  265. sound/soc/codecs/rt5631.c +6 −4
  266. sound/soc/codecs/rt5640.c +10 −9
  267. sound/soc/codecs/rt5645.c +8 −7
  268. sound/soc/codecs/rt5651.c +8 −5
  269. sound/soc/codecs/rt5659.c +6 −7
  270. sound/soc/codecs/rt5660.c +3 −2
  271. sound/soc/codecs/rt5663.c +5 −5
  272. sound/soc/codecs/rt5665.c +3 −3
  273. sound/soc/codecs/rt5668.c +1 −2
  274. sound/soc/codecs/rt5670.c +24 −19
  275. sound/soc/codecs/rt5677.c +7 −7
  276. sound/soc/codecs/rt5682.c +5 −5
  277. sound/soc/codecs/rt5682s.c +3 −2
  278. sound/soc/codecs/rt700.c +11 −17
  279. sound/soc/codecs/rt711-sdca.c +5 −8
  280. sound/soc/codecs/rt711.c +11 −17
  281. sound/soc/codecs/rt712-sdca-dmic.c +3 −6
  282. sound/soc/codecs/rt712-sdca.c +7 −13
  283. sound/soc/codecs/rt715-sdca.c +3 −6
  284. sound/soc/codecs/rt715.c +14 −21
  285. sound/soc/codecs/rt721-sdca.c +3 −6
  286. sound/soc/codecs/rt722-sdca-sdw.c +3 −1
  287. sound/soc/codecs/rt9123.c +3 −3
  288. sound/soc/codecs/sgtl5000.c +4 −4
  289. sound/soc/codecs/simple-mux.c +4 −3
  290. sound/soc/codecs/sma1303.c +11 −20
  291. sound/soc/codecs/sma1307.c +37 −58
  292. sound/soc/codecs/ssm2518.c +2 −1
  293. sound/soc/codecs/ssm2602.c +2 −2
  294. sound/soc/codecs/ssm4567.c +2 −1
  295. sound/soc/codecs/sta32x.c +6 −4
  296. sound/soc/codecs/sta350.c +6 −4
  297. sound/soc/codecs/sta529.c +2 −1
  298. sound/soc/codecs/tas2562.c +2 −2
  299. sound/soc/codecs/tas2781-comlib-i2c.c +1 −1
  300. sound/soc/codecs/tas2781-i2c.c +66 −40
  301. sound/soc/codecs/tas2783-sdw.c +2 −2
  302. sound/soc/codecs/tas5086.c +2 −2
  303. sound/soc/codecs/tas571x.c +4 −3
  304. sound/soc/codecs/tas5720.c +2 −2
  305. sound/soc/codecs/tas5805m.c +2 −4
  306. sound/soc/codecs/tas6424.c +3 −1
  307. sound/soc/codecs/tfa989x.c +1 −1
  308. sound/soc/codecs/tlv320adc3xxx.c +4 −4
  309. sound/soc/codecs/tlv320adcx140.c +2 −4
  310. sound/soc/codecs/tlv320aic23.c +2 −2
  311. sound/soc/codecs/tlv320aic31xx.c +8 −6
  312. sound/soc/codecs/tlv320aic32x4.c +2 −1
  313. sound/soc/codecs/tlv320aic3x.c +6 −5
  314. sound/soc/codecs/tlv320dac33.c +5 −4
  315. sound/soc/codecs/tscs42xx.c +2 −4
  316. sound/soc/codecs/tscs454.c +2 −4
  317. sound/soc/codecs/twl4030.c +8 −6
  318. sound/soc/codecs/twl6040.c +8 −7
  319. sound/soc/codecs/uda1334.c +2 −2
  320. sound/soc/codecs/uda1380.c +2 −1
  321. sound/soc/codecs/wcd9335.c +19 −15
  322. sound/soc/codecs/wcd934x.c +23 −21
  323. sound/soc/codecs/wcd937x.c +43 −20
  324. sound/soc/codecs/wcd938x.c +13 −14
  325. sound/soc/codecs/wcd939x-sdw.c +7 −1
  326. sound/soc/codecs/wcd939x.c +12 −12
  327. sound/soc/codecs/wm0010.c +3 −2
  328. sound/soc/codecs/wm2000.c +4 −4
  329. sound/soc/codecs/wm5100.c +2 −2
  330. sound/soc/codecs/wm5102.c +6 −6
  331. sound/soc/codecs/wm5110.c +8 −8
  332. sound/soc/codecs/wm8350.c +4 −3
  333. sound/soc/codecs/wm8400.c +8 −6
  334. sound/soc/codecs/wm8510.c +2 −1
  335. sound/soc/codecs/wm8523.c +2 −1
  336. sound/soc/codecs/wm8580.c +5 −3
  337. sound/soc/codecs/wm8711.c +2 −1
  338. sound/soc/codecs/wm8728.c +2 −1
  339. sound/soc/codecs/wm8731.c +5 −4
  340. sound/soc/codecs/wm8737.c +4 −2
  341. sound/soc/codecs/wm8750.c +2 −1
  342. sound/soc/codecs/wm8753.c +4 −3
  343. sound/soc/codecs/wm8770.c +2 −1
  344. sound/soc/codecs/wm8776.c +2 −1
  345. sound/soc/codecs/wm8804.c +2 −2
  346. sound/soc/codecs/wm8900.c +8 −4
  347. sound/soc/codecs/wm8903.c +6 −4
  348. sound/soc/codecs/wm8904.c +12 −11
  349. sound/soc/codecs/wm8940.c +4 −2
  350. sound/soc/codecs/wm8955.c +6 −4
  351. sound/soc/codecs/wm8958-dsp2.c +16 −16
  352. sound/soc/codecs/wm8960.c +9 −7
  353. sound/soc/codecs/wm8961.c +3 −2
  354. sound/soc/codecs/wm8962.c +17 −13
  355. sound/soc/codecs/wm8971.c +2 −1
  356. sound/soc/codecs/wm8974.c +2 −1
  357. sound/soc/codecs/wm8978.c +6 −3
  358. sound/soc/codecs/wm8983.c +4 −3
  359. sound/soc/codecs/wm8985.c +5 −4
  360. sound/soc/codecs/wm8988.c +2 −1
  361. sound/soc/codecs/wm8990.c +6 −3
  362. sound/soc/codecs/wm8991.c +3 −2
  363. sound/soc/codecs/wm8993.c +8 −5
  364. sound/soc/codecs/wm8994.c +24 −22
  365. sound/soc/codecs/wm8995.c +4 −3
  366. sound/soc/codecs/wm8996.c +7 −6
  367. sound/soc/codecs/wm8997.c +2 −2
  368. sound/soc/codecs/wm8998.c +4 −4
  369. sound/soc/codecs/wm9081.c +4 −3
  370. sound/soc/codecs/wm9090.c +3 −2
  371. sound/soc/codecs/wm9712.c +4 −3
  372. sound/soc/codecs/wm9713.c +4 −3
  373. sound/soc/codecs/wm_adsp.c +11 −10
  374. sound/soc/codecs/wm_hubs.c +5 −5
  375. sound/soc/codecs/wsa881x.c +4 −5
  376. sound/soc/codecs/wsa883x.c +8 −11
  377. sound/soc/codecs/wsa884x.c +4 −4
  378. sound/soc/fsl/fsl-asoc-card.c +2 −2
  379. sound/soc/fsl/fsl_aud2htx.h +2 −1
  380. sound/soc/fsl/fsl_micfil.c +111 −25
  381. sound/soc/fsl/fsl_spdif.c +8 −8
  382. sound/soc/fsl/fsl_xcvr.c +35 −53
  383. sound/soc/fsl/imx-rpmsg.c +1 −1
  384. sound/soc/generic/audio-graph-card.c +2 −2
  385. sound/soc/intel/atom/sst-atom-controls.c +7 −8
  386. sound/soc/intel/atom/sst/sst_acpi.c +2 −1
  387. sound/soc/intel/avs/boards/da7219.c +1 −2
  388. sound/soc/intel/avs/boards/es8336.c +3 −2
  389. sound/soc/intel/avs/boards/nau8825.c +1 −2
  390. sound/soc/intel/avs/boards/rt274.c +3 −3
  391. sound/soc/intel/avs/boards/rt5514.c +2 −1
  392. sound/soc/intel/avs/boards/rt5640.c +2 −1
  393. sound/soc/intel/avs/control.c +3 −4
  394. sound/soc/intel/avs/debugfs.c +3 −6
  395. sound/soc/intel/avs/path.c +9 −4
  396. sound/soc/intel/avs/pcm.c +1 −1
  397. sound/soc/intel/avs/topology.c +110 −3
  398. sound/soc/intel/avs/topology.h +8 −0
  399. sound/soc/intel/boards/bdw-rt5677.c +4 −5
  400. sound/soc/intel/boards/bytcht_cx2072x.c +2 −1
  401. sound/soc/intel/boards/bytcht_es8316.c +5 −4
  402. sound/soc/intel/boards/bytcr_rt5640.c +13 −12
  403. sound/soc/intel/boards/bytcr_rt5651.c +9 −9
  404. sound/soc/intel/boards/bytcr_wm5102.c +7 −7
  405. sound/soc/intel/boards/cht_bsw_max98090_ti.c +2 −3
  406. sound/soc/intel/boards/cht_bsw_rt5645.c +6 −6
  407. sound/soc/intel/boards/cht_bsw_rt5672.c +4 −4
  408. sound/soc/intel/boards/hda_dsp_common.c +12 −3
  409. sound/soc/intel/boards/sof_board_helpers.c +6 −4
  410. sound/soc/intel/boards/sof_cirrus_common.c +3 −2
  411. sound/soc/intel/boards/sof_da7219.c +2 −3
  412. sound/soc/intel/boards/sof_es8336.c +8 −6
  413. sound/soc/intel/boards/sof_maxim_common.c +12 −10
  414. sound/soc/intel/boards/sof_nau8825.c +1 −1
  415. sound/soc/intel/boards/sof_nuvoton_common.c +3 −2
  416. sound/soc/intel/boards/sof_pcm512x.c +3 −2
  417. sound/soc/intel/boards/sof_realtek_common.c +18 −16
  418. sound/soc/intel/boards/sof_rt5682.c +14 −3
  419. sound/soc/intel/boards/sof_sdw.c +68 −12
  420. sound/soc/intel/catpt/device.c +18 −8
  421. sound/soc/intel/catpt/loader.c +9 −9
  422. sound/soc/intel/catpt/pcm.c +14 −17
  423. sound/soc/intel/catpt/sysfs.c +1 −1
  424. sound/soc/intel/common/Makefile +1 −0
  425. sound/soc/intel/common/soc-acpi-intel-nvl-match.c +90 −0
  426. sound/soc/intel/common/soc-acpi-intel-ptl-match.c +79 −0
  427. sound/soc/intel/common/sof-function-topology-lib.c +6 −2
  428. sound/soc/mediatek/Kconfig +31 −0
  429. sound/soc/mediatek/Makefile +1 −0
  430. sound/soc/mediatek/common/mtk-afe-platform-driver.c +4 −3
  431. sound/soc/mediatek/common/mtk-btcvsd.c +12 −12
  432. sound/soc/mediatek/common/mtk-dsp-sof-common.c +3 −2
  433. sound/soc/mediatek/mt8183/mt8183-dai-adda.c +2 −2
  434. sound/soc/mediatek/mt8183/mt8183-dai-i2s.c +2 −2
  435. sound/soc/mediatek/mt8186/mt8186-afe-pcm.c +6 −6
  436. sound/soc/mediatek/mt8186/mt8186-dai-adda.c +2 −2
  437. sound/soc/mediatek/mt8186/mt8186-dai-i2s.c +2 −2
  438. sound/soc/mediatek/mt8186/mt8186-dai-tdm.c +2 −2
  439. sound/soc/mediatek/mt8186/mt8186-misc-control.c +6 −6
  440. sound/soc/mediatek/mt8186/mt8186-mt6366-common.c +1 −1
  441. sound/soc/mediatek/mt8186/mt8186-mt6366.c +10 −9
  442. sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +4 −6
  443. sound/soc/mediatek/mt8188/mt8188-dai-adda.c +2 −2
  444. sound/soc/mediatek/mt8188/mt8188-dai-dmic.c +1 −1
  445. sound/soc/mediatek/mt8188/mt8188-dai-etdm.c +1 −2
  446. sound/soc/mediatek/mt8188/mt8188-mt6359.c +10 −7
  447. sound/soc/mediatek/mt8189/Makefile +18 −0
  448. sound/soc/mediatek/mt8189/mt8189-afe-clk.c +750 −0
  449. sound/soc/mediatek/mt8189/mt8189-afe-clk.h +76 −0
  450. sound/soc/mediatek/mt8189/mt8189-afe-common.h +240 −0
  451. sound/soc/mediatek/mt8189/mt8189-afe-pcm.c +2615 −0
  452. sound/soc/mediatek/mt8189/mt8189-dai-adda.c +1228 −0
  453. sound/soc/mediatek/mt8189/mt8189-dai-i2s.c +1463 −0
  454. sound/soc/mediatek/mt8189/mt8189-dai-pcm.c +332 −0
  455. sound/soc/mediatek/mt8189/mt8189-dai-tdm.c +672 −0
  456. sound/soc/mediatek/mt8189/mt8189-interconnection.h +97 −0
  457. sound/soc/mediatek/mt8189/mt8189-nau8825.c +1178 −0
  458. sound/soc/mediatek/mt8189/mt8189-reg.h +10773 −0
  459. sound/soc/mediatek/mt8192/mt8192-dai-adda.c +6 −6
  460. sound/soc/mediatek/mt8192/mt8192-dai-i2s.c +2 −2
  461. sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +2 −4
  462. sound/soc/mediatek/mt8195/mt8195-dai-adda.c +4 −4
  463. sound/soc/mediatek/mt8195/mt8195-dai-etdm.c +1 −2
  464. sound/soc/mediatek/mt8195/mt8195-mt6359.c +13 −8
  465. sound/soc/mediatek/mt8365/mt8365-afe-pcm.c +1 −2
  466. sound/soc/meson/aiu-acodec-ctrl.c +2 −4
  467. sound/soc/meson/aiu-codec-ctrl.c +2 −4
  468. sound/soc/meson/axg-spdifout.c +2 −2
  469. sound/soc/meson/axg-tdm-interface.c +2 −2
  470. sound/soc/meson/g12a-toacodec.c +2 −4
  471. sound/soc/meson/g12a-tohdmitx.c +4 −8
  472. sound/soc/meson/t9015.c +2 −2
  473. sound/soc/mxs/mxs-saif.c +90 −33
  474. sound/soc/pxa/spitz.c +6 −3
  475. sound/soc/qcom/qdsp6/audioreach.c +66 −168
  476. sound/soc/qcom/qdsp6/q6adm.c +80 −99
  477. sound/soc/qcom/qdsp6/q6afe.c +14 −35
  478. sound/soc/qcom/qdsp6/q6apm-dai.c +7 −18
  479. sound/soc/qcom/qdsp6/q6apm.c +17 −40
  480. sound/soc/qcom/qdsp6/q6asm-dai.c +48 −39
  481. sound/soc/qcom/qdsp6/q6asm.c +63 −140
  482. sound/soc/qcom/qdsp6/q6asm.h +1 −0
  483. sound/soc/qcom/qdsp6/q6prm.c +6 −21
  484. sound/soc/qcom/qdsp6/q6routing.c +2 −4
  485. sound/soc/qcom/qdsp6/q6usb.c +2 −1
  486. sound/soc/qcom/qdsp6/topology.c +6 −6
  487. sound/soc/qcom/sc7180.c +6 −4
  488. sound/soc/qcom/sc7280.c +3 −64
  489. sound/soc/qcom/sc8280xp.c +4 −30
  490. sound/soc/qcom/sdm845.c +3 −50
  491. sound/soc/qcom/sdw.c +76 −52
  492. sound/soc/qcom/sdw.h +2 −5
  493. sound/soc/qcom/sm8250.c +4 −30
  494. sound/soc/qcom/x1e80100.c +3 −30
  495. sound/soc/renesas/fsi.c +4 −4
  496. sound/soc/renesas/rz-ssi.c +47 −17
  497. sound/soc/rockchip/rk3288_hdmi_analog.c +2 −1
  498. sound/soc/rockchip/rockchip_i2s_tdm.c +1 −2
  499. sound/soc/rockchip/rockchip_max98090.c +1 −1
  500. sound/soc/rockchip/rockchip_sai.c +4 −4
  501. sound/soc/samsung/aries_wm8994.c +3 −3
  502. sound/soc/samsung/bells.c +3 −3
  503. sound/soc/samsung/littlemill.c +4 −4
  504. sound/soc/samsung/lowland.c +2 −1
  505. sound/soc/samsung/midas_wm1811.c +4 −4
  506. sound/soc/samsung/smdk_wm8994.c +15 −15
  507. sound/soc/samsung/speyside.c +13 −11
  508. sound/soc/samsung/tm2_wm5110.c +4 −3
  509. sound/soc/samsung/tobermory.c +3 −3
  510. sound/soc/sdca/Kconfig +28 −0
  511. sound/soc/sdca/Makefile +9 −1
  512. sound/soc/sdca/sdca_asoc.c +16 −73
  513. sound/soc/sdca/sdca_class.c +304 −0
  514. sound/soc/sdca/sdca_class.h +37 −0
  515. sound/soc/sdca/sdca_class_function.c +460 −0
  516. sound/soc/sdca/sdca_device.c +20 −0
  517. sound/soc/sdca/sdca_fdl.c +504 −0
  518. sound/soc/sdca/sdca_function_device.c +117 −0
  519. sound/soc/sdca/sdca_function_device.h +15 −0
  520. sound/soc/sdca/sdca_functions.c +275 −35
  521. sound/soc/sdca/sdca_hid.c +50 −9
  522. sound/soc/sdca/sdca_interrupts.c +224 −56
  523. sound/soc/sdca/sdca_regmap.c +68 −30
  524. sound/soc/sdca/sdca_ump.c +262 −0
  525. sound/soc/sdw_utils/Makefile +1 −0
  526. sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c +3 −2
  527. sound/soc/sdw_utils/soc_sdw_cs42l42.c +2 −1
  528. sound/soc/sdw_utils/soc_sdw_cs42l43.c +6 −3
  529. sound/soc/sdw_utils/soc_sdw_cs42l45.c +80 −0
  530. sound/soc/sdw_utils/soc_sdw_cs_amp.c +2 −1
  531. sound/soc/sdw_utils/soc_sdw_dmic.c +3 −2
  532. sound/soc/sdw_utils/soc_sdw_maxim.c +4 −4
  533. sound/soc/sdw_utils/soc_sdw_rt5682.c +2 −1
  534. sound/soc/sdw_utils/soc_sdw_rt700.c +2 −1
  535. sound/soc/sdw_utils/soc_sdw_rt711.c +2 −1
  536. sound/soc/sdw_utils/soc_sdw_rt_amp.c +3 −2
  537. sound/soc/sdw_utils/soc_sdw_rt_mf_sdca.c +2 −1
  538. sound/soc/sdw_utils/soc_sdw_rt_sdca_jack_common.c +6 −5
  539. sound/soc/sdw_utils/soc_sdw_ti_amp.c +2 −1
  540. sound/soc/sdw_utils/soc_sdw_utils.c +136 −22
  541. sound/soc/soc-core.c +23 −19
  542. sound/soc/soc-dai.c +3 −2
  543. sound/soc/soc-dapm.c +116 −80
  544. sound/soc/soc-jack.c +1 −1
  545. sound/soc/soc-ops.c +51 −11
  546. sound/soc/soc-pcm.c +23 −15
  547. sound/soc/soc-topology.c +5 −5
  548. sound/soc/sof/fw-file-profile.c +12 −1
  549. sound/soc/sof/imx/Kconfig +1 −0
  550. sound/soc/sof/imx/imx9.c +8 −28
  551. sound/soc/sof/intel/Kconfig +18 −0
  552. sound/soc/sof/intel/Makefile +2 −0
  553. sound/soc/sof/intel/apl.c +1 −0
  554. sound/soc/sof/intel/cnl.c +3 −1
  555. sound/soc/sof/intel/hda-dsp.c +1 −0
  556. sound/soc/sof/intel/hda-ipc.c +1 −1
  557. sound/soc/sof/intel/hda.c +211 −2
  558. sound/soc/sof/intel/hda.h +1 −0
  559. sound/soc/sof/intel/icl.c +1 −0
  560. sound/soc/sof/intel/lnl.c +1 −0
  561. sound/soc/sof/intel/mtl.c +2 −0
  562. sound/soc/sof/intel/nvl.c +55 −0
  563. sound/soc/sof/intel/nvl.h +14 −0
  564. sound/soc/sof/intel/pci-nvl.c +82 −0
  565. sound/soc/sof/intel/ptl.c +2 −0
  566. sound/soc/sof/intel/shim.h +2 −0
  567. sound/soc/sof/intel/skl.c +1 −0
  568. sound/soc/sof/intel/tgl.c +4 −0
  569. sound/soc/sof/pcm.c +18 −0
  570. sound/soc/sof/sof-client-probes-ipc4.c +1 −1
  571. sound/soc/sof/sof-client-probes.c +8 −3
  572. sound/soc/sof/topology.c +6 −1
  573. sound/soc/spacemit/Kconfig +15 −0
  574. sound/soc/spacemit/Makefile +5 −0
  575. sound/soc/spacemit/k1_i2s.c +461 −0
  576. sound/soc/stm/stm32_adfsdm.c +1 −1
  577. sound/soc/stm/stm32_sai.c +4 −10
  578. sound/soc/stm/stm32_sai_sub.c +40 −17
  579. sound/soc/sunxi/sun4i-codec.c +2 −1
  580. sound/soc/sunxi/sun4i-spdif.c +24 −2
  581. sound/soc/sunxi/sun50i-codec-analog.c +1 −1
  582. sound/soc/sunxi/sun8i-codec-analog.c +7 −7
  583. sound/soc/sunxi/sun8i-codec.c +2 −2
  584. sound/soc/tegra/Kconfig +1 −1
  585. sound/soc/tegra/tegra186_asrc.c +12 −12
  586. sound/soc/tegra/tegra186_dspk.c +12 −12
  587. sound/soc/tegra/tegra210_admaif.c +8 −8
  588. sound/soc/tegra/tegra210_adx.c +2 −2
  589. sound/soc/tegra/tegra210_ahub.c +3 −3
  590. sound/soc/tegra/tegra210_amx.c +2 −2
  591. sound/soc/tegra/tegra210_dmic.c +12 −12
  592. sound/soc/tegra/tegra210_i2s.c +16 −16
  593. sound/soc/tegra/tegra210_mbdrc.c +12 −12
  594. sound/soc/tegra/tegra210_mixer.c +2 −2
  595. sound/soc/tegra/tegra210_mvc.c +6 −6
  596. sound/soc/tegra/tegra210_ope.c +2 −2
  597. sound/soc/tegra/tegra210_peq.c +4 −4
  598. sound/soc/tegra/tegra210_sfc.c +8 −8
  599. sound/soc/tegra/tegra_asoc_machine.c +7 −4
  600. sound/soc/tegra/tegra_wm8903.c +2 −1
  601. sound/soc/ti/ams-delta.c +4 −4
  602. sound/soc/ti/davinci-evm.c +6 −5
  603. sound/soc/ti/j721e-evm.c +1 −1
  604. sound/soc/ti/n810.c +8 −4
  605. sound/soc/ti/omap-abe-twl6040.c +1 −1
  606. sound/soc/ti/omap-twl4030.c +1 −1
  607. sound/soc/ti/omap3pandora.c +19 −17
  608. sound/soc/ti/rx51.c +10 −7
  609. sound/soc/uniphier/aio-cpu.c +2 −2
  610. sound/soc/uniphier/evea.c +6 −6
  611. sound/soc/ux500/mop500_ab8500.c +1 −1
  612. sound/usb/line6/podhd.c +15 −1
  613. sound/usb/mixer_quirks.c +115 −7
  614. sound/usb/stream.c +2 −4
  615. tools/testing/selftests/alsa/conf.c +1 −1
Documentation/devicetree/bindings/sound/adi,max98363.yaml+0−60
@@ -1,60 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/adi,max98363.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: Analog Devices MAX98363 SoundWire Amplifier
8−
9−maintainers:
10− - Ryan Lee <ryans.lee@analog.com>
11−
12−description:
13− The MAX98363 is a SoundWire input Class D mono amplifier that
14− supports MIPI SoundWire v1.2-compatible digital interface for
15− audio and control data.
16− SoundWire peripheral device ID of MAX98363 is 0x3*019f836300
17− where * is the peripheral device unique ID decoded from pin.
18− It supports up to 10 peripheral devices(0x0 to 0x9).
19−
20−allOf:
21− - $ref: dai-common.yaml#
22−
23−properties:
24− compatible:
25− const: sdw3019f836300
26−
27− reg:
28− maxItems: 1
29−
30− '#sound-dai-cells':
31− const: 0
32−
33−required:
34− - compatible
35− - reg
36− - "#sound-dai-cells"
37−
38−unevaluatedProperties: false
39−
40−examples:
41− - |
42− soundwire@3250000 {
43− #address-cells = <2>;
44− #size-cells = <0>;
45− reg = <0x3250000 0x2000>;
46−
47− speaker@0,0 {
48− compatible = "sdw3019f836300";
49− reg = <0 0>;
50− #sound-dai-cells = <0>;
51− sound-name-prefix = "Speaker Left";
52− };
53−
54− speaker@0,1 {
55− compatible = "sdw3019f836300";
56− reg = <0 1>;
57− #sound-dai-cells = <0>;
58− sound-name-prefix = "Speaker Right";
59− };
60− };
Documentation/devicetree/bindings/sound/adi,ssm2602.txt+0−19
@@ -1,19 +0,0 @@
1−Analog Devices SSM2602, SSM2603 and SSM2604 I2S audio CODEC devices
2−
3−SSM2602 support both I2C and SPI as the configuration interface,
4−the selection is made by the MODE strap-in pin.
5−SSM2603 and SSM2604 only support I2C as the configuration interface.
6−
7−Required properties:
8−
9− - compatible : One of "adi,ssm2602", "adi,ssm2603" or "adi,ssm2604"
10−
11− - reg : the I2C address of the device for I2C, the chip select
12− number for SPI.
13−
14− Example:
15−
16− ssm2602: ssm2602@1a {
17− compatible = "adi,ssm2602";
18− reg = <0x1a>;
19− };
Documentation/devicetree/bindings/sound/adi,ssm3515.yaml+0−49
@@ -1,49 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/adi,ssm3515.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: Analog Devices SSM3515 Audio Amplifier
8−
9−maintainers:
10− - Martin Povišer <povik+lin@cutebit.org>
11−
12−description: |
13− SSM3515 is a mono Class-D audio amplifier with digital input.
14−
15− https://www.analog.com/media/en/technical-documentation/data-sheets/SSM3515.pdf
16−
17−allOf:
18− - $ref: dai-common.yaml#
19−
20−properties:
21− compatible:
22− enum:
23− - adi,ssm3515
24−
25− reg:
26− maxItems: 1
27−
28− '#sound-dai-cells':
29− const: 0
30−
31−required:
32− - compatible
33− - reg
34−
35−unevaluatedProperties: false
36−
37−examples:
38− - |
39− i2c {
40− #address-cells = <1>;
41− #size-cells = <0>;
42−
43− codec@14 {
44− compatible = "adi,ssm3515";
45− reg = <0x14>;
46− #sound-dai-cells = <0>;
47− sound-name-prefix = "Left Tweeter";
48− };
49− };
Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml+3−1
@@ -33,7 +33,9 @@ properties: · 32 unmodified lines
3333 - const: allwinner,sun50i-h6-i2s
3434 - const: allwinner,sun50i-r329-i2s
3535 - items:
36− - const: allwinner,sun20i-d1-i2s
36+ - enum:
37+ - allwinner,sun20i-d1-i2s
38+ - allwinner,sun55i-a523-i2s
3739 - const: allwinner,sun50i-r329-i2s
3840
3941 reg:
Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml+38−6
@@ -23,6 +23,7 @@ properties: · 22 unmodified lines
2323 - const: allwinner,sun8i-h3-spdif
2424 - const: allwinner,sun50i-h6-spdif
2525 - const: allwinner,sun50i-h616-spdif
26+ - const: allwinner,sun55i-a523-spdif
2627 - items:
2728 - const: allwinner,sun8i-a83t-spdif
2829 - const: allwinner,sun8i-h3-spdif
@@ -37,14 +38,12 @@ properties: · 8 unmodified lines
3738 maxItems: 1
3839
3940 clocks:
40− items:
41− - description: Bus Clock
42− - description: Module Clock
41+ minItems: 2
42+ maxItems: 3
4343
4444 clock-names:
45− items:
46− - const: apb
47− - const: spdif
45+ minItems: 2
46+ maxItems: 3
4847
4948 # Even though it only applies to subschemas under the conditionals,
5049 # not listing them here will trigger a warning because of the
@@ -65,6 +64,7 @@ allOf: · 14 unmodified lines
6564 - allwinner,sun8i-h3-spdif
6665 - allwinner,sun50i-h6-spdif
6766 - allwinner,sun50i-h616-spdif
67+ - allwinner,sun55i-a523-spdif
6868
6969 then:
7070 required:
@@ -98,6 +98,38 @@ allOf: · 27 unmodified lines
9898 - const: rx
9999 - const: tx
100100
101+ - if:
102+ properties:
103+ compatible:
104+ contains:
105+ enum:
106+ - allwinner,sun55i-a523-spdif
107+
108+ then:
109+ properties:
110+ clocks:
111+ items:
112+ - description: Bus Clock
113+ - description: TX Clock
114+ - description: RX Clock
115+
116+ clock-names:
117+ items:
118+ - const: apb
119+ - const: tx
120+ - const: rx
121+ else:
122+ properties:
123+ clocks:
124+ items:
125+ - description: Bus Clock
126+ - description: Module Clock
127+
128+ clock-names:
129+ items:
130+ - const: apb
131+ - const: spdif
132+
101133 required:
102134 - "#sound-dai-cells"
103135 - compatible
Documentation/devicetree/bindings/sound/cirrus,cs4271.yaml+10−0
@@ -25,6 +25,16 @@ properties: · 24 unmodified lines
2525 reg:
2626 maxItems: 1
2727
28+ clocks:
29+ items:
30+ - description:
31+ Master clock connected to the MCLK pin if MCLK is an input (i.e. no
32+ crystal used).
33+
34+ clock-names:
35+ items:
36+ - const: mclk
37+
2838 spi-cpha: true
2939
3040 spi-cpol: true
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml+8−0
@@ -15,10 +15,15 @@ description: · 14 unmodified lines
1515
1616 allOf:
1717 - $ref: dai-common.yaml#
18+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
1819
1920 properties:
2021 compatible:
2122 enum:
23+ - cirrus,cs4282
24+ - cirrus,cs4302
25+ - cirrus,cs4304
26+ - cirrus,cs4308
2227 - cirrus,cs5302
2328 - cirrus,cs5304
2429 - cirrus,cs5308
@@ -26,6 +31,9 @@ properties: · 1 unmodified line
2631 reg:
2732 maxItems: 1
2833
34+ spi-max-frequency:
35+ maximum: 24000000
36+
2937 '#sound-dai-cells':
3038 const: 1
3139
Documentation/devicetree/bindings/sound/cs4265.txt+0−29
@@ -1,29 +0,0 @@
1−CS4265 audio CODEC
2−
3−This device supports I2C only.
4−
5−Required properties:
6−
7− - compatible : "cirrus,cs4265"
8−
9− - reg : the I2C address of the device for I2C. The I2C address depends on
10− the state of the AD0 pin. If AD0 is high, the i2c address is 0x4f.
11− If it is low, the i2c address is 0x4e.
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−Examples:
19−
20−codec_ad0_high: cs4265@4f { /* AD0 Pin is high */
21− compatible = "cirrus,cs4265";
22− reg = <0x4f>;
23−};
24−
25−
26−codec_ad0_low: cs4265@4e { /* AD0 Pin is low */
27− compatible = "cirrus,cs4265";
28− reg = <0x4e>;
29−};
Documentation/devicetree/bindings/sound/cs4341.txt+0−22
@@ -1,22 +0,0 @@
1−Cirrus Logic CS4341 audio DAC
2−
3−This device supports both I2C and SPI (configured with pin strapping
4−on the board).
5−
6−Required properties:
7− - compatible: "cirrus,cs4341a"
8− - reg : the I2C address of the device for I2C, the chip select
9− number for SPI.
10−
11−For required properties on I2C-bus, please consult
12−dtschema schemas/i2c/i2c-controller.yaml
13−For required properties on SPI-bus, please consult
14−Documentation/devicetree/bindings/spi/spi-bus.txt
15−
16−Example:
17− codec: cs4341@0 {
18− #sound-dai-cells = <0>;
19− compatible = "cirrus,cs4341a";
20− reg = <0>;
21− spi-max-frequency = <6000000>;
22− };
Documentation/devicetree/bindings/sound/cs4349.txt+0−19
@@ -1,19 +0,0 @@
1−CS4349 audio CODEC
2−
3−Required properties:
4−
5− - compatible : "cirrus,cs4349"
6−
7− - reg : the I2C address of the device for I2C
8−
9−Optional properties:
10−
11− - reset-gpios : a GPIO spec for the reset pin.
12−
13−Example:
14−
15−codec: cs4349@48 {
16− compatible = "cirrus,cs4349";
17− reg = <0x48>;
18− reset-gpios = <&gpio 54 0>;
19−};
Documentation/devicetree/bindings/sound/da9055.txt+0−22
@@ -1,22 +0,0 @@
1−* Dialog DA9055 Audio CODEC
2−
3−DA9055 provides Audio CODEC support (I2C only).
4−
5−The Audio CODEC device in DA9055 has its own I2C address which is configurable,
6−so the device is instantiated separately from the PMIC (MFD) device.
7−
8−For details on accompanying PMIC I2C device, see the following:
9−Documentation/devicetree/bindings/mfd/da9055.txt
10−
11−Required properties:
12−
13− - compatible: "dlg,da9055-codec"
14− - reg: Specifies the I2C slave address
15−
16−
17−Example:
18−
19− codec: da9055-codec@1a {
20− compatible = "dlg,da9055-codec";
21− reg = <0x1a>;
22− };
Documentation/devicetree/bindings/sound/mediatek,mt8189-afe-pcm.yaml+178−0
@@ -0,0 +1,178 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/mediatek,mt8189-afe-pcm.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: MediaTek Audio Front End PCM controller for MT8189
8+
9+maintainers:
10+ - Darren Ye <darren.ye@mediatek.com>
11+ - Cyril Chao <cyril.chao@mediatek.com>
12+
13+properties:
14+ compatible:
15+ const: mediatek,mt8189-afe-pcm
16+
17+ reg:
18+ maxItems: 1
19+
20+ interrupts:
21+ maxItems: 1
22+
23+ memory-region:
24+ maxItems: 1
25+
26+ mediatek,apmixedsys:
27+ $ref: /schemas/types.yaml#/definitions/phandle
28+ description: To set up the apll12 tuner
29+
30+ power-domains:
31+ maxItems: 1
32+
33+ clocks:
34+ items:
35+ - description: mux for audio intbus
36+ - description: mux for audio engen1
37+ - description: mux for audio engen2
38+ - description: mux for audio h
39+ - description: audio apll1 clock
40+ - description: audio apll2 clock
41+ - description: audio apll1 divide4
42+ - description: audio apll2 divide4
43+ - description: audio apll12 divide for i2sin0
44+ - description: audio apll12 divide for i2sin1
45+ - description: audio apll12 divide for i2sout0
46+ - description: audio apll12 divide for i2sout1
47+ - description: audio apll12 divide for fmi2s
48+ - description: audio apll12 divide for tdmout mck
49+ - description: audio apll12 divide for tdmout bck
50+ - description: mux for audio apll1
51+ - description: mux for audio apll2
52+ - description: mux for i2sin0 mck
53+ - description: mux for i2sin1 mck
54+ - description: mux for i2sout0 mck
55+ - description: mux for i2sout1 mck
56+ - description: mux for fmi2s mck
57+ - description: mux for tdmout mck
58+ - description: 26m clock
59+ - description: audio slv clock
60+ - description: audio mst clock
61+ - description: audio intbus clock
62+
63+ clock-names:
64+ items:
65+ - const: top_aud_intbus
66+ - const: top_aud_eng1
67+ - const: top_aud_eng2
68+ - const: top_aud_h
69+ - const: apll1
70+ - const: apll2
71+ - const: apll1_d4
72+ - const: apll2_d4
73+ - const: apll12_div_i2sin0
74+ - const: apll12_div_i2sin1
75+ - const: apll12_div_i2sout0
76+ - const: apll12_div_i2sout1
77+ - const: apll12_div_fmi2s
78+ - const: apll12_div_tdmout_m
79+ - const: apll12_div_tdmout_b
80+ - const: top_apll1
81+ - const: top_apll2
82+ - const: top_i2sin0
83+ - const: top_i2sin1
84+ - const: top_i2sout0
85+ - const: top_i2sout1
86+ - const: top_fmi2s
87+ - const: top_dptx
88+ - const: clk26m
89+ - const: aud_slv_ck_peri
90+ - const: aud_mst_ck_peri
91+ - const: aud_intbus_ck_peri
92+
93+required:
94+ - compatible
95+ - reg
96+ - interrupts
97+ - memory-region
98+ - power-domains
99+ - clocks
100+ - clock-names
101+
102+additionalProperties: false
103+
104+examples:
105+ - |
106+ #include <dt-bindings/interrupt-controller/arm-gic.h>
107+ #include <dt-bindings/interrupt-controller/irq.h>
108+
109+ soc {
110+ #address-cells = <2>;
111+ #size-cells = <2>;
112+
113+ afe@11050000 {
114+ compatible = "mediatek,mt8189-afe-pcm";
115+ reg = <0 0x11050000 0 0x10000>;
116+ interrupts = <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH 0>;
117+ memory-region = <&afe_dma_mem_reserved>;
118+ pinctrl-names = "default";
119+ pinctrl-0 = <&aud_pins_default>;
120+ power-domains = <&scpsys 1>; //MT8189_POWER_DOMAIN_AUDIO
121+ clocks = <&topckgen_clk 23>, //CLK_TOP_AUD_INTBUS_SEL
122+ <&topckgen_clk 39>, //CLK_TOP_AUD_ENGEN1_SEL
123+ <&topckgen_clk 40>, //CLK_TOP_AUD_ENGEN2_SEL
124+ <&topckgen_clk 49>, //CLK_TOP_AUDIO_H_SEL
125+ <&topckgen_clk 146>, //CLK_TOP_APLL1
126+ <&topckgen_clk 151>, //CLK_TOP_APLL2
127+ <&topckgen_clk 148>, //CLK_TOP_APLL1_D4
128+ <&topckgen_clk 153>, //CLK_TOP_APLL2_D4
129+ <&topckgen_clk 93>, //CLK_TOP_APLL12_CK_DIV_I2SIN0
130+ <&topckgen_clk 94>, //CLK_TOP_APLL12_CK_DIV_I2SIN1
131+ <&topckgen_clk 95>, //CLK_TOP_APLL12_CK_DIV_I2SOUT0
132+ <&topckgen_clk 96>, //CLK_TOP_APLL12_CK_DIV_I2SOUT1
133+ <&topckgen_clk 97>, //CLK_TOP_APLL12_CK_DIV_FMI2S
134+ <&topckgen_clk 98>, //CLK_TOP_APLL12_CK_DIV_TDMOUT_M
135+ <&topckgen_clk 99>, //CLK_TOP_APLL12_CK_DIV_TDMOUT_B
136+ <&topckgen_clk 44>, //CLK_TOP_AUD_1_SEL
137+ <&topckgen_clk 45>, //CLK_TOP_AUD_2_SEL
138+ <&topckgen_clk 78>, //CLK_TOP_APLL_I2SIN0_MCK_SEL
139+ <&topckgen_clk 79>, //CLK_TOP_APLL_I2SIN1_MCK_SEL
140+ <&topckgen_clk 84>, //CLK_TOP_APLL_I2SOUT0_MCK_SEL
141+ <&topckgen_clk 85>, //CLK_TOP_APLL_I2SOUT1_MCK_SEL
142+ <&topckgen_clk 90>, //CLK_TOP_APLL_FMI2S_MCK_SEL
143+ <&topckgen_clk 91>, //CLK_TOP_APLL_TDMOUT_MCK_SEL
144+ <&topckgen_clk 191>, //CLK_TOP_TCK_26M_MX9
145+ <&pericfg_ao_clk 77>, //CLK_PERAO_AUDIO0
146+ <&pericfg_ao_clk 78>, //CLK_PERAO_AUDIO1
147+ <&pericfg_ao_clk 79>; //CLK_PERAO_AUDIO2
148+ clock-names = "top_aud_intbus",
149+ "top_aud_eng1",
150+ "top_aud_eng2",
151+ "top_aud_h",
152+ "apll1",
153+ "apll2",
154+ "apll1_d4",
155+ "apll2_d4",
156+ "apll12_div_i2sin0",
157+ "apll12_div_i2sin1",
158+ "apll12_div_i2sout0",
159+ "apll12_div_i2sout1",
160+ "apll12_div_fmi2s",
161+ "apll12_div_tdmout_m",
162+ "apll12_div_tdmout_b",
163+ "top_apll1",
164+ "top_apll2",
165+ "top_i2sin0",
166+ "top_i2sin1",
167+ "top_i2sout0",
168+ "top_i2sout1",
169+ "top_fmi2s",
170+ "top_dptx",
171+ "clk26m",
172+ "aud_slv_ck_peri",
173+ "aud_mst_ck_peri",
174+ "aud_intbus_ck_peri";
175+ };
176+ };
177+
178+...
Documentation/devicetree/bindings/sound/mediatek,mt8189-nau8825.yaml+101−0
@@ -0,0 +1,101 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/mediatek,mt8189-nau8825.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: MediaTek MT8189 ASoC sound card
8+
9+maintainers:
10+ - Darren Ye <darren.ye@mediatek.com>
11+ - Cyril Chao <cyril.chao@mediatek.com>
12+
13+allOf:
14+ - $ref: sound-card-common.yaml#
15+
16+properties:
17+ compatible:
18+ enum:
19+ - mediatek,mt8189-nau8825
20+ - mediatek,mt8189-rt5650
21+ - mediatek,mt8189-rt5682s
22+ - mediatek,mt8189-rt5682i
23+ - mediatek,mt8189-es8326
24+
25+ mediatek,platform:
26+ $ref: /schemas/types.yaml#/definitions/phandle
27+ description: The phandle of MT8189 ASoC platform.
28+
29+patternProperties:
30+ "^dai-link-[0-9]+$":
31+ type: object
32+ description:
33+ Container for dai-link level properties and CODEC sub-nodes.
34+
35+ properties:
36+ link-name:
37+ description:
38+ This property corresponds to the name of the BE dai-link to which
39+ we are going to update parameters in this node.
40+ enum:
41+ - TDM_DPTX_BE
42+ - I2SOUT0_BE
43+ - I2SIN0_BE
44+ - I2SOUT1_BE
45+
46+ codec:
47+ description: Holds subnode which indicates codec dai.
48+ type: object
49+ additionalProperties: false
50+
51+ properties:
52+ sound-dai:
53+ minItems: 1
54+ maxItems: 2
55+ required:
56+ - sound-dai
57+
58+ dai-format:
59+ description: audio format.
60+ enum:
61+ - i2s
62+ - right_j
63+ - left_j
64+ - dsp_a
65+ - dsp_b
66+
67+ mediatek,clk-provider:
68+ $ref: /schemas/types.yaml#/definitions/string
69+ description: Indicates dai-link clock master.
70+ enum:
71+ - cpu
72+ - codec
73+
74+ additionalProperties: false
75+
76+ required:
77+ - link-name
78+
79+required:
80+ - compatible
81+ - mediatek,platform
82+
83+unevaluatedProperties: false
84+
85+examples:
86+ - |
87+ sound {
88+ compatible = "mediatek,mt8189-nau8825";
89+ model = "mt8189_rt9123_8825";
90+ mediatek,platform = <&afe>;
91+ dai-link-0 {
92+ link-name = "I2SOUT1_BE";
93+ dai-format = "i2s";
94+ mediatek,clk-provider = "cpu";
95+ codec {
96+ sound-dai = <&nau8825>;
97+ };
98+ };
99+ };
100+
101+...
Documentation/devicetree/bindings/sound/nuvoton,nau8540.yaml+0−40
@@ -1,40 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/nuvoton,nau8540.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: Nuvoton Technology Corporation NAU85L40 Audio CODEC
8−
9−maintainers:
10− - John Hsu <KCHSU0@nuvoton.com>
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: nuvoton,nau8540
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36− codec@1c {
37− compatible = "nuvoton,nau8540";
38− reg = <0x1c>;
39− };
40− };
Documentation/devicetree/bindings/sound/nuvoton,nau8810.yaml+0−45
@@ -1,45 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/nuvoton,nau8810.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: NAU8810/NAU8812/NAU8814 audio CODEC
8−
9−maintainers:
10− - David Lin <CTLIN0@nuvoton.com>
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− enum:
18− - nuvoton,nau8810
19− - nuvoton,nau8812
20− - nuvoton,nau8814
21−
22− reg:
23− maxItems: 1
24−
25− '#sound-dai-cells':
26− const: 0
27−
28−required:
29− - compatible
30− - reg
31−
32−unevaluatedProperties: false
33−
34−examples:
35− - |
36− i2c {
37− #address-cells = <1>;
38− #size-cells = <0>;
39−
40− codec@1a {
41− #sound-dai-cells = <0>;
42− compatible = "nuvoton,nau8810";
43− reg = <0x1a>;
44− };
45− };
Documentation/devicetree/bindings/sound/nvidia,tegra210-admaif.yaml+66−40
@@ -67,46 +67,72 @@ properties: · 66 unmodified lines
6767 $ref: audio-graph-port.yaml#
6868 unevaluatedProperties: false
6969
70−if:
71− properties:
72− compatible:
73− contains:
74− const: nvidia,tegra210-admaif
75−
76−then:
77− properties:
78− dmas:
79− description:
80− DMA channel specifiers, equally divided for Tx and Rx.
81− minItems: 1
82− maxItems: 20
83− dma-names:
84− items:
85− pattern: "^[rt]x(10|[1-9])$"
86− description:
87− Should be "rx1", "rx2" ... "rx10" for DMA Rx channel
88− Should be "tx1", "tx2" ... "tx10" for DMA Tx channel
89− minItems: 1
90− maxItems: 20
91− interconnects: false
92− interconnect-names: false
93− iommus: false
94−
95−else:
96− properties:
97− dmas:
98− description:
99− DMA channel specifiers, equally divided for Tx and Rx.
100− minItems: 1
101− maxItems: 40
102− dma-names:
103− items:
104− pattern: "^[rt]x(1[0-9]|[1-9]|20)$"
105− description:
106− Should be "rx1", "rx2" ... "rx20" for DMA Rx channel
107− Should be "tx1", "tx2" ... "tx20" for DMA Tx channel
108− minItems: 1
109− maxItems: 40
70+allOf:
71+ - if:
72+ properties:
73+ compatible:
74+ contains:
75+ const: nvidia,tegra210-admaif
76+ then:
77+ properties:
78+ dmas:
79+ description:
80+ DMA channel specifiers, equally divided for Tx and Rx.
81+ minItems: 1
82+ maxItems: 20
83+ dma-names:
84+ items:
85+ pattern: "^[rt]x(10|[1-9])$"
86+ description:
87+ Should be "rx1", "rx2" ... "rx10" for DMA Rx channel
88+ Should be "tx1", "tx2" ... "tx10" for DMA Tx channel
89+ minItems: 1
90+ maxItems: 20
91+ interconnects: false
92+ interconnect-names: false
93+ iommus: false
94+
95+ - if:
96+ properties:
97+ compatible:
98+ contains:
99+ const: nvidia,tegra186-admaif
100+ then:
101+ properties:
102+ dmas:
103+ description:
104+ DMA channel specifiers, equally divided for Tx and Rx.
105+ minItems: 1
106+ maxItems: 40
107+ dma-names:
108+ items:
109+ pattern: "^[rt]x(1[0-9]|[1-9]|20)$"
110+ description:
111+ Should be "rx1", "rx2" ... "rx20" for DMA Rx channel
112+ Should be "tx1", "tx2" ... "tx20" for DMA Tx channel
113+ minItems: 1
114+ maxItems: 40
115+
116+ - if:
117+ properties:
118+ compatible:
119+ contains:
120+ const: nvidia,tegra264-admaif
121+ then:
122+ properties:
123+ dmas:
124+ description:
125+ DMA channel specifiers, equally divided for Tx and Rx.
126+ minItems: 1
127+ maxItems: 64
128+ dma-names:
129+ items:
130+ pattern: "^[rt]x(3[0-2]|[1-2][0-9]|[1-9])$"
131+ description:
132+ Should be "rx1", "rx2" ... "rx32" for DMA Rx channel
133+ Should be "tx1", "tx2" ... "tx32" for DMA Tx channel
134+ minItems: 1
135+ maxItems: 64
110136
111137 required:
112138 - compatible
Documentation/devicetree/bindings/sound/nxp,tfa9879.yaml+0−44
@@ -1,44 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/nxp,tfa9879.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: NXP TFA9879 class-D audio amplifier
8−
9−maintainers:
10− - Peter Rosin <peda@axentia.se>
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: nxp,tfa9879
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28− - '#sound-dai-cells'
29−
30−unevaluatedProperties: false
31−
32−examples:
33− - |
34− i2c1 {
35− #address-cells = <1>;
36− #size-cells = <0>;
37− amplifier@6c {
38− compatible = "nxp,tfa9879";
39− reg = <0x6c>;
40− pinctrl-names = "default";
41− pinctrl-0 = <&pinctrl_i2c1>;
42− #sound-dai-cells = <0>;
43− };
44− };
Documentation/devicetree/bindings/sound/nxp,uda1342.yaml+0−42
@@ -1,42 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/nxp,uda1342.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: NXP uda1342 audio CODECs
8−
9−maintainers:
10− - Binbin Zhou <zhoubinbin@loongson.cn>
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: nxp,uda1342
18−
19− reg:
20− maxItems: 1
21−
22− '#sound-dai-cells':
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28− - '#sound-dai-cells'
29−
30−unevaluatedProperties: false
31−
32−examples:
33− - |
34− i2c {
35− #address-cells = <1>;
36− #size-cells = <0>;
37− codec@1a {
38− compatible = "nxp,uda1342";
39− reg = <0x1a>;
40− #sound-dai-cells = <0>;
41− };
42− };
Documentation/devicetree/bindings/sound/pcm1789.txt+0−22
@@ -1,22 +0,0 @@
1−Texas Instruments pcm1789 DT bindings
2−
3−PCM1789 is a simple audio codec that can be connected via
4−I2C or SPI. Currently, only I2C bus is supported.
5−
6−Required properties:
7−
8− - compatible: "ti,pcm1789"
9−
10−Required properties on I2C:
11−
12− - reg: the I2C address
13− - reset-gpios: GPIO to control the RESET pin
14−
15−Examples:
16−
17− audio-codec@4c {
18− compatible = "ti,pcm1789";
19− reg = <0x4c>;
20− reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
21− #sound-dai-cells = <0>;
22− };
Documentation/devicetree/bindings/sound/pcm179x.txt+0−27
@@ -1,27 +0,0 @@
1−Texas Instruments pcm179x DT bindings
2−
3−This driver supports both the I2C and SPI bus.
4−
5−Required properties:
6−
7− - compatible: "ti,pcm1792a"
8−
9−For required properties on SPI, please consult
10−Documentation/devicetree/bindings/spi/spi-bus.txt
11−
12−Required properties on I2C:
13−
14− - reg: the I2C address
15−
16−
17−Examples:
18−
19− codec_spi: 1792a@0 {
20− compatible = "ti,pcm1792a";
21− spi-max-frequency = <600000>;
22− };
23−
24− codec_i2c: 1792a@4c {
25− compatible = "ti,pcm1792a";
26− reg = <0x4c>;
27− };
Documentation/devicetree/bindings/sound/pcm186x.txt+0−42
@@ -1,42 +0,0 @@
1−Texas Instruments PCM186x Universal Audio ADC
2−
3−These devices support both I2C and SPI (configured with pin strapping
4−on the board).
5−
6−Required properties:
7−
8− - compatible : "ti,pcm1862",
9− "ti,pcm1863",
10− "ti,pcm1864",
11− "ti,pcm1865"
12−
13− - reg : The I2C address of the device for I2C, the chip select
14− number for SPI.
15−
16− - avdd-supply: Analog core power supply (3.3v)
17− - dvdd-supply: Digital core power supply
18− - iovdd-supply: Digital IO power supply
19− See regulator/regulator.txt for more information
20−
21−CODEC input pins:
22− * VINL1
23− * VINR1
24− * VINL2
25− * VINR2
26− * VINL3
27− * VINR3
28− * VINL4
29− * VINR4
30−
31−The pins can be used in referring sound node's audio-routing property.
32−
33−Example:
34−
35− pcm186x: audio-codec@4a {
36− compatible = "ti,pcm1865";
37− reg = <0x4a>;
38−
39− avdd-supply = <&reg_3v3_analog>;
40− dvdd-supply = <&reg_3v3>;
41− iovdd-supply = <&reg_1v8>;
42− };
Documentation/devicetree/bindings/sound/pcm5102a.txt+0−13
@@ -1,13 +0,0 @@
1−PCM5102a audio CODECs
2−
3−These devices does not use I2C or SPI.
4−
5−Required properties:
6−
7− - compatible : set as "ti,pcm5102a"
8−
9−Examples:
10−
11− pcm5102a: pcm5102a {
12− compatible = "ti,pcm5102a";
13− };
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml+19−0
@@ -14,12 +14,14 @@ properties: · 13 unmodified lines
1414 oneOf:
1515 - enum:
1616 - qcom,sc7280-lpass-rx-macro
17+ - qcom,sm6115-lpass-rx-macro
1718 - qcom,sm8250-lpass-rx-macro
1819 - qcom,sm8450-lpass-rx-macro
1920 - qcom,sm8550-lpass-rx-macro
2021 - qcom,sc8280xp-lpass-rx-macro
2122 - items:
2223 - enum:
24+ - qcom,kaanapali-lpass-rx-macro
2325 - qcom,sm8650-lpass-rx-macro
2426 - qcom,sm8750-lpass-rx-macro
2527 - qcom,x1e80100-lpass-rx-macro
@@ -80,6 +82,23 @@ allOf: · 54 unmodified lines
8082 - const: npl
8183 - const: fsgen
8284
85+ - if:
86+ properties:
87+ compatible:
88+ enum:
89+ - qcom,sm6115-lpass-rx-macro
90+ then:
91+ properties:
92+ clocks:
93+ minItems: 4
94+ maxItems: 4
95+ clock-names:
96+ items:
97+ - const: mclk
98+ - const: npl
99+ - const: dcodec
100+ - const: fsgen
101+
83102 - if:
84103 properties:
85104 compatible:
Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml+1−0
@@ -21,6 +21,7 @@ properties: · 20 unmodified lines
2121 - qcom,sc8280xp-lpass-tx-macro
2222 - items:
2323 - enum:
24+ - qcom,kaanapali-lpass-tx-macro
2425 - qcom,sm8650-lpass-tx-macro
2526 - qcom,sm8750-lpass-tx-macro
2627 - qcom,x1e80100-lpass-tx-macro
Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml+36−14
@@ -14,6 +14,7 @@ properties: · 13 unmodified lines
1414 oneOf:
1515 - enum:
1616 - qcom,sc7280-lpass-va-macro
17+ - qcom,sm6115-lpass-va-macro
1718 - qcom,sm8250-lpass-va-macro
1819 - qcom,sm8450-lpass-va-macro
1920 - qcom,sm8550-lpass-va-macro
@@ -21,6 +22,7 @@ properties: · 1 unmodified line
2122 - items:
2223 - enum:
2324 - qcom,glymur-lpass-va-macro
25+ - qcom,kaanapali-lpass-va-macro
2426 - qcom,sm8650-lpass-va-macro
2527 - qcom,sm8750-lpass-va-macro
2628 - qcom,x1e80100-lpass-va-macro
@@ -41,11 +43,7 @@ properties: · 14 unmodified lines
4143
4244 clock-names:
4345 minItems: 1
44− items:
45− - const: mclk
46− - const: macro
47− - const: dcodec
48− - const: npl
46+ maxItems: 4
4947
5048 clock-output-names:
5149 maxItems: 1
@@ -90,29 +88,48 @@ allOf: · 38 unmodified lines
9088 clocks:
9189 maxItems: 1
9290 clock-names:
93− maxItems: 1
91+ items:
92+ - const: mclk
9493 else:
9594 properties:
9695 clocks:
9796 minItems: 3
9897 maxItems: 3
9998 clock-names:
100− minItems: 3
101− maxItems: 3
102−
99+ items:
100+ - const: mclk
101+ - const: macro
102+ - const: dcodec
103103 - if:
104104 properties:
105105 compatible:
106106 contains:
107− const: qcom,sm8250-lpass-va-macro
107+ const: qcom,sm6115-lpass-va-macro
108108 then:
109109 properties:
110110 clocks:
111111 minItems: 3
112112 maxItems: 3
113113 clock-names:
114+ items:
115+ - const: mclk
116+ - const: dcodec
117+ - const: npl
118+ - if:
119+ properties:
120+ compatible:
121+ contains:
122+ const: qcom,sm8250-lpass-va-macro
123+ then:
124+ properties:
125+ clocks:
114126 minItems: 3
115127 maxItems: 3
128+ clock-names:
129+ items:
130+ - const: mclk
131+ - const: macro
132+ - const: dcodec
116133
117134 - if:
118135 properties:
@@ -127,8 +144,11 @@ allOf: · 8 unmodified lines
127144 minItems: 4
128145 maxItems: 4
129146 clock-names:
130− minItems: 4
131− maxItems: 4
147+ items:
148+ - const: mclk
149+ - const: macro
150+ - const: dcodec
151+ - const: npl
132152
133153 - if:
134154 properties:
@@ -142,8 +162,10 @@ allOf: · 7 unmodified lines
142162 minItems: 3
143163 maxItems: 3
144164 clock-names:
145− minItems: 3
146− maxItems: 3
165+ items:
166+ - const: mclk
167+ - const: macro
168+ - const: dcodec
147169
148170 unevaluatedProperties: false
149171
Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml+1−0
@@ -21,6 +21,7 @@ properties: · 20 unmodified lines
2121 - items:
2222 - enum:
2323 - qcom,glymur-lpass-wsa-macro
24+ - qcom,kaanapali-lpass-wsa-macro
2425 - qcom,sm8650-lpass-wsa-macro
2526 - qcom,sm8750-lpass-wsa-macro
2627 - qcom,x1e80100-lpass-wsa-macro
Documentation/devicetree/bindings/sound/qcom,sm8250.yaml+2−0
@@ -23,6 +23,7 @@ properties: · 22 unmodified lines
2323 - const: qcom,sdm845-sndcard
2424 - items:
2525 - enum:
26+ - qcom,kaanapali-sndcard
2627 - qcom,sm8550-sndcard
2728 - qcom,sm8650-sndcard
2829 - qcom,sm8750-sndcard
@@ -38,6 +39,7 @@ properties: · 9 unmodified lines
3839 - qcom,qcs8275-sndcard
3940 - qcom,qcs9075-sndcard
4041 - qcom,qcs9100-sndcard
42+ - qcom,qrb2210-sndcard
4143 - qcom,qrb4210-rb2-sndcard
4244 - qcom,qrb5165-rb5-sndcard
4345 - qcom,sc7180-qdsp6-sndcard
Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml+1−1
@@ -132,7 +132,7 @@ properties: · 131 unmodified lines
132132 $ref: /schemas/gpio/qcom,wcd934x-gpio.yaml#
133133
134134 patternProperties:
135− "^.*@[0-9a-f]+$":
135+ "@[0-9a-f]+$":
136136 type: object
137137 additionalProperties: true
138138 description: |
Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml+87−0
@@ -0,0 +1,87 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/spacemit,k1-i2s.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: K1 I2S controller
8+
9+description:
10+ The I2S bus (Inter-IC sound bus) is a serial link for digital
11+ audio data transfer between devices in the system.
12+
13+maintainers:
14+ - Troy Mitchell <troy.mitchell@linux.spacemit.com>
15+
16+allOf:
17+ - $ref: dai-common.yaml#
18+
19+properties:
20+ compatible:
21+ const: spacemit,k1-i2s
22+
23+ reg:
24+ maxItems: 1
25+
26+ clocks:
27+ items:
28+ - description: clock for I2S sysclk
29+ - description: clock for I2S bclk
30+ - description: clock for I2S bus
31+ - description: clock for I2S controller
32+
33+ clock-names:
34+ items:
35+ - const: sysclk
36+ - const: bclk
37+ - const: bus
38+ - const: func
39+
40+ dmas:
41+ minItems: 1
42+ maxItems: 2
43+
44+ dma-names:
45+ minItems: 1
46+ items:
47+ - const: tx
48+ - const: rx
49+
50+ resets:
51+ maxItems: 1
52+
53+ port:
54+ $ref: audio-graph-port.yaml#
55+ unevaluatedProperties: false
56+
57+ "#sound-dai-cells":
58+ const: 0
59+
60+required:
61+ - compatible
62+ - reg
63+ - clocks
64+ - clock-names
65+ - dmas
66+ - dma-names
67+ - resets
68+ - "#sound-dai-cells"
69+
70+unevaluatedProperties: false
71+
72+examples:
73+ - |
74+ #include <dt-bindings/clock/spacemit,k1-syscon.h>
75+ i2s@d4026000 {
76+ compatible = "spacemit,k1-i2s";
77+ reg = <0xd4026000 0x30>;
78+ clocks = <&syscon_mpmu CLK_I2S_SYSCLK>,
79+ <&syscon_mpmu CLK_I2S_BCLK>,
80+ <&syscon_apbc CLK_SSPA0_BUS>,
81+ <&syscon_apbc CLK_SSPA0>;
82+ clock-names = "sysclk", "bclk", "bus", "func";
83+ dmas = <&pdma0 21>, <&pdma0 22>;
84+ dma-names = "tx", "rx";
85+ resets = <&syscon_apbc RESET_SSPA0>;
86+ #sound-dai-cells = <0>;
87+ };
Documentation/devicetree/bindings/sound/ti,pcm1862.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/ti,pcm1862.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Texas Instruments PCM186x Universal Audio ADC
8+
9+maintainers:
10+ - Ranganath V N <vnranganath.20@gmail.com>
11+
12+description: |
13+ The Texas Instruments PCM186x family are multi-channel audio ADCs
14+ that support both I2C and SPI control interfaces, selected by
15+ pin strapping. These devices include on-chip programmable gain
16+ amplifiers and support differential or single-ended analog inputs.
17+
18+ CODEC input pins:
19+ * VINL1
20+ * VINR1
21+ * VINL2
22+ * VINR2
23+ * VINL3
24+ * VINR3
25+ * VINL4
26+ * VINR4
27+
28+ The pins can be used in referring sound node's audio-routing property.
29+
30+allOf:
31+ - $ref: dai-common.yaml#
32+
33+properties:
34+ compatible:
35+ enum:
36+ - ti,pcm1862
37+ - ti,pcm1863
38+ - ti,pcm1864
39+ - ti,pcm1865
40+
41+ reg:
42+ maxItems: 1
43+
44+ avdd-supply: true
45+
46+ dvdd-supply: true
47+
48+ iovdd-supply: true
49+
50+ '#sound-dai-cells':
51+ const: 0
52+
53+required:
54+ - compatible
55+ - reg
56+ - avdd-supply
57+ - dvdd-supply
58+ - iovdd-supply
59+
60+unevaluatedProperties: false
61+
62+examples:
63+ - |
64+ i2c {
65+ #address-cells = <1>;
66+ #size-cells = <0>;
67+
68+ audio-codec@4a {
69+ compatible = "ti,pcm1865";
70+ reg = <0x4a>;
71+
72+ avdd-supply = <&reg_3v3_analog>;
73+ dvdd-supply = <&reg_3v3>;
74+ iovdd-supply = <&reg_1v8>;
75+ };
76+ };
Documentation/devicetree/bindings/sound/ti,tas2781.yaml+54−4
@@ -24,21 +24,26 @@ description: | · 23 unmodified lines
2424 Instruments Smart Amp speaker protection algorithm. The
2525 integrated speaker voltage and current sense provides for real time
2626 monitoring of loudspeaker behavior.
27− The TAS5802/TAS5815/TAS5825/TAS5827/TAS5828 is a stereo, digital input
28− Class-D audio amplifier optimized for efficiently driving high peak
29− power into small loudspeakers. An integrated on-chip DSP supports
30− Texas Instruments Smart Amp speaker protection algorithm.
27+ The TAS5802/TAS5815/TAS5822/TAS5825/TAS5827/TAS5828 is a stereo,
28+ digital input Class-D audio amplifier optimized for efficiently driving
29+ high peak power into small loudspeakers. An integrated on-chip DSP
30+ supports Texas Instruments Smart Amp speaker protection algorithm.
3131
3232 Specifications about the audio amplifier can be found at:
3333 https://www.ti.com/lit/gpn/tas2120
3434 https://www.ti.com/lit/gpn/tas2320
3535 https://www.ti.com/lit/gpn/tas2563
3636 https://www.ti.com/lit/gpn/tas2572
37+ https://www.ti.com/lit/gpn/tas2574
3738 https://www.ti.com/lit/gpn/tas2781
39+ https://www.ti.com/lit/gpn/tas5806m
40+ https://www.ti.com/lit/gpn/tas5806md
3841 https://www.ti.com/lit/gpn/tas5815
42+ https://www.ti.com/lit/gpn/tas5822m
3943 https://www.ti.com/lit/gpn/tas5825m
4044 https://www.ti.com/lit/gpn/tas5827
4145 https://www.ti.com/lit/gpn/tas5828m
46+ https://www.ti.com/lit/gpn/tas5830
4247
4348 properties:
4449 compatible:
@@ -57,12 +62,18 @@ properties: · 12 unmodified lines
5762 ti,tas2563: 6.1-W Boosted Class-D Audio Amplifier With Integrated
5863 DSP and IV Sense, 16/20/24/32bit stereo I2S or multichannel TDM.
5964
65+ ti,tas2568: 5.3-W Digital Input Smart Amp with I/V Sense and Integrated
66+ 10.75-V Class-H Boost
67+
6068 ti,tas2570: 5.8-W Digital Input smart amp with I/V sense and integrated
6169 11-V Class-H Boost
6270
6371 ti,tas2572: 6.6-W Digital Input smart amp with I/V sense and integrated
6472 13-V Class-H Boost
6573
74+ ti,tas2574: 8.5-W Digital Input smart amp with I/V sense and integrated
75+ 15-V Class-H Boost
76+
6677 ti,tas2781: 24-V Class-D Amplifier with Real Time Integrated Speaker
6778 Protection and Audio Processing, 16/20/24/32bit stereo I2S or
6879 multichannel TDM.
@@ -71,9 +82,20 @@ properties: · 2 unmodified lines
7182 Audio Amplifier with 96-Khz Extended Processing and Low Idle Power
7283 Dissipation.
7384
85+ ti,tas5806m: 23-W, Inductor-Less, Digital Input, Stereo, Closed-Loop
86+ Class-D Audio Amplifier with Enhanced Processing and Low Power
87+ Dissipation.
88+
89+ ti,tas5806md: 23-W, Inductor-Less, Digital Input, Stereo, Closed-Loop
90+ Class-D Audio Amplifier with Enhanced Processing and DirectPath(TM)
91+ HP Driver
92+
7493 ti,tas5815: 30-W, Digital Input, Stereo, Closed-loop Class-D Audio
7594 Amplifier with 96 kHz Enhanced Processing
7695
96+ ti,tas5822: 35-W, Digital Input, Stereo, Closed-Loop Class-D Audio
97+ Amplifier with 96 kHz Enhanced Processing
98+
7799 ti,tas5825: 38-W Stereo, Inductor-Less, Digital Input, Closed-Loop 4.5V
78100 to 26.4V Class-D Audio Amplifier with 192-kHz Extended Audio Processing.
79101
@@ -82,6 +104,9 @@ properties: · 2 unmodified lines
82104
83105 ti,tas5828: 50-W Stereo, Digital Input, High Efficiency Closed-Loop
84106 Class-D Amplifier with Hybrid-Pro Algorithm
107+
108+ ti,tas5830: 65-W Stereo, Digital Input, High Efficiency Closed-Loop
109+ Class-D Amplifier with Class-H Algorithm
85110 oneOf:
86111 - items:
87112 - enum:
@@ -90,13 +115,19 @@ properties: · 2 unmodified lines
90115 - ti,tas2120
91116 - ti,tas2320
92117 - ti,tas2563
118+ - ti,tas2568
93119 - ti,tas2570
94120 - ti,tas2572
121+ - ti,tas2574
95122 - ti,tas5802
123+ - ti,tas5806m
124+ - ti,tas5806md
96125 - ti,tas5815
126+ - ti,tas5822
97127 - ti,tas5825
98128 - ti,tas5827
99129 - ti,tas5828
130+ - ti,tas5830
100131 - const: ti,tas2781
101132 - enum:
102133 - ti,tas2781
@@ -132,6 +163,8 @@ allOf: · 29 unmodified lines
132163 - ti,tas2118
133164 - ti,tas2120
134165 - ti,tas2320
166+ - ti,tas2568
167+ - ti,tas2574
135168 then:
136169 properties:
137170 reg:
@@ -207,6 +240,22 @@ allOf: · 69 unmodified lines
207240 minimum: 0x54
208241 maximum: 0x57
209242
243+ - if:
244+ properties:
245+ compatible:
246+ contains:
247+ enum:
248+ - ti,tas5806m
249+ - ti,tas5806md
250+ - ti,tas5822
251+ then:
252+ properties:
253+ reg:
254+ maxItems: 4
255+ items:
256+ minimum: 0x2c
257+ maximum: 0x2f
258+
210259 - if:
211260 properties:
212261 compatible:
@@ -214,6 +263,7 @@ allOf: · 1 unmodified line
214263 enum:
215264 - ti,tas5827
216265 - ti,tas5828
266+ - ti,tas5830
217267 then:
218268 properties:
219269 reg:
Documentation/devicetree/bindings/sound/trivial-codec.yaml+79−0
@@ -0,0 +1,79 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/sound/trivial-codec.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Trivial Audio Codec
8+
9+maintainers:
10+ - Rob Herring <robh@kernel.org>
11+
12+allOf:
13+ - $ref: dai-common.yaml#
14+
15+properties:
16+ compatible:
17+ enum:
18+ # Analog Devices SSM2602 I2S audio CODEC devices
19+ - adi,ssm2602
20+ - adi,ssm2603
21+ - adi,ssm2604
22+ - adi,ssm3515
23+ # Cirrus Logic CS4265 audio DAC
24+ - cirrus,cs4265
25+ - cirrus,cs4341a
26+ - cirrus,cs4349
27+ - dlg,da9055-codec
28+ # Nuvoton Technology Corporation NAU85L40 Audio CODEC
29+ - nuvoton,nau8540
30+ - nuvoton,nau8810
31+ - nuvoton,nau8812
32+ - nuvoton,nau8814
33+ # NXP TFA9879 class-D audio amplifier
34+ - nxp,tfa9879
35+ - nxp,uda1342
36+ - sdw3019f836300
37+ - ti,pcm1789
38+ - ti,pcm1792a
39+ - ti,pcm5102a
40+ - wlf,wm8510
41+ - wlf,wm8523
42+ - wlf,wm8580
43+ - wlf,wm8581
44+ - wlf,wm8711
45+ - wlf,wm8728
46+ - wlf,wm8737
47+ - wlf,wm8750
48+ - wlf,wm8753
49+ - wlf,wm8770
50+ - wlf,wm8776
51+ - wlf,wm8961
52+ - wlf,wm8974
53+ - wlf,wm8987
54+
55+ reg:
56+ maxItems: 1
57+
58+ "#sound-dai-cells":
59+ const: 0
60+
61+ reset-gpios:
62+ maxItems: 1
63+
64+required:
65+ - compatible
66+ - reg
67+
68+unevaluatedProperties: false
69+
70+examples:
71+ - |
72+ i2c {
73+ #address-cells = <1>;
74+ #size-cells = <0>;
75+ codec@1a {
76+ compatible = "wlf,wm8523";
77+ reg = <0x1a>;
78+ };
79+ };
Documentation/devicetree/bindings/sound/wlf,wm8510.yaml+0−41
@@ -1,41 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8510.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8510 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8510
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36−
37− codec@1a {
38− compatible = "wlf,wm8510";
39− reg = <0x1a>;
40− };
41− };
Documentation/devicetree/bindings/sound/wlf,wm8523.yaml+0−40
@@ -1,40 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8523.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8523 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8523
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36− codec@1a {
37− compatible = "wlf,wm8523";
38− reg = <0x1a>;
39− };
40− };
Documentation/devicetree/bindings/sound/wlf,wm8580.yaml+0−42
@@ -1,42 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8580.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8580 and WM8581 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− enum:
18− - wlf,wm8580
19− - wlf,wm8581
20−
21− reg:
22− maxItems: 1
23−
24− "#sound-dai-cells":
25− const: 0
26−
27−required:
28− - compatible
29− - reg
30−
31−unevaluatedProperties: false
32−
33−examples:
34− - |
35− i2c {
36− #address-cells = <1>;
37− #size-cells = <0>;
38− codec@1a {
39− compatible = "wlf,wm8580";
40− reg = <0x1a>;
41− };
42− };
Documentation/devicetree/bindings/sound/wlf,wm8711.yaml+0−40
@@ -1,40 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8711.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8711 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8711
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36− codec@1a {
37− compatible = "wlf,wm8711";
38− reg = <0x1a>;
39− };
40− };
Documentation/devicetree/bindings/sound/wlf,wm8728.yaml+0−40
@@ -1,40 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8728.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8728 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8728
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36− codec@1a {
37− compatible = "wlf,wm8728";
38− reg = <0x1a>;
39− };
40− };
Documentation/devicetree/bindings/sound/wlf,wm8737.yaml+0−40
@@ -1,40 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8737.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8737 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8737
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36− codec@1a {
37− compatible = "wlf,wm8737";
38− reg = <0x1a>;
39− };
40− };
Documentation/devicetree/bindings/sound/wlf,wm8750.yaml+0−42
@@ -1,42 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8750.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8750 and WM8987 audio CODECs
8−
9−description: |
10− These devices support both I2C and SPI (configured with pin strapping
11− on the board).
12−
13−maintainers:
14− - Mark Brown <broonie@kernel.org>
15−
16−properties:
17− compatible:
18− enum:
19− - wlf,wm8750
20− - wlf,wm8987
21−
22− reg:
23− description:
24− The I2C address of the device for I2C, the chip select number for SPI
25− maxItems: 1
26−
27−additionalProperties: false
28−
29−required:
30− - reg
31−
32−examples:
33− - |
34− i2c {
35− #address-cells = <1>;
36− #size-cells = <0>;
37−
38− codec@1a {
39− compatible = "wlf,wm8750";
40− reg = <0x1a>;
41− };
42− };
Documentation/devicetree/bindings/sound/wlf,wm8753.yaml+0−62
@@ -1,62 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8753.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8753 audio CODEC
8−
9−description: |
10− Pins on the device (for linking into audio routes):
11− * LOUT1
12− * LOUT2
13− * ROUT1
14− * ROUT2
15− * MONO1
16− * MONO2
17− * OUT3
18− * OUT4
19− * LINE1
20− * LINE2
21− * RXP
22− * RXN
23− * ACIN
24− * ACOP
25− * MIC1N
26− * MIC1
27− * MIC2N
28− * MIC2
29− * Mic Bias
30−
31−maintainers:
32− - patches@opensource.cirrus.com
33−
34−allOf:
35− - $ref: dai-common.yaml#
36−
37−properties:
38− compatible:
39− const: wlf,wm8753
40−
41− reg:
42− maxItems: 1
43−
44− "#sound-dai-cells":
45− const: 0
46−
47−required:
48− - compatible
49− - reg
50−
51−unevaluatedProperties: false
52−
53−examples:
54− - |
55− i2c {
56− #address-cells = <1>;
57− #size-cells = <0>;
58− codec@1a {
59− compatible = "wlf,wm8753";
60− reg = <0x1a>;
61− };
62− };
Documentation/devicetree/bindings/sound/wlf,wm8776.yaml+0−41
@@ -1,41 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8776.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8776 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8776
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36−
37− codec@1a {
38− compatible = "wlf,wm8776";
39− reg = <0x1a>;
40− };
41− };
Documentation/devicetree/bindings/sound/wlf,wm8961.yaml+0−43
@@ -1,43 +0,0 @@
1−# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8961.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: Wolfson WM8961 Ultra-Low Power Stereo CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8961
18−
19− reg:
20− maxItems: 1
21−
22− '#sound-dai-cells':
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28− - '#sound-dai-cells'
29−
30−unevaluatedProperties: false
31−
32−examples:
33− - |
34− i2c {
35− #address-cells = <1>;
36− #size-cells = <0>;
37−
38− wm8961: codec@4a {
39− compatible = "wlf,wm8961";
40− reg = <0x4a>;
41− #sound-dai-cells = <0>;
42− };
43− };
Documentation/devicetree/bindings/sound/wlf,wm8974.yaml+0−41
@@ -1,41 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2−%YAML 1.2
3−---
4−$id: http://devicetree.org/schemas/sound/wlf,wm8974.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
6−
7−title: WM8974 audio CODEC
8−
9−maintainers:
10− - patches@opensource.cirrus.com
11−
12−allOf:
13− - $ref: dai-common.yaml#
14−
15−properties:
16− compatible:
17− const: wlf,wm8974
18−
19− reg:
20− maxItems: 1
21−
22− "#sound-dai-cells":
23− const: 0
24−
25−required:
26− - compatible
27− - reg
28−
29−unevaluatedProperties: false
30−
31−examples:
32− - |
33− i2c {
34− #address-cells = <1>;
35− #size-cells = <0>;
36−
37− codec@1a {
38− compatible = "wlf,wm8974";
39− reg = <0x1a>;
40− };
41− };
Documentation/devicetree/bindings/sound/wm8770.txt+0−16
@@ -1,16 +0,0 @@
1−WM8770 audio CODEC
2−
3−This device supports SPI.
4−
5−Required properties:
6−
7− - compatible : "wlf,wm8770"
8−
9− - reg : the chip select number.
10−
11−Example:
12−
13−wm8770: codec@1 {
14− compatible = "wlf,wm8770";
15− reg = <1>;
16−};
MAINTAINERS+5−3
@@ -1758,6 +1758,7 @@ S: Supported · 1757 unmodified lines
17581758 W: http://wiki.analog.com/
17591759 W: https://ez.analog.com/linux-software-drivers
17601760 F: Documentation/devicetree/bindings/sound/adi,*
1761+F: Documentation/devicetree/bindings/sound/trivial-codec.yaml
17611762 F: sound/soc/codecs/ad1*
17621763 F: sound/soc/codecs/ad7*
17631764 F: sound/soc/codecs/adau*
@@ -2421,9 +2422,9 @@ M: Martin Povišer <povik+lin@cutebit.org> · 657 unmodified lines
24212422 L: asahi@lists.linux.dev
24222423 L: linux-sound@vger.kernel.org
24232424 S: Maintained
2424−F: Documentation/devicetree/bindings/sound/adi,ssm3515.yaml
2425−F: Documentation/devicetree/bindings/sound/cirrus,cs42l84.yaml
24262425 F: Documentation/devicetree/bindings/sound/apple,*
2426+F: Documentation/devicetree/bindings/sound/cirrus,cs42l84.yaml
2427+F: Documentation/devicetree/bindings/sound/trivial-codec.yaml
24272428 F: sound/soc/apple/*
24282429 F: sound/soc/codecs/cs42l83-i2c.c
24292430 F: sound/soc/codecs/cs42l84.*
@@ -18749,7 +18750,7 @@ NXP TFA9879 DRIVER · 16319 unmodified lines
1874918750 M: Peter Rosin <peda@axentia.se>
1875018751 L: linux-sound@vger.kernel.org
1875118752 S: Maintained
18752−F: Documentation/devicetree/bindings/sound/nxp,tfa9879.yaml
18753+F: Documentation/devicetree/bindings/sound/trivial-codec.yaml
1875318754 F: sound/soc/codecs/tfa9879*
1875418755
1875518756 NXP-NCI NFC DRIVER
@@ -27799,6 +27800,7 @@ F: Documentation/devicetree/bindings/extcon/wlf,arizona.yaml · 9043 unmodified lines
2779927800 F: Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
2780027801 F: Documentation/devicetree/bindings/mfd/wm831x.txt
2780127802 F: Documentation/devicetree/bindings/regulator/wlf,arizona.yaml
27803+F: Documentation/devicetree/bindings/sound/trivial-codec.yaml
2780227804 F: Documentation/devicetree/bindings/sound/wlf,*.yaml
2780327805 F: Documentation/devicetree/bindings/sound/wm*
2780427806 F: Documentation/hwmon/wm83??.rst
drivers/base/regmap/regmap-sdw-mbq.c+12−11
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515
1616 struct regmap_mbq_context {
1717 struct device *dev;
18+ struct sdw_slave *sdw;
1819
1920 struct regmap_sdw_mbq_cfg cfg;
2021
@@ -46,7 +47,7 @@ static bool regmap_sdw_mbq_deferrable(struct regmap_mbq_context *ctx, unsigned i · 25 unmodified lines
4647 static int regmap_sdw_mbq_poll_busy(struct sdw_slave *slave, unsigned int reg,
4748 struct regmap_mbq_context *ctx)
4849 {
49− struct device *dev = &slave->dev;
50+ struct device *dev = ctx->dev;
5051 int val, ret = 0;
5152
5253 dev_dbg(dev, "Deferring transaction for 0x%x\n", reg);
@@ -96,8 +97,7 @@ static int regmap_sdw_mbq_write_impl(struct sdw_slave *slave, · 43 unmodified lines
9697 static int regmap_sdw_mbq_write(void *context, unsigned int reg, unsigned int val)
9798 {
9899 struct regmap_mbq_context *ctx = context;
99− struct device *dev = ctx->dev;
100− struct sdw_slave *slave = dev_to_sdw_dev(dev);
100+ struct sdw_slave *slave = ctx->sdw;
101101 bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg);
102102 int mbq_size = regmap_sdw_mbq_size(ctx, reg);
103103 int ret;
@@ -156,8 +156,7 @@ static int regmap_sdw_mbq_read_impl(struct sdw_slave *slave, · 52 unmodified lines
156156 static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *val)
157157 {
158158 struct regmap_mbq_context *ctx = context;
159− struct device *dev = ctx->dev;
160− struct sdw_slave *slave = dev_to_sdw_dev(dev);
159+ struct sdw_slave *slave = ctx->sdw;
161160 bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg);
162161 int mbq_size = regmap_sdw_mbq_size(ctx, reg);
163162 int ret;
@@ -208,6 +207,7 @@ static int regmap_sdw_mbq_config_check(const struct regmap_config *config) · 44 unmodified lines
208207
209208 static struct regmap_mbq_context *
210209 regmap_sdw_mbq_gen_context(struct device *dev,
210+ struct sdw_slave *sdw,
211211 const struct regmap_config *config,
212212 const struct regmap_sdw_mbq_cfg *mbq_config)
213213 {
@@ -218,6 +218,7 @@ regmap_sdw_mbq_gen_context(struct device *dev, · 4 unmodified lines
218218 return ERR_PTR(-ENOMEM);
219219
220220 ctx->dev = dev;
221+ ctx->sdw = sdw;
221222
222223 if (mbq_config)
223224 ctx->cfg = *mbq_config;
@@ -228,7 +229,7 @@ regmap_sdw_mbq_gen_context(struct device *dev, · 4 unmodified lines
228229 return ctx;
229230 }
230231
231−struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw,
232+struct regmap *__regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw,
232233 const struct regmap_config *config,
233234 const struct regmap_sdw_mbq_cfg *mbq_config,
234235 struct lock_class_key *lock_key,
@@ -241,16 +242,16 @@ struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw, · 6 unmodified lines
241242 if (ret)
242243 return ERR_PTR(ret);
243244
244− ctx = regmap_sdw_mbq_gen_context(&sdw->dev, config, mbq_config);
245+ ctx = regmap_sdw_mbq_gen_context(dev, sdw, config, mbq_config);
245246 if (IS_ERR(ctx))
246247 return ERR_CAST(ctx);
247248
248− return __regmap_init(&sdw->dev, &regmap_sdw_mbq, ctx,
249+ return __regmap_init(dev, &regmap_sdw_mbq, ctx,
249250 config, lock_key, lock_name);
250251 }
251252 EXPORT_SYMBOL_GPL(__regmap_init_sdw_mbq);
252253
253−struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw,
254+struct regmap *__devm_regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw,
254255 const struct regmap_config *config,
255256 const struct regmap_sdw_mbq_cfg *mbq_config,
256257 struct lock_class_key *lock_key,
@@ -263,11 +264,11 @@ struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw, · 6 unmodified lines
263264 if (ret)
264265 return ERR_PTR(ret);
265266
266− ctx = regmap_sdw_mbq_gen_context(&sdw->dev, config, mbq_config);
267+ ctx = regmap_sdw_mbq_gen_context(dev, sdw, config, mbq_config);
267268 if (IS_ERR(ctx))
268269 return ERR_CAST(ctx);
269270
270− return __devm_regmap_init(&sdw->dev, &regmap_sdw_mbq, ctx,
271+ return __devm_regmap_init(dev, &regmap_sdw_mbq, ctx,
271272 config, lock_key, lock_name);
272273 }
273274 EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw_mbq);
drivers/firmware/cirrus/cs_dsp.c+72−103
@@ -9,9 +9,11 @@ · 8 unmodified lines
99 * Cirrus Logic International Semiconductor Ltd.
1010 */
1111
12+#include <linux/cleanup.h>
1213 #include <linux/ctype.h>
1314 #include <linux/debugfs.h>
1415 #include <linux/delay.h>
16+#include <linux/math.h>
1517 #include <linux/minmax.h>
1618 #include <linux/module.h>
1719 #include <linux/moduleparam.h>
@@ -316,44 +318,6 @@ struct cs_dsp_alg_region_list_item { · 298 unmodified lines
316318 struct cs_dsp_alg_region alg_region;
317319 };
318320
319−struct cs_dsp_buf {
320− struct list_head list;
321− void *buf;
322−};
323−
324−static struct cs_dsp_buf *cs_dsp_buf_alloc(const void *src, size_t len,
325− struct list_head *list)
326−{
327− struct cs_dsp_buf *buf = kzalloc(sizeof(*buf), GFP_KERNEL);
328−
329− if (buf == NULL)
330− return NULL;
331−
332− buf->buf = vmalloc(len);
333− if (!buf->buf) {
334− kfree(buf);
335− return NULL;
336− }
337− memcpy(buf->buf, src, len);
338−
339− if (list)
340− list_add_tail(&buf->list, list);
341−
342− return buf;
343−}
344−
345−static void cs_dsp_buf_free(struct list_head *list)
346−{
347− while (!list_empty(list)) {
348− struct cs_dsp_buf *buf = list_first_entry(list,
349− struct cs_dsp_buf,
350− list);
351− list_del(&buf->list);
352− vfree(buf->buf);
353− kfree(buf);
354− }
355−}
356−
357321 /**
358322 * cs_dsp_mem_region_name() - Return a name string for a memory type
359323 * @type: the memory type to match
@@ -388,18 +352,14 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_mem_region_name, "FW_CS_DSP"); · 28 unmodified lines
388352 #ifdef CONFIG_DEBUG_FS
389353 static void cs_dsp_debugfs_save_wmfwname(struct cs_dsp *dsp, const char *s)
390354 {
391− char *tmp = kasprintf(GFP_KERNEL, "%s\n", s);
392−
393355 kfree(dsp->wmfw_file_name);
394− dsp->wmfw_file_name = tmp;
356+ dsp->wmfw_file_name = kstrdup(s, GFP_KERNEL);
395357 }
396358
397359 static void cs_dsp_debugfs_save_binname(struct cs_dsp *dsp, const char *s)
398360 {
399− char *tmp = kasprintf(GFP_KERNEL, "%s\n", s);
400−
401361 kfree(dsp->bin_file_name);
402− dsp->bin_file_name = tmp;
362+ dsp->bin_file_name = kstrdup(s, GFP_KERNEL);
403363 }
404364
405365 static void cs_dsp_debugfs_clear(struct cs_dsp *dsp)
@@ -410,24 +370,33 @@ static void cs_dsp_debugfs_clear(struct cs_dsp *dsp) · 4 unmodified lines
410370 dsp->bin_file_name = NULL;
411371 }
412372
373+static ssize_t cs_dsp_debugfs_string_read(struct cs_dsp *dsp,
374+ char __user *user_buf,
375+ size_t count, loff_t *ppos,
376+ const char **pstr)
377+{
378+ const char *str __free(kfree) = NULL;
379+
380+ scoped_guard(mutex, &dsp->pwr_lock) {
381+ if (!*pstr)
382+ return 0;
383+
384+ str = kasprintf(GFP_KERNEL, "%s\n", *pstr);
385+ if (!str)
386+ return -ENOMEM;
387+
388+ return simple_read_from_buffer(user_buf, count, ppos, str, strlen(str));
389+ }
390+}
391+
413392 static ssize_t cs_dsp_debugfs_wmfw_read(struct file *file,
414393 char __user *user_buf,
415394 size_t count, loff_t *ppos)
416395 {
417396 struct cs_dsp *dsp = file->private_data;
418− ssize_t ret;
419−
420− mutex_lock(&dsp->pwr_lock);
421397
422− if (!dsp->wmfw_file_name || !dsp->booted)
423− ret = 0;
424− else
425− ret = simple_read_from_buffer(user_buf, count, ppos,
426− dsp->wmfw_file_name,
427− strlen(dsp->wmfw_file_name));
428−
429− mutex_unlock(&dsp->pwr_lock);
430− return ret;
398+ return cs_dsp_debugfs_string_read(dsp, user_buf, count, ppos,
399+ &dsp->wmfw_file_name);
431400 }
432401
433402 static ssize_t cs_dsp_debugfs_bin_read(struct file *file,
@@ -435,19 +404,9 @@ static ssize_t cs_dsp_debugfs_bin_read(struct file *file, · 1 unmodified line
435404 size_t count, loff_t *ppos)
436405 {
437406 struct cs_dsp *dsp = file->private_data;
438− ssize_t ret;
439−
440− mutex_lock(&dsp->pwr_lock);
441407
442− if (!dsp->bin_file_name || !dsp->booted)
443− ret = 0;
444− else
445− ret = simple_read_from_buffer(user_buf, count, ppos,
446− dsp->bin_file_name,
447− strlen(dsp->bin_file_name));
448−
449− mutex_unlock(&dsp->pwr_lock);
450− return ret;
408+ return cs_dsp_debugfs_string_read(dsp, user_buf, count, ppos,
409+ &dsp->bin_file_name);
451410 }
452411
453412 static const struct {
@@ -479,9 +438,11 @@ static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored) · 25 unmodified lines
479438 struct cs_dsp_coeff_ctl *ctl;
480439 unsigned int reg;
481440
441+ guard(mutex)(&dsp->pwr_lock);
442+
482443 list_for_each_entry(ctl, &dsp->ctl_list, list) {
483444 cs_dsp_coeff_base_reg(ctl, &reg, 0);
484− seq_printf(s, "%22.*s: %#8zx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n",
445+ seq_printf(s, "%22.*s: %#8x %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n",
485446 ctl->subname_len, ctl->subname, ctl->len,
486447 cs_dsp_mem_region_name(ctl->alg_region.type),
487448 ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type,
@@ -1028,7 +989,7 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp, · 540 unmodified lines
1028989
1029990 static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl)
1030991 {
1031− kfree(ctl->cache);
992+ kvfree(ctl->cache);
1032993 kfree(ctl->subname);
1033994 kfree(ctl);
1034995 }
@@ -1078,7 +1039,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, · 43 unmodified lines
10781039 ctl->type = type;
10791040 ctl->offset = offset;
10801041 ctl->len = len;
1081− ctl->cache = kzalloc(ctl->len, GFP_KERNEL);
1042+ ctl->cache = kvzalloc(ctl->len, GFP_KERNEL);
10821043 if (!ctl->cache) {
10831044 ret = -ENOMEM;
10841045 goto err_ctl_subname;
@@ -1096,7 +1057,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, · 11 unmodified lines
10961057
10971058 err_list_del:
10981059 list_del(&ctl->list);
1099− kfree(ctl->cache);
1060+ kvfree(ctl->cache);
11001061 err_ctl_subname:
11011062 kfree(ctl->subname);
11021063 err_ctl:
@@ -1485,7 +1446,9 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 382 unmodified lines
14851446 const struct wmfw_region *region;
14861447 const struct cs_dsp_region *mem;
14871448 const char *region_name;
1488− struct cs_dsp_buf *buf;
1449+ u8 *buf __free(kfree) = NULL;
1450+ size_t buf_len = 0;
1451+ size_t region_len;
14891452 unsigned int reg;
14901453 int regions = 0;
14911454 int ret, offset, type;
@@ -1605,23 +1568,23 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 113 unmodified lines
16051568 region_name);
16061569
16071570 if (reg) {
1608− buf = cs_dsp_buf_alloc(region->data,
1609− le32_to_cpu(region->len),
1610− &buf_list);
1611− if (!buf) {
1612− cs_dsp_err(dsp, "Out of memory\n");
1613− ret = -ENOMEM;
1614− goto out_fw;
1571+ region_len = le32_to_cpu(region->len);
1572+ if (region_len > buf_len) {
1573+ buf_len = round_up(region_len, PAGE_SIZE);
1574+ kfree(buf);
1575+ buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA);
1576+ if (!buf) {
1577+ ret = -ENOMEM;
1578+ goto out_fw;
1579+ }
16151580 }
16161581
1617− ret = regmap_raw_write(regmap, reg, buf->buf,
1618− le32_to_cpu(region->len));
1582+ memcpy(buf, region->data, region_len);
1583+ ret = regmap_raw_write(regmap, reg, buf, region_len);
16191584 if (ret != 0) {
16201585 cs_dsp_err(dsp,
1621− "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
1622− file, regions,
1623− le32_to_cpu(region->len), offset,
1624− region_name, ret);
1586+ "%s.%d: Failed to write %zu bytes at %d in %s: %d\n",
1587+ file, regions, region_len, offset, region_name, ret);
16251588 goto out_fw;
16261589 }
16271590 }
@@ -1638,8 +1601,6 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 10 unmodified lines
16381601
16391602 ret = 0;
16401603 out_fw:
1641− cs_dsp_buf_free(&buf_list);
1642−
16431604 if (ret == -EOVERFLOW)
16441605 cs_dsp_err(dsp, "%s: file content overflows file data\n", file);
16451606
@@ -2171,7 +2132,9 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 525 unmodified lines
21712132 struct cs_dsp_alg_region *alg_region;
21722133 const char *region_name;
21732134 int ret, pos, blocks, type, offset, reg, version;
2174− struct cs_dsp_buf *buf;
2135+ u8 *buf __free(kfree) = NULL;
2136+ size_t buf_len = 0;
2137+ size_t region_len;
21752138
21762139 if (!firmware)
21772140 return 0;
@@ -2313,20 +2276,22 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 135 unmodified lines
23132276 }
23142277
23152278 if (reg) {
2316− buf = cs_dsp_buf_alloc(blk->data,
2317− le32_to_cpu(blk->len),
2318− &buf_list);
2319− if (!buf) {
2320− cs_dsp_err(dsp, "Out of memory\n");
2321− ret = -ENOMEM;
2322− goto out_fw;
2279+ region_len = le32_to_cpu(blk->len);
2280+ if (region_len > buf_len) {
2281+ buf_len = round_up(region_len, PAGE_SIZE);
2282+ kfree(buf);
2283+ buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA);
2284+ if (!buf) {
2285+ ret = -ENOMEM;
2286+ goto out_fw;
2287+ }
23232288 }
23242289
2325− cs_dsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
2326− file, blocks, le32_to_cpu(blk->len),
2327− reg);
2328− ret = regmap_raw_write(regmap, reg, buf->buf,
2329− le32_to_cpu(blk->len));
2290+ memcpy(buf, blk->data, region_len);
2291+
2292+ cs_dsp_dbg(dsp, "%s.%d: Writing %zu bytes at %x\n",
2293+ file, blocks, region_len, reg);
2294+ ret = regmap_raw_write(regmap, reg, buf, region_len);
23302295 if (ret != 0) {
23312296 cs_dsp_err(dsp,
23322297 "%s.%d: Failed to write to %x in %s: %d\n",
@@ -2346,8 +2311,6 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 13 unmodified lines
23462311
23472312 ret = 0;
23482313 out_fw:
2349− cs_dsp_buf_free(&buf_list);
2350−
23512314 if (ret == -EOVERFLOW)
23522315 cs_dsp_err(dsp, "%s: file content overflows file data\n", file);
23532316
@@ -2366,6 +2329,9 @@ static int cs_dsp_create_name(struct cs_dsp *dsp) · 12 unmodified lines
23662329 return 0;
23672330 }
23682331
2332+static const struct cs_dsp_client_ops cs_dsp_default_client_ops = {
2333+};
2334+
23692335 static int cs_dsp_common_init(struct cs_dsp *dsp)
23702336 {
23712337 int ret;
@@ -2379,6 +2345,9 @@ static int cs_dsp_common_init(struct cs_dsp *dsp) · 7 unmodified lines
23792345
23802346 mutex_init(&dsp->pwr_lock);
23812347
2348+ if (!dsp->client_ops)
2349+ dsp->client_ops = &cs_dsp_default_client_ops;
2350+
23822351 #ifdef CONFIG_DEBUG_FS
23832352 /* Ensure this is invalid if client never provides a debugfs root */
23842353 dsp->debugfs_root = ERR_PTR(-ENODEV);
drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c+1−0
@@ -600,6 +600,7 @@ KUNIT_ARRAY_PARAM(cs_dsp_callbacks_ops, · 599 unmodified lines
600600
601601 static const struct cs_dsp_callbacks_test_param cs_dsp_no_callbacks_cases[] = {
602602 { .ops = &cs_dsp_callback_test_empty_client_ops, .case_name = "empty ops" },
603+ { .ops = NULL, .case_name = "NULL ops" },
603604 };
604605
605606 KUNIT_ARRAY_PARAM(cs_dsp_no_callbacks,
drivers/gpio/Kconfig+17−0
@@ -6,6 +6,9 @@ · 5 unmodified lines
66 config GPIOLIB_LEGACY
77 def_bool y
88
9+config HAVE_SHARED_GPIOS
10+ bool
11+
912 menuconfig GPIOLIB
1013 bool "GPIO Support"
1114 help
@@ -50,6 +53,11 @@ config OF_GPIO_MM_GPIOCHIP · 38 unmodified lines
5053 this symbol, but new drivers should use the generic gpio-regmap
5154 infrastructure instead.
5255
56+config GPIO_SHARED
57+ def_bool y
58+ depends on HAVE_SHARED_GPIOS || COMPILE_TEST
59+ select AUXILIARY_BUS
60+
5361 config DEBUG_GPIO
5462 bool "Debug GPIO calls"
5563 depends on DEBUG_KERNEL
@@ -2017,6 +2025,15 @@ config GPIO_SIM · 1961 unmodified lines
20172025 This enables the GPIO simulator - a configfs-based GPIO testing
20182026 driver.
20192027
2028+config GPIO_SHARED_PROXY
2029+ tristate "Proxy driver for non-exclusive GPIOs"
2030+ default m
2031+ depends on GPIO_SHARED || COMPILE_TEST
2032+ select AUXILIARY_BUS
2033+ help
2034+ This enables the GPIO shared proxy driver - an abstraction layer
2035+ for GPIO pins that are shared by multiple devices.
2036+
20202037 endmenu
20212038
20222039 menu "GPIO Debugging utilities"
drivers/gpio/Makefile+2−0
@@ -12,6 +12,7 @@ obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o · 11 unmodified lines
1212 obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o
1313 gpiolib-acpi-y := gpiolib-acpi-core.o gpiolib-acpi-quirks.o
1414 obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o
15+obj-$(CONFIG_GPIO_SHARED) += gpiolib-shared.o
1516
1617 # Device drivers. Generally keep list sorted alphabetically
1718 obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o
@@ -159,6 +160,7 @@ obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o · 141 unmodified lines
159160 obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o
160161 obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o
161162 obj-$(CONFIG_GPIO_SCH) += gpio-sch.o
163+obj-$(CONFIG_GPIO_SHARED_PROXY) += gpio-shared-proxy.o
162164 obj-$(CONFIG_GPIO_SIFIVE) += gpio-sifive.o
163165 obj-$(CONFIG_GPIO_SIM) += gpio-sim.o
164166 obj-$(CONFIG_GPIO_SIOX) += gpio-siox.o
drivers/gpio/gpio-shared-proxy.c+333−0
@@ -0,0 +1,333 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Copyright (C) 2025 Linaro Ltd.
4+ */
5+
6+#include <linux/auxiliary_bus.h>
7+#include <linux/cleanup.h>
8+#include <linux/device.h>
9+#include <linux/err.h>
10+#include <linux/gpio/consumer.h>
11+#include <linux/gpio/driver.h>
12+#include <linux/mod_devicetable.h>
13+#include <linux/module.h>
14+#include <linux/string_choices.h>
15+#include <linux/types.h>
16+
17+#include "gpiolib-shared.h"
18+
19+struct gpio_shared_proxy_data {
20+ struct gpio_chip gc;
21+ struct gpio_shared_desc *shared_desc;
22+ struct device *dev;
23+ bool voted_high;
24+};
25+
26+static int
27+gpio_shared_proxy_set_unlocked(struct gpio_shared_proxy_data *proxy,
28+ int (*set_func)(struct gpio_desc *desc, int value),
29+ int value)
30+{
31+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
32+ struct gpio_desc *desc = shared_desc->desc;
33+ int ret = 0;
34+
35+ gpio_shared_lockdep_assert(shared_desc);
36+
37+ if (value) {
38+ /* User wants to set value to high. */
39+ if (proxy->voted_high)
40+ /* Already voted for high, nothing to do. */
41+ goto out;
42+
43+ /* Haven't voted for high yet. */
44+ if (!shared_desc->highcnt) {
45+ /*
46+ * Current value is low, need to actually set value
47+ * to high.
48+ */
49+ ret = set_func(desc, 1);
50+ if (ret)
51+ goto out;
52+ }
53+
54+ shared_desc->highcnt++;
55+ proxy->voted_high = true;
56+
57+ goto out;
58+ }
59+
60+ /* Desired value is low. */
61+ if (!proxy->voted_high)
62+ /* We didn't vote for high, nothing to do. */
63+ goto out;
64+
65+ /* We previously voted for high. */
66+ if (shared_desc->highcnt == 1) {
67+ /* This is the last remaining vote for high, set value to low. */
68+ ret = set_func(desc, 0);
69+ if (ret)
70+ goto out;
71+ }
72+
73+ shared_desc->highcnt--;
74+ proxy->voted_high = false;
75+
76+out:
77+ if (shared_desc->highcnt)
78+ dev_dbg(proxy->dev,
79+ "Voted for value '%s', effective value is 'high', number of votes for 'high': %u\n",
80+ str_high_low(value), shared_desc->highcnt);
81+ else
82+ dev_dbg(proxy->dev, "Voted for value 'low', effective value is 'low'\n");
83+
84+ return ret;
85+}
86+
87+static int gpio_shared_proxy_request(struct gpio_chip *gc, unsigned int offset)
88+{
89+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
90+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
91+
92+ guard(gpio_shared_desc_lock)(shared_desc);
93+
94+ proxy->shared_desc->usecnt++;
95+
96+ dev_dbg(proxy->dev, "Shared GPIO requested, number of users: %u\n",
97+ proxy->shared_desc->usecnt);
98+
99+ return 0;
100+}
101+
102+static void gpio_shared_proxy_free(struct gpio_chip *gc, unsigned int offset)
103+{
104+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
105+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
106+
107+ guard(gpio_shared_desc_lock)(shared_desc);
108+
109+ proxy->shared_desc->usecnt--;
110+
111+ dev_dbg(proxy->dev, "Shared GPIO freed, number of users: %u\n",
112+ proxy->shared_desc->usecnt);
113+}
114+
115+static int gpio_shared_proxy_set_config(struct gpio_chip *gc,
116+ unsigned int offset, unsigned long cfg)
117+{
118+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
119+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
120+ struct gpio_desc *desc = shared_desc->desc;
121+ int ret;
122+
123+ guard(gpio_shared_desc_lock)(shared_desc);
124+
125+ if (shared_desc->usecnt > 1) {
126+ if (shared_desc->cfg != cfg) {
127+ dev_dbg(proxy->dev,
128+ "Shared GPIO's configuration already set, accepting changes but users may conflict!!\n");
129+ } else {
130+ dev_dbg(proxy->dev, "Equal config requested, nothing to do\n");
131+ return 0;
132+ }
133+ }
134+
135+ ret = gpiod_set_config(desc, cfg);
136+ if (ret && ret != -ENOTSUPP)
137+ return ret;
138+
139+ shared_desc->cfg = cfg;
140+ return 0;
141+}
142+
143+static int gpio_shared_proxy_direction_input(struct gpio_chip *gc,
144+ unsigned int offset)
145+{
146+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
147+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
148+ struct gpio_desc *desc = shared_desc->desc;
149+ int dir;
150+
151+ guard(gpio_shared_desc_lock)(shared_desc);
152+
153+ if (shared_desc->usecnt == 1) {
154+ dev_dbg(proxy->dev,
155+ "Only one user of this shared GPIO, allowing to set direction to input\n");
156+
157+ return gpiod_direction_input(desc);
158+ }
159+
160+ dir = gpiod_get_direction(desc);
161+ if (dir < 0)
162+ return dir;
163+
164+ if (dir == GPIO_LINE_DIRECTION_OUT) {
165+ dev_dbg(proxy->dev,
166+ "Shared GPIO's direction already set to output, refusing to change\n");
167+ return -EPERM;
168+ }
169+
170+ return 0;
171+}
172+
173+static int gpio_shared_proxy_direction_output(struct gpio_chip *gc,
174+ unsigned int offset, int value)
175+{
176+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
177+ struct gpio_shared_desc *shared_desc = proxy->shared_desc;
178+ struct gpio_desc *desc = shared_desc->desc;
179+ int ret, dir;
180+
181+ guard(gpio_shared_desc_lock)(shared_desc);
182+
183+ if (shared_desc->usecnt == 1) {
184+ dev_dbg(proxy->dev,
185+ "Only one user of this shared GPIO, allowing to set direction to output with value '%s'\n",
186+ str_high_low(value));
187+
188+ ret = gpiod_direction_output(desc, value);
189+ if (ret)
190+ return ret;
191+
192+ if (value) {
193+ proxy->voted_high = true;
194+ shared_desc->highcnt = 1;
195+ } else {
196+ proxy->voted_high = false;
197+ shared_desc->highcnt = 0;
198+ }
199+
200+ return 0;
201+ }
202+
203+ dir = gpiod_get_direction(desc);
204+ if (dir < 0)
205+ return dir;
206+
207+ if (dir == GPIO_LINE_DIRECTION_IN) {
208+ dev_dbg(proxy->dev,
209+ "Shared GPIO's direction already set to input, refusing to change\n");
210+ return -EPERM;
211+ }
212+
213+ return gpio_shared_proxy_set_unlocked(proxy, gpiod_direction_output, value);
214+}
215+
216+static int gpio_shared_proxy_get(struct gpio_chip *gc, unsigned int offset)
217+{
218+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
219+
220+ return gpiod_get_value(proxy->shared_desc->desc);
221+}
222+
223+static int gpio_shared_proxy_get_cansleep(struct gpio_chip *gc,
224+ unsigned int offset)
225+{
226+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
227+
228+ return gpiod_get_value_cansleep(proxy->shared_desc->desc);
229+}
230+
231+static int gpio_shared_proxy_do_set(struct gpio_shared_proxy_data *proxy,
232+ int (*set_func)(struct gpio_desc *desc, int value),
233+ int value)
234+{
235+ guard(gpio_shared_desc_lock)(proxy->shared_desc);
236+
237+ return gpio_shared_proxy_set_unlocked(proxy, set_func, value);
238+}
239+
240+static int gpio_shared_proxy_set(struct gpio_chip *gc, unsigned int offset,
241+ int value)
242+{
243+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
244+
245+ return gpio_shared_proxy_do_set(proxy, gpiod_set_value, value);
246+}
247+
248+static int gpio_shared_proxy_set_cansleep(struct gpio_chip *gc,
249+ unsigned int offset, int value)
250+{
251+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
252+
253+ return gpio_shared_proxy_do_set(proxy, gpiod_set_value_cansleep, value);
254+}
255+
256+static int gpio_shared_proxy_get_direction(struct gpio_chip *gc,
257+ unsigned int offset)
258+{
259+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
260+
261+ return gpiod_get_direction(proxy->shared_desc->desc);
262+}
263+
264+static int gpio_shared_proxy_to_irq(struct gpio_chip *gc, unsigned int offset)
265+{
266+ struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc);
267+
268+ return gpiod_to_irq(proxy->shared_desc->desc);
269+}
270+
271+static int gpio_shared_proxy_probe(struct auxiliary_device *adev,
272+ const struct auxiliary_device_id *id)
273+{
274+ struct gpio_shared_proxy_data *proxy;
275+ struct gpio_shared_desc *shared_desc;
276+ struct device *dev = &adev->dev;
277+ struct gpio_chip *gc;
278+
279+ shared_desc = devm_gpiod_shared_get(dev);
280+ if (IS_ERR(shared_desc))
281+ return PTR_ERR(shared_desc);
282+
283+ proxy = devm_kzalloc(dev, sizeof(*proxy), GFP_KERNEL);
284+ if (!proxy)
285+ return -ENOMEM;
286+
287+ proxy->shared_desc = shared_desc;
288+ proxy->dev = dev;
289+
290+ gc = &proxy->gc;
291+ gc->base = -1;
292+ gc->ngpio = 1;
293+ gc->label = dev_name(dev);
294+ gc->parent = dev;
295+ gc->owner = THIS_MODULE;
296+ gc->can_sleep = shared_desc->can_sleep;
297+
298+ gc->request = gpio_shared_proxy_request;
299+ gc->free = gpio_shared_proxy_free;
300+ gc->set_config = gpio_shared_proxy_set_config;
301+ gc->direction_input = gpio_shared_proxy_direction_input;
302+ gc->direction_output = gpio_shared_proxy_direction_output;
303+ if (gc->can_sleep) {
304+ gc->set = gpio_shared_proxy_set_cansleep;
305+ gc->get = gpio_shared_proxy_get_cansleep;
306+ } else {
307+ gc->set = gpio_shared_proxy_set;
308+ gc->get = gpio_shared_proxy_get;
309+ }
310+ gc->get_direction = gpio_shared_proxy_get_direction;
311+ gc->to_irq = gpio_shared_proxy_to_irq;
312+
313+ return devm_gpiochip_add_data(dev, &proxy->gc, proxy);
314+}
315+
316+static const struct auxiliary_device_id gpio_shared_proxy_id_table[] = {
317+ { .name = "gpiolib_shared.proxy" },
318+ {},
319+};
320+MODULE_DEVICE_TABLE(auxiliary, gpio_shared_proxy_id_table);
321+
322+static struct auxiliary_driver gpio_shared_proxy_driver = {
323+ .driver = {
324+ .name = "gpio-shared-proxy",
325+ },
326+ .probe = gpio_shared_proxy_probe,
327+ .id_table = gpio_shared_proxy_id_table,
328+};
329+module_auxiliary_driver(gpio_shared_proxy_driver);
330+
331+MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
332+MODULE_DESCRIPTION("Shared GPIO mux driver.");
333+MODULE_LICENSE("GPL");
drivers/gpio/gpiolib-shared.c+558−0
@@ -0,0 +1,558 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Copyright (C) 2025 Linaro Ltd.
4+ */
5+
6+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7+
8+#include <linux/auxiliary_bus.h>
9+#include <linux/cleanup.h>
10+#include <linux/device.h>
11+#include <linux/fwnode.h>
12+#include <linux/gpio/consumer.h>
13+#include <linux/gpio/machine.h>
14+#include <linux/idr.h>
15+#include <linux/kref.h>
16+#include <linux/list.h>
17+#include <linux/lockdep.h>
18+#include <linux/module.h>
19+#include <linux/mutex.h>
20+#include <linux/of.h>
21+#include <linux/overflow.h>
22+#include <linux/printk.h>
23+#include <linux/property.h>
24+#include <linux/slab.h>
25+#include <linux/string.h>
26+
27+#include "gpiolib.h"
28+#include "gpiolib-shared.h"
29+
30+/* Represents a single reference to a GPIO pin. */
31+struct gpio_shared_ref {
32+ struct list_head list;
33+ /* Firmware node associated with this GPIO's consumer. */
34+ struct fwnode_handle *fwnode;
35+ /* GPIO flags this consumer uses for the request. */
36+ enum gpiod_flags flags;
37+ char *con_id;
38+ int dev_id;
39+ struct auxiliary_device adev;
40+ struct gpiod_lookup_table *lookup;
41+};
42+
43+/* Represents a single GPIO pin. */
44+struct gpio_shared_entry {
45+ struct list_head list;
46+ /* Firmware node associated with the GPIO controller. */
47+ struct fwnode_handle *fwnode;
48+ /* Hardware offset of the GPIO within its chip. */
49+ unsigned int offset;
50+ /* Index in the property value array. */
51+ size_t index;
52+ struct gpio_shared_desc *shared_desc;
53+ struct kref ref;
54+ struct list_head refs;
55+};
56+
57+static LIST_HEAD(gpio_shared_list);
58+static DEFINE_MUTEX(gpio_shared_lock);
59+static DEFINE_IDA(gpio_shared_ida);
60+
61+static struct gpio_shared_entry *
62+gpio_shared_find_entry(struct fwnode_handle *controller_node,
63+ unsigned int offset)
64+{
65+ struct gpio_shared_entry *entry;
66+
67+ list_for_each_entry(entry, &gpio_shared_list, list) {
68+ if (entry->fwnode == controller_node && entry->offset == offset)
69+ return entry;
70+ }
71+
72+ return NULL;
73+}
74+
75+#if IS_ENABLED(CONFIG_OF)
76+static int gpio_shared_of_traverse(struct device_node *curr)
77+{
78+ struct gpio_shared_entry *entry;
79+ size_t con_id_len, suffix_len;
80+ struct fwnode_handle *fwnode;
81+ struct of_phandle_args args;
82+ struct property *prop;
83+ unsigned int offset;
84+ const char *suffix;
85+ int ret, count, i;
86+
87+ for_each_property_of_node(curr, prop) {
88+ /*
89+ * The standard name for a GPIO property is "foo-gpios"
90+ * or "foo-gpio". Some bindings also use "gpios" or "gpio".
91+ * There are some legacy device-trees which have a different
92+ * naming convention and for which we have rename quirks in
93+ * place in gpiolib-of.c. I don't think any of them require
94+ * support for shared GPIOs so for now let's just ignore
95+ * them. We can always just export the quirk list and
96+ * iterate over it here.
97+ */
98+ if (!strends(prop->name, "-gpios") &&
99+ !strends(prop->name, "-gpio") &&
100+ strcmp(prop->name, "gpios") != 0 &&
101+ strcmp(prop->name, "gpio") != 0)
102+ continue;
103+
104+ count = of_count_phandle_with_args(curr, prop->name,
105+ "#gpio-cells");
106+ if (count <= 0)
107+ continue;
108+
109+ for (i = 0; i < count; i++) {
110+ struct device_node *np __free(device_node) = NULL;
111+
112+ ret = of_parse_phandle_with_args(curr, prop->name,
113+ "#gpio-cells", i,
114+ &args);
115+ if (ret)
116+ continue;
117+
118+ np = args.np;
119+
120+ if (!of_property_present(np, "gpio-controller"))
121+ continue;
122+
123+ /*
124+ * We support 1, 2 and 3 cell GPIO bindings in the
125+ * kernel currently. There's only one old MIPS dts that
126+ * has a one-cell binding but there's no associated
127+ * consumer so it may as well be an error. There don't
128+ * seem to be any 3-cell users of non-exclusive GPIOs,
129+ * so we can skip this as well. Let's occupy ourselves
130+ * with the predominant 2-cell binding with the first
131+ * cell indicating the hardware offset of the GPIO and
132+ * the second defining the GPIO flags of the request.
133+ */
134+ if (args.args_count != 2)
135+ continue;
136+
137+ fwnode = of_fwnode_handle(args.np);
138+ offset = args.args[0];
139+
140+ entry = gpio_shared_find_entry(fwnode, offset);
141+ if (!entry) {
142+ entry = kzalloc(sizeof(*entry), GFP_KERNEL);
143+ if (!entry)
144+ return -ENOMEM;
145+
146+ entry->fwnode = fwnode_handle_get(fwnode);
147+ entry->offset = offset;
148+ entry->index = count;
149+ INIT_LIST_HEAD(&entry->refs);
150+
151+ list_add_tail(&entry->list, &gpio_shared_list);
152+ }
153+
154+ struct gpio_shared_ref *ref __free(kfree) =
155+ kzalloc(sizeof(*ref), GFP_KERNEL);
156+ if (!ref)
157+ return -ENOMEM;
158+
159+ ref->fwnode = fwnode_handle_get(of_fwnode_handle(curr));
160+ ref->flags = args.args[1];
161+
162+ if (strends(prop->name, "gpios"))
163+ suffix = "-gpios";
164+ else if (strends(prop->name, "gpio"))
165+ suffix = "-gpio";
166+ else
167+ suffix = NULL;
168+ if (!suffix)
169+ continue;
170+
171+ /* We only set con_id if there's actually one. */
172+ if (strcmp(prop->name, "gpios") && strcmp(prop->name, "gpio")) {
173+ ref->con_id = kstrdup(prop->name, GFP_KERNEL);
174+ if (!ref->con_id)
175+ return -ENOMEM;
176+
177+ con_id_len = strlen(ref->con_id);
178+ suffix_len = strlen(suffix);
179+
180+ ref->con_id[con_id_len - suffix_len] = '\0';
181+ }
182+
183+ ref->dev_id = ida_alloc(&gpio_shared_ida, GFP_KERNEL);
184+ if (ref->dev_id < 0) {
185+ kfree(ref->con_id);
186+ return -ENOMEM;
187+ }
188+
189+ if (!list_empty(&entry->refs))
190+ pr_debug("GPIO %u at %s is shared by multiple firmware nodes\n",
191+ entry->offset, fwnode_get_name(entry->fwnode));
192+
193+ list_add_tail(&no_free_ptr(ref)->list, &entry->refs);
194+ }
195+ }
196+
197+ for_each_child_of_node_scoped(curr, child) {
198+ ret = gpio_shared_of_traverse(child);
199+ if (ret)
200+ return ret;
201+ }
202+
203+ return 0;
204+}
205+
206+static int gpio_shared_of_scan(void)
207+{
208+ return gpio_shared_of_traverse(of_root);
209+}
210+#else
211+static int gpio_shared_of_scan(void)
212+{
213+ return 0;
214+}
215+#endif /* CONFIG_OF */
216+
217+static void gpio_shared_adev_release(struct device *dev)
218+{
219+
220+}
221+
222+static int gpio_shared_make_adev(struct gpio_device *gdev,
223+ struct gpio_shared_ref *ref)
224+{
225+ struct auxiliary_device *adev = &ref->adev;
226+ int ret;
227+
228+ lockdep_assert_held(&gpio_shared_lock);
229+
230+ memset(adev, 0, sizeof(*adev));
231+
232+ adev->id = ref->dev_id;
233+ adev->name = "proxy";
234+ adev->dev.parent = gdev->dev.parent;
235+ adev->dev.release = gpio_shared_adev_release;
236+
237+ ret = auxiliary_device_init(adev);
238+ if (ret)
239+ return ret;
240+
241+ ret = auxiliary_device_add(adev);
242+ if (ret) {
243+ auxiliary_device_uninit(adev);
244+ return ret;
245+ }
246+
247+ pr_debug("Created an auxiliary GPIO proxy %s for GPIO device %s\n",
248+ dev_name(&adev->dev), gpio_device_get_label(gdev));
249+
250+ return 0;
251+}
252+
253+int gpio_shared_add_proxy_lookup(struct device *consumer, unsigned long lflags)
254+{
255+ const char *dev_id = dev_name(consumer);
256+ struct gpio_shared_entry *entry;
257+ struct gpio_shared_ref *ref;
258+
259+ struct gpiod_lookup_table *lookup __free(kfree) =
260+ kzalloc(struct_size(lookup, table, 2), GFP_KERNEL);
261+ if (!lookup)
262+ return -ENOMEM;
263+
264+ guard(mutex)(&gpio_shared_lock);
265+
266+ list_for_each_entry(entry, &gpio_shared_list, list) {
267+ list_for_each_entry(ref, &entry->refs, list) {
268+ if (!device_match_fwnode(consumer, ref->fwnode))
269+ continue;
270+
271+ /* We've already done that on a previous request. */
272+ if (ref->lookup)
273+ return 0;
274+
275+ char *key __free(kfree) =
276+ kasprintf(GFP_KERNEL,
277+ KBUILD_MODNAME ".proxy.%u",
278+ ref->adev.id);
279+ if (!key)
280+ return -ENOMEM;
281+
282+ pr_debug("Adding machine lookup entry for a shared GPIO for consumer %s, with key '%s' and con_id '%s'\n",
283+ dev_id, key, ref->con_id ?: "none");
284+
285+ lookup->dev_id = dev_id;
286+ lookup->table[0] = GPIO_LOOKUP(no_free_ptr(key), 0,
287+ ref->con_id, lflags);
288+
289+ gpiod_add_lookup_table(no_free_ptr(lookup));
290+
291+ return 0;
292+ }
293+ }
294+
295+ /* We warn here because this can only happen if the programmer borked. */
296+ WARN_ON(1);
297+ return -ENOENT;
298+}
299+
300+static void gpio_shared_remove_adev(struct auxiliary_device *adev)
301+{
302+ lockdep_assert_held(&gpio_shared_lock);
303+
304+ auxiliary_device_uninit(adev);
305+ auxiliary_device_delete(adev);
306+}
307+
308+int gpio_device_setup_shared(struct gpio_device *gdev)
309+{
310+ struct gpio_shared_entry *entry;
311+ struct gpio_shared_ref *ref;
312+ unsigned long *flags;
313+ int ret;
314+
315+ guard(mutex)(&gpio_shared_lock);
316+
317+ list_for_each_entry(entry, &gpio_shared_list, list) {
318+ list_for_each_entry(ref, &entry->refs, list) {
319+ if (gdev->dev.parent == &ref->adev.dev) {
320+ /*
321+ * This is a shared GPIO proxy. Mark its
322+ * descriptor as such and return here.
323+ */
324+ __set_bit(GPIOD_FLAG_SHARED_PROXY,
325+ &gdev->descs[0].flags);
326+ return 0;
327+ }
328+ }
329+ }
330+
331+ /*
332+ * This is not a shared GPIO proxy but it still may be the device
333+ * exposing shared pins. Find them and create the proxy devices.
334+ */
335+ list_for_each_entry(entry, &gpio_shared_list, list) {
336+ if (!device_match_fwnode(&gdev->dev, entry->fwnode))
337+ continue;
338+
339+ if (list_count_nodes(&entry->refs) <= 1)
340+ continue;
341+
342+ flags = &gdev->descs[entry->offset].flags;
343+
344+ __set_bit(GPIOD_FLAG_SHARED, flags);
345+ /*
346+ * Shared GPIOs are not requested via the normal path. Make
347+ * them inaccessible to anyone even before we register the
348+ * chip.
349+ */
350+ __set_bit(GPIOD_FLAG_REQUESTED, flags);
351+
352+ pr_debug("GPIO %u owned by %s is shared by multiple consumers\n",
353+ entry->offset, gpio_device_get_label(gdev));
354+
355+ list_for_each_entry(ref, &entry->refs, list) {
356+ pr_debug("Setting up a shared GPIO entry for %s\n",
357+ fwnode_get_name(ref->fwnode));
358+
359+ ret = gpio_shared_make_adev(gdev, ref);
360+ if (ret)
361+ return ret;
362+ }
363+ }
364+
365+ return 0;
366+}
367+
368+void gpio_device_teardown_shared(struct gpio_device *gdev)
369+{
370+ struct gpio_shared_entry *entry;
371+ struct gpio_shared_ref *ref;
372+
373+ guard(mutex)(&gpio_shared_lock);
374+
375+ list_for_each_entry(entry, &gpio_shared_list, list) {
376+ if (!device_match_fwnode(&gdev->dev, entry->fwnode))
377+ continue;
378+
379+ list_for_each_entry(ref, &entry->refs, list) {
380+ gpiod_remove_lookup_table(ref->lookup);
381+ kfree(ref->lookup->table[0].key);
382+ kfree(ref->lookup);
383+ ref->lookup = NULL;
384+ gpio_shared_remove_adev(&ref->adev);
385+ }
386+ }
387+}
388+
389+static void gpio_shared_release(struct kref *kref)
390+{
391+ struct gpio_shared_entry *entry =
392+ container_of(kref, struct gpio_shared_entry, ref);
393+ struct gpio_shared_desc *shared_desc = entry->shared_desc;
394+
395+ guard(mutex)(&gpio_shared_lock);
396+
397+ gpio_device_put(shared_desc->desc->gdev);
398+ if (shared_desc->can_sleep)
399+ mutex_destroy(&shared_desc->mutex);
400+ kfree(shared_desc);
401+ entry->shared_desc = NULL;
402+}
403+
404+static void gpiod_shared_put(void *data)
405+{
406+ struct gpio_shared_entry *entry = data;
407+
408+ lockdep_assert_not_held(&gpio_shared_lock);
409+
410+ kref_put(&entry->ref, gpio_shared_release);
411+}
412+
413+static struct gpio_shared_desc *
414+gpiod_shared_desc_create(struct gpio_shared_entry *entry)
415+{
416+ struct gpio_shared_desc *shared_desc;
417+ struct gpio_device *gdev;
418+
419+ shared_desc = kzalloc(sizeof(*shared_desc), GFP_KERNEL);
420+ if (!shared_desc)
421+ return ERR_PTR(-ENOMEM);
422+
423+ gdev = gpio_device_find_by_fwnode(entry->fwnode);
424+ if (!gdev) {
425+ kfree(shared_desc);
426+ return ERR_PTR(-EPROBE_DEFER);
427+ }
428+
429+ shared_desc->desc = &gdev->descs[entry->offset];
430+ shared_desc->can_sleep = gpiod_cansleep(shared_desc->desc);
431+ if (shared_desc->can_sleep)
432+ mutex_init(&shared_desc->mutex);
433+ else
434+ spin_lock_init(&shared_desc->spinlock);
435+
436+ return shared_desc;
437+}
438+
439+static struct gpio_shared_entry *gpiod_shared_find(struct auxiliary_device *adev)
440+{
441+ struct gpio_shared_desc *shared_desc;
442+ struct gpio_shared_entry *entry;
443+ struct gpio_shared_ref *ref;
444+
445+ guard(mutex)(&gpio_shared_lock);
446+
447+ list_for_each_entry(entry, &gpio_shared_list, list) {
448+ list_for_each_entry(ref, &entry->refs, list) {
449+ if (adev != &ref->adev)
450+ continue;
451+
452+ if (entry->shared_desc) {
453+ kref_get(&entry->ref);
454+ return entry;
455+ }
456+
457+ shared_desc = gpiod_shared_desc_create(entry);
458+ if (IS_ERR(shared_desc))
459+ return ERR_CAST(shared_desc);
460+
461+ kref_init(&entry->ref);
462+ entry->shared_desc = shared_desc;
463+
464+ pr_debug("Device %s acquired a reference to the shared GPIO %u owned by %s\n",
465+ dev_name(&adev->dev), gpio_chip_hwgpio(shared_desc->desc),
466+ gpio_device_get_label(shared_desc->desc->gdev));
467+
468+
469+ return entry;
470+ }
471+ }
472+
473+ return ERR_PTR(-ENOENT);
474+}
475+
476+struct gpio_shared_desc *devm_gpiod_shared_get(struct device *dev)
477+{
478+ struct gpio_shared_entry *entry;
479+ int ret;
480+
481+ entry = gpiod_shared_find(to_auxiliary_dev(dev));
482+ if (IS_ERR(entry))
483+ return ERR_CAST(entry);
484+
485+ ret = devm_add_action_or_reset(dev, gpiod_shared_put, entry);
486+ if (ret)
487+ return ERR_PTR(ret);
488+
489+ return entry->shared_desc;
490+}
491+EXPORT_SYMBOL_GPL(devm_gpiod_shared_get);
492+
493+static void gpio_shared_drop_ref(struct gpio_shared_ref *ref)
494+{
495+ list_del(&ref->list);
496+ kfree(ref->con_id);
497+ ida_free(&gpio_shared_ida, ref->dev_id);
498+ fwnode_handle_put(ref->fwnode);
499+ kfree(ref);
500+}
501+
502+static void gpio_shared_drop_entry(struct gpio_shared_entry *entry)
503+{
504+ list_del(&entry->list);
505+ fwnode_handle_put(entry->fwnode);
506+ kfree(entry);
507+}
508+
509+/*
510+ * This is only called if gpio_shared_init() fails so it's in fact __init and
511+ * not __exit.
512+ */
513+static void __init gpio_shared_teardown(void)
514+{
515+ struct gpio_shared_entry *entry, *epos;
516+ struct gpio_shared_ref *ref, *rpos;
517+
518+ list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) {
519+ list_for_each_entry_safe(ref, rpos, &entry->refs, list)
520+ gpio_shared_drop_ref(ref);
521+
522+ gpio_shared_drop_entry(entry);
523+ }
524+}
525+
526+static void gpio_shared_free_exclusive(void)
527+{
528+ struct gpio_shared_entry *entry, *epos;
529+
530+ list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) {
531+ if (list_count_nodes(&entry->refs) > 1)
532+ continue;
533+
534+ gpio_shared_drop_ref(list_first_entry(&entry->refs,
535+ struct gpio_shared_ref,
536+ list));
537+ gpio_shared_drop_entry(entry);
538+ }
539+}
540+
541+static int __init gpio_shared_init(void)
542+{
543+ int ret;
544+
545+ /* Right now, we only support OF-based systems. */
546+ ret = gpio_shared_of_scan();
547+ if (ret) {
548+ gpio_shared_teardown();
549+ pr_err("Failed to scan OF nodes for shared GPIOs: %d\n", ret);
550+ return ret;
551+ }
552+
553+ gpio_shared_free_exclusive();
554+
555+ pr_debug("Finished scanning firmware nodes for shared GPIOs\n");
556+ return 0;
557+}
558+postcore_initcall(gpio_shared_init);
drivers/gpio/gpiolib-shared.h+71−0
@@ -0,0 +1,71 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+#ifndef __LINUX_GPIO_SHARED_H
4+#define __LINUX_GPIO_SHARED_H
5+
6+#include <linux/cleanup.h>
7+#include <linux/lockdep.h>
8+#include <linux/mutex.h>
9+#include <linux/spinlock.h>
10+
11+struct gpio_device;
12+struct gpio_desc;
13+struct device;
14+
15+#if IS_ENABLED(CONFIG_GPIO_SHARED)
16+
17+int gpio_device_setup_shared(struct gpio_device *gdev);
18+void gpio_device_teardown_shared(struct gpio_device *gdev);
19+int gpio_shared_add_proxy_lookup(struct device *consumer, unsigned long lflags);
20+
21+#else
22+
23+static inline int gpio_device_setup_shared(struct gpio_device *gdev)
24+{
25+ return 0;
26+}
27+
28+static inline void gpio_device_teardown_shared(struct gpio_device *gdev) { }
29+
30+static inline int gpio_shared_add_proxy_lookup(struct device *consumer,
31+ unsigned long lflags)
32+{
33+ return 0;
34+}
35+
36+#endif /* CONFIG_GPIO_SHARED */
37+
38+struct gpio_shared_desc {
39+ struct gpio_desc *desc;
40+ bool can_sleep;
41+ unsigned long cfg;
42+ unsigned int usecnt;
43+ unsigned int highcnt;
44+ union {
45+ struct mutex mutex;
46+ spinlock_t spinlock;
47+ };
48+};
49+
50+struct gpio_shared_desc *devm_gpiod_shared_get(struct device *dev);
51+
52+DEFINE_LOCK_GUARD_1(gpio_shared_desc_lock, struct gpio_shared_desc,
53+ if (_T->lock->can_sleep)
54+ mutex_lock(&_T->lock->mutex);
55+ else
56+ spin_lock_irqsave(&_T->lock->spinlock, _T->flags),
57+ if (_T->lock->can_sleep)
58+ mutex_unlock(&_T->lock->mutex);
59+ else
60+ spin_unlock_irqrestore(&_T->lock->spinlock, _T->flags),
61+ unsigned long flags)
62+
63+static inline void gpio_shared_lockdep_assert(struct gpio_shared_desc *shared_desc)
64+{
65+ if (shared_desc->can_sleep)
66+ lockdep_assert_held(&shared_desc->mutex);
67+ else
68+ lockdep_assert_held(&shared_desc->spinlock);
69+}
70+
71+#endif /* __LINUX_GPIO_SHARED_H */
drivers/gpio/gpiolib.c+61−9
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "gpiolib-acpi.h"
3838 #include "gpiolib-cdev.h"
3939 #include "gpiolib-of.h"
40+#include "gpiolib-shared.h"
4041 #include "gpiolib-swnode.h"
4142 #include "gpiolib-sysfs.h"
4243 #include "gpiolib.h"
@@ -1200,6 +1201,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 1157 unmodified lines
12001201 if (ret)
12011202 goto err_remove_irqchip_mask;
12021203
1204+ ret = gpio_device_setup_shared(gdev);
1205+ if (ret)
1206+ goto err_remove_irqchip;
1207+
12031208 /*
12041209 * By first adding the chardev, and then adding the device,
12051210 * we get a device node entry in sysfs under
@@ -1211,10 +1216,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 5 unmodified lines
12111216 if (gpiolib_initialized) {
12121217 ret = gpiochip_setup_dev(gdev);
12131218 if (ret)
1214− goto err_remove_irqchip;
1219+ goto err_teardown_shared;
12151220 }
1221+
12161222 return 0;
12171223
1224+err_teardown_shared:
1225+ gpio_device_teardown_shared(gdev);
12181226 err_remove_irqchip:
12191227 gpiochip_irqchip_remove(gc);
12201228 err_remove_irqchip_mask:
@@ -1283,6 +1291,7 @@ void gpiochip_remove(struct gpio_chip *gc) · 62 unmodified lines
12831291 /* Numb the device, cancelling all outstanding operations */
12841292 rcu_assign_pointer(gdev->chip, NULL);
12851293 synchronize_srcu(&gdev->srcu);
1294+ gpio_device_teardown_shared(gdev);
12861295 gpiochip_irqchip_remove(gc);
12871296 acpi_gpiochip_remove(gc);
12881297 of_gpiochip_remove(gc);
@@ -3981,6 +3990,26 @@ int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) · 2692 unmodified lines
39813990 }
39823991 EXPORT_SYMBOL_GPL(gpiod_set_consumer_name);
39833992
3993+/**
3994+ * gpiod_is_shared() - check if this GPIO can be shared by multiple consumers
3995+ * @desc: GPIO to inspect
3996+ *
3997+ * Returns:
3998+ * True if this GPIO can be shared by multiple consumers at once. False if it's
3999+ * a regular, exclusive GPIO.
4000+ *
4001+ * Note:
4002+ * This function returning true does not mean that this GPIO is currently being
4003+ * shared. It means the GPIO core has registered the fact that the firmware
4004+ * configuration indicates that it can be shared by multiple consumers and is
4005+ * in charge of arbitrating the access.
4006+ */
4007+bool gpiod_is_shared(const struct gpio_desc *desc)
4008+{
4009+ return test_bit(GPIOD_FLAG_SHARED_PROXY, &desc->flags);
4010+}
4011+EXPORT_SYMBOL_GPL(gpiod_is_shared);
4012+
39844013 /**
39854014 * gpiod_to_irq() - return the IRQ corresponding to a GPIO
39864015 * @desc: gpio whose IRQ will be returned (already requested)
@@ -4652,11 +4681,29 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 665 unmodified lines
46524681 scoped_guard(srcu, &gpio_devices_srcu) {
46534682 desc = gpiod_fwnode_lookup(fwnode, consumer, con_id, idx,
46544683 &flags, &lookupflags);
4684+ if (!IS_ERR_OR_NULL(desc) &&
4685+ test_bit(GPIOD_FLAG_SHARED, &desc->flags)) {
4686+ /*
4687+ * We're dealing with a GPIO shared by multiple
4688+ * consumers. This is the moment to add the machine
4689+ * lookup table for the proxy device as previously
4690+ * we only knew the consumer's fwnode.
4691+ */
4692+ ret = gpio_shared_add_proxy_lookup(consumer, lookupflags);
4693+ if (ret)
4694+ return ERR_PTR(ret);
4695+
4696+ /* Trigger platform lookup for shared GPIO proxy. */
4697+ desc = ERR_PTR(-ENOENT);
4698+ /* Trigger it even for fwnode-only gpiod_get(). */
4699+ platform_lookup_allowed = true;
4700+ }
4701+
46554702 if (gpiod_not_found(desc) && platform_lookup_allowed) {
46564703 /*
46574704 * Either we are not using DT or ACPI, or their lookup
4658− * did not return a result. In that case, use platform
4659− * lookup as a fallback.
4705+ * did not return a result or this is a shared GPIO. In
4706+ * that case, use platform lookup as a fallback.
46604707 */
46614708 dev_dbg(consumer,
46624709 "using lookup tables for GPIO lookup\n");
@@ -4679,14 +4726,19 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 16 unmodified lines
46794726 return ERR_PTR(ret);
46804727
46814728 /*
4682− * This happens when there are several consumers for
4683− * the same GPIO line: we just return here without
4684− * further initialization. It is a bit of a hack.
4685− * This is necessary to support fixed regulators.
4729+ * This happens when there are several consumers for the same
4730+ * GPIO line: we just return here without further
4731+ * initialization. It's a hack introduced long ago to support
4732+ * fixed regulators. We now have a better solution with
4733+ * automated scanning where affected platforms just need to
4734+ * select the provided Kconfig option.
46864735 *
4687− * FIXME: Make this more sane and safe.
4736+ * FIXME: Remove the GPIOD_FLAGS_BIT_NONEXCLUSIVE flag after
4737+ * making sure all platforms use the new mechanism.
46884738 */
4689− dev_info(consumer, "nonexclusive access to GPIO for %s\n", name);
4739+ dev_info(consumer,
4740+ "nonexclusive access to GPIO for %s, consider updating your code to using gpio-shared-proxy\n",
4741+ name);
46904742 return desc;
46914743 }
46924744
drivers/gpio/gpiolib.h+2−0
@@ -204,6 +204,8 @@ struct gpio_desc { · 203 unmodified lines
204204 #define GPIOD_FLAG_EDGE_FALLING 17 /* GPIO CDEV detects falling edge events */
205205 #define GPIOD_FLAG_EVENT_CLOCK_REALTIME 18 /* GPIO CDEV reports REALTIME timestamps in events */
206206 #define GPIOD_FLAG_EVENT_CLOCK_HTE 19 /* GPIO CDEV reports hardware timestamps in events */
207+#define GPIOD_FLAG_SHARED 20 /* GPIO is shared by multiple consumers */
208+#define GPIOD_FLAG_SHARED_PROXY 21 /* GPIO is a virtual proxy to a physically shared pin. */
207209
208210 /* Connection label */
209211 struct gpio_desc_label __rcu *label;
drivers/input/misc/arizona-haptics.c+5−9
@@ -34,8 +34,6 @@ static void arizona_haptics_work(struct work_struct *work) · 33 unmodified lines
3434 struct arizona_haptics,
3535 work);
3636 struct arizona *arizona = haptics->arizona;
37− struct snd_soc_component *component =
38− snd_soc_dapm_to_component(arizona->dapm);
3937 int ret;
4038
4139 if (!haptics->arizona->dapm) {
@@ -65,7 +63,7 @@ static void arizona_haptics_work(struct work_struct *work) · 23 unmodified lines
6563 return;
6664 }
6765
68− ret = snd_soc_component_enable_pin(component, "HAPTICS");
66+ ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS");
6967 if (ret != 0) {
7068 dev_err(arizona->dev, "Failed to start HAPTICS: %d\n",
7169 ret);
@@ -80,7 +78,7 @@ static void arizona_haptics_work(struct work_struct *work) · 8 unmodified lines
8078 }
8179 } else {
8280 /* This disable sequence will be a noop if already enabled */
83− ret = snd_soc_component_disable_pin(component, "HAPTICS");
81+ ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS");
8482 if (ret != 0) {
8583 dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n",
8684 ret);
@@ -139,14 +137,12 @@ static int arizona_haptics_play(struct input_dev *input, void *data, · 52 unmodified lines
139137 static void arizona_haptics_close(struct input_dev *input)
140138 {
141139 struct arizona_haptics *haptics = input_get_drvdata(input);
142− struct snd_soc_component *component;
140+ struct snd_soc_dapm_context *dapm = haptics->arizona->dapm;
143141
144142 cancel_work_sync(&haptics->work);
145143
146− if (haptics->arizona->dapm) {
147− component = snd_soc_dapm_to_component(haptics->arizona->dapm);
148− snd_soc_component_disable_pin(component, "HAPTICS");
149− }
144+ if (dapm)
145+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
150146 }
151147
152148 static int arizona_haptics_probe(struct platform_device *pdev)
drivers/regulator/arizona-micsupp.c+2−6
@@ -48,7 +48,6 @@ static void arizona_micsupp_check_cp(struct work_struct *work) · 47 unmodified lines
4848 struct arizona_micsupp *micsupp =
4949 container_of(work, struct arizona_micsupp, check_cp_work);
5050 struct snd_soc_dapm_context *dapm = *micsupp->dapm;
51− struct snd_soc_component *component;
5251 const struct regulator_desc *desc = micsupp->desc;
5352 unsigned int val;
5453 int ret;
@@ -61,14 +60,11 @@ static void arizona_micsupp_check_cp(struct work_struct *work) · 6 unmodified lines
6160 }
6261
6362 if (dapm) {
64− component = snd_soc_dapm_to_component(dapm);
65−
6663 if ((val & (desc->enable_mask | desc->bypass_mask)) ==
6764 desc->enable_mask)
68− snd_soc_component_force_enable_pin(component,
69− "MICSUPP");
65+ snd_soc_dapm_force_enable_pin(dapm, "MICSUPP");
7066 else
71− snd_soc_component_disable_pin(component, "MICSUPP");
67+ snd_soc_dapm_disable_pin(dapm, "MICSUPP");
7268
7369 snd_soc_dapm_sync(dapm);
7470 }
drivers/staging/greybus/audio_codec.c+11−5
@@ -807,6 +807,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 806 unmodified lines
807807 {
808808 int ret;
809809 struct snd_soc_component *comp;
810+ struct snd_soc_dapm_context *dapm;
810811 struct gbaudio_jack *jack = NULL;
811812
812813 if (!gbcodec) {
@@ -815,6 +816,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 2 unmodified lines
815816 }
816817
817818 comp = gbcodec->component;
819+ dapm = snd_soc_component_to_dapm(comp);
818820
819821 mutex_lock(&gbcodec->register_mutex);
820822
@@ -833,18 +835,18 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 12 unmodified lines
833835 }
834836
835837 if (module->dapm_widgets)
836− snd_soc_dapm_new_controls(&comp->dapm, module->dapm_widgets,
838+ snd_soc_dapm_new_controls(dapm, module->dapm_widgets,
837839 module->num_dapm_widgets);
838840 if (module->controls)
839841 snd_soc_add_component_controls(comp, module->controls,
840842 module->num_controls);
841843 if (module->dapm_routes)
842− snd_soc_dapm_add_routes(&comp->dapm, module->dapm_routes,
844+ snd_soc_dapm_add_routes(dapm, module->dapm_routes,
843845 module->num_dapm_routes);
844846
845847 /* card already instantiated, create widgets here only */
846848 if (comp->card->instantiated) {
847− gbaudio_dapm_link_component_dai_widgets(comp->card, &comp->dapm);
849+ gbaudio_dapm_link_component_dai_widgets(comp->card, dapm);
848850 #ifdef CONFIG_SND_JACK
849851 /*
850852 * register jack devices for this module
@@ -966,9 +968,11 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) · 115 unmodified lines
966968 #endif
967969
968970 if (module->dapm_routes) {
971+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp);
972+
969973 dev_dbg(comp->dev, "Removing %d routes\n",
970974 module->num_dapm_routes);
971− snd_soc_dapm_del_routes(&comp->dapm, module->dapm_routes,
975+ snd_soc_dapm_del_routes(dapm, module->dapm_routes,
972976 module->num_dapm_routes);
973977 }
974978 if (module->controls) {
@@ -979,9 +983,11 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) · 4 unmodified lines
979983 module->num_controls);
980984 }
981985 if (module->dapm_widgets) {
986+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp);
987+
982988 dev_dbg(comp->dev, "Removing %d widgets\n",
983989 module->num_dapm_widgets);
984− gbaudio_dapm_free_controls(&comp->dapm, module->dapm_widgets,
990+ gbaudio_dapm_free_controls(dapm, module->dapm_widgets,
985991 module->num_dapm_widgets);
986992 }
987993
drivers/staging/greybus/audio_helper.c+5−4
@@ -115,12 +115,13 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 114 unmodified lines
115115 {
116116 int i;
117117 struct snd_soc_dapm_widget *w, *tmp_w;
118+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
118119
119− mutex_lock(&dapm->card->dapm_mutex);
120+ mutex_lock(&card->dapm_mutex);
120121 for (i = 0; i < num; i++) {
121122 /* below logic can be optimized to identify widget pointer */
122123 w = NULL;
123− list_for_each_entry(tmp_w, &dapm->card->widgets, list) {
124+ list_for_each_entry(tmp_w, &card->widgets, list) {
124125 if (tmp_w->dapm == dapm &&
125126 !strcmp(tmp_w->name, widget->name)) {
126127 w = tmp_w;
@@ -128,7 +129,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 1 unmodified line
128129 }
129130 }
130131 if (!w) {
131− dev_err(dapm->dev, "%s: widget not found\n",
132+ dev_err(card->dev, "%s: widget not found\n",
132133 widget->name);
133134 widget++;
134135 continue;
@@ -136,7 +137,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 1 unmodified line
136137 widget++;
137138 gbaudio_dapm_free_widget(w);
138139 }
139− mutex_unlock(&dapm->card->dapm_mutex);
140+ mutex_unlock(&card->dapm_mutex);
140141 return 0;
141142 }
142143
drivers/staging/greybus/audio_topology.c+12−12
@@ -163,7 +163,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, · 162 unmodified lines
163163 struct gbaudio_ctl_pvt *data;
164164 struct gb_audio_ctl_elem_info *info;
165165 struct gbaudio_module_info *module;
166− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
166+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
167167 struct gbaudio_codec_info *gbcodec = snd_soc_component_get_drvdata(comp);
168168
169169 dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
@@ -214,7 +214,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, · 44 unmodified lines
214214 struct gbaudio_ctl_pvt *data;
215215 struct gb_audio_ctl_elem_value gbvalue;
216216 struct gbaudio_module_info *module;
217− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
217+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
218218 struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
219219 struct gb_bundle *bundle;
220220
@@ -276,7 +276,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, · 55 unmodified lines
276276 struct gbaudio_ctl_pvt *data;
277277 struct gb_audio_ctl_elem_value gbvalue;
278278 struct gbaudio_module_info *module;
279− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
279+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
280280 struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
281281 struct gb_bundle *bundle;
282282
@@ -380,7 +380,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 97 unmodified lines
380380 struct gbaudio_module_info *module;
381381 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
382382 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
383− struct device *codec_dev = widget->dapm->dev;
383+ struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm);
384384 struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
385385 struct gb_bundle *bundle;
386386
@@ -393,7 +393,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines
393393 bundle = to_gb_bundle(module->dev);
394394
395395 if (data->vcount == 2)
396− dev_warn(widget->dapm->dev,
396+ dev_warn(codec_dev,
397397 "GB: Control '%s' is stereo, which is not supported\n",
398398 kcontrol->id.name);
399399
@@ -429,7 +429,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 29 unmodified lines
429429 struct gbaudio_module_info *module;
430430 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
431431 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
432− struct device *codec_dev = widget->dapm->dev;
432+ struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm);
433433 struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
434434 struct gb_bundle *bundle;
435435
@@ -443,7 +443,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines
443443 bundle = to_gb_bundle(module->dev);
444444
445445 if (data->vcount == 2)
446− dev_warn(widget->dapm->dev,
446+ dev_warn(codec_dev,
447447 "GB: Control '%s' is stereo, which is not supported\n",
448448 kcontrol->id.name);
449449
@@ -543,7 +543,7 @@ static int gbcodec_enum_ctl_get(struct snd_kcontrol *kcontrol, · 93 unmodified lines
543543 struct snd_ctl_elem_value *ucontrol)
544544 {
545545 int ret, ctl_id;
546− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
546+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
547547 struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
548548 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
549549 struct gb_audio_ctl_elem_value gbvalue;
@@ -588,7 +588,7 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol *kcontrol, · 38 unmodified lines
588588 struct snd_ctl_elem_value *ucontrol)
589589 {
590590 int ret, ctl_id;
591− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
591+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
592592 struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
593593 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
594594 struct gb_audio_ctl_elem_value gbvalue;
@@ -712,7 +712,7 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 117 unmodified lines
712712 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
713713 struct gbaudio_module_info *module;
714714 struct gb_audio_ctl_elem_value gbvalue;
715− struct device *codec_dev = widget->dapm->dev;
715+ struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm);
716716 struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
717717 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
718718 struct gb_bundle *bundle;
@@ -759,7 +759,7 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 40 unmodified lines
759759 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
760760 struct gb_audio_ctl_elem_value gbvalue;
761761 struct gbaudio_module_info *module;
762− struct device *codec_dev = widget->dapm->dev;
762+ struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm);
763763 struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
764764 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
765765 struct gb_bundle *bundle;
@@ -924,7 +924,7 @@ static int gbaudio_widget_event(struct snd_soc_dapm_widget *w, · 158 unmodified lines
924924 {
925925 int wid;
926926 int ret;
927− struct device *codec_dev = w->dapm->dev;
927+ struct device *codec_dev = snd_soc_dapm_to_dev(w->dapm);
928928 struct gbaudio_codec_info *gbcodec = dev_get_drvdata(codec_dev);
929929 struct gbaudio_module_info *module;
930930 struct gb_bundle *bundle;
include/linux/firmware/cirrus/cs_dsp.h+3−3
@@ -102,7 +102,7 @@ struct cs_dsp_coeff_ctl { · 101 unmodified lines
102102 const char *subname;
103103 unsigned int subname_len;
104104 unsigned int offset;
105− size_t len;
105+ unsigned int len;
106106 unsigned int type;
107107 unsigned int flags;
108108 unsigned int set:1;
@@ -188,8 +188,8 @@ struct cs_dsp { · 79 unmodified lines
188188
189189 #ifdef CONFIG_DEBUG_FS
190190 struct dentry *debugfs_root;
191− char *wmfw_file_name;
192− char *bin_file_name;
191+ const char *wmfw_file_name;
192+ const char *bin_file_name;
193193 #endif
194194 };
195195
include/linux/firmware/cirrus/cs_dsp_test_utils.h+9−9
@@ -26,21 +26,21 @@ struct cs_dsp_test { · 25 unmodified lines
2626
2727 struct cs_dsp_test_local *local;
2828
29− /* Following members are private */
29+ /* private: Following members are private */
3030 bool saw_bus_write;
3131 };
3232
3333 /**
3434 * struct cs_dsp_mock_alg_def - Info for creating a mock algorithm entry.
3535 *
36− * @id Algorithm ID.
37− * @ver; Algorithm version.
38− * @xm_base_words XM base address in DSP words.
39− * @xm_size_words XM size in DSP words.
40− * @ym_base_words YM base address in DSP words.
41− * @ym_size_words YM size in DSP words.
42− * @zm_base_words ZM base address in DSP words.
43− * @zm_size_words ZM size in DSP words.
36+ * @id: Algorithm ID.
37+ * @ver: Algorithm version.
38+ * @xm_base_words: XM base address in DSP words.
39+ * @xm_size_words: XM size in DSP words.
40+ * @ym_base_words: YM base address in DSP words.
41+ * @ym_size_words: YM size in DSP words.
42+ * @zm_base_words: ZM base address in DSP words.
43+ * @zm_size_words: ZM size in DSP words.
4444 */
4545 struct cs_dsp_mock_alg_def {
4646 unsigned int id;
include/linux/gpio/consumer.h+9−0
@@ -167,6 +167,8 @@ int gpiod_cansleep(const struct gpio_desc *desc); · 166 unmodified lines
167167 int gpiod_to_irq(const struct gpio_desc *desc);
168168 int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name);
169169
170+bool gpiod_is_shared(const struct gpio_desc *desc);
171+
170172 /* Convert between the old gpio_ and new gpiod_ interfaces */
171173 struct gpio_desc *gpio_to_desc(unsigned gpio);
172174 int desc_to_gpio(const struct gpio_desc *desc);
@@ -520,6 +522,13 @@ static inline int gpiod_set_consumer_name(struct gpio_desc *desc, · 347 unmodified lines
520522 return -EINVAL;
521523 }
522524
525+static inline bool gpiod_is_shared(const struct gpio_desc *desc)
526+{
527+ /* GPIO can never have been requested */
528+ WARN_ON(desc);
529+ return false;
530+}
531+
523532 static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
524533 {
525534 return NULL;
include/linux/pci_ids.h+1−0
@@ -3075,6 +3075,7 @@ · 3074 unmodified lines
30753075 #define PCI_DEVICE_ID_INTEL_5100_22 0x65f6
30763076 #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
30773077 #define PCI_DEVICE_ID_INTEL_HDA_FCL 0x67a8
3078+#define PCI_DEVICE_ID_INTEL_HDA_NVL_S 0x6e50
30783079 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
30793080 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
30803081 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
include/linux/regmap.h+11−10
@@ -676,7 +676,7 @@ struct regmap *__regmap_init_sdw(struct sdw_slave *sdw, · 675 unmodified lines
676676 const struct regmap_config *config,
677677 struct lock_class_key *lock_key,
678678 const char *lock_name);
679−struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw,
679+struct regmap *__regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw,
680680 const struct regmap_config *config,
681681 const struct regmap_sdw_mbq_cfg *mbq_config,
682682 struct lock_class_key *lock_key,
@@ -738,7 +738,7 @@ struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw, · 55 unmodified lines
738738 const struct regmap_config *config,
739739 struct lock_class_key *lock_key,
740740 const char *lock_name);
741−struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw,
741+struct regmap *__devm_regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw,
742742 const struct regmap_config *config,
743743 const struct regmap_sdw_mbq_cfg *mbq_config,
744744 struct lock_class_key *lock_key,
@@ -970,7 +970,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 225 unmodified lines
970970 */
971971 #define regmap_init_sdw_mbq(sdw, config) \
972972 __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \
973− sdw, config, NULL)
973+ &sdw->dev, sdw, config, NULL)
974974
975975 /**
976976 * regmap_init_sdw_mbq_cfg() - Initialise MBQ SDW register map with config
@@ -983,9 +983,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 6 unmodified lines
983983 * to a struct regmap. The regmap will be automatically freed by the
984984 * device management code.
985985 */
986−#define regmap_init_sdw_mbq_cfg(sdw, config, mbq_config) \
986+#define regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \
987987 __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \
988− sdw, config, mbq_config)
988+ dev, sdw, config, mbq_config)
989989
990990 /**
991991 * regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave
@@ -1198,12 +1198,13 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 206 unmodified lines
11981198 */
11991199 #define devm_regmap_init_sdw_mbq(sdw, config) \
12001200 __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, #config, \
1201− sdw, config, NULL)
1201+ &sdw->dev, sdw, config, NULL)
12021202
12031203 /**
12041204 * devm_regmap_init_sdw_mbq_cfg() - Initialise managed MBQ SDW register map with config
12051205 *
1206− * @sdw: Device that will be interacted with
1206+ * @dev: Device that will be interacted with
1207+ * @sdw: SoundWire Device that will be interacted with
12071208 * @config: Configuration for register map
12081209 * @mbq_config: Properties for the MBQ registers
12091210 *
@@ -1211,9 +1212,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 1 unmodified line
12111212 * to a struct regmap. The regmap will be automatically freed by the
12121213 * device management code.
12131214 */
1214−#define devm_regmap_init_sdw_mbq_cfg(sdw, config, mbq_config) \
1215− __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, \
1216− #config, sdw, config, mbq_config)
1215+#define devm_regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \
1216+ __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, \
1217+ #config, dev, sdw, config, mbq_config)
12171218
12181219 /**
12191220 * devm_regmap_init_slimbus() - Initialise managed register map
include/linux/soundwire/sdw_registers.h+2−0
@@ -355,4 +355,6 @@ · 354 unmodified lines
355355 /* Check the reserved and fixed bits in address */
356356 #define SDW_SDCA_VALID_CTL(reg) (((reg) & (GENMASK(31, 25) | BIT(18) | BIT(13))) == BIT(30))
357357
358+#define SDW_SDCA_MAX_REGISTER 0x47FFFFFF
359+
358360 #endif /* __SDW_REGISTERS_H */
include/linux/string.h+18−0
@@ -562,4 +562,22 @@ static inline bool strstarts(const char *str, const char *prefix) · 561 unmodified lines
562562 return strncmp(str, prefix, strlen(prefix)) == 0;
563563 }
564564
565+/**
566+ * strends - Check if a string ends with another string.
567+ * @str - NULL-terminated string to check against @suffix
568+ * @suffix - NULL-terminated string defining the suffix to look for in @str
569+ *
570+ * Returns:
571+ * True if @str ends with @suffix. False in all other cases.
572+ */
573+static inline bool strends(const char *str, const char *suffix)
574+{
575+ unsigned int str_len = strlen(str), suffix_len = strlen(suffix);
576+
577+ if (str_len < suffix_len)
578+ return false;
579+
580+ return !(strcmp(str + str_len - suffix_len, suffix));
581+}
582+
565583 #endif /* _LINUX_STRING_H_ */
include/sound/cs-amp-lib.h+24−1
@@ -47,21 +47,44 @@ struct cirrus_amp_cal_controls { · 46 unmodified lines
4747 int cs_amp_write_cal_coeffs(struct cs_dsp *dsp,
4848 const struct cirrus_amp_cal_controls *controls,
4949 const struct cirrus_amp_cal_data *data);
50+int cs_amp_read_cal_coeffs(struct cs_dsp *dsp,
51+ const struct cirrus_amp_cal_controls *controls,
52+ struct cirrus_amp_cal_data *data);
53+int cs_amp_write_ambient_temp(struct cs_dsp *dsp,
54+ const struct cirrus_amp_cal_controls *controls,
55+ u32 temp);
5056 int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index,
5157 struct cirrus_amp_cal_data *out_data);
58+int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps,
59+ const struct cirrus_amp_cal_data *in_data);
5260 int cs_amp_get_vendor_spkid(struct device *dev);
61+struct dentry *cs_amp_create_debugfs(struct device *dev);
62+
63+static inline u64 cs_amp_cal_target_u64(const struct cirrus_amp_cal_data *data)
64+{
65+ return ((u64)data->calTarget[1] << 32) | data->calTarget[0];
66+}
5367
5468 struct cs_amp_test_hooks {
5569 efi_status_t (*get_efi_variable)(efi_char16_t *name,
5670 efi_guid_t *guid,
71+ u32 *returned_attr,
5772 unsigned long *size,
5873 void *buf);
74+ efi_status_t (*set_efi_variable)(efi_char16_t *name,
75+ efi_guid_t *guid,
76+ u32 attr,
77+ unsigned long size,
78+ void *buf);
5979
6080 int (*write_cal_coeff)(struct cs_dsp *dsp,
6181 const struct cirrus_amp_cal_controls *controls,
6282 const char *ctl_name, u32 val);
63−};
6483
84+ int (*read_cal_coeff)(struct cs_dsp *dsp,
85+ const struct cirrus_amp_cal_controls *controls,
86+ const char *ctl_name, u32 *val);
87+};
6588 extern const struct cs_amp_test_hooks * const cs_amp_test_hooks;
6689
6790 #endif /* CS_AMP_LIB_H */
include/sound/cs35l56.h+50−0
@@ -9,12 +9,15 @@ · 8 unmodified lines
99 #ifndef __CS35L56_H
1010 #define __CS35L56_H
1111
12+#include <linux/debugfs.h>
1213 #include <linux/firmware/cirrus/cs_dsp.h>
1314 #include <linux/regulator/consumer.h>
1415 #include <linux/regmap.h>
1516 #include <linux/spi/spi.h>
1617 #include <sound/cs-amp-lib.h>
1718
19+struct snd_ctl_elem_value;
20+
1821 #define CS35L56_DEVID 0x0000000
1922 #define CS35L56_REVID 0x0000004
2023 #define CS35L56_RELID 0x000000C
@@ -62,6 +65,8 @@ · 41 unmodified lines
6265 #define CS35L56_IRQ1_MASK_8 0x000E0AC
6366 #define CS35L56_IRQ1_MASK_18 0x000E0D4
6467 #define CS35L56_IRQ1_MASK_20 0x000E0DC
68+#define CS35L56_MIXER_NGATE_CH1_CFG 0x0010004
69+#define CS35L56_MIXER_NGATE_CH2_CFG 0x0010008
6570 #define CS35L56_DSP_MBOX_1_RAW 0x0011000
6671 #define CS35L56_DSP_VIRTUAL1_MBOX_1 0x0011020
6772 #define CS35L56_DSP_VIRTUAL1_MBOX_2 0x0011024
@@ -177,6 +182,9 @@ · 109 unmodified lines
177182 /* IRQ1_EINT_8 */
178183 #define CS35L56_TEMP_ERR_EINT1_MASK 0x80000000
179184
185+/* MIXER_NGATE_CHn_CFG */
186+#define CS35L56_AUX_NGATE_CHn_EN 0x00000001
187+
180188 /* Mixer input sources */
181189 #define CS35L56_INPUT_SRC_NONE 0x00
182190 #define CS35L56_INPUT_SRC_ASP1RX1 0x08
@@ -243,6 +251,7 @@ · 60 unmodified lines
243251 #define CS35L56_MBOX_CMD_AUDIO_PLAY 0x0B000001
244252 #define CS35L56_MBOX_CMD_AUDIO_PAUSE 0x0B000002
245253 #define CS35L56_MBOX_CMD_AUDIO_REINIT 0x0B000003
254+#define CS35L56_MBOX_CMD_AUDIO_CALIBRATION 0x0B000006
246255 #define CS35L56_MBOX_CMD_HIBERNATE_NOW 0x02000001
247256 #define CS35L56_MBOX_CMD_WAKEUP 0x02000002
248257 #define CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE 0x02000003
@@ -258,12 +267,22 @@ · 9 unmodified lines
258267 #define CS35L56_PS3_POLL_US 500
259268 #define CS35L56_PS3_TIMEOUT_US 300000
260269
270+#define CS35L56_CAL_STATUS_SUCCESS 1
271+#define CS35L56_CAL_STATUS_OUT_OF_RANGE 3
272+
273+#define CS35L56_CAL_SET_STATUS_UNKNOWN 0
274+#define CS35L56_CAL_SET_STATUS_DEFAULT 1
275+#define CS35L56_CAL_SET_STATUS_SET 2
276+
261277 #define CS35L56_CONTROL_PORT_READY_US 2200
262278 #define CS35L56_HALO_STATE_POLL_US 1000
263279 #define CS35L56_HALO_STATE_TIMEOUT_US 250000
264280 #define CS35L56_RESET_PULSE_MIN_US 1100
265281 #define CS35L56_WAKE_HOLD_TIME_US 1000
266282
283+#define CS35L56_CALIBRATION_POLL_US (100 * USEC_PER_MSEC)
284+#define CS35L56_CALIBRATION_TIMEOUT_US (5 * USEC_PER_SEC)
285+
267286 #define CS35L56_SDW1_PLAYBACK_PORT 1
268287 #define CS35L56_SDW1_CAPTURE_PORT 3
269288
@@ -291,9 +310,16 @@ struct cs35l56_fw_reg { · 21 unmodified lines
291310 unsigned int posture_number;
292311 };
293312
313+struct cs35l56_cal_debugfs_fops {
314+ const struct debugfs_short_fops calibrate;
315+ const struct debugfs_short_fops cal_temperature;
316+ const struct debugfs_short_fops cal_data;
317+};
318+
294319 struct cs35l56_base {
295320 struct device *dev;
296321 struct regmap *regmap;
322+ struct cs_dsp *dsp;
297323 int irq;
298324 struct mutex irq_lock;
299325 u8 type;
@@ -304,11 +330,14 @@ struct cs35l56_base { · 4 unmodified lines
304330 bool can_hibernate;
305331 bool cal_data_valid;
306332 s8 cal_index;
333+ u8 num_amps;
307334 struct cirrus_amp_cal_data cal_data;
308335 struct gpio_desc *reset_gpio;
309336 struct cs35l56_spi_payload *spi_payload_buf;
310337 const struct cs35l56_fw_reg *fw_reg;
311338 const struct cirrus_amp_cal_controls *calibration_controls;
339+ struct dentry *debugfs;
340+ u64 silicon_uid;
312341 };
313342
314343 static inline bool cs35l56_is_otp_register(unsigned int reg)
@@ -340,6 +369,7 @@ extern const struct regmap_config cs35l63_regmap_i2c; · 25 unmodified lines
340369 extern const struct regmap_config cs35l63_regmap_sdw;
341370
342371 extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls;
372+extern const char * const cs35l56_cal_set_status_text[3];
343373
344374 extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
345375 extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
@@ -358,8 +388,28 @@ int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base); · 12 unmodified lines
358388 int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire);
359389 void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
360390 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base);
391+int cs35l56_stash_calibration(struct cs35l56_base *cs35l56_base,
392+ const struct cirrus_amp_cal_data *data);
393+ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base,
394+ const char __user *from, size_t count,
395+ loff_t *ppos);
396+ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base,
397+ const char __user *from, size_t count,
398+ loff_t *ppos);
399+ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base,
400+ char __user *to, size_t count,
401+ loff_t *ppos);
402+ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base,
403+ const char __user *from, size_t count,
404+ loff_t *ppos);
405+void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base,
406+ const struct cs35l56_cal_debugfs_fops *fops);
407+void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base);
408+int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base,
409+ struct snd_ctl_elem_value *uvalue);
361410 int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
362411 bool *fw_missing, unsigned int *fw_version);
412+void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base);
363413 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
364414 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
365415 int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
include/sound/sdca.h+19−0
@@ -12,19 +12,24 @@ · 11 unmodified lines
1212 #include <linux/types.h>
1313 #include <linux/kconfig.h>
1414
15+struct acpi_table_swft;
16+struct fwnode_handle;
1517 struct sdw_slave;
18+struct sdca_dev;
1619
1720 #define SDCA_MAX_FUNCTION_COUNT 8
1821
1922 /**
2023 * struct sdca_function_desc - short descriptor for an SDCA Function
2124 * @node: firmware node for the Function.
25+ * @func_dev: pointer to SDCA function device.
2226 * @name: Human-readable string.
2327 * @type: Function topology type.
2428 * @adr: ACPI address (used for SDCA register access).
2529 */
2630 struct sdca_function_desc {
2731 struct fwnode_handle *node;
32+ struct sdca_dev *func_dev;
2833 const char *name;
2934 u32 type;
3035 u8 adr;
@@ -37,11 +42,13 @@ struct sdca_function_desc { · 6 unmodified lines
3742 * @num_functions: Total number of supported SDCA functions. Invalid/unsupported
3843 * functions will be skipped.
3944 * @function: Array of function descriptors.
45+ * @swft: Pointer to the SWFT table, if available.
4046 */
4147 struct sdca_device_data {
4248 u32 interface_revision;
4349 int num_functions;
4450 struct sdca_function_desc function[SDCA_MAX_FUNCTION_COUNT];
51+ struct acpi_table_swft *swft;
4552 };
4653
4754 enum sdca_quirk {
@@ -52,17 +59,29 @@ enum sdca_quirk { · 4 unmodified lines
5259 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
5360
5461 void sdca_lookup_functions(struct sdw_slave *slave);
62+void sdca_lookup_swft(struct sdw_slave *slave);
5563 void sdca_lookup_interface_revision(struct sdw_slave *slave);
5664 bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
65+int sdca_dev_register_functions(struct sdw_slave *slave);
66+void sdca_dev_unregister_functions(struct sdw_slave *slave);
5767
5868 #else
5969
6070 static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
71+static inline void sdca_lookup_swft(struct sdw_slave *slave) {}
6172 static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}
6273 static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
6374 {
6475 return false;
6576 }
77+
78+static inline int sdca_dev_register_functions(struct sdw_slave *slave)
79+{
80+ return 0;
81+}
82+
83+static inline void sdca_dev_unregister_functions(struct sdw_slave *slave) {}
84+
6685 #endif
6786
6887 #endif
include/sound/sdca_fdl.h+105−0
@@ -0,0 +1,105 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * The MIPI SDCA specification is available for public downloads at
4+ * https://www.mipi.org/mipi-sdca-v1-0-download
5+ *
6+ * Copyright (C) 2025 Cirrus Logic, Inc. and
7+ * Cirrus Logic International Semiconductor Ltd.
8+ */
9+
10+#ifndef __SDCA_FDL_H__
11+#define __SDCA_FDL_H__
12+
13+#include <linux/completion.h>
14+#include <linux/workqueue.h>
15+
16+struct device;
17+struct regmap;
18+struct sdca_fdl_set;
19+struct sdca_function_data;
20+struct sdca_interrupt;
21+struct sdca_interrupt_info;
22+
23+/**
24+ * struct fdl_state - FDL state structure to keep data between interrupts
25+ * @begin: Completion indicating the start of an FDL download cycle.
26+ * @done: Completion indicating the end of an FDL download cycle.
27+ * @timeout: Delayed work used for timing out UMP transactions.
28+ * @lock: Mutex to protect between the timeout work and IRQ handlers.
29+ * @interrupt: Pointer to the interrupt struct to which this FDL is attached.
30+ * @set: Pointer to the FDL set currently being downloaded.
31+ * @file_index: Index of the current file being processed.
32+ */
33+struct fdl_state {
34+ struct completion begin;
35+ struct completion done;
36+ struct delayed_work timeout;
37+ struct mutex lock;
38+
39+ struct sdca_interrupt *interrupt;
40+ struct sdca_fdl_set *set;
41+ int file_index;
42+};
43+
44+#define SDCA_CTL_XU_FDLH_COMPLETE 0
45+#define SDCA_CTL_XU_FDLH_MORE_FILES SDCA_CTL_XU_FDLH_SET_IN_PROGRESS
46+#define SDCA_CTL_XU_FDLH_FILE_AVAILABLE (SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
47+ SDCA_CTL_XU_FDLH_SET_IN_PROGRESS)
48+#define SDCA_CTL_XU_FDLH_MASK (SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK | \
49+ SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
50+ SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
51+ SDCA_CTL_XU_FDLH_RESET_ACK | \
52+ SDCA_CTL_XU_FDLH_REQ_ABORT)
53+
54+#define SDCA_CTL_XU_FDLD_COMPLETE 0
55+#define SDCA_CTL_XU_FDLD_FILE_OK (SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
56+ SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
57+ SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
58+ SDCA_CTL_XU_FDLD_NEEDS_SET)
59+#define SDCA_CTL_XU_FDLD_MORE_FILES_OK (SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
60+ SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
61+ SDCA_CTL_XU_FDLD_NEEDS_SET)
62+#define SDCA_CTL_XU_FDLD_MASK (SDCA_CTL_XU_FDLD_REQ_RESET | \
63+ SDCA_CTL_XU_FDLD_REQ_ABORT | \
64+ SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
65+ SDCA_CTL_XU_FDLD_NEEDS_SET)
66+
67+#if IS_ENABLED(CONFIG_SND_SOC_SDCA_FDL)
68+
69+int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt);
70+int sdca_fdl_process(struct sdca_interrupt *interrupt);
71+int sdca_fdl_sync(struct device *dev, struct sdca_function_data *function,
72+ struct sdca_interrupt_info *info);
73+
74+int sdca_reset_function(struct device *dev, struct sdca_function_data *function,
75+ struct regmap *regmap);
76+
77+#else
78+
79+static inline int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt)
80+{
81+ return 0;
82+}
83+
84+static inline int sdca_fdl_process(struct sdca_interrupt *interrupt)
85+{
86+ return 0;
87+}
88+
89+static inline int sdca_fdl_sync(struct device *dev,
90+ struct sdca_function_data *function,
91+ struct sdca_interrupt_info *info)
92+{
93+ return 0;
94+}
95+
96+static inline int sdca_reset_function(struct device *dev,
97+ struct sdca_function_data *function,
98+ struct regmap *regmap)
99+{
100+ return 0;
101+}
102+
103+#endif // CONFIG_SND_SOC_SDCA_FDL
104+
105+#endif // __SDCA_FDL_H__
include/sound/sdca_function.h+124−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/types.h>
1414 #include <linux/hid.h>
1515
16+struct acpi_table_swft;
1617 struct device;
1718 struct sdca_entity;
1819 struct sdca_function_desc;
@@ -63,6 +64,7 @@ struct sdca_function_desc; · 44 unmodified lines
6364 * @SDCA_FUNCTION_TYPE_RJ: Retaskable jack.
6465 * @SDCA_FUNCTION_TYPE_SIMPLE_JACK: Subset of UAJ.
6566 * @SDCA_FUNCTION_TYPE_HID: Human Interface Device, for e.g. buttons.
67+ * @SDCA_FUNCTION_TYPE_COMPANION_AMP: Sources audio from another amp.
6668 * @SDCA_FUNCTION_TYPE_IMP_DEF: Implementation-defined function.
6769 *
6870 * SDCA Function Types from SDCA specification v1.0a Section 5.1.2
@@ -82,6 +84,7 @@ enum sdca_function_type { · 13 unmodified lines
8284 SDCA_FUNCTION_TYPE_RJ = 0x07,
8385 SDCA_FUNCTION_TYPE_SIMPLE_JACK = 0x08,
8486 SDCA_FUNCTION_TYPE_HID = 0x0A,
87+ SDCA_FUNCTION_TYPE_COMPANION_AMP = 0x0B,
8588 SDCA_FUNCTION_TYPE_IMP_DEF = 0x1F,
8689 };
8790
@@ -95,6 +98,7 @@ enum sdca_function_type { · 7 unmodified lines
9598 #define SDCA_FUNCTION_TYPE_RJ_NAME "RJ"
9699 #define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack"
97100 #define SDCA_FUNCTION_TYPE_HID_NAME "HID"
101+#define SDCA_FUNCTION_TYPE_COMPANION_AMP_NAME "CompanionAmp"
98102 #define SDCA_FUNCTION_TYPE_IMP_DEF_NAME "ImplementationDefined"
99103
100104 /**
@@ -133,6 +137,32 @@ struct sdca_init_write { · 32 unmodified lines
133137 #define SDCA_CTL_TYPE_S(ent, sel) SDCA_CTL_TYPE(SDCA_ENTITY_TYPE_##ent, \
134138 SDCA_CTL_##ent##_##sel)
135139
140+/**
141+ * enum sdca_messageoffset_range - Column definitions UMP MessageOffset
142+ */
143+enum sdca_messageoffset_range {
144+ SDCA_MESSAGEOFFSET_BUFFER_START_ADDRESS = 0,
145+ SDCA_MESSAGEOFFSET_BUFFER_LENGTH = 1,
146+ SDCA_MESSAGEOFFSET_UMP_MODE = 2,
147+ SDCA_MESSAGEOFFSET_NCOLS = 3,
148+};
149+
150+/**
151+ * enum sdca_ump_mode - SDCA UMP Mode
152+ */
153+enum sdca_ump_mode {
154+ SDCA_UMP_MODE_DIRECT = 0x00,
155+ SDCA_UMP_MODE_INDIRECT = 0x01,
156+};
157+
158+/**
159+ * enum sdca_ump_owner - SDCA UMP Owner
160+ */
161+enum sdca_ump_owner {
162+ SDCA_UMP_OWNER_HOST = 0x00,
163+ SDCA_UMP_OWNER_DEVICE = 0x01,
164+};
165+
136166 /**
137167 * enum sdca_it_controls - SDCA Controls for Input Terminal
138168 *
@@ -258,6 +288,27 @@ enum sdca_xu_controls { · 119 unmodified lines
258288 SDCA_CTL_XU_FDL_STATUS = 0x14,
259289 SDCA_CTL_XU_FDL_SET_INDEX = 0x15,
260290 SDCA_CTL_XU_FDL_HOST_REQUEST = 0x16,
291+
292+ /* FDL Status Host->Device bit definitions */
293+ SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK = BIT(0),
294+ SDCA_CTL_XU_FDLH_TRANSFERRED_FILE = BIT(1),
295+ SDCA_CTL_XU_FDLH_SET_IN_PROGRESS = BIT(2),
296+ SDCA_CTL_XU_FDLH_RESET_ACK = BIT(4),
297+ SDCA_CTL_XU_FDLH_REQ_ABORT = BIT(5),
298+ /* FDL Status Device->Host bit definitions */
299+ SDCA_CTL_XU_FDLD_REQ_RESET = BIT(4),
300+ SDCA_CTL_XU_FDLD_REQ_ABORT = BIT(5),
301+ SDCA_CTL_XU_FDLD_ACK_TRANSFER = BIT(6),
302+ SDCA_CTL_XU_FDLD_NEEDS_SET = BIT(7),
303+};
304+
305+/**
306+ * enum sdca_set_index_range - Column definitions UMP SetIndex
307+ */
308+enum sdca_fdl_set_index_range {
309+ SDCA_FDL_SET_INDEX_SET_NUMBER = 0,
310+ SDCA_FDL_SET_INDEX_FILE_SET_ID = 1,
311+ SDCA_FDL_SET_INDEX_NCOLS = 2,
261312 };
262313
263314 /**
@@ -542,6 +593,9 @@ enum sdca_entity0_controls { · 278 unmodified lines
542593 SDCA_CTL_ENTITY_0_FUNCTION_NEEDS_INITIALIZATION = BIT(5),
543594 SDCA_CTL_ENTITY_0_FUNCTION_HAS_BEEN_RESET = BIT(6),
544595 SDCA_CTL_ENTITY_0_FUNCTION_BUSY = BIT(7),
596+
597+ /* Function Action Bits */
598+ SDCA_CTL_ENTITY_0_RESET_FUNCTION_NOW = BIT(0),
545599 };
546600
547601 #define SDCA_CTL_MIC_BIAS_NAME "Mic Bias"
@@ -557,7 +611,7 @@ enum sdca_entity0_controls { · 9 unmodified lines
557611 #define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type"
558612 #define SDCA_CTL_MIXER_NAME "Mixer"
559613 #define SDCA_CTL_SELECTOR_NAME "Selector"
560−#define SDCA_CTL_MUTE_NAME "Mute"
614+#define SDCA_CTL_MUTE_NAME "Channel"
561615 #define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume"
562616 #define SDCA_CTL_AGC_NAME "AGC"
563617 #define SDCA_CTL_BASS_BOOST_NAME "Bass Boost"
@@ -771,6 +825,7 @@ struct sdca_control { · 207 unmodified lines
771825 u8 layers;
772826
773827 bool deferrable;
828+ bool is_volatile;
774829 bool has_default;
775830 bool has_fixed;
776831 };
@@ -1089,6 +1144,27 @@ struct sdca_entity_hide { · 312 unmodified lines
10891144 struct hid_descriptor hid_desc;
10901145 };
10911146
1147+/**
1148+ * enum sdca_xu_reset_machanism - SDCA FDL Resets
1149+ */
1150+enum sdca_xu_reset_mechanism {
1151+ SDCA_XU_RESET_FUNCTION = 0x0,
1152+ SDCA_XU_RESET_DEVICE = 0x1,
1153+ SDCA_XU_RESET_BUS = 0x2,
1154+};
1155+
1156+/**
1157+ * struct sdca_entity_xu - information specific to XU Entities
1158+ * @max_delay: the maximum time in microseconds allowed for the Device
1159+ * to change the ownership from Device to Host
1160+ * @reset_mechanism: indicates the type of reset that can be requested
1161+ * the end of an FDL.
1162+ */
1163+struct sdca_entity_xu {
1164+ unsigned int max_delay;
1165+ enum sdca_xu_reset_mechanism reset_mechanism;
1166+};
1167+
10921168 /**
10931169 * struct sdca_entity - information for one SDCA Entity
10941170 * @label: String such as "OT 12".
@@ -1105,6 +1181,7 @@ struct sdca_entity_hide { · 10 unmodified lines
11051181 * @pde: Power Domain Entity specific Entity properties.
11061182 * @ge: Group Entity specific Entity properties.
11071183 * @hide: HIDE Entity specific Entity properties.
1184+ * @xu: XU Entity specific Entity properties.
11081185 */
11091186 struct sdca_entity {
11101187 const char *label;
@@ -1122,6 +1199,7 @@ struct sdca_entity { · 11 unmodified lines
11221199 struct sdca_entity_pde pde;
11231200 struct sdca_entity_ge ge;
11241201 struct sdca_entity_hide hide;
1202+ struct sdca_entity_xu xu;
11251203 };
11261204 };
11271205
@@ -1288,6 +1366,42 @@ enum sdca_cluster_range { · 160 unmodified lines
12881366 SDCA_CLUSTER_NCOLS = 2,
12891367 };
12901368
1369+/**
1370+ * struct sdca_fdl_file - information about a file from a fileset used in FDL
1371+ * @vendor_id: Vendor ID of the file.
1372+ * @file_id: File ID of the file.
1373+ * @fdl_offset: Offset information for FDL.
1374+ */
1375+struct sdca_fdl_file {
1376+ u16 vendor_id;
1377+ u32 file_id;
1378+ u32 fdl_offset;
1379+};
1380+
1381+/**
1382+ * struct sdca_fdl_set - information about a set of files used in FDL
1383+ * @files: Array of files in this FDL set.
1384+ * @num_files: Number of files in this FDL set.
1385+ * @id: ID of the FDL set.
1386+ */
1387+struct sdca_fdl_set {
1388+ struct sdca_fdl_file *files;
1389+ int num_files;
1390+ u32 id;
1391+};
1392+
1393+/**
1394+ * struct sdca_fdl_data - information about a function's FDL data
1395+ * @swft: Pointer to the SoundWire File Table.
1396+ * @sets: Array of FDL sets used by this function.
1397+ * @num_sets: Number of FDL sets used by this function.
1398+ */
1399+struct sdca_fdl_data {
1400+ struct acpi_table_swft *swft;
1401+ struct sdca_fdl_set *sets;
1402+ int num_sets;
1403+};
1404+
12911405 /**
12921406 * struct sdca_function_data - top-level information for one SDCA function
12931407 * @desc: Pointer to short descriptor from initial parsing.
@@ -1299,6 +1413,9 @@ enum sdca_cluster_range { · 5 unmodified lines
12991413 * @num_clusters: Number of Channel Clusters reported in this Function.
13001414 * @busy_max_delay: Maximum Function busy delay in microseconds, before an
13011415 * error should be reported.
1416+ * @reset_max_delay: Maximum Function reset delay in microseconds, before an
1417+ * error should be reported.
1418+ * @fdl_data: FDL data for this Function, if available.
13021419 */
13031420 struct sdca_function_data {
13041421 struct sdca_function_desc *desc;
@@ -1311,6 +1428,9 @@ struct sdca_function_data { · 6 unmodified lines
13111428 int num_clusters;
13121429
13131430 unsigned int busy_max_delay;
1431+ unsigned int reset_max_delay;
1432+
1433+ struct sdca_fdl_data fdl_data;
13141434 };
13151435
13161436 static inline u32 sdca_range(struct sdca_control_range *range,
@@ -1332,10 +1452,12 @@ static inline u32 sdca_range_search(struct sdca_control_range *range, · 15 unmodified lines
13321452 return 0;
13331453 }
13341454
1335−int sdca_parse_function(struct device *dev,
1455+int sdca_parse_function(struct device *dev, struct sdw_slave *sdw,
13361456 struct sdca_function_desc *desc,
13371457 struct sdca_function_data *function);
13381458
1459+const char *sdca_find_terminal_name(enum sdca_terminal_type type);
1460+
13391461 struct sdca_control *sdca_selector_find_control(struct device *dev,
13401462 struct sdca_entity *entity,
13411463 const int sel);
include/sound/sdca_hid.h+17−4
@@ -8,14 +8,27 @@ · 7 unmodified lines
88 #ifndef __SDCA_HID_H__
99 #define __SDCA_HID_H__
1010
11−#include <linux/types.h>
12−#include <linux/hid.h>
11+struct device;
12+struct sdw_slave;
13+
14+struct sdca_entity;
15+struct sdca_interrupt;
1316
1417 #if IS_ENABLED(CONFIG_SND_SOC_SDCA_HID)
15−int sdca_add_hid_device(struct device *dev, struct sdca_entity *entity);
18+
19+int sdca_add_hid_device(struct device *dev, struct sdw_slave *sdw,
20+ struct sdca_entity *entity);
21+int sdca_hid_process_report(struct sdca_interrupt *interrupt);
1622
1723 #else
18−static inline int sdca_add_hid_device(struct device *dev, struct sdca_entity *entity)
24+
25+static inline int sdca_add_hid_device(struct device *dev, struct sdw_slave *sdw,
26+ struct sdca_entity *entity)
27+{
28+ return 0;
29+}
30+
31+static inline int sdca_hid_process_report(struct sdca_interrupt *interrupt)
1932 {
2033 return 0;
2134 }
include/sound/sdca_interrupts.h+14−5
@@ -23,18 +23,23 @@ struct sdca_function_data; · 22 unmodified lines
2323 /**
2424 * struct sdca_interrupt - contains information about a single SDCA interrupt
2525 * @name: The name of the interrupt.
26+ * @dev: Pointer to the Function device.
27+ * @device_regmap: Pointer to the IRQ regmap.
28+ * @function_regmap: Pointer to the SDCA Function regmap.
2629 * @component: Pointer to the ASoC component owns the interrupt.
2730 * @function: Pointer to the Function that the interrupt is associated with.
2831 * @entity: Pointer to the Entity that the interrupt is associated with.
2932 * @control: Pointer to the Control that the interrupt is associated with.
3033 * @priv: Pointer to private data for use by the handler.
31− * @externally_requested: Internal flag used to check if a client driver has
32− * already requested the interrupt, for custom handling, allowing the core to
33− * skip handling this interrupt.
34+ * @irq: IRQ number allocated to this interrupt, also used internally to track
35+ * the IRQ being assigned.
3436 */
3537 struct sdca_interrupt {
3638 const char *name;
3739
40+ struct device *dev;
41+ struct regmap *device_regmap;
42+ struct regmap *function_regmap;
3843 struct snd_soc_component *component;
3944 struct sdca_function_data *function;
4045 struct sdca_entity *entity;
@@ -42,7 +47,7 @@ struct sdca_interrupt { · 1 unmodified line
4247
4348 void *priv;
4449
45− bool externally_requested;
50+ int irq;
4651 };
4752
4853 /**
@@ -64,11 +69,15 @@ struct sdca_interrupt_info { · 15 unmodified lines
6469 int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *interrupt_info,
6570 int sdca_irq, const char *name, irq_handler_t handler,
6671 void *data);
67−int sdca_irq_data_populate(struct snd_soc_component *component,
72+int sdca_irq_data_populate(struct device *dev, struct regmap *function_regmap,
73+ struct snd_soc_component *component,
6874 struct sdca_function_data *function,
6975 struct sdca_entity *entity,
7076 struct sdca_control *control,
7177 struct sdca_interrupt *interrupt);
78+int sdca_irq_populate_early(struct device *dev, struct regmap *function_regmap,
79+ struct sdca_function_data *function,
80+ struct sdca_interrupt_info *info);
7281 int sdca_irq_populate(struct sdca_function_data *function,
7382 struct snd_soc_component *component,
7483 struct sdca_interrupt_info *info);
include/sound/sdca_regmap.h+2−0
@@ -27,5 +27,7 @@ int sdca_regmap_populate_constants(struct device *dev, struct sdca_function_data · 26 unmodified lines
2727
2828 int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap,
2929 struct sdca_function_data *function);
30+int sdca_regmap_write_init(struct device *dev, struct regmap *regmap,
31+ struct sdca_function_data *function);
3032
3133 #endif // __SDCA_REGMAP_H__
include/sound/sdca_ump.h+50−0
@@ -0,0 +1,50 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * The MIPI SDCA specification is available for public downloads at
4+ * https://www.mipi.org/mipi-sdca-v1-0-download
5+ *
6+ * Copyright (C) 2025 Cirrus Logic, Inc. and
7+ * Cirrus Logic International Semiconductor Ltd.
8+ */
9+
10+#ifndef __SDCA_UMP_H__
11+#define __SDCA_UMP_H__
12+
13+struct regmap;
14+struct sdca_control;
15+struct sdca_entity;
16+struct sdca_function_data;
17+struct snd_soc_component;
18+struct delayed_work;
19+
20+int sdca_ump_get_owner_host(struct device *dev,
21+ struct regmap *function_regmap,
22+ struct sdca_function_data *function,
23+ struct sdca_entity *entity,
24+ struct sdca_control *control);
25+int sdca_ump_set_owner_device(struct device *dev,
26+ struct regmap *function_regmap,
27+ struct sdca_function_data *function,
28+ struct sdca_entity *entity,
29+ struct sdca_control *control);
30+int sdca_ump_read_message(struct device *dev,
31+ struct regmap *device_regmap,
32+ struct regmap *function_regmap,
33+ struct sdca_function_data *function,
34+ struct sdca_entity *entity,
35+ unsigned int offset_sel, unsigned int length_sel,
36+ void **msg);
37+int sdca_ump_write_message(struct device *dev,
38+ struct regmap *device_regmap,
39+ struct regmap *function_regmap,
40+ struct sdca_function_data *function,
41+ struct sdca_entity *entity,
42+ unsigned int offset_sel, unsigned int msg_offset,
43+ unsigned int length_sel,
44+ void *msg, int msg_len);
45+
46+void sdca_ump_cancel_timeout(struct delayed_work *work);
47+void sdca_ump_schedule_timeout(struct delayed_work *work,
48+ unsigned int timeout_us);
49+
50+#endif // __SDCA_UMP_H__
include/sound/soc-acpi-intel-match.h+2−0
@@ -34,6 +34,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[]; · 33 unmodified lines
3434 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[];
3535 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[];
3636 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[];
37+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[];
3738
3839 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[];
3940 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_sdw_machines[];
@@ -46,6 +47,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[]; · 6 unmodified lines
4647 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[];
4748 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[];
4849 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[];
50+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_sdw_machines[];
4951
5052 /*
5153 * generic table used for HDA codec-based platforms, possibly with
include/sound/soc-acpi.h+4−4
@@ -114,8 +114,8 @@ struct snd_soc_acpi_endpoint { · 113 unmodified lines
114114 * @name_prefix: string used for codec controls
115115 */
116116 struct snd_soc_acpi_adr_device {
117− const u64 adr;
118− const u8 num_endpoints;
117+ u64 adr;
118+ u8 num_endpoints;
119119 const struct snd_soc_acpi_endpoint *endpoints;
120120 const char *name_prefix;
121121 };
@@ -131,8 +131,8 @@ struct snd_soc_acpi_adr_device { · 9 unmodified lines
131131 */
132132
133133 struct snd_soc_acpi_link_adr {
134− const u32 mask;
135− const u32 num_adr;
134+ u32 mask;
135+ u32 num_adr;
136136 const struct snd_soc_acpi_adr_device *adr_d;
137137 };
138138
include/sound/soc.h+19−20
@@ -319,6 +319,13 @@ struct platform_device; · 318 unmodified lines
319319 #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
320320 SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
321321
322+#define SOC_ENUM_EXT_ACC(xname, xenum, xhandler_get, xhandler_put, xaccess) \
323+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
324+ .access = xaccess, \
325+ .info = snd_soc_info_enum_double, \
326+ .get = xhandler_get, .put = xhandler_put, \
327+ .private_value = (unsigned long)&xenum }
328+
322329 #define SND_SOC_BYTES(xname, xbase, xregs) \
323330 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
324331 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
@@ -331,6 +338,13 @@ struct platform_device; · 6 unmodified lines
331338 .put = xhandler_put, .private_value = \
332339 ((unsigned long)&(struct soc_bytes) \
333340 {.base = xbase, .num_regs = xregs }) }
341+#define SND_SOC_BYTES_E_ACC(xname, xbase, xregs, xhandler_get, xhandler_put, xaccess) \
342+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
343+ .access = xaccess, \
344+ .info = snd_soc_bytes_info, .get = xhandler_get, \
345+ .put = xhandler_put, .private_value = \
346+ ((unsigned long)&(struct soc_bytes) \
347+ {.base = xbase, .num_regs = xregs }) }
334348
335349 #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \
336350 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -1225,6 +1239,7 @@ struct soc_mixer_control { · 888 unmodified lines
12251239 unsigned int sign_bit;
12261240 unsigned int invert:1;
12271241 unsigned int autodisable:1;
1242+ unsigned int sdca_q78:1;
12281243 #ifdef CONFIG_SND_SOC_TOPOLOGY
12291244 struct snd_soc_dobj dobj;
12301245 #endif
@@ -1305,22 +1320,6 @@ static inline unsigned int snd_soc_enum_item_to_val(const struct soc_enum *e, · 74 unmodified lines
13051320 return e->values[item];
13061321 }
13071322
1308−/**
1309− * snd_soc_kcontrol_component() - Returns the component that registered the
1310− * control
1311− * @kcontrol: The control for which to get the component
1312− *
1313− * Note: This function will work correctly if the control has been registered
1314− * for a component. With snd_soc_add_codec_controls() or via table based
1315− * setup for either a CODEC or component driver. Otherwise the behavior is
1316− * undefined.
1317− */
1318−static inline struct snd_soc_component *snd_soc_kcontrol_component(
1319− struct snd_kcontrol *kcontrol)
1320−{
1321− return snd_kcontrol_chip(kcontrol);
1322−}
1323−
13241323 int snd_soc_util_init(void);
13251324 void snd_soc_util_exit(void);
13261325
@@ -1482,22 +1481,22 @@ static inline void _snd_soc_dapm_mutex_assert_held_c(struct snd_soc_card *card) · 155 unmodified lines
14821481
14831482 static inline void _snd_soc_dapm_mutex_lock_root_d(struct snd_soc_dapm_context *dapm)
14841483 {
1485− _snd_soc_dapm_mutex_lock_root_c(dapm->card);
1484+ _snd_soc_dapm_mutex_lock_root_c(snd_soc_dapm_to_card(dapm));
14861485 }
14871486
14881487 static inline void _snd_soc_dapm_mutex_lock_d(struct snd_soc_dapm_context *dapm)
14891488 {
1490− _snd_soc_dapm_mutex_lock_c(dapm->card);
1489+ _snd_soc_dapm_mutex_lock_c(snd_soc_dapm_to_card(dapm));
14911490 }
14921491
14931492 static inline void _snd_soc_dapm_mutex_unlock_d(struct snd_soc_dapm_context *dapm)
14941493 {
1495− _snd_soc_dapm_mutex_unlock_c(dapm->card);
1494+ _snd_soc_dapm_mutex_unlock_c(snd_soc_dapm_to_card(dapm));
14961495 }
14971496
14981497 static inline void _snd_soc_dapm_mutex_assert_held_d(struct snd_soc_dapm_context *dapm)
14991498 {
1500− _snd_soc_dapm_mutex_assert_held_c(dapm->card);
1499+ _snd_soc_dapm_mutex_assert_held_c(snd_soc_dapm_to_card(dapm));
15011500 }
15021501
15031502 #define snd_soc_dapm_mutex_lock_root(x) _Generic((x), \
include/sound/soc_sdw_utils.h+16−3
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <sound/soc-acpi.h>
1414
1515 #define SOC_SDW_MAX_DAI_NUM 8
16+#define SOC_SDW_MAX_AUX_NUM 2
1617 #define SOC_SDW_MAX_NO_PROPS 2
1718 #define SOC_SDW_JACK_JDSRC(quirk) ((quirk) & GENMASK(3, 0))
1819
@@ -45,6 +46,7 @@ struct asoc_sdw_codec_info; · 26 unmodified lines
4546
4647 struct asoc_sdw_dai_info {
4748 const bool direction[2]; /* playback & capture support */
49+ const char *codec_name;
4850 const char *dai_name;
4951 const char *component_name;
5052 const int dai_type;
@@ -64,16 +66,22 @@ struct asoc_sdw_dai_info { · 13 unmodified lines
6466 bool quirk_exclude;
6567 };
6668
69+struct asoc_sdw_aux_info {
70+ const char *codec_name;
71+};
72+
6773 struct asoc_sdw_codec_info {
6874 const int part_id;
6975 const int version_id;
70− const char *codec_name;
76+ const char *name_prefix;
7177 int amp_num;
7278 const u8 acpi_id[ACPI_ID_LEN];
7379 const bool ignore_internal_dmic;
7480 const struct snd_soc_ops *ops;
7581 struct asoc_sdw_dai_info dais[SOC_SDW_MAX_DAI_NUM];
7682 const int dai_num;
83+ struct asoc_sdw_aux_info auxs[SOC_SDW_MAX_AUX_NUM];
84+ const int aux_num;
7785
7886 int (*codec_card_late_probe)(struct snd_soc_card *card);
7987
@@ -130,7 +138,7 @@ int asoc_sdw_hw_free(struct snd_pcm_substream *substream); · 50 unmodified lines
130138 void asoc_sdw_shutdown(struct snd_pcm_substream *substream);
131139
132140 const char *asoc_sdw_get_codec_name(struct device *dev,
133− const struct asoc_sdw_codec_info *codec_info,
141+ const struct asoc_sdw_dai_info *dai_info,
134142 const struct snd_soc_acpi_link_adr *adr_link,
135143 int adr_index);
136144
@@ -164,12 +172,15 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d · 27 unmodified lines
164172 int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd),
165173 const struct snd_soc_ops *ops);
166174
167−int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *num_ends);
175+int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card,
176+ int *num_devs, int *num_ends, int *num_aux);
168177
169178 struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks,
170179 const struct snd_soc_acpi_endpoint *new);
180+int asoc_sdw_get_dai_type(u32 type);
171181
172182 int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
183+ struct snd_soc_aux_dev *soc_aux,
173184 struct asoc_sdw_dailink *soc_dais,
174185 struct asoc_sdw_endpoint *soc_ends,
175186 int *num_devs);
@@ -246,6 +257,8 @@ int asoc_sdw_cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da · 70 unmodified lines
246257 int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
247258 int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
248259 int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
260+int asoc_sdw_cs42l45_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
261+int asoc_sdw_cs42l45_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
249262 int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
250263 int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
251264 /* TI */
include/sound/tas2781.h+7−1
@@ -117,14 +117,20 @@ enum audio_device { · 116 unmodified lines
117117 TAS2120,
118118 TAS2320,
119119 TAS2563,
120+ TAS2568,
120121 TAS2570,
121122 TAS2572,
123+ TAS2574,
122124 TAS2781,
123125 TAS5802,
126+ TAS5806M,
127+ TAS5806MD,
124128 TAS5815,
129+ TAS5822,
125130 TAS5825,
126131 TAS5827,
127132 TAS5828,
133+ TAS5830,
128134 TAS_OTHERS,
129135 };
130136
@@ -197,7 +203,6 @@ struct tasdevice_priv { · 66 unmodified lines
197203 struct acoustic_data acou_data;
198204 #endif
199205 struct tasdevice_fw *fmw;
200− struct gpio_desc *speaker_id;
201206 struct gpio_desc *reset;
202207 struct mutex codec_lock;
203208 struct regmap *regmap;
@@ -215,6 +220,7 @@ struct tasdevice_priv { · 11 unmodified lines
215220 unsigned int magic_num;
216221 unsigned int chip_id;
217222 unsigned int sysclk;
223+ int speaker_id;
218224
219225 int irq;
220226 int cur_prog;
include/trace/events/asoc.h+2−2
@@ -27,8 +27,8 @@ DECLARE_EVENT_CLASS(snd_soc_dapm, · 26 unmodified lines
2727 TP_ARGS(dapm, val),
2828
2929 TP_STRUCT__entry(
30− __string( card_name, dapm->card->name)
31− __string( comp_name, dapm->component ? dapm->component->name : "(none)")
30+ __string( card_name, snd_soc_dapm_to_card(dapm)->name)
31+ __string( comp_name, snd_soc_dapm_to_component(dapm) ? snd_soc_dapm_to_component(dapm)->name : "(none)")
3232 __field( int, val)
3333 ),
3434
include/uapi/sound/intel/avs/tokens.h+6−0
@@ -21,6 +21,7 @@ enum avs_tplg_token { · 20 unmodified lines
2121 AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8,
2222 AVS_TKN_MANIFEST_NUM_CONDPATH_TMPLS_U32 = 9,
2323 AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32 = 10,
24+ AVS_TKN_MANIFEST_NUM_NHLT_CONFIGS_U32 = 11,
2425
2526 /* struct avs_tplg_library */
2627 AVS_TKN_LIBRARY_ID_U32 = 101,
@@ -124,6 +125,7 @@ enum avs_tplg_token { · 97 unmodified lines
124125 AVS_TKN_MOD_KCONTROL_ID_U32 = 1707,
125126 AVS_TKN_MOD_INIT_CONFIG_NUM_IDS_U32 = 1708,
126127 AVS_TKN_MOD_INIT_CONFIG_ID_U32 = 1709,
128+ AVS_TKN_MOD_NHLT_CONFIG_ID_U32 = 1710,
127129
128130 /* struct avs_tplg_path_template */
129131 AVS_TKN_PATH_TMPL_ID_U32 = 1801,
@@ -160,6 +162,10 @@ enum avs_tplg_token { · 30 unmodified lines
160162 AVS_TKN_INIT_CONFIG_ID_U32 = 2401,
161163 AVS_TKN_INIT_CONFIG_PARAM_U8 = 2402,
162164 AVS_TKN_INIT_CONFIG_LENGTH_U32 = 2403,
165+
166+ /* struct avs_tplg_nhlt_config */
167+ AVS_TKN_NHLT_CONFIG_ID_U32 = 2501,
168+ AVS_TKN_NHLT_CONFIG_SIZE_U32 = 2502,
163169 };
164170
165171 #endif
lib/tests/string_kunit.c+13−0
@@ -602,6 +602,18 @@ static void string_test_memtostr(struct kunit *test) · 601 unmodified lines
602602 KUNIT_EXPECT_EQ(test, dest[7], '\0');
603603 }
604604
605+static void string_test_strends(struct kunit *test)
606+{
607+ KUNIT_EXPECT_TRUE(test, strends("foo-bar", "bar"));
608+ KUNIT_EXPECT_TRUE(test, strends("foo-bar", "-bar"));
609+ KUNIT_EXPECT_TRUE(test, strends("foobar", "foobar"));
610+ KUNIT_EXPECT_TRUE(test, strends("foobar", ""));
611+ KUNIT_EXPECT_FALSE(test, strends("bar", "foobar"));
612+ KUNIT_EXPECT_FALSE(test, strends("", "foo"));
613+ KUNIT_EXPECT_FALSE(test, strends("foobar", "ba"));
614+ KUNIT_EXPECT_TRUE(test, strends("", ""));
615+}
616+
605617 static struct kunit_case string_test_cases[] = {
606618 KUNIT_CASE(string_test_memset16),
607619 KUNIT_CASE(string_test_memset32),
@@ -623,6 +635,7 @@ static struct kunit_case string_test_cases[] = { · 15 unmodified lines
623635 KUNIT_CASE(string_test_strlcat),
624636 KUNIT_CASE(string_test_strtomem),
625637 KUNIT_CASE(string_test_memtostr),
638+ KUNIT_CASE(string_test_strends),
626639 {}
627640 };
628641
sound/ac97_bus.c+8−5
@@ -46,11 +46,14 @@ static bool snd_ac97_check_id(struct snd_ac97 *ac97, unsigned int id, · 45 unmodified lines
4646 * @id_mask: Mask that is applied to the device ID before comparing to @id
4747 *
4848 * This function resets the AC'97 device. If @try_warm is true the function
49− * first performs a warm reset. If the warm reset is successful the function
50− * returns 1. Otherwise or if @try_warm is false the function issues cold reset
51− * followed by a warm reset. If this is successful the function returns 0,
52− * otherwise a negative error code. If @id is 0 any valid device ID will be
53− * accepted, otherwise only the ID that matches @id and @id_mask is accepted.
49+ * first performs a warm reset. If @try_warm is false the function issues
50+ * cold reset followed by a warm reset. If @id is 0 any valid device ID
51+ * will be accepted, otherwise only the ID that matches @id and @id_mask
52+ * is accepted.
53+ * Returns:
54+ * * %1 - if warm reset is successful
55+ * * %0 - if cold reset and warm reset is successful
56+ * * %-ENODEV - if @id and @id_mask not matching
5457 */
5558 int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
5659 unsigned int id_mask)
sound/core/pcm_drm_eld.c+1−1
@@ -379,7 +379,7 @@ int snd_parse_eld(struct device *dev, struct snd_parsed_hdmi_eld *e, · 378 unmodified lines
379379 * in console or for audio devices. Assume the highest speakers
380380 * configuration, to _not_ prohibit multi-channel audio playback.
381381 */
382− if (!e->spk_alloc)
382+ if (!e->spk_alloc && e->sad_count)
383383 e->spk_alloc = 0xffff;
384384
385385 return 0;
sound/core/rawmidi.c+1−4
@@ -2106,13 +2106,11 @@ EXPORT_SYMBOL(snd_rawmidi_set_ops); · 2105 unmodified lines
21062106
21072107 static int __init alsa_rawmidi_init(void)
21082108 {
2109−
21102109 snd_ctl_register_ioctl(snd_rawmidi_control_ioctl);
21112110 snd_ctl_register_ioctl_compat(snd_rawmidi_control_ioctl);
21122111 #ifdef CONFIG_SND_OSSEMUL
2113− { int i;
21142112 /* check device map table */
2115− for (i = 0; i < SNDRV_CARDS; i++) {
2113+ for (int i = 0; i < SNDRV_CARDS; i++) {
21162114 if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
21172115 pr_err("ALSA: rawmidi: invalid midi_map[%d] = %d\n",
21182116 i, midi_map[i]);
@@ -2124,7 +2122,6 @@ static int __init alsa_rawmidi_init(void) · 5 unmodified lines
21242122 amidi_map[i] = 1;
21252123 }
21262124 }
2127− }
21282125 #endif /* CONFIG_SND_OSSEMUL */
21292126 return 0;
21302127 }
sound/drivers/pcmtest.c+2−2
@@ -696,10 +696,10 @@ static int setup_patt_bufs(void) · 695 unmodified lines
696696 size_t i;
697697
698698 for (i = 0; i < ARRAY_SIZE(patt_bufs); i++) {
699− patt_bufs[i].buf = kzalloc(MAX_PATTERN_LEN, GFP_KERNEL);
699+ patt_bufs[i].buf = kmalloc(MAX_PATTERN_LEN, GFP_KERNEL);
700700 if (!patt_bufs[i].buf)
701701 break;
702− strcpy(patt_bufs[i].buf, DEFAULT_PATTERN);
702+ strscpy_pad(patt_bufs[i].buf, DEFAULT_PATTERN, MAX_PATTERN_LEN);
703703 patt_bufs[i].len = DEFAULT_PATTERN_LEN;
704704 }
705705
sound/firewire/dice/Makefile+1−1
@@ -2,5 +2,5 @@ · 1 unmodified line
22 snd-dice-y := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
33 dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
44 dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \
5− dice-harman.o dice-focusrite.o dice-weiss.o
5+ dice-harman.o dice-focusrite.o dice-weiss.o dice-teac.o
66 obj-$(CONFIG_SND_DICE) += snd-dice.o
sound/firewire/dice/dice-extension.c+2−2
@@ -116,7 +116,7 @@ static int detect_stream_formats(struct snd_dice *dice, u64 section_addr) · 115 unmodified lines
116116 break;
117117
118118 base_offset += EXT_APP_STREAM_ENTRIES;
119− stream_count = be32_to_cpu(reg[0]);
119+ stream_count = min_t(unsigned int, be32_to_cpu(reg[0]), MAX_STREAMS);
120120 err = read_stream_entries(dice, section_addr, base_offset,
121121 stream_count, mode,
122122 dice->tx_pcm_chs,
@@ -125,7 +125,7 @@ static int detect_stream_formats(struct snd_dice *dice, u64 section_addr) · 2 unmodified lines
125125 break;
126126
127127 base_offset += stream_count * EXT_APP_STREAM_ENTRY_SIZE;
128− stream_count = be32_to_cpu(reg[1]);
128+ stream_count = min_t(unsigned int, be32_to_cpu(reg[1]), MAX_STREAMS);
129129 err = read_stream_entries(dice, section_addr, base_offset,
130130 stream_count,
131131 mode, dice->rx_pcm_chs,
sound/firewire/dice/dice-teac.c+43−0
@@ -0,0 +1,43 @@
1+// SPDX-License-Identifier: GPL-2.0
2+// dice-teac.c - a part of driver for DICE based devices
3+//
4+// Copyright (c) 2025 Takashi Sakamoto
5+
6+#include "dice.h"
7+
8+int snd_dice_detect_teac_formats(struct snd_dice *dice)
9+{
10+ __be32 reg;
11+ u32 data;
12+ int err;
13+
14+ err = snd_dice_transaction_read_tx(dice, TX_NUMBER, &reg, sizeof(reg));
15+ if (err < 0)
16+ return err;
17+
18+ dice->tx_pcm_chs[0][SND_DICE_RATE_MODE_LOW] = 16;
19+ dice->tx_pcm_chs[0][SND_DICE_RATE_MODE_MIDDLE] = 16;
20+ dice->tx_midi_ports[0] = 1;
21+
22+ data = be32_to_cpu(reg);
23+ if (data > 1) {
24+ dice->tx_pcm_chs[1][SND_DICE_RATE_MODE_LOW] = 16;
25+ dice->tx_pcm_chs[1][SND_DICE_RATE_MODE_MIDDLE] = 16;
26+ }
27+
28+ err = snd_dice_transaction_read_rx(dice, RX_NUMBER, &reg, sizeof(reg));
29+ if (err < 0)
30+ return err;
31+
32+ dice->rx_pcm_chs[0][SND_DICE_RATE_MODE_LOW] = 16;
33+ dice->rx_pcm_chs[0][SND_DICE_RATE_MODE_MIDDLE] = 16;
34+ dice->rx_midi_ports[0] = 1;
35+
36+ data = be32_to_cpu(reg);
37+ if (data > 1) {
38+ dice->rx_pcm_chs[1][SND_DICE_RATE_MODE_LOW] = 16;
39+ dice->rx_pcm_chs[1][SND_DICE_RATE_MODE_MIDDLE] = 16;
40+ }
41+
42+ return 0;
43+}
sound/firewire/dice/dice.c+13−0
@@ -22,6 +22,7 @@ MODULE_LICENSE("GPL"); · 21 unmodified lines
2222 #define OUI_PRESONUS 0x000a92
2323 #define OUI_HARMAN 0x000fd7
2424 #define OUI_AVID 0x00a07e
25+#define OUI_TEAC 0x00022e
2526
2627 #define DICE_CATEGORY_ID 0x04
2728 #define WEISS_CATEGORY_ID 0x00
@@ -458,6 +459,18 @@ static const struct ieee1394_device_id dice_id_table[] = { · 430 unmodified lines
458459 .match_flags = IEEE1394_MATCH_VERSION,
459460 .version = DICE_INTERFACE,
460461 },
462+ // Tascam IF-FW/DM MkII for DM-3200 and DM-4800.
463+ {
464+ .match_flags = IEEE1394_MATCH_VENDOR_ID |
465+ IEEE1394_MATCH_MODEL_ID |
466+ IEEE1394_MATCH_SPECIFIER_ID |
467+ IEEE1394_MATCH_VERSION,
468+ .vendor_id = OUI_TEAC,
469+ .model_id = OUI_TEAC,
470+ .specifier_id = OUI_TEAC,
471+ .version = 0x800006,
472+ .driver_data = (kernel_ulong_t)snd_dice_detect_teac_formats,
473+ },
461474 { }
462475 };
463476 MODULE_DEVICE_TABLE(ieee1394, dice_id_table);
sound/firewire/dice/dice.h+1−0
@@ -233,5 +233,6 @@ int snd_dice_detect_presonus_formats(struct snd_dice *dice); · 232 unmodified lines
233233 int snd_dice_detect_harman_formats(struct snd_dice *dice);
234234 int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice);
235235 int snd_dice_detect_weiss_formats(struct snd_dice *dice);
236+int snd_dice_detect_teac_formats(struct snd_dice *dice);
236237
237238 #endif
sound/hda/codecs/hdmi/intelhdmi.c+1−0
@@ -793,6 +793,7 @@ static const struct hda_device_id snd_hda_id_intelhdmi[] = { · 792 unmodified lines
793793 HDA_CODEC_ID_MODEL(0x80862820, "Lunar Lake HDMI", MODEL_ADLP),
794794 HDA_CODEC_ID_MODEL(0x80862822, "Panther Lake HDMI", MODEL_ADLP),
795795 HDA_CODEC_ID_MODEL(0x80862823, "Wildcat Lake HDMI", MODEL_ADLP),
796+ HDA_CODEC_ID_MODEL(0x80862824, "Nova Lake HDMI", MODEL_ADLP),
796797 HDA_CODEC_ID_MODEL(0x80862882, "Valleyview2 HDMI", MODEL_BYT),
797798 HDA_CODEC_ID_MODEL(0x80862883, "Braswell HDMI", MODEL_BYT),
798799 {} /* terminator */
sound/hda/codecs/realtek/alc269.c+101−10
@@ -3406,7 +3406,42 @@ static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, · 3405 unmodified lines
34063406 spec->power_hook = alc287_s4_power_gpio3_default;
34073407 spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
34083408 }
3409+/* GPIO2: mute led GPIO3: micmute led */
3410+static void alc245_tas2781_spi_hp_fixup_muteled(struct hda_codec *codec,
3411+ const struct hda_fixup *fix, int action)
3412+{
3413+ struct alc_spec *spec = codec->spec;
3414+ static const hda_nid_t conn[] = { 0x02 };
3415+
3416+ switch (action) {
3417+ case HDA_FIXUP_ACT_PRE_PROBE:
3418+ spec->gen.auto_mute_via_amp = 1;
3419+ snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3420+ break;
3421+ }
3422+
3423+ tas2781_fixup_spi(codec, fix, action);
3424+ alc_fixup_hp_gpio_led(codec, action, 0x04, 0x0);
3425+ alc285_fixup_hp_coef_micmute_led(codec, fix, action);
3426+}
3427+/* JD2: mute led GPIO3: micmute led */
3428+static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec,
3429+ const struct hda_fixup *fix, int action)
3430+{
3431+ struct alc_spec *spec = codec->spec;
3432+ static const hda_nid_t conn[] = { 0x02 };
3433+
3434+ switch (action) {
3435+ case HDA_FIXUP_ACT_PRE_PROBE:
3436+ spec->gen.auto_mute_via_amp = 1;
3437+ snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3438+ break;
3439+ }
34093440
3441+ tas2781_fixup_txnw_i2c(codec, fix, action);
3442+ alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
3443+ alc285_fixup_hp_coef_micmute_led(codec, fix, action);
3444+}
34103445 /*
34113446 * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
34123447 * at PM resume
@@ -3418,6 +3453,21 @@ static void alc283_fixup_dell_hp_resume(struct hda_codec *codec, · 5 unmodified lines
34183453 alc_write_coef_idx(codec, 0xd, 0x2800);
34193454 }
34203455
3456+/* Swap DAC assignments for HP and speaker */
3457+static void alc288_fixup_surface_swap_dacs(struct hda_codec *codec,
3458+ const struct hda_fixup *fix, int action)
3459+{
3460+ struct alc_spec *spec = codec->spec;
3461+ static hda_nid_t preferred_pairs[] = {
3462+ 0x21, 0x03, 0x14, 0x02, 0
3463+ };
3464+
3465+ if (action != HDA_FIXUP_ACT_PRE_PROBE)
3466+ return;
3467+
3468+ spec->gen.preferred_dacs = preferred_pairs;
3469+}
3470+
34213471 enum {
34223472 ALC269_FIXUP_GPIO2,
34233473 ALC269_FIXUP_SONY_VAIO,
@@ -3737,6 +3787,10 @@ enum { · 313 unmodified lines
37373787 ALC269_FIXUP_POSITIVO_P15X_HEADSET_MIC,
37383788 ALC289_FIXUP_ASUS_ZEPHYRUS_DUAL_SPK,
37393789 ALC256_FIXUP_VAIO_RPL_MIC_NO_PRESENCE,
3790+ ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED,
3791+ ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED,
3792+ ALC288_FIXUP_SURFACE_SWAP_DACS,
3793+ ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO,
37403794 };
37413795
37423796 /* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -5270,6 +5324,12 @@ static const struct hda_fixup alc269_fixups[] = { · 1527 unmodified lines
52705324 .type = HDA_FIXUP_FUNC,
52715325 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
52725326 },
5327+ [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO] = {
5328+ .type = HDA_FIXUP_FUNC,
5329+ .v.func = alc236_fixup_hp_mute_led_coefbit2,
5330+ .chained = true,
5331+ .chain_id = ALC236_FIXUP_HP_GPIO_LED,
5332+ },
52735333 [ALC236_FIXUP_LENOVO_INV_DMIC] = {
52745334 .type = HDA_FIXUP_FUNC,
52755335 .v.func = alc_fixup_inv_dmic,
@@ -6183,7 +6243,19 @@ static const struct hda_fixup alc269_fixups[] = { · 907 unmodified lines
61836243 },
61846244 .chained = true,
61856245 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6186− }
6246+ },
6247+ [ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED] = {
6248+ .type = HDA_FIXUP_FUNC,
6249+ .v.func = alc245_tas2781_spi_hp_fixup_muteled,
6250+ },
6251+ [ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED] = {
6252+ .type = HDA_FIXUP_FUNC,
6253+ .v.func = alc245_tas2781_i2c_hp_fixup_muteled,
6254+ },
6255+ [ALC288_FIXUP_SURFACE_SWAP_DACS] = {
6256+ .type = HDA_FIXUP_FUNC,
6257+ .v.func = alc288_fixup_surface_swap_dacs,
6258+ },
61876259 };
61886260
61896261 static const struct hda_quirk alc269_fixup_tbl[] = {
@@ -6526,6 +6598,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 336 unmodified lines
65266598 SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
65276599 SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
65286600 SND_PCI_QUIRK(0x103c, 0x8a75, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
6601+ SND_PCI_QUIRK(0x103c, 0x8a76, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
6602+ SND_PCI_QUIRK(0x103c, 0x8a77, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
65296603 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
65306604 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
65316605 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
@@ -6696,15 +6770,29 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 164 unmodified lines
66966770 SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
66976771 SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
66986772 SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
6699− SND_PCI_QUIRK(0x103c, 0x8ed5, "HP Merino13X", ALC245_FIXUP_TAS2781_SPI_2),
6700− SND_PCI_QUIRK(0x103c, 0x8ed6, "HP Merino13", ALC245_FIXUP_TAS2781_SPI_2),
6701− SND_PCI_QUIRK(0x103c, 0x8ed7, "HP Merino14", ALC245_FIXUP_TAS2781_SPI_2),
6702− SND_PCI_QUIRK(0x103c, 0x8ed8, "HP Merino16", ALC245_FIXUP_TAS2781_SPI_2),
6703− SND_PCI_QUIRK(0x103c, 0x8ed9, "HP Merino14W", ALC245_FIXUP_TAS2781_SPI_2),
6704− SND_PCI_QUIRK(0x103c, 0x8eda, "HP Merino16W", ALC245_FIXUP_TAS2781_SPI_2),
6705− SND_PCI_QUIRK(0x103c, 0x8f40, "HP Lampas14", ALC287_FIXUP_TXNW2781_I2C),
6706− SND_PCI_QUIRK(0x103c, 0x8f41, "HP Lampas16", ALC287_FIXUP_TXNW2781_I2C),
6707− SND_PCI_QUIRK(0x103c, 0x8f42, "HP LampasW14", ALC287_FIXUP_TXNW2781_I2C),
6773+ SND_PCI_QUIRK(0x103c, 0x8eb6, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6774+ SND_PCI_QUIRK(0x103c, 0x8eb7, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6775+ SND_PCI_QUIRK(0x103c, 0x8eb8, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6776+ SND_PCI_QUIRK(0x103c, 0x8ec1, "HP 200 G2i", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6777+ SND_PCI_QUIRK(0x103c, 0x8ec4, "HP Bantie I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6778+ SND_PCI_QUIRK(0x103c, 0x8ec5, "HP Bantie I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6779+ SND_PCI_QUIRK(0x103c, 0x8ece, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6780+ SND_PCI_QUIRK(0x103c, 0x8ecf, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6781+ SND_PCI_QUIRK(0x103c, 0x8ed2, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6782+ SND_PCI_QUIRK(0x103c, 0x8ed5, "HP EliteBook 8 Flip G2i 13", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6783+ SND_PCI_QUIRK(0x103c, 0x8ed6, "HP EliteBook 8 G2i 13", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6784+ SND_PCI_QUIRK(0x103c, 0x8ed7, "HP EliteBook 8 G2i 14", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6785+ SND_PCI_QUIRK(0x103c, 0x8ed8, "HP EliteBook 8 G2i 16", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6786+ SND_PCI_QUIRK(0x103c, 0x8ed9, "HP ZBook Firefly 14W", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6787+ SND_PCI_QUIRK(0x103c, 0x8eda, "HP ZBook Firefly 16W", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED),
6788+ SND_PCI_QUIRK(0x103c, 0x8ee4, "HP Bantie A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6789+ SND_PCI_QUIRK(0x103c, 0x8ee5, "HP Bantie A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
6790+ SND_PCI_QUIRK(0x103c, 0x8f0c, "HP ZBook X G2i 16W", ALC236_FIXUP_HP_GPIO_LED),
6791+ SND_PCI_QUIRK(0x103c, 0x8f0e, "HP ZBook X G2i 16W", ALC236_FIXUP_HP_GPIO_LED),
6792+ SND_PCI_QUIRK(0x103c, 0x8f40, "HP ZBook 8 G2a 14", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
6793+ SND_PCI_QUIRK(0x103c, 0x8f41, "HP ZBook 8 G2a 16", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
6794+ SND_PCI_QUIRK(0x103c, 0x8f42, "HP ZBook 8 G2a 14W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
6795+ SND_PCI_QUIRK(0x103c, 0x8f62, "HP ZBook 8 G2a 16W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
67086796 SND_PCI_QUIRK(0x1043, 0x1032, "ASUS VivoBook X513EA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
67096797 SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
67106798 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
@@ -6736,6 +6824,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 25 unmodified lines
67366824 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
67376825 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
67386826 SND_PCI_QUIRK(0x1043, 0x1314, "ASUS GA605K", ALC285_FIXUP_ASUS_GA605K_HEADSET_MIC),
6827+ SND_PCI_QUIRK(0x1043, 0x1384, "ASUS RC73XA", ALC287_FIXUP_TXNW2781_I2C),
6828+ SND_PCI_QUIRK(0x1043, 0x1394, "ASUS RC73YA", ALC287_FIXUP_TXNW2781_I2C),
67396829 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
67406830 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
67416831 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
@@ -6883,6 +6973,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 141 unmodified lines
68836973 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
68846974 SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
68856975 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6976+ SND_PCI_QUIRK(0x1414, 0x9c20, "Microsoft Surface Pro 2/3", ALC288_FIXUP_SURFACE_SWAP_DACS),
68866977 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
68876978 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
68886979 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
sound/hda/codecs/senarytech.c+6−3
@@ -19,6 +19,9 @@ · 18 unmodified lines
1919 #include "hda_jack.h"
2020 #include "generic.h"
2121
22+/* GPIO node ID */
23+#define SENARY_GPIO_NODE 0x01
24+
2225 struct senary_spec {
2326 struct hda_gen_spec gen;
2427
@@ -120,11 +123,11 @@ static void senary_init_gpio_led(struct hda_codec *codec) · 95 unmodified lines
120123 unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask;
121124
122125 if (mask) {
123− snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
126+ snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_MASK,
124127 mask);
125− snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
128+ snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DIRECTION,
126129 mask);
127− snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
130+ snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DATA,
128131 spec->gpio_led);
129132 }
130133 }
sound/hda/codecs/side-codecs/Kconfig+15−0
@@ -88,6 +88,21 @@ config SND_HDA_SCODEC_CS35L56_SPI · 87 unmodified lines
8888 Say Y or M here to include CS35L56 amplifier support with
8989 SPI control.
9090
91+menu "CS35L56 driver options"
92+ depends on SND_HDA_SCODEC_CS35L56
93+
94+config SND_HDA_SCODEC_CS35L56_CAL_DEBUGFS
95+ bool "CS35L56 create debugfs for factory calibration"
96+ default N
97+ depends on DEBUG_FS
98+ select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
99+ help
100+ Create debugfs entries used during factory-line manufacture
101+ for factory calibration.
102+
103+ If unsure select "N".
104+endmenu
105+
91106 config SND_HDA_SCODEC_TAS2781
92107 tristate
93108 select SND_HDA_GENERIC
sound/hda/codecs/side-codecs/cs35l56_hda.c+110−6
@@ -548,20 +548,24 @@ static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmw · 547 unmodified lines
548548 kfree(coeff_filename);
549549 }
550550
551−static void cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)
551+static int cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)
552552 {
553553 int ret;
554554
555555 if (!cs35l56->base.cal_data_valid || cs35l56->base.secured)
556− return;
556+ return -EACCES;
557557
558558 ret = cs_amp_write_cal_coeffs(&cs35l56->cs_dsp,
559559 &cs35l56_calibration_controls,
560560 &cs35l56->base.cal_data);
561− if (ret < 0)
561+ if (ret < 0) {
562562 dev_warn(cs35l56->base.dev, "Failed to write calibration: %d\n", ret);
563− else
564− dev_info(cs35l56->base.dev, "Calibration applied\n");
563+ return ret;
564+ }
565+
566+ dev_info(cs35l56->base.dev, "Calibration applied\n");
567+
568+ return 0;
565569 }
566570
567571 static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
@@ -669,7 +673,9 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 101 unmodified lines
669673 if (ret)
670674 dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret);
671675
676+ /* Don't need to check return code, it's not fatal if this fails */
672677 cs35l56_hda_apply_calibration(cs35l56);
678+
673679 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT);
674680 if (ret)
675681 cs_dsp_stop(&cs35l56->cs_dsp);
@@ -695,6 +701,100 @@ static void cs35l56_hda_dsp_work(struct work_struct *work) · 19 unmodified lines
695701 cs35l56_hda_fw_load(cs35l56);
696702 }
697703
704+static ssize_t cs35l56_hda_debugfs_calibrate_write(struct file *file,
705+ const char __user *from,
706+ size_t count, loff_t *ppos)
707+{
708+ struct cs35l56_base *cs35l56_base = file->private_data;
709+ ssize_t ret;
710+
711+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
712+ if (ret)
713+ return ret;
714+
715+ ret = cs35l56_calibrate_debugfs_write(cs35l56_base, from, count, ppos);
716+ pm_runtime_autosuspend(cs35l56_base->dev);
717+
718+ return ret;
719+}
720+
721+static ssize_t cs35l56_hda_debugfs_cal_temperature_write(struct file *file,
722+ const char __user *from,
723+ size_t count, loff_t *ppos)
724+{
725+ struct cs35l56_base *cs35l56_base = file->private_data;
726+ ssize_t ret;
727+
728+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
729+ if (ret)
730+ return ret;
731+
732+ ret = cs35l56_cal_ambient_debugfs_write(cs35l56_base, from, count, ppos);
733+ pm_runtime_autosuspend(cs35l56_base->dev);
734+
735+ return ret;
736+}
737+
738+static ssize_t cs35l56_hda_debugfs_cal_data_read(struct file *file,
739+ char __user *to,
740+ size_t count, loff_t *ppos)
741+{
742+ struct cs35l56_base *cs35l56_base = file->private_data;
743+ ssize_t ret;
744+
745+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
746+ if (ret)
747+ return ret;
748+
749+ ret = cs35l56_cal_data_debugfs_read(cs35l56_base, to, count, ppos);
750+ pm_runtime_autosuspend(cs35l56_base->dev);
751+
752+ return ret;
753+}
754+
755+static ssize_t cs35l56_hda_debugfs_cal_data_write(struct file *file,
756+ const char __user *from,
757+ size_t count, loff_t *ppos)
758+{
759+ struct cs35l56_base *cs35l56_base = file->private_data;
760+ struct cs35l56_hda *cs35l56 = cs35l56_hda_from_base(cs35l56_base);
761+ ssize_t ret;
762+
763+ ret = cs35l56_cal_data_debugfs_write(cs35l56_base, from, count, ppos);
764+ if (ret == -ENODATA)
765+ return count; /* Ignore writes of empty cal blobs */
766+
767+ if (ret < 0)
768+ return ret;
769+
770+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
771+ if (ret)
772+ return ret;
773+
774+ ret = cs35l56_hda_apply_calibration(cs35l56);
775+ if (ret == 0)
776+ cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_AUDIO_REINIT);
777+ else
778+ count = -EIO;
779+
780+ pm_runtime_autosuspend(cs35l56_base->dev);
781+
782+ return count;
783+}
784+
785+static const struct cs35l56_cal_debugfs_fops cs35l56_hda_cal_debugfs_fops = {
786+ .calibrate = {
787+ .write = cs35l56_hda_debugfs_calibrate_write,
788+ },
789+ .cal_temperature = {
790+ .write = cs35l56_hda_debugfs_cal_temperature_write,
791+ },
792+ .cal_data = {
793+ .read = cs35l56_hda_debugfs_cal_data_read,
794+ .write = cs35l56_hda_debugfs_cal_data_write,
795+ },
796+};
797+
698798 static int cs35l56_hda_bind(struct device *dev, struct device *master, void *master_data)
699799 {
700800 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
@@ -722,6 +822,9 @@ static int cs35l56_hda_bind(struct device *dev, struct device *master, void *mas · 21 unmodified lines
722822 cs_dsp_init_debugfs(&cs35l56->cs_dsp, cs35l56->debugfs_root);
723823 #endif
724824
825+ if (IS_ENABLED(CONFIG_SND_HDA_SCODEC_CS35L56_CAL_DEBUGFS))
826+ cs35l56_create_cal_debugfs(&cs35l56->base, &cs35l56_hda_cal_debugfs_fops);
827+
725828 dev_dbg(cs35l56->base.dev, "Bound\n");
726829
727830 return 0;
@@ -735,6 +838,7 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void * · 7 unmodified lines
735838
736839 cancel_work_sync(&cs35l56->dsp_work);
737840
841+ cs35l56_remove_cal_debugfs(&cs35l56->base);
738842 cs35l56_hda_remove_controls(cs35l56);
739843
740844 #if IS_ENABLED(CONFIG_SND_DEBUG)
@@ -1050,7 +1154,7 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id) · 309 unmodified lines
10501154 }
10511155
10521156 cs35l56->base.type = hid & 0xff;
1053− cs35l56->base.cal_index = -1;
1157+ cs35l56->base.cal_index = cs35l56->index;
10541158
10551159 cs35l56_init_cs_dsp(&cs35l56->base, &cs35l56->cs_dsp);
10561160 cs35l56->cs_dsp.client_ops = &cs35l56_hda_client_ops;
sound/hda/codecs/side-codecs/cs35l56_hda.h+6−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #ifndef __CS35L56_HDA_H__
1010 #define __CS35L56_HDA_H__
1111
12+#include <linux/container_of.h>
1213 #include <linux/device.h>
1314 #include <linux/gpio/consumer.h>
1415 #include <linux/firmware/cirrus/cs_dsp.h>
@@ -42,6 +43,11 @@ struct cs35l56_hda { · 27 unmodified lines
4243 #endif
4344 };
4445
46+static inline struct cs35l56_hda *cs35l56_hda_from_base(struct cs35l56_base *cs35l56_base)
47+{
48+ return container_of(cs35l56_base, struct cs35l56_hda, base);
49+}
50+
4551 extern const struct dev_pm_ops cs35l56_hda_pm_ops;
4652
4753 int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id);
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c+25−19
@@ -87,6 +87,7 @@ static const struct acpi_gpio_mapping tas2781_speaker_id_gpios[] = { · 86 unmodified lines
8787
8888 static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid)
8989 {
90+ struct gpio_desc *speaker_id;
9091 struct acpi_device *adev;
9192 struct device *physdev;
9293 LIST_HEAD(resources);
@@ -119,19 +120,31 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) · 26 unmodified lines
119120 /* Speaker id was needed for ASUS projects. */
120121 ret = kstrtou32(sub, 16, &subid);
121122 if (!ret && upper_16_bits(subid) == PCI_VENDOR_ID_ASUSTEK) {
122− ret = devm_acpi_dev_add_driver_gpios(p->dev,
123− tas2781_speaker_id_gpios);
124− if (ret < 0)
123+ ret = acpi_dev_add_driver_gpios(adev, tas2781_speaker_id_gpios);
124+ if (ret < 0) {
125125 dev_err(p->dev, "Failed to add driver gpio %d.\n",
126126 ret);
127− p->speaker_id = devm_gpiod_get(p->dev, "speakerid", GPIOD_IN);
128− if (IS_ERR(p->speaker_id)) {
129− dev_err(p->dev, "Failed to get Speaker id.\n");
130− ret = PTR_ERR(p->speaker_id);
131− goto err;
127+ p->speaker_id = -1;
128+ goto end_2563;
129+ }
130+
131+ speaker_id = fwnode_gpiod_get_index(acpi_fwnode_handle(adev),
132+ "speakerid", 0, GPIOD_IN, NULL);
133+ if (!IS_ERR(speaker_id)) {
134+ p->speaker_id = gpiod_get_value_cansleep(speaker_id);
135+ dev_dbg(p->dev, "Got speaker id gpio from ACPI: %d.\n",
136+ p->speaker_id);
137+ gpiod_put(speaker_id);
138+ } else {
139+ p->speaker_id = -1;
140+ ret = PTR_ERR(speaker_id);
141+ dev_err(p->dev, "Get speaker id gpio failed %d.\n",
142+ ret);
132143 }
144+
145+ acpi_dev_remove_driver_gpios(adev);
133146 } else {
134− p->speaker_id = NULL;
147+ p->speaker_id = -1;
135148 }
136149
137150 end_2563:
@@ -432,23 +445,16 @@ static void tasdevice_dspfw_init(void *context) · 294 unmodified lines
432445 struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev);
433446 struct tas2781_hda_i2c_priv *hda_priv = tas_hda->hda_priv;
434447 struct hda_codec *codec = tas_priv->codec;
435− int ret, spk_id;
448+ int ret;
436449
437450 tasdevice_dsp_remove(tas_priv);
438451 tas_priv->fw_state = TASDEVICE_DSP_FW_PENDING;
439− if (tas_priv->speaker_id != NULL) {
440− // Speaker id need to be checked for ASUS only.
441− spk_id = gpiod_get_value(tas_priv->speaker_id);
442− if (spk_id < 0) {
443− // Speaker id is not valid, use default.
444− dev_dbg(tas_priv->dev, "Wrong spk_id = %d\n", spk_id);
445− spk_id = 0;
446− }
452+ if (tas_priv->speaker_id >= 0) {
447453 snprintf(tas_priv->coef_binaryname,
448454 sizeof(tas_priv->coef_binaryname),
449455 "TAS2XXX%04X%d.bin",
450456 lower_16_bits(codec->core.subsystem_id),
451− spk_id);
457+ tas_priv->speaker_id);
452458 } else {
453459 snprintf(tas_priv->coef_binaryname,
454460 sizeof(tas_priv->coef_binaryname),
sound/hda/controllers/intel.c+2−0
@@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_ids[] = { · 2549 unmodified lines
25502550 { PCI_DEVICE_DATA(INTEL, HDA_PTL_H, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) },
25512551 /* Wildcat Lake */
25522552 { PCI_DEVICE_DATA(INTEL, HDA_WCL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) },
2553+ /* Nova Lake */
2554+ { PCI_DEVICE_DATA(INTEL, HDA_NVL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) },
25532555 /* Apollolake (Broxton-P) */
25542556 { PCI_DEVICE_DATA(INTEL, HDA_APL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON) },
25552557 /* Gemini-Lake */
sound/hda/core/intel-dsp-config.c+8−0
@@ -578,6 +578,14 @@ static const struct config_entry config_table[] = { · 577 unmodified lines
578578
579579 #endif
580580
581+ /* Nova Lake */
582+#if IS_ENABLED(CONFIG_SND_SOC_SOF_NOVALAKE)
583+ {
584+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
585+ .device = PCI_DEVICE_ID_INTEL_HDA_NVL_S,
586+ },
587+#endif
588+
581589 };
582590
583591 static const struct config_entry *snd_intel_dsp_find_config
sound/isa/gus/gus_reset.c+0−3
@@ -9,9 +9,6 @@ · 8 unmodified lines
99 #include <sound/core.h>
1010 #include <sound/gus.h>
1111
12−extern int snd_gf1_synth_init(struct snd_gus_card * gus);
13−extern void snd_gf1_synth_done(struct snd_gus_card * gus);
14−
1512 /*
1613 * ok.. default interrupt handlers...
1714 */
sound/isa/wavefront/wavefront_midi.c+2−0
@@ -278,6 +278,7 @@ static int snd_wavefront_midi_input_close(struct snd_rawmidi_substream *substrea · 277 unmodified lines
278278 return -EIO;
279279
280280 guard(spinlock_irqsave)(&midi->open);
281+ midi->substream_input[mpu] = NULL;
281282 midi->mode[mpu] &= ~MPU401_MODE_INPUT;
282283
283284 return 0;
@@ -300,6 +301,7 @@ static int snd_wavefront_midi_output_close(struct snd_rawmidi_substream *substre · 16 unmodified lines
300301 return -EIO;
301302
302303 guard(spinlock_irqsave)(&midi->open);
304+ midi->substream_output[mpu] = NULL;
303305 midi->mode[mpu] &= ~MPU401_MODE_OUTPUT;
304306 return 0;
305307 }
sound/isa/wavefront/wavefront_synth.c+2−2
@@ -950,9 +950,9 @@ wavefront_send_sample (snd_wavefront_t *dev, · 949 unmodified lines
950950 if (header->size) {
951951 dev->freemem = wavefront_freemem (dev);
952952
953− if (dev->freemem < (int)header->size) {
953+ if (dev->freemem < 0 || dev->freemem < header->size) {
954954 dev_err(dev->card->dev,
955− "insufficient memory to load %d byte sample.\n",
955+ "insufficient memory to load %u byte sample.\n",
956956 header->size);
957957 return -ENOMEM;
958958 }
sound/pci/au88x0/au88x0_eq.c+1−1
@@ -568,7 +568,7 @@ static int vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex_t * vortex) · 567 unmodified lines
568568 eqlzr_t *eq = &(vortex->eq);
569569
570570 vortex_EqHw_SetLeftGainsTarget(vortex, eq->this130);
571− vortex_EqHw_SetRightGainsTarget(vortex, &(eq->this130[eq->this10]));
571+ vortex_EqHw_SetRightGainsTarget(vortex, eq->this130 + eq->this10);
572572
573573 return 0;
574574 }
sound/pci/ctxfi/ctatc.c+71−26
@@ -25,6 +25,9 @@ · 24 unmodified lines
2525 #include <sound/control.h>
2626 #include <sound/asoundef.h>
2727
28+#define NUM_ATC_SRCS 6
29+#define NUM_ATC_PCM (2 * 4)
30+
2831 #define MONO_SUM_SCALE 0x19a8 /* 2^(-0.5) in 14-bit floating format */
2932 #define MAX_MULTI_CHN 8
3033
@@ -60,6 +63,7 @@ static const struct snd_pci_quirk subsys_20k2_list[] = { · 29 unmodified lines
6063 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_CREATIVE, 0xf000,
6164 PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, "HENDRIX",
6265 CTHENDRIX),
66+ SND_PCI_QUIRK(0x160b, 0x0101, "OK0010", CTOK0010),
6367 { } /* terminator */
6468 };
6569
@@ -75,6 +79,7 @@ static const char *ct_subsys_name[NUM_CTCARDS] = { · 9 unmodified lines
7579 [CTHENDRIX] = "Hendrix",
7680 [CTSB0880] = "SB0880",
7781 [CTSB1270] = "SB1270",
82+ [CTOK0010] = "OK0010",
7883 [CT20K2_UNKNOWN] = "Unknown",
7984 };
8085
@@ -984,6 +989,24 @@ static struct capabilities atc_capabilities(struct ct_atc *atc) · 903 unmodified lines
984989 return hw->capabilities(hw);
985990 }
986991
992+static void atc_dedicated_rca_select(struct ct_atc *atc)
993+{
994+ struct dao *dao;
995+ struct ct_mixer *mixer = atc->mixer;
996+ struct rsc *rscs[2] = {NULL};
997+
998+ dao = container_of(atc->daios[atc->rca_state ? RCA : LINEO1],
999+ struct dao, daio);
1000+ dao->ops->clear_left_input(dao);
1001+ dao->ops->clear_right_input(dao);
1002+
1003+ mixer->get_output_ports(mixer, MIX_WAVE_FRONT, &rscs[0], &rscs[1]);
1004+ dao = container_of(atc->daios[atc->rca_state ? LINEO1 : RCA],
1005+ struct dao, daio);
1006+ dao->ops->set_left_input(dao, rscs[0]);
1007+ dao->ops->set_right_input(dao, rscs[1]);
1008+}
1009+
9871010 static int atc_output_switch_get(struct ct_atc *atc)
9881011 {
9891012 struct hw *hw = atc->hw;
@@ -1085,6 +1108,11 @@ static int atc_mic_unmute(struct ct_atc *atc, unsigned char state) · 95 unmodified lines
10851108 return atc_daio_unmute(atc, state, MIC);
10861109 }
10871110
1111+static int atc_rca_unmute(struct ct_atc *atc, unsigned char state)
1112+{
1113+ return atc_daio_unmute(atc, state, RCA);
1114+}
1115+
10881116 static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state)
10891117 {
10901118 return atc_daio_unmute(atc, state, SPDIFOO);
@@ -1161,9 +1189,11 @@ static int atc_release_resources(struct ct_atc *atc) · 70 unmodified lines
11611189
11621190 if (atc->daios) {
11631191 daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
1164− for (i = 0; i < atc->n_daio; i++) {
1192+ for (i = 0; i < NUM_DAIOTYP; i++) {
11651193 daio = atc->daios[i];
1166− if (daio->type < LINEIM) {
1194+ if (!daio)
1195+ continue;
1196+ if (daio->output) {
11671197 dao = container_of(daio, struct dao, daio);
11681198 dao->ops->clear_left_input(dao);
11691199 dao->ops->clear_right_input(dao);
@@ -1176,8 +1206,9 @@ static int atc_release_resources(struct ct_atc *atc) · 6 unmodified lines
11761206
11771207 if (atc->pcm) {
11781208 sum_mgr = atc->rsc_mgrs[SUM];
1179− for (i = 0; i < atc->n_pcm; i++)
1180− sum_mgr->put_sum(sum_mgr, atc->pcm[i]);
1209+ for (i = 0; i < NUM_ATC_PCM; i++)
1210+ if (atc->pcm[i])
1211+ sum_mgr->put_sum(sum_mgr, atc->pcm[i]);
11811212
11821213 kfree(atc->pcm);
11831214 atc->pcm = NULL;
@@ -1185,8 +1216,9 @@ static int atc_release_resources(struct ct_atc *atc) · 1 unmodified line
11851216
11861217 if (atc->srcs) {
11871218 src_mgr = atc->rsc_mgrs[SRC];
1188− for (i = 0; i < atc->n_src; i++)
1189− src_mgr->put_src(src_mgr, atc->srcs[i]);
1219+ for (i = 0; i < NUM_ATC_SRCS; i++)
1220+ if (atc->srcs[i])
1221+ src_mgr->put_src(src_mgr, atc->srcs[i]);
11901222
11911223 kfree(atc->srcs);
11921224 atc->srcs = NULL;
@@ -1194,7 +1226,9 @@ static int atc_release_resources(struct ct_atc *atc) · 1 unmodified line
11941226
11951227 if (atc->srcimps) {
11961228 srcimp_mgr = atc->rsc_mgrs[SRCIMP];
1197− for (i = 0; i < atc->n_srcimp; i++) {
1229+ for (i = 0; i < NUM_ATC_SRCS; i++) {
1230+ if (!atc->srcimps[i])
1231+ continue;
11981232 srcimp = atc->srcimps[i];
11991233 srcimp->ops->unmap(srcimp);
12001234 srcimp_mgr->put_srcimp(srcimp_mgr, atc->srcimps[i]);
@@ -1294,6 +1328,7 @@ static int atc_identify_card(struct ct_atc *atc, unsigned int ssid) · 93 unmodified lines
12941328 dev_info(atc->card->dev, "chip %s model %s (%04x:%04x) is found\n",
12951329 atc->chip_name, atc->model_name,
12961330 vendor_id, device_id);
1331+ atc->rca_state = 0;
12971332 return 0;
12981333 }
12991334
@@ -1367,32 +1402,35 @@ static int atc_get_resources(struct ct_atc *atc) · 67 unmodified lines
13671402 struct srcimp_mgr *srcimp_mgr;
13681403 struct sum_desc sum_dsc = {0};
13691404 struct sum_mgr *sum_mgr;
1370− int err, i, num_srcs, num_daios;
1405+ struct capabilities cap;
1406+ int err, i;
13711407
1372− num_daios = ((atc->model == CTSB1270) ? 8 : 7);
1373− num_srcs = ((atc->model == CTSB1270) ? 6 : 4);
1408+ cap = atc->capabilities(atc);
13741409
1375− atc->daios = kcalloc(num_daios, sizeof(void *), GFP_KERNEL);
1410+ atc->daios = kcalloc(NUM_DAIOTYP, sizeof(void *), GFP_KERNEL);
13761411 if (!atc->daios)
13771412 return -ENOMEM;
13781413
1379− atc->srcs = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL);
1414+ atc->srcs = kcalloc(NUM_ATC_SRCS, sizeof(void *), GFP_KERNEL);
13801415 if (!atc->srcs)
13811416 return -ENOMEM;
13821417
1383− atc->srcimps = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL);
1418+ atc->srcimps = kcalloc(NUM_ATC_SRCS, sizeof(void *), GFP_KERNEL);
13841419 if (!atc->srcimps)
13851420 return -ENOMEM;
13861421
1387− atc->pcm = kcalloc(2 * 4, sizeof(void *), GFP_KERNEL);
1422+ atc->pcm = kcalloc(NUM_ATC_PCM, sizeof(void *), GFP_KERNEL);
13881423 if (!atc->pcm)
13891424 return -ENOMEM;
13901425
13911426 daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
13921427 da_desc.msr = atc->msr;
1393− for (i = 0, atc->n_daio = 0; i < num_daios; i++) {
1428+ for (i = 0; i < NUM_DAIOTYP; i++) {
1429+ if (((i == MIC) && !cap.dedicated_mic) || ((i == RCA) && !cap.dedicated_rca))
1430+ continue;
13941431 da_desc.type = (atc->model != CTSB073X) ? i :
13951432 ((i == SPDIFIO) ? SPDIFI1 : i);
1433+ da_desc.output = (i < LINEIM) || (i == RCA);
13961434 err = daio_mgr->get_daio(daio_mgr, &da_desc,
13971435 (struct daio **)&atc->daios[i]);
13981436 if (err) {
@@ -1401,42 +1439,39 @@ static int atc_get_resources(struct ct_atc *atc) · 2 unmodified lines
14011439 i);
14021440 return err;
14031441 }
1404− atc->n_daio++;
14051442 }
14061443
14071444 src_mgr = atc->rsc_mgrs[SRC];
14081445 src_dsc.multi = 1;
14091446 src_dsc.msr = atc->msr;
14101447 src_dsc.mode = ARCRW;
1411− for (i = 0, atc->n_src = 0; i < num_srcs; i++) {
1448+ for (i = 0; i < NUM_ATC_SRCS; i++) {
1449+ if (((i > 3) && !cap.dedicated_mic))
1450+ continue;
14121451 err = src_mgr->get_src(src_mgr, &src_dsc,
14131452 (struct src **)&atc->srcs[i]);
14141453 if (err)
14151454 return err;
1416−
1417− atc->n_src++;
14181455 }
14191456
14201457 srcimp_mgr = atc->rsc_mgrs[SRCIMP];
14211458 srcimp_dsc.msr = 8;
1422− for (i = 0, atc->n_srcimp = 0; i < num_srcs; i++) {
1459+ for (i = 0; i < NUM_ATC_SRCS; i++) {
1460+ if (((i > 3) && !cap.dedicated_mic))
1461+ continue;
14231462 err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc,
14241463 (struct srcimp **)&atc->srcimps[i]);
14251464 if (err)
14261465 return err;
1427−
1428− atc->n_srcimp++;
14291466 }
14301467
14311468 sum_mgr = atc->rsc_mgrs[SUM];
14321469 sum_dsc.msr = atc->msr;
1433− for (i = 0, atc->n_pcm = 0; i < (2*4); i++) {
1470+ for (i = 0; i < NUM_ATC_PCM; i++) {
14341471 err = sum_mgr->get_sum(sum_mgr, &sum_dsc,
14351472 (struct sum **)&atc->pcm[i]);
14361473 if (err)
14371474 return err;
1438−
1439− atc->n_pcm++;
14401475 }
14411476
14421477 return 0;
@@ -1489,9 +1524,11 @@ static void atc_connect_resources(struct ct_atc *atc) · 46 unmodified lines
14891524 struct sum *sum;
14901525 struct ct_mixer *mixer;
14911526 struct rsc *rscs[2] = {NULL};
1527+ struct capabilities cap;
14921528 int i, j;
14931529
14941530 mixer = atc->mixer;
1531+ cap = atc->capabilities(atc);
14951532
14961533 for (i = MIX_WAVE_FRONT, j = LINEO1; i <= MIX_SPDIF_OUT; i++, j++) {
14971534 mixer->get_output_ports(mixer, i, &rscs[0], &rscs[1]);
@@ -1500,6 +1537,11 @@ static void atc_connect_resources(struct ct_atc *atc) · 2 unmodified lines
15001537 dao->ops->set_right_input(dao, rscs[1]);
15011538 }
15021539
1540+ if (cap.dedicated_rca) {
1541+ /* SE-300PCIE has a dedicated DAC for the RCA. */
1542+ atc_dedicated_rca_select(atc);
1543+ }
1544+
15031545 dai = container_of(atc->daios[LINEIM], struct dai, daio);
15041546 atc_connect_dai(atc->rsc_mgrs[SRC], dai,
15051547 (struct src **)&atc->srcs[2],
@@ -1509,8 +1551,9 @@ static void atc_connect_resources(struct ct_atc *atc) · 3 unmodified lines
15091551 src = atc->srcs[3];
15101552 mixer->set_input_right(mixer, MIX_LINE_IN, &src->rsc);
15111553
1512− if (atc->model == CTSB1270) {
1554+ if (cap.dedicated_mic) {
15131555 /* Titanium HD has a dedicated ADC for the Mic. */
1556+ /* SE-300PCIE has a 4-channel ADC. */
15141557 dai = container_of(atc->daios[MIC], struct dai, daio);
15151558 atc_connect_dai(atc->rsc_mgrs[SRC], dai,
15161559 (struct src **)&atc->srcs[4],
@@ -1632,12 +1675,14 @@ static const struct ct_atc atc_preset = { · 115 unmodified lines
16321675 .line_rear_unmute = atc_line_rear_unmute,
16331676 .line_in_unmute = atc_line_in_unmute,
16341677 .mic_unmute = atc_mic_unmute,
1678+ .rca_unmute = atc_rca_unmute,
16351679 .spdif_out_unmute = atc_spdif_out_unmute,
16361680 .spdif_in_unmute = atc_spdif_in_unmute,
16371681 .spdif_out_get_status = atc_spdif_out_get_status,
16381682 .spdif_out_set_status = atc_spdif_out_set_status,
16391683 .spdif_out_passthru = atc_spdif_out_passthru,
16401684 .capabilities = atc_capabilities,
1685+ .dedicated_rca_select = atc_dedicated_rca_select,
16411686 .output_switch_get = atc_output_switch_get,
16421687 .output_switch_put = atc_output_switch_put,
16431688 .mic_source_switch_get = atc_mic_source_switch_get,
sound/pci/ctxfi/ctatc.h+4−4
@@ -82,6 +82,8 @@ struct ct_atc { · 81 unmodified lines
8282 const char *chip_name;
8383 const char *model_name;
8484
85+ unsigned char rca_state; /* 0 = dedicated RCA, 1 = 7.1ch Front */
86+
8587 struct ct_vm *vm; /* device virtual memory manager for this card */
8688 int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
8789 void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
@@ -113,12 +115,14 @@ struct ct_atc { · 25 unmodified lines
113115 int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state);
114116 int (*line_in_unmute)(struct ct_atc *atc, unsigned char state);
115117 int (*mic_unmute)(struct ct_atc *atc, unsigned char state);
118+ int (*rca_unmute)(struct ct_atc *atc, unsigned char state);
116119 int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state);
117120 int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state);
118121 int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status);
119122 int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status);
120123 int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state);
121124 struct capabilities (*capabilities)(struct ct_atc *atc);
125+ void (*dedicated_rca_select)(struct ct_atc *atc);
122126 int (*output_switch_get)(struct ct_atc *atc);
123127 int (*output_switch_put)(struct ct_atc *atc, int position);
124128 int (*mic_source_switch_get)(struct ct_atc *atc);
@@ -132,10 +136,6 @@ struct ct_atc { · 7 unmodified lines
132136 void **pcm; /* SUMs for collecting all pcm stream */
133137 void **srcs; /* Sample Rate Converters for input signal */
134138 void **srcimps; /* input mappers for SRCs */
135− unsigned char n_daio;
136− unsigned char n_src;
137− unsigned char n_srcimp;
138− unsigned char n_pcm;
139139
140140 struct ct_timer *timer;
141141
sound/pci/ctxfi/ctdaio.c+10−8
@@ -18,8 +18,6 @@ · 17 unmodified lines
1818 #include <linux/slab.h>
1919 #include <linux/kernel.h>
2020
21−#define DAIO_OUT_MAX SPDIFOO
22−
2321 struct daio_usage {
2422 unsigned short data;
2523 };
@@ -47,6 +45,7 @@ static const struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { · 21 unmodified lines
4745 [LINEO4] = {.left = 0x70, .right = 0x71},
4846 [LINEIM] = {.left = 0x45, .right = 0xc5},
4947 [MIC] = {.left = 0x55, .right = 0xd5},
48+ [RCA] = {.left = 0x30, .right = 0x31},
5049 [SPDIFOO] = {.left = 0x00, .right = 0x01},
5150 [SPDIFIO] = {.left = 0x05, .right = 0x85},
5251 };
@@ -125,6 +124,7 @@ static unsigned int daio_device_index(enum DAIOTYP type, struct hw *hw) · 72 unmodified lines
125124 case LINEO4: return 6;
126125 case LINEIM: return 4;
127126 case MIC: return 5;
127+ case RCA: return 3;
128128 default: return -EINVAL;
129129 }
130130 default:
@@ -329,7 +329,7 @@ static int daio_rsc_init(struct daio *daio, · 198 unmodified lines
329329 goto error1;
330330
331331 /* Set daio->rscl/r->ops to daio specific ones */
332− if (desc->type <= DAIO_OUT_MAX) {
332+ if (desc->output) {
333333 daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops;
334334 } else {
335335 switch (hw->chip_type) {
@@ -344,6 +344,7 @@ static int daio_rsc_init(struct daio *daio, · 8 unmodified lines
344344 }
345345 }
346346 daio->type = desc->type;
347+ daio->output = desc->output;
347348
348349 return 0;
349350
@@ -390,7 +391,7 @@ static int dao_rsc_init(struct dao *dao, · 40 unmodified lines
390391 hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk);
391392
392393 conf = (desc->msr & 0x7) | (desc->passthru << 3);
393− hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk,
394+ hw->daio_mgr_dao_init(hw, mgr->mgr.ctrl_blk,
394395 daio_device_index(dao->daio.type, hw), conf);
395396 hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk,
396397 daio_device_index(dao->daio.type, hw));
@@ -433,6 +434,7 @@ static int dao_rsc_reinit(struct dao *dao, const struct dao_desc *desc) · 36 unmodified lines
433434 dsc.type = dao->daio.type;
434435 dsc.msr = desc->msr;
435436 dsc.passthru = desc->passthru;
437+ dsc.output = dao->daio.output;
436438 dao_rsc_uninit(dao);
437439 return dao_rsc_init(dao, &dsc, mgr);
438440 }
@@ -518,7 +520,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 79 unmodified lines
518520
519521 err = -ENOMEM;
520522 /* Allocate mem for daio resource */
521− if (desc->type <= DAIO_OUT_MAX) {
523+ if (desc->output) {
522524 struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL);
523525 if (!dao)
524526 goto error;
@@ -565,7 +567,7 @@ static int put_daio_rsc(struct daio_mgr *mgr, struct daio *daio) · 40 unmodified lines
565567 daio_mgr_put_rsc(&mgr->mgr, daio->type);
566568 }
567569
568− if (daio->type <= DAIO_OUT_MAX) {
570+ if (daio->output) {
569571 dao_rsc_uninit(container_of(daio, struct dao, daio));
570572 kfree(container_of(daio, struct dao, daio));
571573 } else {
@@ -580,7 +582,7 @@ static int daio_mgr_enb_daio(struct daio_mgr *mgr, struct daio *daio) · 8 unmodified lines
580582 {
581583 struct hw *hw = mgr->mgr.hw;
582584
583− if (DAIO_OUT_MAX >= daio->type) {
585+ if (daio->output) {
584586 hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk,
585587 daio_device_index(daio->type, hw));
586588 } else {
@@ -594,7 +596,7 @@ static int daio_mgr_dsb_daio(struct daio_mgr *mgr, struct daio *daio) · 7 unmodified lines
594596 {
595597 struct hw *hw = mgr->mgr.hw;
596598
597− if (DAIO_OUT_MAX >= daio->type) {
599+ if (daio->output) {
598600 hw->daio_mgr_dsb_dao(mgr->mgr.ctrl_blk,
599601 daio_device_index(daio->type, hw));
600602 } else {
sound/pci/ctxfi/ctdaio.h+3−0
@@ -31,6 +31,7 @@ enum DAIOTYP { · 30 unmodified lines
3131 LINEIM,
3232 SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */
3333 MIC, /* Dedicated mic on Titanium HD */
34+ RCA, /* Dedicated RCA on SE-300PCIE */
3435 SPDIFI1, /* S/PDIF In on internal Drive Bay */
3536 NUM_DAIOTYP
3637 };
@@ -43,6 +44,7 @@ struct daio { · 6 unmodified lines
4344 struct rsc rscl; /* Basic resource info for left TX/RX */
4445 struct rsc rscr; /* Basic resource info for right TX/RX */
4546 enum DAIOTYP type;
47+ unsigned char output;
4648 };
4749
4850 struct dao {
@@ -91,6 +93,7 @@ struct daio_desc { · 42 unmodified lines
9193 unsigned int type:4;
9294 unsigned int msr:4;
9395 unsigned int passthru:1;
96+ unsigned int output:1;
9497 };
9598
9699 struct daio_mgr {
sound/pci/ctxfi/cthardware.h+3−1
@@ -38,6 +38,7 @@ enum CTCARDS { · 37 unmodified lines
3838 CTHENDRIX,
3939 CTSB0880,
4040 CTSB1270,
41+ CTOK0010,
4142 CT20K2_UNKNOWN,
4243 NUM_CTCARDS /* This should always be the last */
4344 };
@@ -62,6 +63,7 @@ struct card_conf { · 18 unmodified lines
6263 struct capabilities {
6364 unsigned int digit_io_switch:1;
6465 unsigned int dedicated_mic:1;
66+ unsigned int dedicated_rca:1;
6567 unsigned int output_switch:1;
6668 unsigned int mic_source_switch:1;
6769 };
@@ -167,7 +169,7 @@ struct hw { · 99 unmodified lines
167169 int (*daio_mgr_dsb_dai)(void *blk, unsigned int idx);
168170 int (*daio_mgr_enb_dao)(void *blk, unsigned int idx);
169171 int (*daio_mgr_dsb_dao)(void *blk, unsigned int idx);
170− int (*daio_mgr_dao_init)(void *blk, unsigned int idx,
172+ int (*daio_mgr_dao_init)(struct hw *hw, void *blk, unsigned int idx,
171173 unsigned int conf);
172174 int (*daio_mgr_set_imaparc)(void *blk, unsigned int slot);
173175 int (*daio_mgr_set_imapnxt)(void *blk, unsigned int next);
sound/pci/ctxfi/cthw20k1.c+2−1
@@ -1031,7 +1031,7 @@ static int daio_mgr_dsb_dao(void *blk, unsigned int idx) · 1030 unmodified lines
10311031 return 0;
10321032 }
10331033
1034−static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf)
1034+static int daio_mgr_dao_init(struct hw *hw __maybe_unused, void *blk, unsigned int idx, unsigned int conf)
10351035 {
10361036 struct daio_mgr_ctrl_blk *ctl = blk;
10371037
@@ -1775,6 +1775,7 @@ static struct capabilities hw_capabilities(struct hw *hw) · 737 unmodified lines
17751775 /* SB073x and Vista compatible cards have no digit IO switch */
17761776 cap.digit_io_switch = !(hw->model == CTSB073X || hw->model == CTUAA);
17771777 cap.dedicated_mic = 0;
1778+ cap.dedicated_rca = 0;
17781779 cap.output_switch = 0;
17791780 cap.mic_source_switch = 0;
17801781
sound/pci/ctxfi/cthw20k2.c+62−19
@@ -910,7 +910,7 @@ static int dao_commit_write(struct hw *hw, unsigned int idx, void *blk) · 909 unmodified lines
910910 struct dao_ctrl_blk *ctl = blk;
911911
912912 if (ctl->dirty.bf.atxcsl) {
913− if (idx < 4) {
913+ if ((idx < 4) && ((hw->model != CTOK0010) || (idx < 3))) {
914914 /* S/PDIF SPOSx */
915915 hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_L+0x40*idx,
916916 ctl->atxcsl);
@@ -985,11 +985,12 @@ static int daio_mgr_dsb_dao(void *blk, unsigned int idx) · 68 unmodified lines
985985 return 0;
986986 }
987987
988−static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf)
988+static int daio_mgr_dao_init(struct hw *hw, void *blk, unsigned int idx, unsigned int conf)
989989 {
990990 struct daio_mgr_ctrl_blk *ctl = blk;
991991
992− if (idx < 4) {
992+ /* Port 3 is dedicated to RCA on SE-300PCIE */
993+ if ((idx < 4) && ((hw->model != CTOK0010) || (idx < 3))) {
993994 /* S/PDIF output */
994995 switch ((conf & 0xf)) {
995996 case 1:
@@ -1176,6 +1177,10 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) · 180 unmodified lines
11761177 hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21011111);
11771178 hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121);
11781179 hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0);
1180+ } else if ((4 == info->msr) && (hw->model == CTOK0010)) {
1181+ hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21212121);
1182+ hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121);
1183+ hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0);
11791184 } else {
11801185 dev_alert(hw->card->dev,
11811186 "ERROR!!! Invalid sampling rate!!!\n");
@@ -1183,7 +1188,8 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) · 1 unmodified line
11831188 }
11841189
11851190 for (i = 0; i < 8; i++) {
1186− if (i <= 3) {
1191+ /* Port 3 is configured as I2S on SE-300PCIE */
1192+ if ((i < 4) && ((hw->model != CTOK0010) || (i < 3))) {
11871193 /* This comment looks wrong since loop is over 4 */
11881194 /* channels and emu20k2 supports 4 spdif IOs. */
11891195 /* 1st 3 channels are SPDIFs (SB0960) */
@@ -1637,6 +1643,13 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info) · 447 unmodified lines
16371643 hw_write_20kx(hw, GPIO_DATA, data);
16381644 hw_dac_start(hw);
16391645 return 0;
1646+ } else if (hw->model == CTOK0010) {
1647+ hw_dac_stop(hw);
1648+ data = hw_read_20kx(hw, GPIO_DATA);
1649+ data |= 0x1000;
1650+ hw_write_20kx(hw, GPIO_DATA, data);
1651+ hw_dac_start(hw);
1652+ return 0;
16401653 }
16411654
16421655 /* Set DAC reset bit as output */
@@ -1756,9 +1769,11 @@ End: · 113 unmodified lines
17561769 static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
17571770 {
17581771 u32 data;
1759− if (hw->model == CTSB1270) {
1772+ if ((hw->model == CTSB1270) || (hw->model == CTOK0010)) {
17601773 /* Titanium HD has two ADC chips, one for line in and one */
1761− /* for MIC. We don't need to switch the ADC input. */
1774+ /* for MIC. Also, SE-300PCIE has a single ADC chip that */
1775+ /* simultaneously supports 4-channel input. We don't need */
1776+ /* to switch the ADC input. */
17621777 return 1;
17631778 }
17641779 data = hw_read_20kx(hw, GPIO_DATA);
@@ -1826,6 +1841,32 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) · 61 unmodified lines
18261841 return 0;
18271842 }
18281843
1844+static void hw_adc_stop(struct hw *hw)
1845+{
1846+ u32 data;
1847+ /* Reset the ADC (reset is active low). */
1848+ data = hw_read_20kx(hw, GPIO_DATA);
1849+ data &= ~(0x1 << 15);
1850+ hw_write_20kx(hw, GPIO_DATA, data);
1851+ usleep_range(10000, 11000);
1852+}
1853+
1854+static void hw_adc_start(struct hw *hw)
1855+{
1856+ u32 data;
1857+ /* Return the ADC to normal operation. */
1858+ data = hw_read_20kx(hw, GPIO_DATA);
1859+ data |= (0x1 << 15);
1860+ hw_write_20kx(hw, GPIO_DATA, data);
1861+ msleep(50);
1862+}
1863+
1864+static void hw_adc_reset(struct hw *hw)
1865+{
1866+ hw_adc_stop(hw);
1867+ hw_adc_start(hw);
1868+}
1869+
18291870 static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
18301871 {
18311872 int err;
@@ -1836,6 +1877,12 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 4 unmodified lines
18361877 data |= (0x1 << 15);
18371878 hw_write_20kx(hw, GPIO_CTRL, data);
18381879
1880+ if (hw->model == CTOK0010) {
1881+ /* Manual ADC setup for SE-300PCIE is not needed. */
1882+ hw_adc_reset(hw);
1883+ return 0;
1884+ }
1885+
18391886 /* Initialize I2C */
18401887 err = hw20k2_i2c_init(hw, 0x1A, 1, 1);
18411888 if (err < 0) {
@@ -1843,10 +1890,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 1 unmodified line
18431890 goto error;
18441891 }
18451892
1846− /* Reset the ADC (reset is active low). */
1847− data = hw_read_20kx(hw, GPIO_DATA);
1848− data &= ~(0x1 << 15);
1849− hw_write_20kx(hw, GPIO_DATA, data);
1893+ hw_adc_stop(hw);
18501894
18511895 if (hw->model == CTSB1270) {
18521896 /* Set up the PCM4220 ADC on Titanium HD */
@@ -1860,11 +1904,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 7 unmodified lines
18601904 hw_write_20kx(hw, GPIO_DATA, data);
18611905 }
18621906
1863− usleep_range(10000, 11000);
1864− /* Return the ADC to normal operation. */
1865− data |= (0x1 << 15);
1866− hw_write_20kx(hw, GPIO_DATA, data);
1867− msleep(50);
1907+ hw_adc_start(hw);
18681908
18691909 /* I2C write to register offset 0x0B to set ADC LRCLK polarity */
18701910 /* invert bit, interface format to I2S, word length to 24-bit, */
@@ -1910,7 +1950,8 @@ static struct capabilities hw_capabilities(struct hw *hw) · 39 unmodified lines
19101950 struct capabilities cap;
19111951
19121952 cap.digit_io_switch = 0;
1913− cap.dedicated_mic = hw->model == CTSB1270;
1953+ cap.dedicated_mic = (hw->model == CTSB1270) || (hw->model == CTOK0010);
1954+ cap.dedicated_rca = hw->model == CTOK0010;
19141955 cap.output_switch = hw->model == CTSB1270;
19151956 cap.mic_source_switch = hw->model == CTSB1270;
19161957
@@ -2147,15 +2188,17 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) · 230 unmodified lines
21472188 /* Reset all SRC pending interrupts */
21482189 hw_write_20kx(hw, SRC_IP, 0);
21492190
2150− if (hw->model != CTSB1270) {
2191+ if (hw->model == CTSB1270) {
2192+ hw_write_20kx(hw, GPIO_CTRL, 0x9E5F);
2193+ } else if (hw->model == CTOK0010) {
2194+ hw_write_20kx(hw, GPIO_CTRL, 0x9902);
2195+ } else {
21512196 /* TODO: detect the card ID and configure GPIO accordingly. */
21522197 /* Configures GPIO (0xD802 0x98028) */
21532198 /*hw_write_20kx(hw, GPIO_CTRL, 0x7F07);*/
21542199 /* Configures GPIO (SB0880) */
21552200 /*hw_write_20kx(hw, GPIO_CTRL, 0xFF07);*/
21562201 hw_write_20kx(hw, GPIO_CTRL, 0xD802);
2157− } else {
2158− hw_write_20kx(hw, GPIO_CTRL, 0x9E5F);
21592202 }
21602203 /* Enable audio ring */
21612204 hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01);
sound/pci/ctxfi/ctmixer.c+70−3
@@ -547,8 +547,14 @@ static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) · 546 unmodified lines
547547 atc->mic_unmute(atc, state);
548548 else if (MIXER_SPDIFI_C_S == type)
549549 atc->spdif_in_unmute(atc, state);
550− else if (MIXER_WAVEF_P_S == type)
551− atc->line_front_unmute(atc, state);
550+ else if (MIXER_WAVEF_P_S == type) {
551+ if (cap.dedicated_rca) {
552+ atc->rca_unmute(atc, atc->rca_state ? 0 : state);
553+ atc->line_front_unmute(atc, atc->rca_state ? state : 0);
554+ } else {
555+ atc->line_front_unmute(atc, state);
556+ }
557+ }
552558 else if (MIXER_WAVES_P_S == type)
553559 atc->line_surround_unmute(atc, state);
554560 else if (MIXER_WAVEC_P_S == type)
@@ -612,6 +618,57 @@ static struct snd_kcontrol_new swh_ctl = { · 57 unmodified lines
612618 .put = ct_alsa_mix_switch_put
613619 };
614620
621+static int dedicated_rca_info(struct snd_kcontrol *kcontrol,
622+ struct snd_ctl_elem_info *info)
623+{
624+ static const char *const names[2] = {
625+ "RCA", "Front"
626+ };
627+
628+ return snd_ctl_enum_info(info, 1, 2, names);
629+}
630+
631+static int dedicated_rca_get(struct snd_kcontrol *kcontrol,
632+ struct snd_ctl_elem_value *ucontrol)
633+{
634+ struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
635+
636+ ucontrol->value.enumerated.item[0] = atc->rca_state;
637+ return 0;
638+}
639+
640+static int dedicated_rca_put(struct snd_kcontrol *kcontrol,
641+ struct snd_ctl_elem_value *ucontrol)
642+{
643+ struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
644+ unsigned int rca_state = ucontrol->value.enumerated.item[0];
645+ unsigned char state;
646+
647+ if (rca_state > 1)
648+ return -EINVAL;
649+
650+ if (rca_state == atc->rca_state)
651+ return 0;
652+
653+ state = get_switch_state(atc->mixer, MIXER_WAVEF_P_S);
654+ do_switch(atc, MIXER_WAVEF_P_S, 0);
655+
656+ atc->rca_state = rca_state;
657+ atc->dedicated_rca_select(atc);
658+
659+ do_switch(atc, MIXER_WAVEF_P_S, state);
660+
661+ return 1;
662+}
663+
664+static struct snd_kcontrol_new rca_ctl = {
665+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
666+ .name = "Analog Playback Route",
667+ .info = dedicated_rca_info,
668+ .get = dedicated_rca_get,
669+ .put = dedicated_rca_put,
670+};
671+
615672 static int ct_spdif_info(struct snd_kcontrol *kcontrol,
616673 struct snd_ctl_elem_info *uinfo)
617674 {
@@ -784,7 +841,17 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) · 166 unmodified lines
784841 if (err)
785842 return err;
786843 }
787− atc->line_front_unmute(atc, 1);
844+
845+ if (cap.dedicated_rca) {
846+ err = ct_mixer_kcontrol_new(mixer, &rca_ctl);
847+ if (err)
848+ return err;
849+
850+ atc->line_front_unmute(atc, 0);
851+ atc->rca_unmute(atc, 1);
852+ } else {
853+ atc->line_front_unmute(atc, 1);
854+ }
788855 set_switch_state(mixer, MIXER_WAVEF_P_S, 1);
789856 atc->line_surround_unmute(atc, 0);
790857 set_switch_state(mixer, MIXER_WAVES_P_S, 0);
sound/pci/maestro3.c+3−3
@@ -2571,9 +2571,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, · 2570 unmodified lines
25712571
25722572 if (IS_ENABLED(CONFIG_PM_SLEEP)) {
25732573 chip->suspend_mem =
2574− vmalloc(array_size(sizeof(u16),
2575− REV_B_CODE_MEMORY_LENGTH +
2576− REV_B_DATA_MEMORY_LENGTH));
2574+ vmalloc_array(REV_B_CODE_MEMORY_LENGTH +
2575+ REV_B_DATA_MEMORY_LENGTH,
2576+ sizeof(u16));
25772577 if (!chip->suspend_mem)
25782578 dev_warn(card->dev, "can't allocate apm buffer\n");
25792579 }
sound/soc/Kconfig+1−0
@@ -127,6 +127,7 @@ source "sound/soc/renesas/Kconfig" · 126 unmodified lines
127127 source "sound/soc/rockchip/Kconfig"
128128 source "sound/soc/samsung/Kconfig"
129129 source "sound/soc/sdca/Kconfig"
130+source "sound/soc/spacemit/Kconfig"
130131 source "sound/soc/spear/Kconfig"
131132 source "sound/soc/sprd/Kconfig"
132133 source "sound/soc/starfive/Kconfig"
sound/soc/Makefile+1−0
@@ -70,6 +70,7 @@ obj-$(CONFIG_SND_SOC) += rockchip/ · 69 unmodified lines
7070 obj-$(CONFIG_SND_SOC) += samsung/
7171 obj-$(CONFIG_SND_SOC) += sdca/
7272 obj-$(CONFIG_SND_SOC) += sof/
73+obj-$(CONFIG_SND_SOC) += spacemit/
7374 obj-$(CONFIG_SND_SOC) += spear/
7475 obj-$(CONFIG_SND_SOC) += sprd/
7576 obj-$(CONFIG_SND_SOC) += starfive/
sound/soc/amd/acp/acp-mach-common.c+23−17
@@ -116,6 +116,7 @@ static const struct snd_soc_dapm_route rt5682_map[] = { · 115 unmodified lines
116116 static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd)
117117 {
118118 struct snd_soc_card *card = rtd->card;
119+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
119120 struct acp_card_drvdata *drvdata = card->drvdata;
120121 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
121122 struct snd_soc_component *component = codec_dai->component;
@@ -129,7 +130,7 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines
129130 drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
130131 drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
131132
132− ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets,
133+ ret = snd_soc_dapm_new_controls(dapm, rt5682_widgets,
133134 ARRAY_SIZE(rt5682_widgets));
134135 if (ret) {
135136 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -166,7 +167,7 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines
166167 return ret;
167168 }
168169
169− return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682_map, ARRAY_SIZE(rt5682_map));
170+ return snd_soc_dapm_add_routes(dapm, rt5682_map, ARRAY_SIZE(rt5682_map));
170171 }
171172
172173 static int acp_card_hs_startup(struct snd_pcm_substream *substream)
@@ -357,6 +358,7 @@ static const struct snd_soc_dapm_route rt5682s_map[] = { · 184 unmodified lines
357358 static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
358359 {
359360 struct snd_soc_card *card = rtd->card;
361+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
360362 struct acp_card_drvdata *drvdata = card->drvdata;
361363 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
362364 struct snd_soc_component *component = codec_dai->component;
@@ -372,7 +374,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) · 9 unmodified lines
372374 drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
373375 }
374376
375− ret = snd_soc_dapm_new_controls(&card->dapm, rt5682s_widgets,
377+ ret = snd_soc_dapm_new_controls(dapm, rt5682s_widgets,
376378 ARRAY_SIZE(rt5682s_widgets));
377379 if (ret) {
378380 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -409,7 +411,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines
409411 return ret;
410412 }
411413
412− return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map));
414+ return snd_soc_dapm_add_routes(dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map));
413415 }
414416
415417 static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream,
@@ -581,13 +583,14 @@ static struct snd_soc_codec_conf rt1019_conf[] = { · 165 unmodified lines
581583 static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd)
582584 {
583585 struct snd_soc_card *card = rtd->card;
586+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
584587 struct acp_card_drvdata *drvdata = card->drvdata;
585588 int ret;
586589
587590 if (drvdata->amp_codec_id != RT1019)
588591 return -EINVAL;
589592
590− ret = snd_soc_dapm_new_controls(&card->dapm, rt1019_widgets,
593+ ret = snd_soc_dapm_new_controls(dapm, rt1019_widgets,
591594 ARRAY_SIZE(rt1019_widgets));
592595 if (ret) {
593596 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -601,7 +604,7 @@ static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines
601604 return ret;
602605 }
603606
604− return snd_soc_dapm_add_routes(&rtd->card->dapm, rt1019_map_lr,
607+ return snd_soc_dapm_add_routes(dapm, rt1019_map_lr,
605608 ARRAY_SIZE(rt1019_map_lr));
606609 }
607610
@@ -746,13 +749,14 @@ static const struct snd_soc_dapm_route max98360a_map[] = { · 138 unmodified lines
746749 static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd)
747750 {
748751 struct snd_soc_card *card = rtd->card;
752+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
749753 struct acp_card_drvdata *drvdata = card->drvdata;
750754 int ret;
751755
752756 if (drvdata->amp_codec_id != MAX98360A)
753757 return -EINVAL;
754758
755− ret = snd_soc_dapm_new_controls(&card->dapm, max98360a_widgets,
759+ ret = snd_soc_dapm_new_controls(dapm, max98360a_widgets,
756760 ARRAY_SIZE(max98360a_widgets));
757761 if (ret) {
758762 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -766,7 +770,7 @@ static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines
766770 return ret;
767771 }
768772
769− return snd_soc_dapm_add_routes(&rtd->card->dapm, max98360a_map,
773+ return snd_soc_dapm_add_routes(dapm, max98360a_map,
770774 ARRAY_SIZE(max98360a_map));
771775 }
772776
@@ -882,13 +886,14 @@ static int acp_card_max98388_startup(struct snd_pcm_substream *substream) · 109 unmodified lines
882886 static int acp_card_max98388_init(struct snd_soc_pcm_runtime *rtd)
883887 {
884888 struct snd_soc_card *card = rtd->card;
889+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
885890 struct acp_card_drvdata *drvdata = card->drvdata;
886891 int ret;
887892
888893 if (drvdata->amp_codec_id != MAX98388)
889894 return -EINVAL;
890895
891− ret = snd_soc_dapm_new_controls(&card->dapm, max98388_widgets,
896+ ret = snd_soc_dapm_new_controls(dapm, max98388_widgets,
892897 ARRAY_SIZE(max98388_widgets));
893898
894899 if (ret) {
@@ -904,7 +909,7 @@ static int acp_card_max98388_init(struct snd_soc_pcm_runtime *rtd) · 9 unmodified lines
904909 return ret;
905910 }
906911
907− return snd_soc_dapm_add_routes(&rtd->card->dapm, max98388_map,
912+ return snd_soc_dapm_add_routes(dapm, max98388_map,
908913 ARRAY_SIZE(max98388_map));
909914 }
910915
@@ -966,6 +971,7 @@ static const struct snd_soc_dapm_route nau8825_map[] = { · 55 unmodified lines
966971 static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
967972 {
968973 struct snd_soc_card *card = rtd->card;
974+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
969975 struct acp_card_drvdata *drvdata = card->drvdata;
970976 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
971977 struct snd_soc_component *component = codec_dai->component;
@@ -976,7 +982,7 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) · 4 unmodified lines
976982 if (drvdata->hs_codec_id != NAU8825)
977983 return -EINVAL;
978984
979− ret = snd_soc_dapm_new_controls(&card->dapm, nau8825_widgets,
985+ ret = snd_soc_dapm_new_controls(dapm, nau8825_widgets,
980986 ARRAY_SIZE(nau8825_widgets));
981987 if (ret) {
982988 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -1013,7 +1019,7 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines
10131019 return ret;
10141020 }
10151021
1016− return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
1022+ return snd_soc_dapm_add_routes(dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
10171023 }
10181024
10191025 static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
@@ -1102,8 +1108,7 @@ static const struct snd_soc_ops acp_card_nau8825_ops = { · 82 unmodified lines
11021108 static int platform_clock_control(struct snd_soc_dapm_widget *w,
11031109 struct snd_kcontrol *k, int event)
11041110 {
1105− struct snd_soc_dapm_context *dapm = w->dapm;
1106− struct snd_soc_card *card = dapm->card;
1111+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
11071112 struct snd_soc_dai *codec_dai;
11081113 int ret = 0;
11091114
@@ -1181,13 +1186,14 @@ static struct snd_pcm_hw_constraint_list constraints_sample_bits = { · 71 unmodified lines
11811186 static int acp_8821_init(struct snd_soc_pcm_runtime *rtd)
11821187 {
11831188 struct snd_soc_card *card = rtd->card;
1189+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
11841190 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
11851191 struct snd_soc_component *component = codec_dai->component;
11861192 int ret;
11871193
11881194 dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
11891195
1190− ret = snd_soc_dapm_new_controls(&card->dapm, nau8821_widgets,
1196+ ret = snd_soc_dapm_new_controls(dapm, nau8821_widgets,
11911197 ARRAY_SIZE(nau8821_widgets));
11921198 if (ret) {
11931199 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret);
@@ -1221,7 +1227,7 @@ static int acp_8821_init(struct snd_soc_pcm_runtime *rtd) · 27 unmodified lines
12211227
12221228 nau8821_enable_jack_detect(component, &nau8821_jack);
12231229
1224− return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8821_audio_route,
1230+ return snd_soc_dapm_add_routes(dapm, nau8821_audio_route,
12251231 ARRAY_SIZE(nau8821_audio_route));
12261232 }
12271233
@@ -1340,7 +1346,7 @@ static int acp_rtk_set_bias_level(struct snd_soc_card *card, · 112 unmodified lines
13401346 struct snd_soc_dapm_context *dapm,
13411347 enum snd_soc_bias_level level)
13421348 {
1343− struct snd_soc_component *component = dapm->component;
1349+ struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
13441350 struct acp_card_drvdata *drvdata = card->drvdata;
13451351 int ret = 0;
13461352
sound/soc/amd/acp/acp-sdw-legacy-mach.c+19−4
@@ -360,20 +360,25 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 359 unmodified lines
360360 struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
361361 struct asoc_sdw_endpoint *soc_ends __free(kfree) = NULL;
362362 struct asoc_sdw_dailink *soc_dais __free(kfree) = NULL;
363+ struct snd_soc_aux_dev *soc_aux;
363364 struct snd_soc_codec_conf *codec_conf;
364365 struct snd_soc_dai_link *dai_links;
365366 int num_devs = 0;
366367 int num_ends = 0;
368+ int num_aux = 0;
369+ int num_confs;
367370 int num_links;
368371 int be_id = 0;
369372 int ret;
370373
371− ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends);
374+ ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends, &num_aux);
372375 if (ret < 0) {
373376 dev_err(dev, "failed to count devices/endpoints: %d\n", ret);
374377 return ret;
375378 }
376379
380+ num_confs = num_ends;
381+
377382 /* One per DAI link, worst case is a DAI link for every endpoint */
378383 soc_dais = kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL);
379384 if (!soc_dais)
@@ -384,7 +389,11 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 4 unmodified lines
384389 if (!soc_ends)
385390 return -ENOMEM;
386391
387− ret = asoc_sdw_parse_sdw_endpoints(card, soc_dais, soc_ends, &num_devs);
392+ soc_aux = devm_kcalloc(dev, num_aux, sizeof(*soc_aux), GFP_KERNEL);
393+ if (!soc_aux)
394+ return -ENOMEM;
395+
396+ ret = asoc_sdw_parse_sdw_endpoints(card, soc_aux, soc_dais, soc_ends, &num_confs);
388397 if (ret < 0)
389398 return ret;
390399
@@ -396,7 +405,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 5 unmodified lines
396405
397406 dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num);
398407
399− codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL);
408+ codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL);
400409 if (!codec_conf)
401410 return -ENOMEM;
402411
@@ -407,9 +416,11 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 4 unmodified lines
407416 return -ENOMEM;
408417
409418 card->codec_conf = codec_conf;
410− card->num_configs = num_devs;
419+ card->num_configs = num_confs;
411420 card->dai_link = dai_links;
412421 card->num_links = num_links;
422+ card->aux_dev = soc_aux;
423+ card->num_aux_devs = num_aux;
413424
414425 /* SDW */
415426 if (sdw_be_num) {
@@ -463,6 +474,10 @@ static int mc_probe(struct platform_device *pdev) · 47 unmodified lines
463474 card->late_probe = asoc_sdw_card_late_probe;
464475
465476 snd_soc_card_set_drvdata(card, ctx);
477+ if (mach->mach_params.subsystem_id_set)
478+ snd_soc_card_set_pci_ssid(card,
479+ mach->mach_params.subsystem_vendor,
480+ mach->mach_params.subsystem_device);
466481
467482 dmi_check_system(soc_sdw_quirk_table);
468483
sound/soc/amd/acp/acp-sdw-sof-mach.c+10−2
@@ -272,15 +272,17 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 271 unmodified lines
272272 struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
273273 struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL;
274274 struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL;
275+ struct snd_soc_aux_dev *sof_aux;
275276 struct snd_soc_codec_conf *codec_conf;
276277 struct snd_soc_dai_link *dai_links;
277278 int num_devs = 0;
278279 int num_ends = 0;
280+ int num_aux = 0;
279281 int num_links;
280282 int be_id = 0;
281283 int ret;
282284
283− ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends);
285+ ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends, &num_aux);
284286 if (ret < 0) {
285287 dev_err(dev, "failed to count devices/endpoints: %d\n", ret);
286288 return ret;
@@ -296,7 +298,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 9 unmodified lines
296298 if (!sof_ends)
297299 return -ENOMEM;
298300
299− ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs);
301+ sof_aux = devm_kcalloc(dev, num_aux, sizeof(*sof_aux), GFP_KERNEL);
302+ if (!sof_aux)
303+ return -ENOMEM;
304+
305+ ret = asoc_sdw_parse_sdw_endpoints(card, sof_aux, sof_dais, sof_ends, &num_devs);
300306 if (ret < 0)
301307 return ret;
302308
@@ -322,6 +328,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 19 unmodified lines
322328 card->num_configs = num_devs;
323329 card->dai_link = dai_links;
324330 card->num_links = num_links;
331+ card->aux_dev = sof_aux;
332+ card->num_aux_devs = num_aux;
325333
326334 /* SDW */
327335 if (sdw_be_num) {
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c+7−3
@@ -159,7 +159,8 @@ static int acp3x_es83xx_configure_widgets(struct snd_soc_card *card) · 158 unmodified lines
159159 static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w,
160160 struct snd_kcontrol *kcontrol, int event)
161161 {
162− struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card);
162+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
163+ struct acp3x_es83xx_private *priv = get_mach_priv(card);
163164
164165 dev_dbg(priv->codec_dev, "headphone power event = %d\n", event);
165166 if (SND_SOC_DAPM_EVENT_ON(event))
@@ -176,7 +177,8 @@ static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w, · 10 unmodified lines
176177 static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
177178 struct snd_kcontrol *kcontrol, int event)
178179 {
179− struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card);
180+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
181+ struct acp3x_es83xx_private *priv = get_mach_priv(card);
180182
181183 dev_dbg(priv->codec_dev, "speaker power event: %d\n", event);
182184 if (SND_SOC_DAPM_EVENT_ON(event))
@@ -314,7 +316,9 @@ static int acp3x_es83xx_init(struct snd_soc_pcm_runtime *runtime) · 131 unmodified lines
314316
315317 num_routes = acp3x_es83xx_configure_mics(priv);
316318 if (num_routes > 0) {
317− ret = snd_soc_dapm_add_routes(&card->dapm, priv->mic_map, num_routes);
319+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
320+
321+ ret = snd_soc_dapm_add_routes(dapm, priv->mic_map, num_routes);
318322 if (ret != 0)
319323 device_remove_software_node(priv->codec_dev);
320324 }
sound/soc/amd/ps/acp63.h+2−0
@@ -370,6 +370,8 @@ struct acp63_dev_data { · 369 unmodified lines
370370 u32 addr;
371371 u32 reg_range;
372372 u32 acp_rev;
373+ u32 subsystem_vendor;
374+ u32 subsystem_device;
373375 u32 acp_sw_pad_keeper_en;
374376 u32 acp_pad_pulldown_ctrl;
375377 u16 acp63_sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS];
sound/soc/amd/ps/pci-ps.c+9−0
@@ -335,6 +335,12 @@ static struct snd_soc_acpi_mach *acp63_sdw_machine_select(struct device *dev) · 334 unmodified lines
335335 mach->mach_params.links = mach->links;
336336 mach->mach_params.link_mask = mach->link_mask;
337337 mach->mach_params.subsystem_rev = acp_data->acp_rev;
338+ mach->mach_params.subsystem_vendor = acp_data->subsystem_vendor;
339+ mach->mach_params.subsystem_device = acp_data->subsystem_device;
340+ mach->mach_params.subsystem_id_set = true;
341+
342+ dev_dbg(dev, "SSID %x%x\n", mach->mach_params.subsystem_vendor,
343+ mach->mach_params.subsystem_device);
338344 return mach;
339345 }
340346 }
@@ -617,6 +623,9 @@ static int snd_acp63_probe(struct pci_dev *pci, · 276 unmodified lines
617623 adata->addr = addr;
618624 adata->reg_range = ACP63_REG_END - ACP63_REG_START;
619625 adata->acp_rev = pci->revision;
626+ adata->subsystem_vendor = pci->subsystem_vendor;
627+ adata->subsystem_device = pci->subsystem_device;
628+
620629 pci_set_master(pci);
621630 pci_set_drvdata(pci, adata);
622631 mutex_init(&adata->acp_lock);
sound/soc/amd/vangogh/acp5x-mach.c+1−2
@@ -61,8 +61,7 @@ static const struct snd_kcontrol_new acp5x_8821_controls[] = { · 60 unmodified lines
6161 static int platform_clock_control(struct snd_soc_dapm_widget *w,
6262 struct snd_kcontrol *k, int event)
6363 {
64− struct snd_soc_dapm_context *dapm = w->dapm;
65− struct snd_soc_card *card = dapm->card;
64+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
6665 struct snd_soc_dai *dai;
6766 int ret = 0;
6867
sound/soc/atmel/atmel-pdmic.c+2−2
@@ -280,7 +280,7 @@ static const DECLARE_TLV_DB_RANGE(mic_gain_tlv, · 279 unmodified lines
280280 static int pdmic_get_mic_volsw(struct snd_kcontrol *kcontrol,
281281 struct snd_ctl_elem_value *ucontrol)
282282 {
283− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
283+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
284284 unsigned int dgain_val, scale_val;
285285 int i;
286286
@@ -304,7 +304,7 @@ static int pdmic_put_mic_volsw(struct snd_kcontrol *kcontrol, · 17 unmodified lines
304304 {
305305 struct soc_mixer_control *mc =
306306 (struct soc_mixer_control *)kcontrol->private_value;
307− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
307+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
308308 int max = mc->max;
309309 unsigned int val;
310310 int ret;
sound/soc/atmel/sam9g20_wm8731.c+1−1
@@ -80,7 +80,7 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) · 79 unmodified lines
8080 }
8181
8282 #ifndef ENABLE_MIC_INPUT
83− snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic");
83+ snd_soc_dapm_disable_pin(snd_soc_card_to_dapm(rtd->card), "Int Mic");
8484 #endif
8585
8686 return 0;
sound/soc/atmel/tse850-pcm5142.c+16−16
@@ -58,8 +58,8 @@ struct tse850_priv { · 57 unmodified lines
5858 static int tse850_get_mux1(struct snd_kcontrol *kctrl,
5959 struct snd_ctl_elem_value *ucontrol)
6060 {
61− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
62− struct snd_soc_card *card = dapm->card;
61+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
62+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
6363 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
6464
6565 ucontrol->value.enumerated.item[0] = tse850->loop1_cache;
@@ -70,8 +70,8 @@ static int tse850_get_mux1(struct snd_kcontrol *kctrl, · 4 unmodified lines
7070 static int tse850_put_mux1(struct snd_kcontrol *kctrl,
7171 struct snd_ctl_elem_value *ucontrol)
7272 {
73− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
74− struct snd_soc_card *card = dapm->card;
73+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
74+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
7575 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
7676 struct soc_enum *e = (struct soc_enum *)kctrl->private_value;
7777 unsigned int val = ucontrol->value.enumerated.item[0];
@@ -88,8 +88,8 @@ static int tse850_put_mux1(struct snd_kcontrol *kctrl, · 10 unmodified lines
8888 static int tse850_get_mux2(struct snd_kcontrol *kctrl,
8989 struct snd_ctl_elem_value *ucontrol)
9090 {
91− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
92− struct snd_soc_card *card = dapm->card;
91+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
92+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
9393 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
9494
9595 ucontrol->value.enumerated.item[0] = tse850->loop2_cache;
@@ -100,8 +100,8 @@ static int tse850_get_mux2(struct snd_kcontrol *kctrl, · 4 unmodified lines
100100 static int tse850_put_mux2(struct snd_kcontrol *kctrl,
101101 struct snd_ctl_elem_value *ucontrol)
102102 {
103− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
104− struct snd_soc_card *card = dapm->card;
103+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
104+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
105105 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
106106 struct soc_enum *e = (struct soc_enum *)kctrl->private_value;
107107 unsigned int val = ucontrol->value.enumerated.item[0];
@@ -118,8 +118,8 @@ static int tse850_put_mux2(struct snd_kcontrol *kctrl, · 10 unmodified lines
118118 static int tse850_get_mix(struct snd_kcontrol *kctrl,
119119 struct snd_ctl_elem_value *ucontrol)
120120 {
121− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
122− struct snd_soc_card *card = dapm->card;
121+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
122+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
123123 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
124124
125125 ucontrol->value.enumerated.item[0] = tse850->add_cache;
@@ -130,8 +130,8 @@ static int tse850_get_mix(struct snd_kcontrol *kctrl, · 4 unmodified lines
130130 static int tse850_put_mix(struct snd_kcontrol *kctrl,
131131 struct snd_ctl_elem_value *ucontrol)
132132 {
133− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
134− struct snd_soc_card *card = dapm->card;
133+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
134+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
135135 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
136136 int connect = !!ucontrol->value.integer.value[0];
137137
@@ -152,8 +152,8 @@ static int tse850_put_mix(struct snd_kcontrol *kctrl, · 14 unmodified lines
152152 static int tse850_get_ana(struct snd_kcontrol *kctrl,
153153 struct snd_ctl_elem_value *ucontrol)
154154 {
155− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
156− struct snd_soc_card *card = dapm->card;
155+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
156+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
157157 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
158158 int ret;
159159
@@ -185,8 +185,8 @@ static int tse850_get_ana(struct snd_kcontrol *kctrl, · 25 unmodified lines
185185 static int tse850_put_ana(struct snd_kcontrol *kctrl,
186186 struct snd_ctl_elem_value *ucontrol)
187187 {
188− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
189− struct snd_soc_card *card = dapm->card;
188+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl);
189+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
190190 struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
191191 struct soc_enum *e = (struct soc_enum *)kctrl->private_value;
192192 unsigned int uV = ucontrol->value.enumerated.item[0];
sound/soc/codecs/88pm860x-codec.c+6−5
@@ -269,7 +269,7 @@ static int snd_soc_get_volsw_2r_st(struct snd_kcontrol *kcontrol, · 268 unmodified lines
269269 {
270270 struct soc_mixer_control *mc =
271271 (struct soc_mixer_control *)kcontrol->private_value;
272− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
272+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
273273 unsigned int reg = mc->reg;
274274 unsigned int reg2 = mc->rreg;
275275 int val[2], val2[2], i;
@@ -293,7 +293,7 @@ static int snd_soc_put_volsw_2r_st(struct snd_kcontrol *kcontrol, · 17 unmodified lines
293293 {
294294 struct soc_mixer_control *mc =
295295 (struct soc_mixer_control *)kcontrol->private_value;
296− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
296+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
297297 unsigned int reg = mc->reg;
298298 unsigned int reg2 = mc->rreg;
299299 int err;
@@ -326,7 +326,7 @@ static int snd_soc_get_volsw_2r_out(struct snd_kcontrol *kcontrol, · 26 unmodified lines
326326 {
327327 struct soc_mixer_control *mc =
328328 (struct soc_mixer_control *)kcontrol->private_value;
329− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
329+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
330330 unsigned int reg = mc->reg;
331331 unsigned int reg2 = mc->rreg;
332332 unsigned int shift = mc->shift;
@@ -346,7 +346,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol, · 13 unmodified lines
346346 {
347347 struct soc_mixer_control *mc =
348348 (struct soc_mixer_control *)kcontrol->private_value;
349− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
349+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
350350 unsigned int reg = mc->reg;
351351 unsigned int reg2 = mc->rreg;
352352 unsigned int shift = mc->shift;
@@ -1106,6 +1106,7 @@ static int pm860x_set_bias_level(struct snd_soc_component *component, · 753 unmodified lines
11061106 enum snd_soc_bias_level level)
11071107 {
11081108 struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
1109+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11091110 int data;
11101111
11111112 switch (level) {
@@ -1116,7 +1117,7 @@ static int pm860x_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
11161117 break;
11171118
11181119 case SND_SOC_BIAS_STANDBY:
1119− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1120+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
11201121 /* Enable Audio PLL & Audio section */
11211122 data = AUDIO_PLL | AUDIO_SECTION_ON;
11221123 pm860x_reg_write(pm860x->i2c, REG_MISC2, data);
sound/soc/codecs/Kconfig+50−0
@@ -106,6 +106,7 @@ config SND_SOC_ALL_CODECS · 105 unmodified lines
106106 imply SND_SOC_CS48L32
107107 imply SND_SOC_CS53L30
108108 imply SND_SOC_CS530X_I2C
109+ imply SND_SOC_CS530X_SPI
109110 imply SND_SOC_CX20442
110111 imply SND_SOC_CX2072X
111112 imply SND_SOC_DA7210
@@ -170,6 +171,7 @@ config SND_SOC_ALL_CODECS · 58 unmodified lines
170171 imply SND_SOC_MT6359
171172 imply SND_SOC_MT6660
172173 imply SND_SOC_NAU8315
174+ imply SND_SOC_NAU8325
173175 imply SND_SOC_NAU8540
174176 imply SND_SOC_NAU8810
175177 imply SND_SOC_NAU8821
@@ -896,6 +898,38 @@ config SND_SOC_CS35L56_SDW · 720 unmodified lines
896898 help
897899 Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control
898900
901+config SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
902+ bool
903+
904+menu "CS35L56 driver options"
905+ depends on SND_SOC_CS35L56
906+
907+config SND_SOC_CS35L56_CAL_DEBUGFS
908+ bool "CS35L56 create debugfs for factory calibration"
909+ default N
910+ depends on DEBUG_FS
911+ select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
912+ help
913+ Create debugfs entries used during factory-line manufacture
914+ for factory calibration.
915+
916+ If unsure select "N".
917+
918+config SND_SOC_CS35L56_CAL_SET_CTRL
919+ bool "CS35L56 ALSA control to restore factory calibration"
920+ default N
921+ select SND_SOC_CS35L56_CAL_SYSFS_COMMON
922+ help
923+ Allow restoring factory calibration data through an ALSA
924+ control. This is only needed on platforms without UEFI or
925+ some other method of non-volatile storage that the driver
926+ can access directly.
927+
928+ On most platforms this is not needed.
929+
930+ If unsure select "N".
931+endmenu
932+
899933 config SND_SOC_CS40L50
900934 tristate "Cirrus Logic CS40L50 CODEC"
901935 depends on MFD_CS40L50_CORE
@@ -1082,6 +1116,15 @@ config SND_SOC_CS530X_I2C · 180 unmodified lines
10821116 Enable support for Cirrus Logic CS530X ADCs
10831117 with I2C control.
10841118
1119+config SND_SOC_CS530X_SPI
1120+ tristate "Cirrus Logic CS530x ADCs (SPI)"
1121+ depends on SPI_MASTER
1122+ select REGMAP_SPI
1123+ select SND_SOC_CS530X
1124+ help
1125+ Enable support for Cirrus Logic CS530X ADCs
1126+ with SPI control.
1127+
10851128 config SND_SOC_CX20442
10861129 tristate
10871130 depends on TTY
@@ -1567,6 +1610,7 @@ config SND_SOC_PEB2466 · 479 unmodified lines
15671610
15681611 config SND_SOC_PM4125
15691612 depends on SND_SOC_PM4125_SDW
1613+ select SND_SOC_WCD_COMMON
15701614 tristate
15711615 depends on SOUNDWIRE || !SOUNDWIRE
15721616
@@ -1575,6 +1619,7 @@ config SND_SOC_PM4125_SDW · 2 unmodified lines
15751619 select SND_SOC_PM4125
15761620 select SND_SOC_WCD_MBHC
15771621 select REGMAP_IRQ
1622+ select SND_SOC_WCD_COMMON
15781623 depends on SOUNDWIRE
15791624 select REGMAP_SOUNDWIRE
15801625 help
@@ -2310,6 +2355,7 @@ config SND_SOC_WCD934X · 729 unmodified lines
23102355 tristate "WCD9340/WCD9341 Codec"
23112356 depends on COMMON_CLK
23122357 depends on SLIMBUS
2358+ depends on SOUNDWIRE || !SOUNDWIRE
23132359 select REGMAP_IRQ
23142360 select REGMAP_SLIMBUS
23152361 select SND_SOC_WCD_CLASSH
@@ -2715,6 +2761,10 @@ config SND_SOC_MT6660 · 399 unmodified lines
27152761 config SND_SOC_NAU8315
27162762 tristate "Nuvoton Technology Corporation NAU8315 CODEC"
27172763
2764+config SND_SOC_NAU8325
2765+ tristate "Nuvoton Technology Corporation NAU8325 CODEC"
2766+ depends on I2C
2767+
27182768 config SND_SOC_NAU8540
27192769 tristate "Nuvoton Technology Corporation NAU85L40 CODEC"
27202770 depends on I2C
sound/soc/codecs/Makefile+6−2
@@ -50,9 +50,9 @@ snd-soc-audio-iio-aux-y := audio-iio-aux.o · 49 unmodified lines
5050 snd-soc-aw8738-y := aw8738.o
5151 snd-soc-aw87390-y := aw87390.o
5252 snd-soc-aw88081-y := aw88081.o
53−snd-soc-aw88395-lib-y := aw88395/aw88395_lib.o
54−snd-soc-aw88395-y := aw88395/aw88395.o \
53+snd-soc-aw88395-lib-y := aw88395/aw88395_lib.o \
5554 aw88395/aw88395_device.o
55+snd-soc-aw88395-y := aw88395/aw88395.o
5656 snd-soc-aw88166-y := aw88166.o
5757 snd-soc-aw88261-y := aw88261.o
5858 snd-soc-aw88399-y := aw88399.o
@@ -115,6 +115,7 @@ snd-soc-cs48l32-y := cs48l32.o cs48l32-tables.o · 56 unmodified lines
115115 snd-soc-cs53l30-y := cs53l30.o
116116 snd-soc-cs530x-y := cs530x.o
117117 snd-soc-cs530x-i2c-y := cs530x-i2c.o
118+snd-soc-cs530x-spi-y := cs530x-spi.o
118119 snd-soc-cx20442-y := cx20442.o
119120 snd-soc-cx2072x-y := cx2072x.o
120121 snd-soc-da7210-y := da7210.o
@@ -192,6 +193,7 @@ snd-soc-mt6359-y := mt6359.o · 71 unmodified lines
192193 snd-soc-mt6359-accdet-y := mt6359-accdet.o
193194 snd-soc-mt6660-y := mt6660.o
194195 snd-soc-nau8315-y := nau8315.o
196+snd-soc-nau8325-y := nau8325.o
195197 snd-soc-nau8540-y := nau8540.o
196198 snd-soc-nau8810-y := nau8810.o
197199 snd-soc-nau8821-y := nau8821.o
@@ -546,6 +548,7 @@ obj-$(CONFIG_SND_SOC_CS48L32) += snd-soc-cs48l32.o · 348 unmodified lines
546548 obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o
547549 obj-$(CONFIG_SND_SOC_CS530X) += snd-soc-cs530x.o
548550 obj-$(CONFIG_SND_SOC_CS530X_I2C) += snd-soc-cs530x-i2c.o
551+obj-$(CONFIG_SND_SOC_CS530X_SPI) += snd-soc-cs530x-spi.o
549552 obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o
550553 obj-$(CONFIG_SND_SOC_CX2072X) += snd-soc-cx2072x.o
551554 obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
@@ -618,6 +621,7 @@ obj-$(CONFIG_SND_SOC_MT6359) += snd-soc-mt6359.o · 66 unmodified lines
618621 obj-$(CONFIG_SND_SOC_MT6359_ACCDET) += mt6359-accdet.o
619622 obj-$(CONFIG_SND_SOC_MT6660) += snd-soc-mt6660.o
620623 obj-$(CONFIG_SND_SOC_NAU8315) += snd-soc-nau8315.o
624+obj-$(CONFIG_SND_SOC_NAU8325) += snd-soc-nau8325.o
621625 obj-$(CONFIG_SND_SOC_NAU8540) += snd-soc-nau8540.o
622626 obj-$(CONFIG_SND_SOC_NAU8810) += snd-soc-nau8810.o
623627 obj-$(CONFIG_SND_SOC_NAU8821) += snd-soc-nau8821.o
sound/soc/codecs/ab8500-codec.c+9−9
@@ -1114,7 +1114,7 @@ static void anc_configure(struct snd_soc_component *component, · 1113 unmodified lines
11141114 static int sid_status_control_get(struct snd_kcontrol *kcontrol,
11151115 struct snd_ctl_elem_value *ucontrol)
11161116 {
1117− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1117+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11181118 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
11191119
11201120 mutex_lock(&drvdata->ctrl_lock);
@@ -1128,7 +1128,7 @@ static int sid_status_control_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
11281128 static int sid_status_control_put(struct snd_kcontrol *kcontrol,
11291129 struct snd_ctl_elem_value *ucontrol)
11301130 {
1131− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1131+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11321132 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
11331133 unsigned int param, sidconf, val;
11341134 int status = 1;
@@ -1183,7 +1183,7 @@ out: · 48 unmodified lines
11831183 static int anc_status_control_get(struct snd_kcontrol *kcontrol,
11841184 struct snd_ctl_elem_value *ucontrol)
11851185 {
1186− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1186+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11871187 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
11881188
11891189 mutex_lock(&drvdata->ctrl_lock);
@@ -1196,8 +1196,8 @@ static int anc_status_control_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines
11961196 static int anc_status_control_put(struct snd_kcontrol *kcontrol,
11971197 struct snd_ctl_elem_value *ucontrol)
11981198 {
1199− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1200− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1199+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1200+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12011201 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
12021202 struct device *dev = component->dev;
12031203 bool apply_fir, apply_iir;
@@ -1279,7 +1279,7 @@ static int filter_control_info(struct snd_kcontrol *kcontrol, · 75 unmodified lines
12791279 static int filter_control_get(struct snd_kcontrol *kcontrol,
12801280 struct snd_ctl_elem_value *ucontrol)
12811281 {
1282− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1282+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
12831283 struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component);
12841284 struct filter_control *fc =
12851285 (struct filter_control *)kcontrol->private_value;
@@ -1296,7 +1296,7 @@ static int filter_control_get(struct snd_kcontrol *kcontrol, · 10 unmodified lines
12961296 static int filter_control_put(struct snd_kcontrol *kcontrol,
12971297 struct snd_ctl_elem_value *ucontrol)
12981298 {
1299− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1299+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
13001300 struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component);
13011301 struct filter_control *fc =
13021302 (struct filter_control *)kcontrol->private_value;
@@ -1934,7 +1934,7 @@ static int ab8500_audio_init_audioblock(struct snd_soc_component *component) · 631 unmodified lines
19341934 static int ab8500_audio_setup_mics(struct snd_soc_component *component,
19351935 struct amic_settings *amics)
19361936 {
1937− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1937+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
19381938 u8 value8;
19391939 unsigned int value;
19401940 int status;
@@ -2449,7 +2449,7 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np, · 508 unmodified lines
24492449
24502450 static int ab8500_codec_probe(struct snd_soc_component *component)
24512451 {
2452− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2452+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
24532453 struct device *dev = component->dev;
24542454 struct device_node *np = dev->of_node;
24552455 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev);
sound/soc/codecs/ad1836.c+1−1
@@ -250,7 +250,7 @@ static int ad1836_resume(struct snd_soc_component *component) · 249 unmodified lines
250250 static int ad1836_probe(struct snd_soc_component *component)
251251 {
252252 struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component);
253− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
253+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
254254 int num_dacs, num_adcs;
255255 int ret = 0;
256256 int i;
sound/soc/codecs/ad193x.c+2−2
@@ -282,7 +282,7 @@ static int ad193x_set_dai_sysclk(struct snd_soc_dai *codec_dai, · 281 unmodified lines
282282 int clk_id, unsigned int freq, int dir)
283283 {
284284 struct snd_soc_component *component = codec_dai->component;
285− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
285+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
286286 struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
287287
288288 if (clk_id == AD193X_SYSCLK_MCLK) {
@@ -476,7 +476,7 @@ static void ad193x_reg_default_init(struct ad193x_priv *ad193x) · 187 unmodified lines
476476 static int ad193x_component_probe(struct snd_soc_component *component)
477477 {
478478 struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
479− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
479+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
480480 int num, ret;
481481
482482 /* default setting for ad193x */
sound/soc/codecs/adau1761.c+5−4
@@ -621,6 +621,7 @@ static int adau1761_set_bias_level(struct snd_soc_component *component, · 620 unmodified lines
621621 enum snd_soc_bias_level level)
622622 {
623623 struct adau *adau = snd_soc_component_get_drvdata(component);
624+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
624625
625626 switch (level) {
626627 case SND_SOC_BIAS_ON:
@@ -632,7 +633,7 @@ static int adau1761_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines
632633 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
633634 ADAU17X1_CLOCK_CONTROL_SYSCLK_EN,
634635 ADAU17X1_CLOCK_CONTROL_SYSCLK_EN);
635− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
636+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
636637 regcache_sync(adau->regmap);
637638 break;
638639 case SND_SOC_BIAS_OFF:
@@ -658,7 +659,7 @@ static enum adau1761_output_mode adau1761_get_lineout_mode( · 19 unmodified lines
658659
659660 static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component)
660661 {
661− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
662+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
662663 struct adau1761_platform_data *pdata = component->dev->platform_data;
663664 struct adau *adau = snd_soc_component_get_drvdata(component);
664665 enum adau1761_digmic_jackdet_pin_mode mode;
@@ -721,7 +722,7 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component) · 56 unmodified lines
721722
722723 static int adau1761_setup_headphone_mode(struct snd_soc_component *component)
723724 {
724− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
725+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
725726 struct adau *adau = snd_soc_component_get_drvdata(component);
726727 struct adau1761_platform_data *pdata = component->dev->platform_data;
727728 enum adau1761_output_mode mode;
@@ -819,7 +820,7 @@ static bool adau1761_readable_register(struct device *dev, unsigned int reg) · 91 unmodified lines
819820
820821 static int adau1761_component_probe(struct snd_soc_component *component)
821822 {
822− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
823+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
823824 struct adau1761_platform_data *pdata = component->dev->platform_data;
824825 struct adau *adau = snd_soc_component_get_drvdata(component);
825826 int ret;
sound/soc/codecs/adau1781.c+1−1
@@ -381,7 +381,7 @@ static int adau1781_set_input_mode(struct adau *adau, unsigned int reg, · 380 unmodified lines
381381
382382 static int adau1781_component_probe(struct snd_soc_component *component)
383383 {
384− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
384+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
385385 struct adau1781_platform_data *pdata = dev_get_platdata(component->dev);
386386 struct adau *adau = snd_soc_component_get_drvdata(component);
387387 int ret;
sound/soc/codecs/adau17x1.c+7−7
@@ -185,8 +185,8 @@ static const struct snd_soc_dapm_route adau17x1_dapm_pll_route = { · 184 unmodified lines
185185 static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
186186 struct snd_ctl_elem_value *ucontrol)
187187 {
188− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
189− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
188+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
189+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
190190 struct adau *adau = snd_soc_component_get_drvdata(component);
191191 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
192192 struct snd_soc_dapm_update update = {};
@@ -230,7 +230,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, · 37 unmodified lines
230230 static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol,
231231 struct snd_ctl_elem_value *ucontrol)
232232 {
233− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
233+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
234234 struct adau *adau = snd_soc_component_get_drvdata(component);
235235 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
236236 unsigned int stream = e->shift_l;
@@ -383,7 +383,7 @@ static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id, · 146 unmodified lines
383383 static int adau17x1_set_dai_sysclk(struct snd_soc_dai *dai,
384384 int clk_id, unsigned int freq, int dir)
385385 {
386− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(dai->component);
386+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(dai->component);
387387 struct adau *adau = snd_soc_component_get_drvdata(dai->component);
388388 bool is_pll;
389389 bool was_pll;
@@ -881,7 +881,7 @@ static int adau17x1_setup_firmware(struct snd_soc_component *component, · 491 unmodified lines
881881 int ret;
882882 int dspsr, dsp_run;
883883 struct adau *adau = snd_soc_component_get_drvdata(component);
884− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
884+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
885885
886886 /* Check if sample rate is the same as before. If it is there is no
887887 * point in performing the below steps as the call to
@@ -922,7 +922,7 @@ err: · 34 unmodified lines
922922
923923 int adau17x1_add_widgets(struct snd_soc_component *component)
924924 {
925− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
925+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
926926 struct adau *adau = snd_soc_component_get_drvdata(component);
927927 int ret;
928928
@@ -958,7 +958,7 @@ EXPORT_SYMBOL_GPL(adau17x1_add_widgets); · 29 unmodified lines
958958
959959 int adau17x1_add_routes(struct snd_soc_component *component)
960960 {
961− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
961+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
962962 struct adau *adau = snd_soc_component_get_drvdata(component);
963963 int ret;
964964
sound/soc/codecs/adau1977.c+3−2
@@ -473,6 +473,7 @@ static int adau1977_set_bias_level(struct snd_soc_component *component, · 472 unmodified lines
473473 enum snd_soc_bias_level level)
474474 {
475475 struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
476+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
476477 int ret = 0;
477478
478479 switch (level) {
@@ -481,7 +482,7 @@ static int adau1977_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines
481482 case SND_SOC_BIAS_PREPARE:
482483 break;
483484 case SND_SOC_BIAS_STANDBY:
484− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
485+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
485486 ret = adau1977_power_enable(adau1977);
486487 break;
487488 case SND_SOC_BIAS_OFF:
@@ -845,7 +846,7 @@ static int adau1977_set_sysclk(struct snd_soc_component *component, · 357 unmodified lines
845846
846847 static int adau1977_component_probe(struct snd_soc_component *component)
847848 {
848− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
849+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
849850 struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
850851 int ret;
851852
sound/soc/codecs/adau7118.c+3−4
@@ -335,6 +335,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 334 unmodified lines
335335 enum snd_soc_bias_level level)
336336 {
337337 struct adau7118_data *st = snd_soc_component_get_drvdata(component);
338+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
338339 int ret = 0;
339340
340341 dev_dbg(st->dev, "Set bias level %d\n", level);
@@ -345,8 +346,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
345346 break;
346347
347348 case SND_SOC_BIAS_STANDBY:
348− if (snd_soc_component_get_bias_level(component) ==
349− SND_SOC_BIAS_OFF) {
349+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
350350 /* power on */
351351 ret = regulator_enable(st->iovdd);
352352 if (ret)
@@ -393,8 +393,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 40 unmodified lines
393393 static int adau7118_component_probe(struct snd_soc_component *component)
394394 {
395395 struct adau7118_data *st = snd_soc_component_get_drvdata(component);
396− struct snd_soc_dapm_context *dapm =
397− snd_soc_component_get_dapm(component);
396+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
398397 int ret = 0;
399398
400399 if (st->hw_mode) {
sound/soc/codecs/adav80x.c+5−5
@@ -314,7 +314,7 @@ static int adav80x_set_deemph(struct snd_soc_component *component) · 313 unmodified lines
314314 static int adav80x_put_deemph(struct snd_kcontrol *kcontrol,
315315 struct snd_ctl_elem_value *ucontrol)
316316 {
317− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
317+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
318318 struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
319319 unsigned int deemph = ucontrol->value.integer.value[0];
320320
@@ -329,7 +329,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, · 8 unmodified lines
329329 static int adav80x_get_deemph(struct snd_kcontrol *kcontrol,
330330 struct snd_ctl_elem_value *ucontrol)
331331 {
332− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
332+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
333333 struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
334334
335335 ucontrol->value.integer.value[0] = adav80x->deemph;
@@ -539,7 +539,7 @@ static int adav80x_set_sysclk(struct snd_soc_component *component, · 203 unmodified lines
539539 unsigned int freq, int dir)
540540 {
541541 struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
542− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
542+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
543543
544544 if (dir == SND_SOC_CLOCK_IN) {
545545 switch (clk_id) {
@@ -622,7 +622,7 @@ static int adav80x_set_sysclk(struct snd_soc_component *component, · 76 unmodified lines
622622 static int adav80x_set_pll(struct snd_soc_component *component, int pll_id,
623623 int source, unsigned int freq_in, unsigned int freq_out)
624624 {
625− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
625+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
626626 struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
627627 unsigned int pll_ctrl1 = 0;
628628 unsigned int pll_ctrl2 = 0;
@@ -802,7 +802,7 @@ static struct snd_soc_dai_driver adav80x_dais[] = { · 173 unmodified lines
802802
803803 static int adav80x_probe(struct snd_soc_component *component)
804804 {
805− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
805+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
806806 struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
807807
808808 /* Force PLLs on for SYSCLK output */
sound/soc/codecs/ak4458.c+2−2
@@ -187,7 +187,7 @@ static const struct soc_enum ak4458_dif_enum = · 186 unmodified lines
187187 static int get_digfil(struct snd_kcontrol *kcontrol,
188188 struct snd_ctl_elem_value *ucontrol)
189189 {
190− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
190+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
191191 struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
192192
193193 ucontrol->value.enumerated.item[0] = ak4458->digfil;
@@ -198,7 +198,7 @@ static int get_digfil(struct snd_kcontrol *kcontrol, · 4 unmodified lines
198198 static int set_digfil(struct snd_kcontrol *kcontrol,
199199 struct snd_ctl_elem_value *ucontrol)
200200 {
201− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
201+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
202202 struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
203203 int num;
204204
sound/soc/codecs/ak4619.c+2−2
@@ -257,7 +257,7 @@ static void ak4619_set_deemph(struct snd_soc_component *component) · 256 unmodified lines
257257 static int ak4619_put_deemph(struct snd_kcontrol *kcontrol,
258258 struct snd_ctl_elem_value *ucontrol)
259259 {
260− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
260+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
261261 struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component);
262262 int deemph_en = ucontrol->value.integer.value[0];
263263 int ret = 0;
@@ -282,7 +282,7 @@ static int ak4619_put_deemph(struct snd_kcontrol *kcontrol, · 18 unmodified lines
282282 static int ak4619_get_deemph(struct snd_kcontrol *kcontrol,
283283 struct snd_ctl_elem_value *ucontrol)
284284 {
285− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
285+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
286286 struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component);
287287
288288 ucontrol->value.integer.value[0] = ak4619->deemph_en;
sound/soc/codecs/ak4641.c+4−3
@@ -91,7 +91,7 @@ static int ak4641_set_deemph(struct snd_soc_component *component) · 90 unmodified lines
9191 static int ak4641_put_deemph(struct snd_kcontrol *kcontrol,
9292 struct snd_ctl_elem_value *ucontrol)
9393 {
94− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
94+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
9595 struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component);
9696 int deemph = ucontrol->value.integer.value[0];
9797
@@ -106,7 +106,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, · 8 unmodified lines
106106 static int ak4641_get_deemph(struct snd_kcontrol *kcontrol,
107107 struct snd_ctl_elem_value *ucontrol)
108108 {
109− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
109+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
110110 struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component);
111111
112112 ucontrol->value.integer.value[0] = ak4641->deemph;
@@ -415,6 +415,7 @@ static int ak4641_mute(struct snd_soc_dai *dai, int mute, int direction) · 302 unmodified lines
415415 static int ak4641_set_bias_level(struct snd_soc_component *component,
416416 enum snd_soc_bias_level level)
417417 {
418+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
418419 struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component);
419420 struct ak4641_platform_data *pdata = component->dev->platform_data;
420421 int ret;
@@ -429,7 +430,7 @@ static int ak4641_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines
429430 snd_soc_component_update_bits(component, AK4641_DAC, 0x20, 0x20);
430431 break;
431432 case SND_SOC_BIAS_STANDBY:
432− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
433+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
433434 if (pdata && gpio_is_valid(pdata->gpio_power))
434435 gpio_set_value(pdata->gpio_power, 1);
435436 mdelay(1);
sound/soc/codecs/alc5623.c+1−1
@@ -888,7 +888,7 @@ static int alc5623_resume(struct snd_soc_component *component) · 887 unmodified lines
888888 static int alc5623_probe(struct snd_soc_component *component)
889889 {
890890 struct alc5623_priv *alc5623 = snd_soc_component_get_drvdata(component);
891− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
891+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
892892
893893 alc5623_reset(component);
894894
sound/soc/codecs/arizona-jack.c+3−5
@@ -212,17 +212,16 @@ static void arizona_extcon_pulse_micbias(struct arizona_priv *info) · 211 unmodified lines
212212 struct arizona *arizona = info->arizona;
213213 const char *widget = arizona_extcon_get_micbias(info);
214214 struct snd_soc_dapm_context *dapm = arizona->dapm;
215− struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
216215 int ret;
217216
218− ret = snd_soc_component_force_enable_pin(component, widget);
217+ ret = snd_soc_dapm_force_enable_pin(dapm, widget);
219218 if (ret)
220219 dev_warn(arizona->dev, "Failed to enable %s: %d\n", widget, ret);
221220
222221 snd_soc_dapm_sync(dapm);
223222
224223 if (!arizona->pdata.micd_force_micbias) {
225− ret = snd_soc_component_disable_pin(component, widget);
224+ ret = snd_soc_dapm_disable_pin(dapm, widget);
226225 if (ret)
227226 dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret);
228227
@@ -287,7 +286,6 @@ static void arizona_stop_mic(struct arizona_priv *info) · 58 unmodified lines
287286 struct arizona *arizona = info->arizona;
288287 const char *widget = arizona_extcon_get_micbias(info);
289288 struct snd_soc_dapm_context *dapm = arizona->dapm;
290− struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
291289 bool change = false;
292290 int ret;
293291
@@ -297,7 +295,7 @@ static void arizona_stop_mic(struct arizona_priv *info) · 3 unmodified lines
297295 if (ret < 0)
298296 dev_err(arizona->dev, "Failed to disable micd: %d\n", ret);
299297
300− ret = snd_soc_component_disable_pin(component, widget);
298+ ret = snd_soc_dapm_disable_pin(dapm, widget);
301299 if (ret)
302300 dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret);
303301
sound/soc/codecs/arizona.c+10−12
@@ -169,7 +169,7 @@ static const struct snd_soc_dapm_widget arizona_spkr = · 168 unmodified lines
169169
170170 int arizona_init_spk(struct snd_soc_component *component)
171171 {
172− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
172+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
173173 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
174174 struct arizona *arizona = priv->arizona;
175175 int ret;
@@ -238,7 +238,7 @@ static const struct snd_soc_dapm_route arizona_mono_routes[] = { · 62 unmodified lines
238238
239239 int arizona_init_mono(struct snd_soc_component *component)
240240 {
241− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
241+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
242242 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
243243 struct arizona *arizona = priv->arizona;
244244 int i;
@@ -255,6 +255,7 @@ EXPORT_SYMBOL_GPL(arizona_init_mono); · 10 unmodified lines
255255
256256 int arizona_init_gpio(struct snd_soc_component *component)
257257 {
258+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
258259 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
259260 struct arizona *arizona = priv->arizona;
260261 int i;
@@ -262,24 +263,21 @@ int arizona_init_gpio(struct snd_soc_component *component) · 1 unmodified line
262263 switch (arizona->type) {
263264 case WM5110:
264265 case WM8280:
265− snd_soc_component_disable_pin(component,
266− "DRC2 Signal Activity");
266+ snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity");
267267 break;
268268 default:
269269 break;
270270 }
271271
272− snd_soc_component_disable_pin(component, "DRC1 Signal Activity");
272+ snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity");
273273
274274 for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
275275 switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) {
276276 case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT:
277− snd_soc_component_enable_pin(component,
278− "DRC1 Signal Activity");
277+ snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity");
279278 break;
280279 case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT:
281− snd_soc_component_enable_pin(component,
282− "DRC2 Signal Activity");
280+ snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity");
283281 break;
284282 default:
285283 break;
@@ -1911,7 +1909,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, · 1625 unmodified lines
19111909 int clk_id, unsigned int freq, int dir)
19121910 {
19131911 struct snd_soc_component *component = dai->component;
1914− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1912+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
19151913 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
19161914 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
19171915 struct snd_soc_dapm_route routes[2];
@@ -2724,7 +2722,7 @@ static bool arizona_eq_filter_unstable(bool mode, __be16 _a, __be16 _b) · 806 unmodified lines
27242722 int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
27252723 struct snd_ctl_elem_value *ucontrol)
27262724 {
2727− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2725+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
27282726 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
27292727 struct soc_bytes *params = (void *)kcontrol->private_value;
27302728 unsigned int val;
@@ -2768,7 +2766,7 @@ EXPORT_SYMBOL_GPL(arizona_eq_coeff_put); · 37 unmodified lines
27682766 int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
27692767 struct snd_ctl_elem_value *ucontrol)
27702768 {
2771− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2769+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
27722770 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
27732771 __be16 *data = (__be16 *)ucontrol->value.bytes.data;
27742772 s16 val = be16_to_cpu(*data);
sound/soc/codecs/audio-iio-aux.c+1−1
@@ -131,7 +131,7 @@ static_assert(ARRAY_SIZE(routes) >= 2, "2 routes are needed"); · 130 unmodified lines
131131 static int audio_iio_aux_add_dapms(struct snd_soc_component *component,
132132 struct audio_iio_aux_chan *chan)
133133 {
134− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
134+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
135135 int ret;
136136
137137 /* Allocated names are not needed afterwards (duplicated in ASoC internals) */
sound/soc/codecs/aw87390.c+7−7
@@ -175,7 +175,7 @@ static int aw87390_dev_set_profile_index(struct aw_device *aw_dev, int index) · 174 unmodified lines
175175 static int aw87390_profile_info(struct snd_kcontrol *kcontrol,
176176 struct snd_ctl_elem_info *uinfo)
177177 {
178− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
178+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
179179 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec);
180180 char *prof_name;
181181 int count, ret;
@@ -210,7 +210,7 @@ static int aw87390_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
210210 static int aw87390_profile_get(struct snd_kcontrol *kcontrol,
211211 struct snd_ctl_elem_value *ucontrol)
212212 {
213− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
213+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
214214 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec);
215215
216216 ucontrol->value.integer.value[0] = aw87390->aw_pa->prof_index;
@@ -221,7 +221,7 @@ static int aw87390_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
221221 static int aw87390_profile_set(struct snd_kcontrol *kcontrol,
222222 struct snd_ctl_elem_value *ucontrol)
223223 {
224− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
224+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
225225 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec);
226226 int ret;
227227
@@ -360,7 +360,7 @@ static void aw87390_parse_channel_dt(struct aw87390 *aw87390) · 132 unmodified lines
360360 aw_dev->channel = channel_value;
361361 }
362362
363−static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct regmap *regmap)
363+static int aw87390_init(struct aw87390 *aw87390, struct i2c_client *i2c, struct regmap *regmap)
364364 {
365365 struct aw_device *aw_dev;
366366 unsigned int chip_id;
@@ -384,7 +384,7 @@ static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct · 17 unmodified lines
384384 if (!aw_dev)
385385 return -ENOMEM;
386386
387− (*aw87390)->aw_pa = aw_dev;
387+ aw87390->aw_pa = aw_dev;
388388 aw_dev->i2c = i2c;
389389 aw_dev->regmap = regmap;
390390 aw_dev->dev = &i2c->dev;
@@ -398,7 +398,7 @@ static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct · 7 unmodified lines
398398 aw_dev->prof_index = AW87390_INIT_PROFILE;
399399 aw_dev->status = AW87390_DEV_PW_OFF;
400400
401− aw87390_parse_channel_dt(*aw87390);
401+ aw87390_parse_channel_dt(aw87390);
402402
403403 return 0;
404404 }
@@ -426,7 +426,7 @@ static int aw87390_i2c_probe(struct i2c_client *i2c) · 21 unmodified lines
426426 "failed to init regmap\n");
427427
428428 /* aw pa init */
429− ret = aw87390_init(&aw87390, i2c, aw87390->regmap);
429+ ret = aw87390_init(aw87390, i2c, aw87390->regmap);
430430 if (ret)
431431 return ret;
432432
sound/soc/codecs/aw88081.c+12−12
@@ -779,7 +779,7 @@ static void aw88081_start(struct aw88081 *aw88081, bool sync_start) · 778 unmodified lines
779779 if (sync_start == AW88081_SYNC_START)
780780 aw88081_start_pa(aw88081);
781781 else
782− queue_delayed_work(system_wq,
782+ queue_delayed_work(system_dfl_wq,
783783 &aw88081->start_work,
784784 AW88081_START_WORK_DELAY_MS);
785785 }
@@ -808,7 +808,7 @@ static struct snd_soc_dai_driver aw88081_dai[] = { · 22 unmodified lines
808808 static int aw88081_get_fade_in_time(struct snd_kcontrol *kcontrol,
809809 struct snd_ctl_elem_value *ucontrol)
810810 {
811− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
811+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
812812 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component);
813813 struct aw_device *aw_dev = aw88081->aw_pa;
814814
@@ -820,7 +820,7 @@ static int aw88081_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
820820 static int aw88081_set_fade_in_time(struct snd_kcontrol *kcontrol,
821821 struct snd_ctl_elem_value *ucontrol)
822822 {
823− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
823+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
824824 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component);
825825 struct soc_mixer_control *mc =
826826 (struct soc_mixer_control *)kcontrol->private_value;
@@ -843,7 +843,7 @@ static int aw88081_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines
843843 static int aw88081_get_fade_out_time(struct snd_kcontrol *kcontrol,
844844 struct snd_ctl_elem_value *ucontrol)
845845 {
846− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
846+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
847847 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component);
848848 struct aw_device *aw_dev = aw88081->aw_pa;
849849
@@ -855,7 +855,7 @@ static int aw88081_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
855855 static int aw88081_set_fade_out_time(struct snd_kcontrol *kcontrol,
856856 struct snd_ctl_elem_value *ucontrol)
857857 {
858− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
858+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
859859 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component);
860860 struct soc_mixer_control *mc =
861861 (struct soc_mixer_control *)kcontrol->private_value;
@@ -891,7 +891,7 @@ static int aw88081_dev_set_profile_index(struct aw_device *aw_dev, int index) · 29 unmodified lines
891891 static int aw88081_profile_info(struct snd_kcontrol *kcontrol,
892892 struct snd_ctl_elem_info *uinfo)
893893 {
894− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
894+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
895895 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
896896 char *prof_name;
897897 int count, ret;
@@ -926,7 +926,7 @@ static int aw88081_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
926926 static int aw88081_profile_get(struct snd_kcontrol *kcontrol,
927927 struct snd_ctl_elem_value *ucontrol)
928928 {
929− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
929+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
930930 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
931931
932932 ucontrol->value.integer.value[0] = aw88081->aw_pa->prof_index;
@@ -937,7 +937,7 @@ static int aw88081_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
937937 static int aw88081_profile_set(struct snd_kcontrol *kcontrol,
938938 struct snd_ctl_elem_value *ucontrol)
939939 {
940− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
940+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
941941 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
942942 int ret;
943943
@@ -963,7 +963,7 @@ static int aw88081_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines
963963 static int aw88081_volume_get(struct snd_kcontrol *kcontrol,
964964 struct snd_ctl_elem_value *ucontrol)
965965 {
966− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
966+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
967967 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
968968 struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc;
969969
@@ -975,7 +975,7 @@ static int aw88081_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
975975 static int aw88081_volume_set(struct snd_kcontrol *kcontrol,
976976 struct snd_ctl_elem_value *ucontrol)
977977 {
978− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
978+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
979979 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
980980 struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc;
981981 struct soc_mixer_control *mc =
@@ -1003,7 +1003,7 @@ static int aw88081_volume_set(struct snd_kcontrol *kcontrol, · 21 unmodified lines
10031003 static int aw88081_get_fade_step(struct snd_kcontrol *kcontrol,
10041004 struct snd_ctl_elem_value *ucontrol)
10051005 {
1006− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1006+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
10071007 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
10081008
10091009 ucontrol->value.integer.value[0] = aw88081->aw_pa->fade_step;
@@ -1014,7 +1014,7 @@ static int aw88081_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines
10141014 static int aw88081_set_fade_step(struct snd_kcontrol *kcontrol,
10151015 struct snd_ctl_elem_value *ucontrol)
10161016 {
1017− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1017+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
10181018 struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec);
10191019 struct soc_mixer_control *mc =
10201020 (struct soc_mixer_control *)kcontrol->private_value;
sound/soc/codecs/aw88166.c+23−136
@@ -41,109 +41,6 @@ static const struct regmap_config aw88166_remap_config = { · 40 unmodified lines
4141 .val_format_endian = REGMAP_ENDIAN_BIG,
4242 };
4343
44−static int aw_dev_dsp_write_16bit(struct aw_device *aw_dev,
45− unsigned short dsp_addr, unsigned int dsp_data)
46−{
47− int ret;
48−
49− ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr);
50− if (ret) {
51− dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret);
52− return ret;
53− }
54−
55− ret = regmap_write(aw_dev->regmap, AW88166_DSPMDAT_REG, (u16)dsp_data);
56− if (ret) {
57− dev_err(aw_dev->dev, "%s write data error, ret=%d", __func__, ret);
58− return ret;
59− }
60−
61− return 0;
62−}
63−
64−static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev,
65− unsigned short dsp_addr, unsigned int *dsp_data)
66−{
67− unsigned int temp_data;
68− int ret;
69−
70− ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr);
71− if (ret) {
72− dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret);
73− return ret;
74− }
75−
76− ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data);
77− if (ret) {
78− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
79− return ret;
80− }
81− *dsp_data = temp_data;
82−
83− return 0;
84−}
85−
86−static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev,
87− unsigned short dsp_addr, unsigned int *dsp_data)
88−{
89− unsigned int temp_data;
90− int ret;
91−
92− ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr);
93− if (ret) {
94− dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret);
95− return ret;
96− }
97−
98− ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data);
99− if (ret) {
100− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
101− return ret;
102− }
103− *dsp_data = temp_data;
104−
105− ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data);
106− if (ret) {
107− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
108− return ret;
109− }
110− *dsp_data |= (temp_data << 16);
111−
112− return 0;
113−}
114−
115−static int aw_dev_dsp_read(struct aw_device *aw_dev,
116− unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type)
117−{
118− u32 reg_value;
119− int ret;
120−
121− mutex_lock(&aw_dev->dsp_lock);
122− switch (data_type) {
123− case AW88166_DSP_16_DATA:
124− ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data);
125− if (ret)
126− dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit failed", (u32)dsp_addr);
127− break;
128− case AW88166_DSP_32_DATA:
129− ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data);
130− if (ret)
131− dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32-bit failed", (u32)dsp_addr);
132− break;
133− default:
134− dev_err(aw_dev->dev, "data type[%d] unsupported", data_type);
135− ret = -EINVAL;
136− break;
137− }
138−
139− /* clear dsp chip select state */
140− if (regmap_read(aw_dev->regmap, AW88166_ID_REG, &reg_value))
141− dev_err(aw_dev->dev, "%s fail to clear chip state. ret=%d\n", __func__, ret);
142− mutex_unlock(&aw_dev->dsp_lock);
143−
144− return ret;
145−}
146−
14744 static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd)
14845 {
14946 int ret;
@@ -904,25 +801,19 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev, · 754 unmodified lines
904801 u32 tmp_len;
905802 int i, ret;
906803
907− mutex_lock(&aw_dev->dsp_lock);
908804 ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, base);
909805 if (ret)
910− goto error_operation;
806+ return ret;
911807
912808 for (i = 0; i < len; i += AW88166_MAX_RAM_WRITE_BYTE_SIZE) {
913809 tmp_len = min(len - i, AW88166_MAX_RAM_WRITE_BYTE_SIZE);
914810 ret = regmap_raw_write(aw_dev->regmap, AW88166_DSPMDAT_REG,
915811 &data[i], tmp_len);
916812 if (ret)
917− goto error_operation;
813+ return ret;
918814 }
919− mutex_unlock(&aw_dev->dsp_lock);
920815
921816 return 0;
922−
923−error_operation:
924− mutex_unlock(&aw_dev->dsp_lock);
925− return ret;
926817 }
927818
928819 static int aw_dev_get_ra(struct aw_cali_desc *cali_desc)
@@ -933,7 +824,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 4 unmodified lines
933824 int ret;
934825
935826 ret = aw_dev_dsp_read(aw_dev, AW88166_DSP_REG_CFG_ADPZ_RA,
936− &dsp_ra, AW88166_DSP_32_DATA);
827+ &dsp_ra, AW_DSP_32_DATA);
937828 if (ret) {
938829 dev_err(aw_dev->dev, "read ra error\n");
939830 return ret;
@@ -990,29 +881,25 @@ static int aw_dev_check_sram(struct aw_device *aw_dev) · 50 unmodified lines
990881 {
991882 unsigned int reg_val;
992883
993− mutex_lock(&aw_dev->dsp_lock);
994884 /* read dsp_rom_check_reg */
995− aw_dev_dsp_read_16bit(aw_dev, AW88166_DSP_ROM_CHECK_ADDR, &reg_val);
885+ aw_dev_dsp_read(aw_dev, AW88166_DSP_ROM_CHECK_ADDR, &reg_val, AW_DSP_16_DATA);
996886 if (reg_val != AW88166_DSP_ROM_CHECK_DATA) {
997887 dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]\n",
998888 reg_val, AW88166_DSP_ROM_CHECK_DATA);
999− goto error;
889+ return -EPERM;
1000890 }
1001891
1002892 /* check dsp_cfg_base_addr */
1003− aw_dev_dsp_write_16bit(aw_dev, AW88166_DSP_CFG_ADDR, AW88166_DSP_ODD_NUM_BIT_TEST);
1004− aw_dev_dsp_read_16bit(aw_dev, AW88166_DSP_CFG_ADDR, &reg_val);
893+ aw_dev_dsp_write(aw_dev, AW88166_DSP_CFG_ADDR,
894+ AW88166_DSP_ODD_NUM_BIT_TEST, AW_DSP_16_DATA);
895+ aw_dev_dsp_read(aw_dev, AW88166_DSP_CFG_ADDR, &reg_val, AW_DSP_16_DATA);
1005896 if (reg_val != AW88166_DSP_ODD_NUM_BIT_TEST) {
1006897 dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]\n",
1007898 reg_val, AW88166_DSP_ODD_NUM_BIT_TEST);
1008− goto error;
899+ return -EPERM;
1009900 }
1010− mutex_unlock(&aw_dev->dsp_lock);
1011901
1012902 return 0;
1013−error:
1014− mutex_unlock(&aw_dev->dsp_lock);
1015− return -EPERM;
1016903 }
1017904
1018905 static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag)
@@ -1310,7 +1197,7 @@ static void aw88166_start(struct aw88166 *aw88166, bool sync_start) · 291 unmodified lines
13101197 if (sync_start == AW88166_SYNC_START)
13111198 aw88166_start_pa(aw88166);
13121199 else
1313− queue_delayed_work(system_wq,
1200+ queue_delayed_work(system_dfl_wq,
13141201 &aw88166->start_work,
13151202 AW88166_START_WORK_DELAY_MS);
13161203 }
@@ -1391,7 +1278,7 @@ static struct snd_soc_dai_driver aw88166_dai[] = { · 74 unmodified lines
13911278 static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol,
13921279 struct snd_ctl_elem_value *ucontrol)
13931280 {
1394− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1281+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
13951282 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
13961283 struct aw_device *aw_dev = aw88166->aw_pa;
13971284
@@ -1403,7 +1290,7 @@ static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
14031290 static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol,
14041291 struct snd_ctl_elem_value *ucontrol)
14051292 {
1406− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1293+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
14071294 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
14081295 struct soc_mixer_control *mc =
14091296 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1426,7 +1313,7 @@ static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines
14261313 static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol,
14271314 struct snd_ctl_elem_value *ucontrol)
14281315 {
1429− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1316+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
14301317 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
14311318 struct aw_device *aw_dev = aw88166->aw_pa;
14321319
@@ -1438,7 +1325,7 @@ static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
14381325 static int aw88166_set_fade_out_time(struct snd_kcontrol *kcontrol,
14391326 struct snd_ctl_elem_value *ucontrol)
14401327 {
1441− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1328+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
14421329 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
14431330 struct soc_mixer_control *mc =
14441331 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1476,7 +1363,7 @@ static int aw88166_dev_set_profile_index(struct aw_device *aw_dev, int index) · 31 unmodified lines
14761363 static int aw88166_profile_info(struct snd_kcontrol *kcontrol,
14771364 struct snd_ctl_elem_info *uinfo)
14781365 {
1479− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1366+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
14801367 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
14811368 char *prof_name;
14821369 int count, ret;
@@ -1511,7 +1398,7 @@ static int aw88166_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
15111398 static int aw88166_profile_get(struct snd_kcontrol *kcontrol,
15121399 struct snd_ctl_elem_value *ucontrol)
15131400 {
1514− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1401+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15151402 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15161403
15171404 ucontrol->value.integer.value[0] = aw88166->aw_pa->prof_index;
@@ -1522,7 +1409,7 @@ static int aw88166_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
15221409 static int aw88166_profile_set(struct snd_kcontrol *kcontrol,
15231410 struct snd_ctl_elem_value *ucontrol)
15241411 {
1525− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1412+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15261413 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15271414 int ret;
15281415
@@ -1547,7 +1434,7 @@ static int aw88166_profile_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines
15471434 static int aw88166_volume_get(struct snd_kcontrol *kcontrol,
15481435 struct snd_ctl_elem_value *ucontrol)
15491436 {
1550− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1437+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15511438 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15521439 struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc;
15531440
@@ -1559,7 +1446,7 @@ static int aw88166_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
15591446 static int aw88166_volume_set(struct snd_kcontrol *kcontrol,
15601447 struct snd_ctl_elem_value *ucontrol)
15611448 {
1562− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1449+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15631450 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15641451 struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc;
15651452 struct soc_mixer_control *mc =
@@ -1583,7 +1470,7 @@ static int aw88166_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines
15831470 static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol,
15841471 struct snd_ctl_elem_value *ucontrol)
15851472 {
1586− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1473+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15871474 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15881475
15891476 ucontrol->value.integer.value[0] = aw88166->aw_pa->fade_step;
@@ -1594,7 +1481,7 @@ static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines
15941481 static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol,
15951482 struct snd_ctl_elem_value *ucontrol)
15961483 {
1597− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1484+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
15981485 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
15991486 struct soc_mixer_control *mc =
16001487 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1615,7 +1502,7 @@ static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines
16151502 static int aw88166_re_get(struct snd_kcontrol *kcontrol,
16161503 struct snd_ctl_elem_value *ucontrol)
16171504 {
1618− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1505+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
16191506 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
16201507 struct aw_device *aw_dev = aw88166->aw_pa;
16211508
@@ -1627,7 +1514,7 @@ static int aw88166_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
16271514 static int aw88166_re_set(struct snd_kcontrol *kcontrol,
16281515 struct snd_ctl_elem_value *ucontrol)
16291516 {
1630− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1517+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
16311518 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
16321519 struct soc_mixer_control *mc =
16331520 (struct soc_mixer_control *)kcontrol->private_value;
sound/soc/codecs/aw88166.h+0−5
@@ -516,11 +516,6 @@ enum AW88166_DEV_DSP_CFG { · 515 unmodified lines
516516 AW88166_DEV_DSP_BYPASS = 1,
517517 };
518518
519−enum {
520− AW88166_DSP_16_DATA = 0,
521− AW88166_DSP_32_DATA = 1,
522−};
523−
524519 enum {
525520 AW88166_SYNC_START = 0,
526521 AW88166_ASYNC_START,
sound/soc/codecs/aw88261.c+17−17
@@ -705,7 +705,7 @@ static void aw88261_start(struct aw88261 *aw88261, bool sync_start) · 704 unmodified lines
705705 if (sync_start == AW88261_SYNC_START)
706706 aw88261_start_pa(aw88261);
707707 else
708− queue_delayed_work(system_wq,
708+ queue_delayed_work(system_dfl_wq,
709709 &aw88261->start_work,
710710 AW88261_START_WORK_DELAY_MS);
711711 }
@@ -734,7 +734,7 @@ static struct snd_soc_dai_driver aw88261_dai[] = { · 22 unmodified lines
734734 static int aw88261_get_fade_in_time(struct snd_kcontrol *kcontrol,
735735 struct snd_ctl_elem_value *ucontrol)
736736 {
737− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
737+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
738738 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
739739 struct aw_device *aw_dev = aw88261->aw_pa;
740740
@@ -746,7 +746,7 @@ static int aw88261_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
746746 static int aw88261_set_fade_in_time(struct snd_kcontrol *kcontrol,
747747 struct snd_ctl_elem_value *ucontrol)
748748 {
749− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
749+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
750750 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
751751 struct soc_mixer_control *mc =
752752 (struct soc_mixer_control *)kcontrol->private_value;
@@ -769,7 +769,7 @@ static int aw88261_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines
769769 static int aw88261_get_fade_out_time(struct snd_kcontrol *kcontrol,
770770 struct snd_ctl_elem_value *ucontrol)
771771 {
772− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
772+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
773773 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
774774 struct aw_device *aw_dev = aw88261->aw_pa;
775775
@@ -781,7 +781,7 @@ static int aw88261_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
781781 static int aw88261_set_fade_out_time(struct snd_kcontrol *kcontrol,
782782 struct snd_ctl_elem_value *ucontrol)
783783 {
784− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
784+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
785785 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
786786 struct soc_mixer_control *mc =
787787 (struct soc_mixer_control *)kcontrol->private_value;
@@ -817,7 +817,7 @@ static int aw88261_dev_set_profile_index(struct aw_device *aw_dev, int index) · 29 unmodified lines
817817 static int aw88261_profile_info(struct snd_kcontrol *kcontrol,
818818 struct snd_ctl_elem_info *uinfo)
819819 {
820− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
820+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
821821 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
822822 char *prof_name;
823823 int count, ret;
@@ -852,7 +852,7 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
852852 static int aw88261_profile_get(struct snd_kcontrol *kcontrol,
853853 struct snd_ctl_elem_value *ucontrol)
854854 {
855− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
855+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
856856 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
857857
858858 ucontrol->value.integer.value[0] = aw88261->aw_pa->prof_index;
@@ -863,7 +863,7 @@ static int aw88261_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
863863 static int aw88261_profile_set(struct snd_kcontrol *kcontrol,
864864 struct snd_ctl_elem_value *ucontrol)
865865 {
866− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
866+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
867867 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
868868 int ret;
869869
@@ -889,7 +889,7 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines
889889 static int aw88261_volume_get(struct snd_kcontrol *kcontrol,
890890 struct snd_ctl_elem_value *ucontrol)
891891 {
892− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
892+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
893893 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
894894 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc;
895895
@@ -901,7 +901,7 @@ static int aw88261_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
901901 static int aw88261_volume_set(struct snd_kcontrol *kcontrol,
902902 struct snd_ctl_elem_value *ucontrol)
903903 {
904− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
904+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
905905 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
906906 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc;
907907 struct soc_mixer_control *mc =
@@ -926,7 +926,7 @@ static int aw88261_volume_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines
926926 static int aw88261_get_fade_step(struct snd_kcontrol *kcontrol,
927927 struct snd_ctl_elem_value *ucontrol)
928928 {
929− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
929+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
930930 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
931931
932932 ucontrol->value.integer.value[0] = aw88261->aw_pa->fade_step;
@@ -937,7 +937,7 @@ static int aw88261_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines
937937 static int aw88261_set_fade_step(struct snd_kcontrol *kcontrol,
938938 struct snd_ctl_elem_value *ucontrol)
939939 {
940− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
940+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
941941 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
942942 struct soc_mixer_control *mc =
943943 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1131,7 +1131,7 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261) · 187 unmodified lines
11311131
11321132 static int aw88261_codec_probe(struct snd_soc_component *component)
11331133 {
1134− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1134+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11351135 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
11361136 int ret;
11371137
@@ -1184,7 +1184,7 @@ static void aw88261_parse_channel_dt(struct aw88261 *aw88261) · 46 unmodified lines
11841184 aw_dev->channel = channel_value;
11851185 }
11861186
1187−static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap)
1187+static int aw88261_init(struct aw88261 *aw88261, struct i2c_client *i2c, struct regmap *regmap)
11881188 {
11891189 struct aw_device *aw_dev;
11901190 unsigned int chip_id;
@@ -1207,7 +1207,7 @@ static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct · 16 unmodified lines
12071207 if (!aw_dev)
12081208 return -ENOMEM;
12091209
1210− (*aw88261)->aw_pa = aw_dev;
1210+ aw88261->aw_pa = aw_dev;
12111211 aw_dev->i2c = i2c;
12121212 aw_dev->regmap = regmap;
12131213 aw_dev->dev = &i2c->dev;
@@ -1221,7 +1221,7 @@ static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct · 7 unmodified lines
12211221 aw_dev->fade_step = AW88261_VOLUME_STEP_DB;
12221222 aw_dev->volume_desc.ctl_volume = AW88261_VOL_DEFAULT_VALUE;
12231223 aw_dev->volume_desc.mute_volume = AW88261_MUTE_VOL;
1224− aw88261_parse_channel_dt(*aw88261);
1224+ aw88261_parse_channel_dt(aw88261);
12251225
12261226 return ret;
12271227 }
@@ -1250,7 +1250,7 @@ static int aw88261_i2c_probe(struct i2c_client *i2c) · 22 unmodified lines
12501250 }
12511251
12521252 /* aw pa init */
1253− ret = aw88261_init(&aw88261, i2c, aw88261->regmap);
1253+ ret = aw88261_init(aw88261, i2c, aw88261->regmap);
12541254 if (ret)
12551255 return ret;
12561256
sound/soc/codecs/aw88395/aw88395.c+15−15
@@ -75,7 +75,7 @@ static void aw88395_start(struct aw88395 *aw88395, bool sync_start) · 74 unmodified lines
7575 if (sync_start == AW88395_SYNC_START)
7676 aw88395_start_pa(aw88395);
7777 else
78− queue_delayed_work(system_wq,
78+ queue_delayed_work(system_dfl_wq,
7979 &aw88395->start_work,
8080 AW88395_START_WORK_DELAY_MS);
8181 }
@@ -104,7 +104,7 @@ static struct snd_soc_dai_driver aw88395_dai[] = { · 22 unmodified lines
104104 static int aw88395_get_fade_in_time(struct snd_kcontrol *kcontrol,
105105 struct snd_ctl_elem_value *ucontrol)
106106 {
107− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
107+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
108108 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component);
109109 struct aw_device *aw_dev = aw88395->aw_pa;
110110
@@ -116,7 +116,7 @@ static int aw88395_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
116116 static int aw88395_set_fade_in_time(struct snd_kcontrol *kcontrol,
117117 struct snd_ctl_elem_value *ucontrol)
118118 {
119− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
119+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
120120 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component);
121121 struct soc_mixer_control *mc =
122122 (struct soc_mixer_control *)kcontrol->private_value;
@@ -139,7 +139,7 @@ static int aw88395_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines
139139 static int aw88395_get_fade_out_time(struct snd_kcontrol *kcontrol,
140140 struct snd_ctl_elem_value *ucontrol)
141141 {
142− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
142+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
143143 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component);
144144 struct aw_device *aw_dev = aw88395->aw_pa;
145145
@@ -151,7 +151,7 @@ static int aw88395_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
151151 static int aw88395_set_fade_out_time(struct snd_kcontrol *kcontrol,
152152 struct snd_ctl_elem_value *ucontrol)
153153 {
154− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
154+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
155155 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component);
156156 struct soc_mixer_control *mc =
157157 (struct soc_mixer_control *)kcontrol->private_value;
@@ -173,7 +173,7 @@ static int aw88395_set_fade_out_time(struct snd_kcontrol *kcontrol, · 15 unmodified lines
173173 static int aw88395_profile_info(struct snd_kcontrol *kcontrol,
174174 struct snd_ctl_elem_info *uinfo)
175175 {
176− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
176+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
177177 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
178178 char *prof_name;
179179 int count, ret;
@@ -208,7 +208,7 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
208208 static int aw88395_profile_get(struct snd_kcontrol *kcontrol,
209209 struct snd_ctl_elem_value *ucontrol)
210210 {
211− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
211+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
212212 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
213213
214214 ucontrol->value.integer.value[0] = aw88395_dev_get_profile_index(aw88395->aw_pa);
@@ -219,7 +219,7 @@ static int aw88395_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
219219 static int aw88395_profile_set(struct snd_kcontrol *kcontrol,
220220 struct snd_ctl_elem_value *ucontrol)
221221 {
222− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
222+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
223223 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
224224 int ret;
225225
@@ -245,7 +245,7 @@ static int aw88395_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines
245245 static int aw88395_volume_get(struct snd_kcontrol *kcontrol,
246246 struct snd_ctl_elem_value *ucontrol)
247247 {
248− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
248+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
249249 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
250250 struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc;
251251
@@ -257,7 +257,7 @@ static int aw88395_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
257257 static int aw88395_volume_set(struct snd_kcontrol *kcontrol,
258258 struct snd_ctl_elem_value *ucontrol)
259259 {
260− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
260+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
261261 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
262262 struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc;
263263 struct soc_mixer_control *mc =
@@ -281,7 +281,7 @@ static int aw88395_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines
281281 static int aw88395_get_fade_step(struct snd_kcontrol *kcontrol,
282282 struct snd_ctl_elem_value *ucontrol)
283283 {
284− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
284+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
285285 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
286286
287287 ucontrol->value.integer.value[0] = aw88395->aw_pa->fade_step;
@@ -292,7 +292,7 @@ static int aw88395_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines
292292 static int aw88395_set_fade_step(struct snd_kcontrol *kcontrol,
293293 struct snd_ctl_elem_value *ucontrol)
294294 {
295− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
295+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
296296 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
297297 struct soc_mixer_control *mc =
298298 (struct soc_mixer_control *)kcontrol->private_value;
@@ -313,7 +313,7 @@ static int aw88395_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines
313313 static int aw88395_re_get(struct snd_kcontrol *kcontrol,
314314 struct snd_ctl_elem_value *ucontrol)
315315 {
316− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
316+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
317317 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
318318 struct aw_device *aw_dev = aw88395->aw_pa;
319319
@@ -325,7 +325,7 @@ static int aw88395_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
325325 static int aw88395_re_set(struct snd_kcontrol *kcontrol,
326326 struct snd_ctl_elem_value *ucontrol)
327327 {
328− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
328+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
329329 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
330330 struct soc_mixer_control *mc =
331331 (struct soc_mixer_control *)kcontrol->private_value;
@@ -401,7 +401,7 @@ static const struct snd_soc_dapm_route aw88395_audio_map[] = { · 69 unmodified lines
401401
402402 static int aw88395_codec_probe(struct snd_soc_component *component)
403403 {
404− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
404+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
405405 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component);
406406 int ret;
407407
sound/soc/codecs/aw88395/aw88395_device.c+20−19
@@ -64,7 +64,7 @@ static int aw_dev_dsp_write_32bit(struct aw_device *aw_dev, · 63 unmodified lines
6464 return 0;
6565 }
6666
67−static int aw_dev_dsp_write(struct aw_device *aw_dev,
67+int aw_dev_dsp_write(struct aw_device *aw_dev,
6868 unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type)
6969 {
7070 u32 reg_value;
@@ -72,13 +72,13 @@ static int aw_dev_dsp_write(struct aw_device *aw_dev, · 1 unmodified line
7272
7373 mutex_lock(&aw_dev->dsp_lock);
7474 switch (data_type) {
75− case AW88395_DSP_16_DATA:
75+ case AW_DSP_16_DATA:
7676 ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data);
7777 if (ret)
7878 dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed",
7979 (u32)dsp_addr, dsp_data);
8080 break;
81− case AW88395_DSP_32_DATA:
81+ case AW_DSP_32_DATA:
8282 ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data);
8383 if (ret)
8484 dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed",
@@ -97,6 +97,7 @@ static int aw_dev_dsp_write(struct aw_device *aw_dev, · 12 unmodified lines
9797
9898 return ret;
9999 }
100+EXPORT_SYMBOL_GPL(aw_dev_dsp_write);
100101
101102 static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev,
102103 unsigned short dsp_addr, unsigned int *dsp_data)
@@ -149,7 +150,7 @@ static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev, · 46 unmodified lines
149150 return 0;
150151 }
151152
152−static int aw_dev_dsp_read(struct aw_device *aw_dev,
153+int aw_dev_dsp_read(struct aw_device *aw_dev,
153154 unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type)
154155 {
155156 u32 reg_value;
@@ -157,13 +158,13 @@ static int aw_dev_dsp_read(struct aw_device *aw_dev, · 1 unmodified line
157158
158159 mutex_lock(&aw_dev->dsp_lock);
159160 switch (data_type) {
160− case AW88395_DSP_16_DATA:
161+ case AW_DSP_16_DATA:
161162 ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data);
162163 if (ret)
163164 dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed",
164165 (u32)dsp_addr, *dsp_data);
165166 break;
166− case AW88395_DSP_32_DATA:
167+ case AW_DSP_32_DATA:
167168 ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data);
168169 if (ret)
169170 dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed",
@@ -182,7 +183,7 @@ static int aw_dev_dsp_read(struct aw_device *aw_dev, · 12 unmodified lines
182183
183184 return ret;
184185 }
185−
186+EXPORT_SYMBOL_GPL(aw_dev_dsp_read);
186187
187188 static int aw_dev_read_chipid(struct aw_device *aw_dev, u16 *chip_id)
188189 {
@@ -231,7 +232,7 @@ static int aw_dev_dsp_fw_check(struct aw_device *aw_dev) · 42 unmodified lines
231232 dsp_fw_desc = &set_prof_desc->sec_desc[AW88395_DATA_TYPE_DSP_FW];
232233
233234 for (i = 0; i < AW88395_FW_CHECK_PART; i++) {
234− ret = aw_dev_dsp_read(aw_dev, addr, &dsp_val, AW88395_DSP_16_DATA);
235+ ret = aw_dev_dsp_read(aw_dev, addr, &dsp_val, AW_DSP_16_DATA);
235236 if (ret) {
236237 dev_err(aw_dev->dev, "dsp read failed");
237238 return ret;
@@ -351,11 +352,11 @@ static int aw_dev_modify_dsp_cfg(struct aw_device *aw_dev, · 113 unmodified lines
351352 return -EINVAL;
352353 }
353354 switch (data_type) {
354− case AW88395_DSP_16_DATA:
355+ case AW_DSP_16_DATA:
355356 data1 = cpu_to_le16((u16)dsp_data);
356357 memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data1, 2);
357358 break;
358− case AW88395_DSP_32_DATA:
359+ case AW_DSP_32_DATA:
359360 data2 = cpu_to_le32(dsp_data);
360361 memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data2, 4);
361362 break;
@@ -377,14 +378,14 @@ static int aw_dev_dsp_set_cali_re(struct aw_device *aw_dev) · 15 unmodified lines
377378
378379 /* set cali re to device */
379380 ret = aw_dev_dsp_write(aw_dev,
380− AW88395_DSP_REG_CFG_ADPZ_RE, cali_re, AW88395_DSP_32_DATA);
381+ AW88395_DSP_REG_CFG_ADPZ_RE, cali_re, AW_DSP_32_DATA);
381382 if (ret) {
382383 dev_err(aw_dev->dev, "set cali re error");
383384 return ret;
384385 }
385386
386387 ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RE,
387− cali_re, AW88395_DSP_32_DATA);
388+ cali_re, AW_DSP_32_DATA);
388389 if (ret)
389390 dev_err(aw_dev->dev, "modify dsp cfg failed");
390391
@@ -428,7 +429,7 @@ static int aw_dev_dsp_set_crc32(struct aw_device *aw_dev) · 37 unmodified lines
428429 crc_value = crc32c(0xFFFFFFFF, crc_dsp_cfg->data, crc_data_len) ^ 0xFFFFFFFF;
429430
430431 return aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_CRC_ADDR, crc_value,
431− AW88395_DSP_32_DATA);
432+ AW_DSP_32_DATA);
432433 }
433434
434435 static void aw_dev_dsp_check_crc_enable(struct aw_device *aw_dev, bool flag)
@@ -663,7 +664,7 @@ static int aw_dev_set_vcalb(struct aw_device *aw_dev) · 228 unmodified lines
663664 int vcalb, vcalk;
664665 int ret;
665666
666− ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VCALB, &vcalb_adj, AW88395_DSP_16_DATA);
667+ ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VCALB, &vcalb_adj, AW_DSP_16_DATA);
667668 if (ret) {
668669 dev_err(aw_dev->dev, "read vcalb_adj failed");
669670 return ret;
@@ -720,14 +721,14 @@ static int aw_dev_set_vcalb(struct aw_device *aw_dev) · 50 unmodified lines
720721 dev_dbg(aw_dev->dev, "vcalb=%d, reg_val=0x%x, vcalb_adj =0x%x",
721722 vcalb, reg_val, vcalb_adj);
722723
723− ret = aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_VCALB, reg_val, AW88395_DSP_16_DATA);
724+ ret = aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_VCALB, reg_val, AW_DSP_16_DATA);
724725 if (ret) {
725726 dev_err(aw_dev->dev, "write vcalb failed");
726727 return ret;
727728 }
728729
729730 ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_VCALB,
730− (u32)reg_val, AW88395_DSP_16_DATA);
731+ (u32)reg_val, AW_DSP_16_DATA);
731732 if (ret)
732733 dev_err(aw_dev->dev, "modify dsp cfg failed");
733734
@@ -741,7 +742,7 @@ static int aw_dev_get_cali_f0_delay(struct aw_device *aw_dev) · 7 unmodified lines
741742 int ret;
742743
743744 ret = aw_dev_dsp_read(aw_dev,
744− AW88395_DSP_CALI_F0_DELAY, &cali_delay, AW88395_DSP_16_DATA);
745+ AW88395_DSP_CALI_F0_DELAY, &cali_delay, AW_DSP_16_DATA);
745746 if (ret)
746747 dev_err(aw_dev->dev, "read cali delay failed, ret=%d", ret);
747748 else
@@ -991,7 +992,7 @@ static int aw_dev_get_dsp_status(struct aw_device *aw_dev) · 243 unmodified lines
991992
992993 static int aw_dev_get_vmax(struct aw_device *aw_dev, unsigned int *vmax)
993994 {
994− return aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VMAX, vmax, AW88395_DSP_16_DATA);
995+ return aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VMAX, vmax, AW_DSP_16_DATA);
995996 }
996997
997998 static int aw_dev_update_reg_container(struct aw_device *aw_dev,
@@ -1089,7 +1090,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 91 unmodified lines
10891090 int ret;
10901091
10911092 ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RA,
1092− &dsp_ra, AW88395_DSP_32_DATA);
1093+ &dsp_ra, AW_DSP_32_DATA);
10931094 if (ret) {
10941095 dev_err(aw_dev->dev, "read ra error");
10951096 return ret;
sound/soc/codecs/aw88395/aw88395_device.h+6−2
@@ -89,8 +89,8 @@ enum AW88395_DEV_DSP_CFG { · 88 unmodified lines
8989 };
9090
9191 enum {
92− AW88395_DSP_16_DATA = 0,
93− AW88395_DSP_32_DATA = 1,
92+ AW_DSP_16_DATA = 0,
93+ AW_DSP_32_DATA = 1,
9494 };
9595
9696 enum {
@@ -210,5 +210,9 @@ int aw88395_dev_get_profile_count(struct aw_device *aw_dev); · 113 unmodified lines
210210 int aw88395_dev_load_acf_check(struct aw_device *aw_dev, struct aw_container *aw_cfg);
211211 int aw88395_dev_cfg_load(struct aw_device *aw_dev, struct aw_container *aw_cfg);
212212 void aw88395_dev_mute(struct aw_device *aw_dev, bool is_mute);
213+int aw_dev_dsp_write(struct aw_device *aw_dev,
214+ unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type);
215+int aw_dev_dsp_read(struct aw_device *aw_dev,
216+ unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type);
213217
214218 #endif
sound/soc/codecs/aw88399.c+38−215
@@ -26,172 +26,6 @@ static const struct regmap_config aw88399_remap_config = { · 25 unmodified lines
2626 .val_format_endian = REGMAP_ENDIAN_BIG,
2727 };
2828
29−static int aw_dev_dsp_write_16bit(struct aw_device *aw_dev,
30− unsigned short dsp_addr, unsigned int dsp_data)
31−{
32− int ret;
33−
34− ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr);
35− if (ret) {
36− dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret);
37− return ret;
38− }
39−
40− ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, (u16)dsp_data);
41− if (ret) {
42− dev_err(aw_dev->dev, "%s write data error, ret=%d", __func__, ret);
43− return ret;
44− }
45−
46− return 0;
47−}
48−
49−static int aw_dev_dsp_write_32bit(struct aw_device *aw_dev,
50− unsigned short dsp_addr, unsigned int dsp_data)
51−{
52− unsigned int temp_data;
53− int ret;
54−
55− ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr);
56− if (ret) {
57− dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret);
58− return ret;
59− }
60−
61− temp_data = dsp_data & AW88395_DSP_16_DATA_MASK;
62− ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, temp_data);
63− if (ret) {
64− dev_err(aw_dev->dev, "%s write datal error, ret=%d", __func__, ret);
65− return ret;
66− }
67−
68− temp_data = dsp_data >> 16;
69− ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, temp_data);
70− if (ret)
71− dev_err(aw_dev->dev, "%s write datah error, ret=%d", __func__, ret);
72−
73− return ret;
74−}
75−
76−static int aw_dev_dsp_write(struct aw_device *aw_dev,
77− unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type)
78−{
79− unsigned int reg_value;
80− int ret;
81−
82− mutex_lock(&aw_dev->dsp_lock);
83− switch (data_type) {
84− case AW88395_DSP_16_DATA:
85− ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data);
86− if (ret)
87− dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed",
88− dsp_addr, dsp_data);
89− break;
90− case AW88395_DSP_32_DATA:
91− ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data);
92− if (ret)
93− dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed",
94− dsp_addr, dsp_data);
95− break;
96− default:
97− dev_err(aw_dev->dev, "data type[%d] unsupported", data_type);
98− ret = -EINVAL;
99− break;
100− }
101−
102− /* clear dsp chip select state */
103− if (regmap_read(aw_dev->regmap, 0x00, &reg_value))
104− dev_err(aw_dev->dev, "%s fail to clear chip state. Err=%d\n", __func__, ret);
105− mutex_unlock(&aw_dev->dsp_lock);
106−
107− return ret;
108−}
109−
110−static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev,
111− unsigned short dsp_addr, unsigned int *dsp_data)
112−{
113− unsigned int temp_data;
114− int ret;
115−
116− ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr);
117− if (ret) {
118− dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret);
119− return ret;
120− }
121−
122− ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data);
123− if (ret) {
124− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
125− return ret;
126− }
127− *dsp_data = temp_data;
128−
129− return 0;
130−}
131−
132−static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev,
133− unsigned short dsp_addr, unsigned int *dsp_data)
134−{
135− unsigned int temp_data;
136− int ret;
137−
138− ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr);
139− if (ret) {
140− dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret);
141− return ret;
142− }
143−
144− ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data);
145− if (ret) {
146− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
147− return ret;
148− }
149− *dsp_data = temp_data;
150−
151− ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data);
152− if (ret) {
153− dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
154− return ret;
155− }
156− *dsp_data |= (temp_data << 16);
157−
158− return 0;
159−}
160−
161−static int aw_dev_dsp_read(struct aw_device *aw_dev,
162− unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type)
163−{
164− u32 reg_value;
165− int ret;
166−
167− mutex_lock(&aw_dev->dsp_lock);
168− switch (data_type) {
169− case AW88399_DSP_16_DATA:
170− ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data);
171− if (ret)
172− dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed",
173− (u32)dsp_addr, *dsp_data);
174− break;
175− case AW88399_DSP_32_DATA:
176− ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data);
177− if (ret)
178− dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed",
179− (u32)dsp_addr, *dsp_data);
180− break;
181− default:
182− dev_err(aw_dev->dev, "data type[%d] unsupported", data_type);
183− ret = -EINVAL;
184− break;
185− }
186−
187− /* clear dsp chip select state */
188− if (regmap_read(aw_dev->regmap, AW88399_ID_REG, &reg_value))
189− dev_err(aw_dev->dev, "%s fail to clear chip state. ret=%d\n", __func__, ret);
190− mutex_unlock(&aw_dev->dsp_lock);
191−
192− return ret;
193−}
194−
19529 static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd)
19630 {
19731 int ret;
@@ -929,25 +763,19 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev, · 731 unmodified lines
929763 u32 tmp_len;
930764 int i, ret;
931765
932− mutex_lock(&aw_dev->dsp_lock);
933766 ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, base);
934767 if (ret)
935− goto error_operation;
768+ return ret;
936769
937770 for (i = 0; i < len; i += AW88399_MAX_RAM_WRITE_BYTE_SIZE) {
938771 tmp_len = min(len - i, AW88399_MAX_RAM_WRITE_BYTE_SIZE);
939772 ret = regmap_raw_write(aw_dev->regmap, AW88399_DSPMDAT_REG,
940773 &data[i], tmp_len);
941774 if (ret)
942− goto error_operation;
775+ return ret;
943776 }
944− mutex_unlock(&aw_dev->dsp_lock);
945777
946778 return 0;
947−
948−error_operation:
949− mutex_unlock(&aw_dev->dsp_lock);
950− return ret;
951779 }
952780
953781 static int aw_dev_get_ra(struct aw_cali_desc *cali_desc)
@@ -958,7 +786,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 4 unmodified lines
958786 int ret;
959787
960788 ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_RA,
961− &dsp_ra, AW88399_DSP_32_DATA);
789+ &dsp_ra, AW_DSP_32_DATA);
962790 if (ret) {
963791 dev_err(aw_dev->dev, "read ra error");
964792 return ret;
@@ -1015,29 +843,25 @@ static int aw_dev_check_sram(struct aw_device *aw_dev) · 50 unmodified lines
1015843 {
1016844 unsigned int reg_val;
1017845
1018− mutex_lock(&aw_dev->dsp_lock);
1019846 /* read dsp_rom_check_reg */
1020− aw_dev_dsp_read_16bit(aw_dev, AW88399_DSP_ROM_CHECK_ADDR, &reg_val);
847+ aw_dev_dsp_read(aw_dev, AW88399_DSP_ROM_CHECK_ADDR, &reg_val, AW_DSP_16_DATA);
1021848 if (reg_val != AW88399_DSP_ROM_CHECK_DATA) {
1022849 dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]",
1023850 reg_val, AW88399_DSP_ROM_CHECK_DATA);
1024− goto error;
851+ return -EPERM;
1025852 }
1026853
1027854 /* check dsp_cfg_base_addr */
1028− aw_dev_dsp_write_16bit(aw_dev, AW88399_DSP_CFG_ADDR, AW88399_DSP_ODD_NUM_BIT_TEST);
1029− aw_dev_dsp_read_16bit(aw_dev, AW88399_DSP_CFG_ADDR, &reg_val);
855+ aw_dev_dsp_write(aw_dev, AW88399_DSP_CFG_ADDR,
856+ AW88399_DSP_ODD_NUM_BIT_TEST, AW_DSP_16_DATA);
857+ aw_dev_dsp_read(aw_dev, AW88399_DSP_CFG_ADDR, &reg_val, AW_DSP_16_DATA);
1030858 if (reg_val != AW88399_DSP_ODD_NUM_BIT_TEST) {
1031859 dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]",
1032860 reg_val, AW88399_DSP_ODD_NUM_BIT_TEST);
1033− goto error;
861+ return -EPERM;
1034862 }
1035− mutex_unlock(&aw_dev->dsp_lock);
1036863
1037864 return 0;
1038−error:
1039− mutex_unlock(&aw_dev->dsp_lock);
1040− return -EPERM;
1041865 }
1042866
1043867 static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag)
@@ -1340,7 +1164,7 @@ static void aw88399_start(struct aw88399 *aw88399, bool sync_start) · 296 unmodified lines
13401164 if (sync_start == AW88399_SYNC_START)
13411165 aw88399_start_pa(aw88399);
13421166 else
1343− queue_delayed_work(system_wq,
1167+ queue_delayed_work(system_dfl_wq,
13441168 &aw88399->start_work,
13451169 AW88399_START_WORK_DELAY_MS);
13461170 }
@@ -1432,22 +1256,22 @@ static int aw_cali_svc_get_cali_cfg(struct aw_device *aw_dev) · 85 unmodified lines
14321256 int ret;
14331257
14341258 ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH,
1435− &cali_cfg->data[0], AW88399_DSP_32_DATA);
1259+ &cali_cfg->data[0], AW_DSP_32_DATA);
14361260 if (ret)
14371261 return ret;
14381262
14391263 ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH,
1440− &cali_cfg->data[1], AW88399_DSP_32_DATA);
1264+ &cali_cfg->data[1], AW_DSP_32_DATA);
14411265 if (ret)
14421266 return ret;
14431267
14441268 ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN,
1445− &cali_cfg->data[2], AW88399_DSP_16_DATA);
1269+ &cali_cfg->data[2], AW_DSP_16_DATA);
14461270 if (ret)
14471271 return ret;
14481272
14491273 ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA,
1450− &cali_cfg->data[3], AW88399_DSP_16_DATA);
1274+ &cali_cfg->data[3], AW_DSP_16_DATA);
14511275
14521276 return ret;
14531277 }
@@ -1458,22 +1282,22 @@ static int aw_cali_svc_set_cali_cfg(struct aw_device *aw_dev, · 4 unmodified lines
14581282 int ret;
14591283
14601284 ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH,
1461− cali_cfg.data[0], AW88399_DSP_32_DATA);
1285+ cali_cfg.data[0], AW_DSP_32_DATA);
14621286 if (ret)
14631287 return ret;
14641288
14651289 ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH,
1466− cali_cfg.data[1], AW88399_DSP_32_DATA);
1290+ cali_cfg.data[1], AW_DSP_32_DATA);
14671291 if (ret)
14681292 return ret;
14691293
14701294 ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN,
1471− cali_cfg.data[2], AW88399_DSP_16_DATA);
1295+ cali_cfg.data[2], AW_DSP_16_DATA);
14721296 if (ret)
14731297 return ret;
14741298
14751299 ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA,
1476− cali_cfg.data[3], AW88399_DSP_16_DATA);
1300+ cali_cfg.data[3], AW_DSP_16_DATA);
14771301
14781302 return ret;
14791303 }
@@ -1488,7 +1312,7 @@ static int aw_cali_svc_cali_en(struct aw_device *aw_dev, bool cali_en) · 8 unmodified lines
14881312 regmap_update_bits(aw_dev->regmap, AW88399_DBGCTRL_REG,
14891313 ~AW883XX_DSP_NG_EN_MASK, AW883XX_DSP_NG_EN_DISABLE_VALUE);
14901314 aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR,
1491− AW88399_DSP_LOW_POWER_SWITCH_DISABLE, AW88399_DSP_16_DATA);
1315+ AW88399_DSP_LOW_POWER_SWITCH_DISABLE, AW_DSP_16_DATA);
14921316
14931317 ret = aw_cali_svc_get_cali_cfg(aw_dev);
14941318 if (ret) {
@@ -1548,8 +1372,7 @@ static void aw_cali_svc_backup_info(struct aw_device *aw_dev) · 53 unmodified lines
15481372 regmap_read(aw_dev->regmap, AW88399_DBGCTRL_REG, &reg_val);
15491373 backup_desc->dsp_ng_cfg = reg_val & (~AW883XX_DSP_NG_EN_MASK);
15501374
1551− aw_dev_dsp_read(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR,
1552− &dsp_val, AW88399_DSP_16_DATA);
1375+ aw_dev_dsp_read(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, &dsp_val, AW_DSP_16_DATA);
15531376
15541377 backup_desc->dsp_lp_cfg = dsp_val;
15551378 }
@@ -1562,7 +1385,7 @@ static void aw_cali_svc_recover_info(struct aw_device *aw_dev) · 6 unmodified lines
15621385 ~AW883XX_DSP_NG_EN_MASK, backup_desc->dsp_ng_cfg);
15631386
15641387 aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR,
1565− backup_desc->dsp_lp_cfg, AW88399_DSP_16_DATA);
1388+ backup_desc->dsp_lp_cfg, AW_DSP_16_DATA);
15661389 }
15671390
15681391 static int aw_cali_svc_cali_re_mode_enable(struct aw_device *aw_dev, bool is_enable)
@@ -1609,7 +1432,7 @@ static int aw_cali_svc_get_dev_re(struct aw_device *aw_dev, uint32_t *re) · 40 unmodified lines
16091432 uint32_t dsp_re, show_re;
16101433 int ret;
16111434
1612− ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CALRE, &dsp_re, AW88399_DSP_16_DATA);
1435+ ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CALRE, &dsp_re, AW_DSP_16_DATA);
16131436 if (ret)
16141437 return ret;
16151438
@@ -1744,7 +1567,7 @@ re_mode_err: · 128 unmodified lines
17441567 static int aw88399_get_fade_in_time(struct snd_kcontrol *kcontrol,
17451568 struct snd_ctl_elem_value *ucontrol)
17461569 {
1747− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1570+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
17481571 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component);
17491572 struct aw_device *aw_dev = aw88399->aw_pa;
17501573
@@ -1756,7 +1579,7 @@ static int aw88399_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
17561579 static int aw88399_set_fade_in_time(struct snd_kcontrol *kcontrol,
17571580 struct snd_ctl_elem_value *ucontrol)
17581581 {
1759− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1582+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
17601583 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component);
17611584 struct soc_mixer_control *mc =
17621585 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1779,7 +1602,7 @@ static int aw88399_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines
17791602 static int aw88399_get_fade_out_time(struct snd_kcontrol *kcontrol,
17801603 struct snd_ctl_elem_value *ucontrol)
17811604 {
1782− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1605+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
17831606 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component);
17841607 struct aw_device *aw_dev = aw88399->aw_pa;
17851608
@@ -1791,7 +1614,7 @@ static int aw88399_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines
17911614 static int aw88399_set_fade_out_time(struct snd_kcontrol *kcontrol,
17921615 struct snd_ctl_elem_value *ucontrol)
17931616 {
1794− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1617+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
17951618 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component);
17961619 struct soc_mixer_control *mc =
17971620 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1829,7 +1652,7 @@ static int aw88399_dev_set_profile_index(struct aw_device *aw_dev, int index) · 31 unmodified lines
18291652 static int aw88399_profile_info(struct snd_kcontrol *kcontrol,
18301653 struct snd_ctl_elem_info *uinfo)
18311654 {
1832− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1655+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
18331656 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
18341657 char *prof_name;
18351658 int count, ret;
@@ -1864,7 +1687,7 @@ static int aw88399_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines
18641687 static int aw88399_profile_get(struct snd_kcontrol *kcontrol,
18651688 struct snd_ctl_elem_value *ucontrol)
18661689 {
1867− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1690+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
18681691 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
18691692
18701693 ucontrol->value.integer.value[0] = aw88399->aw_pa->prof_index;
@@ -1875,7 +1698,7 @@ static int aw88399_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
18751698 static int aw88399_profile_set(struct snd_kcontrol *kcontrol,
18761699 struct snd_ctl_elem_value *ucontrol)
18771700 {
1878− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1701+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
18791702 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
18801703 int ret;
18811704
@@ -1900,7 +1723,7 @@ static int aw88399_profile_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines
19001723 static int aw88399_volume_get(struct snd_kcontrol *kcontrol,
19011724 struct snd_ctl_elem_value *ucontrol)
19021725 {
1903− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1726+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19041727 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19051728 struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc;
19061729
@@ -1912,7 +1735,7 @@ static int aw88399_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
19121735 static int aw88399_volume_set(struct snd_kcontrol *kcontrol,
19131736 struct snd_ctl_elem_value *ucontrol)
19141737 {
1915− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1738+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19161739 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19171740 struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc;
19181741 struct soc_mixer_control *mc =
@@ -1936,7 +1759,7 @@ static int aw88399_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines
19361759 static int aw88399_get_fade_step(struct snd_kcontrol *kcontrol,
19371760 struct snd_ctl_elem_value *ucontrol)
19381761 {
1939− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1762+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19401763 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19411764
19421765 ucontrol->value.integer.value[0] = aw88399->aw_pa->fade_step;
@@ -1947,7 +1770,7 @@ static int aw88399_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines
19471770 static int aw88399_set_fade_step(struct snd_kcontrol *kcontrol,
19481771 struct snd_ctl_elem_value *ucontrol)
19491772 {
1950− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1773+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19511774 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19521775 struct soc_mixer_control *mc =
19531776 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1968,7 +1791,7 @@ static int aw88399_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines
19681791 static int aw88399_re_get(struct snd_kcontrol *kcontrol,
19691792 struct snd_ctl_elem_value *ucontrol)
19701793 {
1971− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1794+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19721795 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19731796 struct aw_device *aw_dev = aw88399->aw_pa;
19741797
@@ -1980,7 +1803,7 @@ static int aw88399_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
19801803 static int aw88399_re_set(struct snd_kcontrol *kcontrol,
19811804 struct snd_ctl_elem_value *ucontrol)
19821805 {
1983− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1806+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
19841807 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
19851808 struct soc_mixer_control *mc =
19861809 (struct soc_mixer_control *)kcontrol->private_value;
@@ -2002,7 +1825,7 @@ static int aw88399_re_set(struct snd_kcontrol *kcontrol, · 15 unmodified lines
20021825 static int aw88399_calib_switch_get(struct snd_kcontrol *kcontrol,
20031826 struct snd_ctl_elem_value *ucontrol)
20041827 {
2005− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1828+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
20061829 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
20071830 struct aw_device *aw_dev = aw88399->aw_pa;
20081831
@@ -2014,7 +1837,7 @@ static int aw88399_calib_switch_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
20141837 static int aw88399_calib_switch_set(struct snd_kcontrol *kcontrol,
20151838 struct snd_ctl_elem_value *ucontrol)
20161839 {
2017− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1840+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
20181841 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
20191842 struct aw_device *aw_dev = aw88399->aw_pa;
20201843
@@ -2036,7 +1859,7 @@ static int aw88399_calib_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines
20361859 static int aw88399_calib_set(struct snd_kcontrol *kcontrol,
20371860 struct snd_ctl_elem_value *ucontrol)
20381861 {
2039− struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
1862+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
20401863 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
20411864 struct aw_device *aw_dev = aw88399->aw_pa;
20421865
sound/soc/codecs/aw88399.h+0−5
@@ -602,11 +602,6 @@ enum AW88399_DEV_DSP_CFG { · 601 unmodified lines
602602 AW88399_DEV_DSP_BYPASS = 1,
603603 };
604604
605−enum {
606− AW88399_DSP_16_DATA = 0,
607− AW88399_DSP_32_DATA = 1,
608−};
609−
610605 enum {
611606 AW88399_NOT_RCV_MODE = 0,
612607 AW88399_RCV_MODE = 1,
sound/soc/codecs/bd28623.c+2−4
@@ -70,8 +70,7 @@ static void bd28623_power_off(struct bd28623_priv *bd) · 69 unmodified lines
7070 static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol,
7171 struct snd_ctl_elem_value *ucontrol)
7272 {
73− struct snd_soc_component *component =
74− snd_soc_kcontrol_component(kcontrol);
73+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
7574 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component);
7675
7776 ucontrol->value.integer.value[0] = bd->switch_spk;
@@ -82,8 +81,7 @@ static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol, · 4 unmodified lines
8281 static int bd28623_set_switch_spk(struct snd_kcontrol *kcontrol,
8382 struct snd_ctl_elem_value *ucontrol)
8483 {
85− struct snd_soc_component *component =
86− snd_soc_kcontrol_component(kcontrol);
84+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
8785 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component);
8886
8987 if (bd->switch_spk == ucontrol->value.integer.value[0])
sound/soc/codecs/cpcap.c+9−12
@@ -380,7 +380,7 @@ static SOC_ENUM_SINGLE_DECL(cpcap_emu_r_mux_enum, 0, 8, cpcap_out_mux_texts); · 379 unmodified lines
380380 static int cpcap_output_mux_get_enum(struct snd_kcontrol *kcontrol,
381381 struct snd_ctl_elem_value *ucontrol)
382382 {
383− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
383+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
384384 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
385385 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
386386 unsigned int shift = e->shift_l;
@@ -423,10 +423,9 @@ static int cpcap_output_mux_get_enum(struct snd_kcontrol *kcontrol, · 36 unmodified lines
423423 static int cpcap_output_mux_put_enum(struct snd_kcontrol *kcontrol,
424424 struct snd_ctl_elem_value *ucontrol)
425425 {
426− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
426+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
427427 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
428− struct snd_soc_dapm_context *dapm =
429− snd_soc_dapm_kcontrol_dapm(kcontrol);
428+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
430429 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
431430 unsigned int muxval = ucontrol->value.enumerated.item[0];
432431 unsigned int mask = BIT(e->shift_l);
@@ -468,7 +467,7 @@ static int cpcap_output_mux_put_enum(struct snd_kcontrol *kcontrol, · 35 unmodified lines
468467 static int cpcap_input_right_mux_get_enum(struct snd_kcontrol *kcontrol,
469468 struct snd_ctl_elem_value *ucontrol)
470469 {
471− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
470+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
472471 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
473472 int regval, mask;
474473 int err;
@@ -507,10 +506,9 @@ static int cpcap_input_right_mux_get_enum(struct snd_kcontrol *kcontrol, · 32 unmodified lines
507506 static int cpcap_input_right_mux_put_enum(struct snd_kcontrol *kcontrol,
508507 struct snd_ctl_elem_value *ucontrol)
509508 {
510− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
509+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
511510 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
512− struct snd_soc_dapm_context *dapm =
513− snd_soc_dapm_kcontrol_dapm(kcontrol);
511+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
514512 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
515513 unsigned int muxval = ucontrol->value.enumerated.item[0];
516514 int regval = 0, mask;
@@ -552,7 +550,7 @@ static int cpcap_input_right_mux_put_enum(struct snd_kcontrol *kcontrol, · 35 unmodified lines
552550 static int cpcap_input_left_mux_get_enum(struct snd_kcontrol *kcontrol,
553551 struct snd_ctl_elem_value *ucontrol)
554552 {
555− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
553+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
556554 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
557555 int regval, mask;
558556 int err;
@@ -583,10 +581,9 @@ static int cpcap_input_left_mux_get_enum(struct snd_kcontrol *kcontrol, · 24 unmodified lines
583581 static int cpcap_input_left_mux_put_enum(struct snd_kcontrol *kcontrol,
584582 struct snd_ctl_elem_value *ucontrol)
585583 {
586− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
584+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
587585 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
588− struct snd_soc_dapm_context *dapm =
589− snd_soc_dapm_kcontrol_dapm(kcontrol);
586+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
590587 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
591588 unsigned int muxval = ucontrol->value.enumerated.item[0];
592589 int regval = 0, mask;
sound/soc/codecs/cros_ec_codec.c+4−6
@@ -108,8 +108,7 @@ error: · 107 unmodified lines
108108 static int dmic_get_gain(struct snd_kcontrol *kcontrol,
109109 struct snd_ctl_elem_value *ucontrol)
110110 {
111− struct snd_soc_component *component =
112− snd_soc_kcontrol_component(kcontrol);
111+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
113112 struct cros_ec_codec_priv *priv =
114113 snd_soc_component_get_drvdata(component);
115114 struct ec_param_ec_codec_dmic p;
@@ -140,8 +139,7 @@ static int dmic_get_gain(struct snd_kcontrol *kcontrol, · 24 unmodified lines
140139 static int dmic_put_gain(struct snd_kcontrol *kcontrol,
141140 struct snd_ctl_elem_value *ucontrol)
142141 {
143− struct snd_soc_component *component =
144− snd_soc_kcontrol_component(kcontrol);
142+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
145143 struct cros_ec_codec_priv *priv =
146144 snd_soc_component_get_drvdata(component);
147145 struct soc_mixer_control *control =
@@ -633,7 +631,7 @@ leave: · 485 unmodified lines
633631 static int wov_enable_get(struct snd_kcontrol *kcontrol,
634632 struct snd_ctl_elem_value *ucontrol)
635633 {
636− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
634+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
637635 struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c);
638636
639637 ucontrol->value.integer.value[0] = priv->wov_enabled;
@@ -643,7 +641,7 @@ static int wov_enable_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
643641 static int wov_enable_put(struct snd_kcontrol *kcontrol,
644642 struct snd_ctl_elem_value *ucontrol)
645643 {
646− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
644+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
647645 struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c);
648646 int enabled = ucontrol->value.integer.value[0];
649647 struct ec_param_ec_codec_wov p;
sound/soc/codecs/cs-amp-lib-test.c+1485−37
@@ -20,6 +20,10 @@ · 19 unmodified lines
2020 #include <linux/random.h>
2121 #include <sound/cs-amp-lib.h>
2222
23+#define CIRRUS_LOGIC_CALIBRATION_EFI_NAME L"CirrusSmartAmpCalibrationData"
24+#define CIRRUS_LOGIC_CALIBRATION_EFI_GUID \
25+ EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, 0x5d, 0xb3)
26+
2327 #define LENOVO_SPEAKER_ID_EFI_NAME L"SdwSpeaker"
2428 #define LENOVO_SPEAKER_ID_EFI_GUID \
2529 EFI_GUID(0x48df970e, 0xe27f, 0x460a, 0xb5, 0x86, 0x77, 0x19, 0x80, 0x1d, 0x92, 0x82)
@@ -28,6 +32,10 @@ · 2 unmodified lines
2832 #define HP_SPEAKER_ID_EFI_GUID \
2933 EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, 0x1d, 0x1e)
3034
35+#define HP_CALIBRATION_EFI_NAME L"SmartAmpCalibrationData"
36+#define HP_CALIBRATION_EFI_GUID \
37+ EFI_GUID(0x53559579, 0x8753, 0x4f5c, 0x91, 0x30, 0xe8, 0x2a, 0xcf, 0xb8, 0xd8, 0x93)
38+
3139 KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destroy,
3240 struct faux_device *)
3341
@@ -36,6 +44,7 @@ struct cs_amp_lib_test_priv { · 2 unmodified lines
3644
3745 struct cirrus_amp_efi_data *cal_blob;
3846 struct list_head ctl_write_list;
47+ u32 efi_attr;
3948 };
4049
4150 struct cs_amp_lib_test_ctl_write_entry {
@@ -49,6 +58,20 @@ struct cs_amp_lib_test_param { · 7 unmodified lines
4958 int amp_index;
5059 };
5160
61+static struct cirrus_amp_efi_data *cs_amp_lib_test_cal_blob_dup(struct kunit *test)
62+{
63+ struct cs_amp_lib_test_priv *priv = test->priv;
64+ struct cirrus_amp_efi_data *temp;
65+
66+ KUNIT_ASSERT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
67+ priv->cal_blob->size);
68+ temp = kunit_kmalloc(test, priv->cal_blob->size, GFP_KERNEL);
69+ KUNIT_ASSERT_NOT_NULL(test, temp);
70+ memcpy(temp, priv->cal_blob, priv->cal_blob->size);
71+
72+ return temp;
73+}
74+
5275 static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps)
5376 {
5477 struct cs_amp_lib_test_priv *priv = test->priv;
@@ -69,9 +92,15 @@ static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps · 14 unmodified lines
6992 for (i = 0; i < num_amps; i++)
7093 priv->cal_blob->data[i].calTime[0] |= 1;
7194
72− /* Ensure that all UIDs are non-zero and unique. */
73− for (i = 0; i < num_amps; i++)
95+ /*
96+ * Ensure that all UIDs are non-zero and unique.
97+ * Make both words non-zero and not equal values, so that
98+ * tests can verify that both words were checked or changed.
99+ */
100+ for (i = 0; i < num_amps; i++) {
74101 *(u8 *)&priv->cal_blob->data[i].calTarget[0] = i + 1;
102+ *(u8 *)&priv->cal_blob->data[i].calTarget[1] = i;
103+ }
75104 }
76105
77106 static u64 cs_amp_lib_test_get_target_uid(struct kunit *test)
@@ -90,6 +119,7 @@ static u64 cs_amp_lib_test_get_target_uid(struct kunit *test) · 12 unmodified lines
90119 /* Redirected get_efi_variable to simulate that the file is too short */
91120 static efi_status_t cs_amp_lib_test_get_efi_variable_nohead(efi_char16_t *name,
92121 efi_guid_t *guid,
122+ u32 *returned_attr,
93123 unsigned long *size,
94124 void *buf)
95125 {
@@ -115,13 +145,12 @@ static void cs_amp_lib_test_cal_data_too_short_test(struct kunit *test) · 19 unmodified lines
115145
116146 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data);
117147 KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW);
118−
119− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
120148 }
121149
122150 /* Redirected get_efi_variable to simulate that the count is larger than the file */
123151 static efi_status_t cs_amp_lib_test_get_efi_variable_bad_count(efi_char16_t *name,
124152 efi_guid_t *guid,
153+ u32 *returned_attr,
125154 unsigned long *size,
126155 void *buf)
127156 {
@@ -158,13 +187,12 @@ static void cs_amp_lib_test_cal_count_too_big_test(struct kunit *test) · 30 unmodified lines
158187
159188 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data);
160189 KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW);
161−
162− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
163190 }
164191
165192 /* Redirected get_efi_variable to simulate that the variable not found */
166193 static efi_status_t cs_amp_lib_test_get_efi_variable_none(efi_char16_t *name,
167194 efi_guid_t *guid,
195+ u32 *returned_attr,
168196 unsigned long *size,
169197 void *buf)
170198 {
@@ -185,19 +213,17 @@ static void cs_amp_lib_test_no_cal_data_test(struct kunit *test) · 14 unmodified lines
185213
186214 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data);
187215 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
188−
189− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
190216 }
191217
192218 /* Redirected get_efi_variable to simulate reading a cal data blob */
193219 static efi_status_t cs_amp_lib_test_get_efi_variable(efi_char16_t *name,
194220 efi_guid_t *guid,
221+ u32 *returned_attr,
195222 unsigned long *size,
196223 void *buf)
197224 {
198− static const efi_char16_t expected_name[] = L"CirrusSmartAmpCalibrationData";
199− static const efi_guid_t expected_guid =
200− EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, 0x5d, 0xb3);
225+ static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME;
226+ static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID;
201227 struct kunit *test = kunit_get_current_test();
202228 struct cs_amp_lib_test_priv *priv = test->priv;
203229
@@ -218,11 +244,65 @@ static efi_status_t cs_amp_lib_test_get_efi_variable(efi_char16_t *name, · 14 unmodified lines
218244
219245 memcpy(buf, priv->cal_blob, priv->cal_blob->size);
220246
247+ if (returned_attr) {
248+ if (priv->efi_attr)
249+ *returned_attr = priv->efi_attr;
250+ else
251+ *returned_attr = EFI_VARIABLE_NON_VOLATILE |
252+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
253+ EFI_VARIABLE_RUNTIME_ACCESS;
254+ }
255+
256+ return EFI_SUCCESS;
257+}
258+
259+#define CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE \
260+ struct_size_t(struct cirrus_amp_efi_data, data, 8)
261+
262+/* Redirected get_efi_variable to simulate reading a prealloced zero-filled blob */
263+static efi_status_t cs_amp_lib_test_get_efi_variable_all_zeros(efi_char16_t *name,
264+ efi_guid_t *guid,
265+ u32 *returned_attr,
266+ unsigned long *size,
267+ void *buf)
268+{
269+ static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME;
270+ static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID;
271+ struct kunit *test = kunit_get_current_test();
272+ struct cs_amp_lib_test_priv *priv = test->priv;
273+
274+ KUNIT_EXPECT_NOT_ERR_OR_NULL(test, name);
275+ KUNIT_EXPECT_NOT_ERR_OR_NULL(test, guid);
276+
277+ if (memcmp(name, expected_name, sizeof(expected_name)) ||
278+ efi_guidcmp(*guid, expected_guid))
279+ return -EFI_NOT_FOUND;
280+
281+ if (!buf) {
282+ *size = CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE;
283+ return EFI_BUFFER_TOO_SMALL;
284+ }
285+
286+ KUNIT_ASSERT_EQ(test, *size, struct_size(priv->cal_blob, data, 8));
287+ priv->cal_blob = kunit_kzalloc(test, CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE, GFP_KERNEL);
288+ KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob);
289+ memset(buf, 0, CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE);
290+
291+ if (returned_attr) {
292+ if (priv->efi_attr)
293+ *returned_attr = priv->efi_attr;
294+ else
295+ *returned_attr = EFI_VARIABLE_NON_VOLATILE |
296+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
297+ EFI_VARIABLE_RUNTIME_ACCESS;
298+ }
299+
221300 return EFI_SUCCESS;
222301 }
223302
224303 static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *name,
225304 efi_guid_t *guid,
305+ u32 *returned_attr,
226306 unsigned long *size,
227307 void *buf)
228308 {
@@ -249,6 +329,12 @@ static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *name, · 20 unmodified lines
249329
250330 memcpy(buf, priv->cal_blob, priv->cal_blob->size);
251331
332+ if (returned_attr) {
333+ *returned_attr = EFI_VARIABLE_NON_VOLATILE |
334+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
335+ EFI_VARIABLE_RUNTIME_ACCESS;
336+ }
337+
252338 return EFI_SUCCESS;
253339 }
254340
@@ -291,8 +377,6 @@ static void cs_amp_lib_test_get_efi_cal_by_uid_test(struct kunit *test) · 36 unmodified lines
291377 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid, -1, &result_data);
292378 KUNIT_EXPECT_EQ(test, ret, 0);
293379
294− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
295−
296380 KUNIT_EXPECT_EQ(test, result_data.calTarget[0], target_uid & 0xFFFFFFFFULL);
297381 KUNIT_EXPECT_EQ(test, result_data.calTarget[1], target_uid >> 32);
298382 KUNIT_EXPECT_EQ(test, result_data.calTime[0],
@@ -326,8 +410,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_unchecked_test(struct kunit *te · 27 unmodified lines
326410 param->amp_index, &result_data);
327411 KUNIT_EXPECT_EQ(test, ret, 0);
328412
329− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
330−
331413 KUNIT_EXPECT_EQ(test, result_data.calTime[0],
332414 priv->cal_blob->data[param->amp_index].calTime[0]);
333415 KUNIT_EXPECT_EQ(test, result_data.calTime[1],
@@ -361,8 +443,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_checked_test(struct kunit *test · 27 unmodified lines
361443 param->amp_index, &result_data);
362444 KUNIT_EXPECT_EQ(test, ret, 0);
363445
364− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
365−
366446 KUNIT_EXPECT_EQ(test, result_data.calTime[0],
367447 priv->cal_blob->data[param->amp_index].calTime[0]);
368448 KUNIT_EXPECT_EQ(test, result_data.calTime[1],
@@ -399,8 +479,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test(struct kunit · 30 unmodified lines
399479 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid,
400480 param->amp_index, &result_data);
401481 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
402−
403− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
404482 }
405483
406484 /*
@@ -432,8 +510,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_fallback_test(struct kunit *tes · 25 unmodified lines
432510 param->amp_index, &result_data);
433511 KUNIT_EXPECT_EQ(test, ret, 0);
434512
435− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
436−
437513 KUNIT_EXPECT_EQ(test, result_data.calTime[0],
438514 priv->cal_blob->data[param->amp_index].calTime[0]);
439515 KUNIT_EXPECT_EQ(test, result_data.calTime[1],
@@ -473,8 +549,6 @@ static void cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test(struct kunit · 33 unmodified lines
473549 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, -1,
474550 &result_data);
475551 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
476−
477− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
478552 }
479553
480554 /*
@@ -504,8 +578,6 @@ static void cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test(struc · 23 unmodified lines
504578 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, 99,
505579 &result_data);
506580 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
507−
508− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
509581 }
510582
511583 /*
@@ -527,8 +599,6 @@ static void cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test(struct kunit · 15 unmodified lines
527599
528600 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 99, &result_data);
529601 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
530−
531− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
532602 }
533603
534604 /* If neither the target UID or the index is given the result should be -ENOENT. */
@@ -547,8 +617,6 @@ static void cs_amp_lib_test_get_efi_cal_no_uid_no_index_test(struct kunit *test) · 12 unmodified lines
547617
548618 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data);
549619 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
550−
551− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
552620 }
553621
554622 /*
@@ -576,8 +644,6 @@ static void cs_amp_lib_test_get_efi_cal_zero_not_matched_test(struct kunit *test · 21 unmodified lines
576644
577645 ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data);
578646 KUNIT_EXPECT_EQ(test, ret, -ENOENT);
579−
580− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
581647 }
582648
583649 /*
@@ -619,8 +685,6 @@ static void cs_amp_lib_test_get_efi_cal_empty_entry_test(struct kunit *test) · 35 unmodified lines
619685 0, 2,
620686 &result_data),
621687 -ENOENT);
622−
623− kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable);
624688 }
625689
626690 static const struct cirrus_amp_cal_controls cs_amp_lib_test_calibration_controls = {
@@ -676,9 +740,6 @@ static void cs_amp_lib_test_write_cal_data_test(struct kunit *test) · 49 unmodified lines
676740
677741 ret = cs_amp_write_cal_coeffs(dsp, &cs_amp_lib_test_calibration_controls, &data);
678742 KUNIT_EXPECT_EQ(test, ret, 0);
679−
680− kunit_deactivate_static_stub(test, cs_amp_test_hooks->write_cal_coeff);
681−
682743 KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 4);
683744
684745 /* Checksum control must be written last */
@@ -702,6 +763,1363 @@ static void cs_amp_lib_test_write_cal_data_test(struct kunit *test) · 17 unmodified lines
702763 KUNIT_EXPECT_EQ(test, entry->value, data.calStatus);
703764 }
704765
766+static int cs_amp_lib_test_read_cal_coeff(struct cs_dsp *dsp,
767+ const struct cirrus_amp_cal_controls *controls,
768+ const char *ctl_name, u32 *val)
769+{
770+ struct kunit *test = kunit_get_current_test();
771+
772+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctl_name);
773+ KUNIT_EXPECT_PTR_EQ(test, controls, &cs_amp_lib_test_calibration_controls);
774+
775+ if (strcmp(ctl_name, controls->ambient) == 0)
776+ *val = 19;
777+ else if (strcmp(ctl_name, controls->calr) == 0)
778+ *val = 1077;
779+ else if (strcmp(ctl_name, controls->status) == 0)
780+ *val = 2;
781+ else
782+ kunit_fail_current_test("Bad control '%s'\n", ctl_name);
783+
784+ return 0;
785+}
786+
787+static void cs_amp_lib_test_read_cal_data_test(struct kunit *test)
788+{
789+ struct cs_amp_lib_test_priv *priv = test->priv;
790+ struct cirrus_amp_cal_data data = { 0 };
791+ struct cs_dsp *dsp;
792+ int ret;
793+
794+ dsp = kunit_kzalloc(test, sizeof(*dsp), GFP_KERNEL);
795+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dsp);
796+ dsp->dev = &priv->amp_dev->dev;
797+
798+ kunit_activate_static_stub(test,
799+ cs_amp_test_hooks->read_cal_coeff,
800+ cs_amp_lib_test_read_cal_coeff);
801+
802+ ret = cs_amp_read_cal_coeffs(dsp, &cs_amp_lib_test_calibration_controls, &data);
803+ KUNIT_EXPECT_EQ(test, ret, 0);
804+
805+ KUNIT_EXPECT_EQ(test, 19, data.calAmbient);
806+ KUNIT_EXPECT_EQ(test, 1077, data.calR);
807+ KUNIT_EXPECT_EQ(test, 2, data.calStatus);
808+ KUNIT_EXPECT_NE(test, 0, data.calTime[0] | data.calTime[1]);
809+}
810+
811+static void cs_amp_lib_test_write_ambient_test(struct kunit *test)
812+{
813+ struct cs_amp_lib_test_priv *priv = test->priv;
814+ struct cs_amp_lib_test_ctl_write_entry *entry;
815+ struct cs_dsp *dsp;
816+ int ret;
817+
818+ dsp = kunit_kzalloc(test, sizeof(*dsp), GFP_KERNEL);
819+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dsp);
820+ dsp->dev = &priv->amp_dev->dev;
821+
822+ /* Redirect calls to write firmware controls */
823+ kunit_activate_static_stub(test,
824+ cs_amp_test_hooks->write_cal_coeff,
825+ cs_amp_lib_test_write_cal_coeff);
826+
827+ ret = cs_amp_write_ambient_temp(dsp, &cs_amp_lib_test_calibration_controls, 18);
828+ KUNIT_EXPECT_EQ(test, ret, 0);
829+
830+ KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 1);
831+
832+ entry = list_first_entry(&priv->ctl_write_list, typeof(*entry), list);
833+ KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.ambient);
834+ KUNIT_EXPECT_EQ(test, entry->value, 18);
835+}
836+
837+static efi_status_t cs_amp_lib_test_set_efi_variable(efi_char16_t *name,
838+ efi_guid_t *guid,
839+ u32 attr,
840+ unsigned long size,
841+ void *buf)
842+{
843+ static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME;
844+ static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID;
845+ struct kunit *test = kunit_get_current_test();
846+ struct cs_amp_lib_test_priv *priv = test->priv;
847+
848+ KUNIT_ASSERT_NOT_NULL(test, name);
849+ KUNIT_ASSERT_NOT_NULL(test, guid);
850+
851+ if (memcmp(name, expected_name, sizeof(expected_name)) ||
852+ efi_guidcmp(*guid, expected_guid))
853+ return -EFI_NOT_FOUND;
854+
855+ KUNIT_ASSERT_NOT_NULL(test, buf);
856+ KUNIT_ASSERT_NE(test, 0, size);
857+
858+ kunit_kfree(test, priv->cal_blob);
859+ priv->cal_blob = kunit_kmalloc(test, size, GFP_KERNEL);
860+ KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob);
861+ memcpy(priv->cal_blob, buf, size);
862+ priv->efi_attr = attr;
863+
864+ return EFI_SUCCESS;
865+}
866+
867+static efi_status_t cs_amp_lib_test_set_efi_variable_denied(efi_char16_t *name,
868+ efi_guid_t *guid,
869+ u32 attr,
870+ unsigned long size,
871+ void *buf)
872+{
873+ return EFI_WRITE_PROTECTED;
874+}
875+
876+#define CS_AMP_CAL_DEFAULT_EFI_ATTR \
877+ (EFI_VARIABLE_NON_VOLATILE | \
878+ EFI_VARIABLE_BOOTSERVICE_ACCESS | \
879+ EFI_VARIABLE_RUNTIME_ACCESS)
880+
881+static void cs_amp_lib_test_create_new_cal_efi(struct kunit *test)
882+{
883+ struct cs_amp_lib_test_priv *priv = test->priv;
884+ struct device *dev = &priv->amp_dev->dev;
885+ struct cirrus_amp_cal_data data;
886+ int i;
887+
888+ kunit_activate_static_stub(test,
889+ cs_amp_test_hooks->get_efi_variable,
890+ cs_amp_lib_test_get_efi_variable_none);
891+ kunit_activate_static_stub(test,
892+ cs_amp_test_hooks->set_efi_variable,
893+ cs_amp_lib_test_set_efi_variable);
894+
895+ /* For unspecified number of amps */
896+ get_random_bytes(&data, sizeof(data));
897+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
898+ KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr);
899+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1);
900+ KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8);
901+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
902+ priv->cal_blob->size);
903+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
904+ for (i = 1; i < priv->cal_blob->count; i++)
905+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
906+
907+ /* For 2 amps */
908+ priv->cal_blob = NULL;
909+ get_random_bytes(&data, sizeof(data));
910+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data));
911+ KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr);
912+ KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count);
913+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size);
914+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
915+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
916+
917+ /* For 4 amps */
918+ priv->cal_blob = NULL;
919+ get_random_bytes(&data, sizeof(data));
920+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data));
921+ KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count);
922+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size);
923+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
924+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
925+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
926+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
927+
928+ /* For 6 amps */
929+ priv->cal_blob = NULL;
930+ get_random_bytes(&data, sizeof(data));
931+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data));
932+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
933+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
934+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
935+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
936+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
937+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
938+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
939+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
940+}
941+
942+static void cs_amp_lib_test_create_new_cal_efi_indexed(struct kunit *test)
943+{
944+ struct cs_amp_lib_test_priv *priv = test->priv;
945+ struct device *dev = &priv->amp_dev->dev;
946+ struct cirrus_amp_cal_data data;
947+
948+ kunit_activate_static_stub(test,
949+ cs_amp_test_hooks->get_efi_variable,
950+ cs_amp_lib_test_get_efi_variable_none);
951+ kunit_activate_static_stub(test,
952+ cs_amp_test_hooks->set_efi_variable,
953+ cs_amp_lib_test_set_efi_variable);
954+
955+ /* In slot 0 */
956+ priv->cal_blob = NULL;
957+ get_random_bytes(&data, sizeof(data));
958+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, 6, &data));
959+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
960+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
961+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
962+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
963+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
964+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
965+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
966+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
967+
968+ /* In slot 1 */
969+ priv->cal_blob = NULL;
970+ get_random_bytes(&data, sizeof(data));
971+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data));
972+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
973+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
974+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
975+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data)));
976+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
977+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
978+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
979+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
980+
981+ /* In slot 5 */
982+ priv->cal_blob = NULL;
983+ get_random_bytes(&data, sizeof(data));
984+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, 6, &data));
985+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
986+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
987+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data));
988+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data)));
989+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
990+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
991+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
992+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
993+}
994+
995+static void cs_amp_lib_test_create_new_cal_efi_indexed_no_max(struct kunit *test)
996+{
997+ struct cs_amp_lib_test_priv *priv = test->priv;
998+ struct device *dev = &priv->amp_dev->dev;
999+ struct cirrus_amp_cal_data data;
1000+ int i;
1001+
1002+ kunit_activate_static_stub(test,
1003+ cs_amp_test_hooks->get_efi_variable,
1004+ cs_amp_lib_test_get_efi_variable_none);
1005+ kunit_activate_static_stub(test,
1006+ cs_amp_test_hooks->set_efi_variable,
1007+ cs_amp_lib_test_set_efi_variable);
1008+
1009+ /* In slot 0 with unspecified number of amps */
1010+ priv->cal_blob = NULL;
1011+ get_random_bytes(&data, sizeof(data));
1012+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data));
1013+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1);
1014+ KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8);
1015+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1016+ priv->cal_blob->size);
1017+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1018+ for (i = 1; i < priv->cal_blob->count; i++)
1019+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1020+
1021+ /* In slot 1 with unspecified number of amps */
1022+ priv->cal_blob = NULL;
1023+ get_random_bytes(&data, sizeof(data));
1024+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data));
1025+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 2);
1026+ KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8);
1027+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1028+ priv->cal_blob->size);
1029+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1030+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data)));
1031+ for (i = 2; i < priv->cal_blob->count; i++)
1032+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1033+
1034+ /* In slot 5 with unspecified number of amps */
1035+ priv->cal_blob = NULL;
1036+ get_random_bytes(&data, sizeof(data));
1037+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, -1, &data));
1038+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 6);
1039+ KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8);
1040+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1041+ priv->cal_blob->size);
1042+ for (i = 0; (i < 5) && (i < priv->cal_blob->count); i++)
1043+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1044+
1045+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data));
1046+ for (i = 6; i < priv->cal_blob->count; i++)
1047+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1048+}
1049+
1050+static void cs_amp_lib_test_grow_append_cal_efi(struct kunit *test)
1051+{
1052+ struct cs_amp_lib_test_priv *priv = test->priv;
1053+ struct device *dev = &priv->amp_dev->dev;
1054+ const struct cirrus_amp_efi_data *original_blob;
1055+ struct cirrus_amp_cal_data data;
1056+
1057+ kunit_activate_static_stub(test,
1058+ cs_amp_test_hooks->get_efi_variable,
1059+ cs_amp_lib_test_get_efi_variable);
1060+ kunit_activate_static_stub(test,
1061+ cs_amp_test_hooks->set_efi_variable,
1062+ cs_amp_lib_test_set_efi_variable);
1063+
1064+ /* Initially 1 used entry grown to 2 entries */
1065+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1066+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1067+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1068+ get_random_bytes(&data, sizeof(data));
1069+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1070+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data));
1071+ KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr);
1072+ KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count);
1073+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size);
1074+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1075+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1076+
1077+ /* Initially 1 entry grown to 4 entries */
1078+ priv->cal_blob = NULL;
1079+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1080+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1081+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1082+ get_random_bytes(&data, sizeof(data));
1083+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1084+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data));
1085+ KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count);
1086+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size);
1087+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1088+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1089+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1090+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1091+
1092+ /* Initially 2 entries grown to 4 entries */
1093+ priv->cal_blob = NULL;
1094+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1095+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1096+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1097+ get_random_bytes(&data, sizeof(data));
1098+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1099+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data));
1100+ KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count);
1101+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size);
1102+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1103+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1104+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data));
1105+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1106+
1107+ /* Initially 1 entry grown to 6 entries */
1108+ priv->cal_blob = NULL;
1109+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1110+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1111+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1112+ get_random_bytes(&data, sizeof(data));
1113+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1114+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data));
1115+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1116+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1117+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1118+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1119+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1120+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1121+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1122+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1123+
1124+ /* Initially 4 entries grown to 6 entries */
1125+ priv->cal_blob = NULL;
1126+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1127+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1128+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1129+ get_random_bytes(&data, sizeof(data));
1130+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1131+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data));
1132+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1133+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1134+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1135+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1136+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1137+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1138+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1139+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1140+}
1141+
1142+static void cs_amp_lib_test_grow_append_cal_efi_indexed(struct kunit *test)
1143+{
1144+ struct cs_amp_lib_test_priv *priv = test->priv;
1145+ struct device *dev = &priv->amp_dev->dev;
1146+ const struct cirrus_amp_efi_data *original_blob;
1147+ struct cirrus_amp_cal_data data;
1148+
1149+ kunit_activate_static_stub(test,
1150+ cs_amp_test_hooks->get_efi_variable,
1151+ cs_amp_lib_test_get_efi_variable);
1152+ kunit_activate_static_stub(test,
1153+ cs_amp_test_hooks->set_efi_variable,
1154+ cs_amp_lib_test_set_efi_variable);
1155+
1156+ /* Initially 1 entry grown to 2 entries using slot 1 */
1157+ priv->cal_blob = NULL;
1158+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1159+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1160+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1161+ get_random_bytes(&data, sizeof(data));
1162+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1163+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 2, &data));
1164+ KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count);
1165+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size);
1166+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1167+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1168+
1169+ /* Initially 1 entry grown to 6 entries using slot 1 */
1170+ priv->cal_blob = NULL;
1171+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1172+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1173+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1174+ get_random_bytes(&data, sizeof(data));
1175+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1176+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data));
1177+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1178+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1179+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1180+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1181+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1182+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1183+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1184+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1185+
1186+ /* Initially 2 entries grown to 6 entries using slot 2 */
1187+ priv->cal_blob = NULL;
1188+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1189+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1190+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1191+ get_random_bytes(&data, sizeof(data));
1192+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1193+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, 6, &data));
1194+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1195+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1196+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1197+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1198+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data));
1199+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1200+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1201+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1202+
1203+ /* Initially 2 entries grown to 6 entries using slot 4 */
1204+ kunit_kfree(test, original_blob);
1205+ kunit_kfree(test, priv->cal_blob);
1206+ priv->cal_blob = NULL;
1207+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1208+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1209+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1210+ get_random_bytes(&data, sizeof(data));
1211+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1212+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, 6, &data));
1213+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1214+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1215+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1216+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1217+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1218+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1219+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1220+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1221+}
1222+
1223+static void cs_amp_lib_test_cal_efi_all_zeros_add_first(struct kunit *test)
1224+{
1225+ struct cs_amp_lib_test_priv *priv = test->priv;
1226+ struct device *dev = &priv->amp_dev->dev;
1227+ struct cirrus_amp_cal_data data;
1228+ int i;
1229+
1230+ /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */
1231+ kunit_activate_static_stub(test,
1232+ cs_amp_test_hooks->get_efi_variable,
1233+ cs_amp_lib_test_get_efi_variable_all_zeros);
1234+ kunit_activate_static_stub(test,
1235+ cs_amp_test_hooks->set_efi_variable,
1236+ cs_amp_lib_test_set_efi_variable);
1237+
1238+ /*
1239+ * Add an entry. The header should be filled in to match the
1240+ * original EFI variable size.
1241+ */
1242+ get_random_bytes(&data, sizeof(data));
1243+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1244+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1245+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1246+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1247+ for (i = 1; i < priv->cal_blob->count; i++) {
1248+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]);
1249+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]);
1250+ }
1251+}
1252+
1253+static void cs_amp_lib_test_cal_efi_all_zeros_add_first_no_shrink(struct kunit *test)
1254+{
1255+ struct cs_amp_lib_test_priv *priv = test->priv;
1256+ struct device *dev = &priv->amp_dev->dev;
1257+ struct cirrus_amp_cal_data data;
1258+ int i;
1259+
1260+ /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */
1261+ kunit_activate_static_stub(test,
1262+ cs_amp_test_hooks->get_efi_variable,
1263+ cs_amp_lib_test_get_efi_variable_all_zeros);
1264+ kunit_activate_static_stub(test,
1265+ cs_amp_test_hooks->set_efi_variable,
1266+ cs_amp_lib_test_set_efi_variable);
1267+
1268+ /*
1269+ * Add an entry. The header should be filled in to match the
1270+ * original EFI variable size. A number of amps less than the
1271+ * available preallocated space does not shrink the EFI variable.
1272+ */
1273+ get_random_bytes(&data, sizeof(data));
1274+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data));
1275+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1276+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1277+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1278+ for (i = 1; i < priv->cal_blob->count; i++) {
1279+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]);
1280+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]);
1281+ }
1282+}
1283+
1284+static void cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed(struct kunit *test)
1285+{
1286+ struct cs_amp_lib_test_priv *priv = test->priv;
1287+ struct device *dev = &priv->amp_dev->dev;
1288+ struct cirrus_amp_cal_data data;
1289+ int i;
1290+
1291+ /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */
1292+ kunit_activate_static_stub(test,
1293+ cs_amp_test_hooks->get_efi_variable,
1294+ cs_amp_lib_test_get_efi_variable_all_zeros);
1295+ kunit_activate_static_stub(test,
1296+ cs_amp_test_hooks->set_efi_variable,
1297+ cs_amp_lib_test_set_efi_variable);
1298+
1299+ /*
1300+ * Write entry to slot 2. The header should be filled in to match
1301+ * the original EFI variable size.
1302+ */
1303+ get_random_bytes(&data, sizeof(data));
1304+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, -1, &data));
1305+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1306+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1307+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]);
1308+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]);
1309+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]);
1310+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]);
1311+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data));
1312+ for (i = 3; i < priv->cal_blob->count; i++) {
1313+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]);
1314+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]);
1315+ }
1316+}
1317+
1318+static void cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed_no_shrink(struct kunit *test)
1319+{
1320+ struct cs_amp_lib_test_priv *priv = test->priv;
1321+ struct device *dev = &priv->amp_dev->dev;
1322+ struct cirrus_amp_cal_data data;
1323+ int i;
1324+
1325+ /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */
1326+ kunit_activate_static_stub(test,
1327+ cs_amp_test_hooks->get_efi_variable,
1328+ cs_amp_lib_test_get_efi_variable_all_zeros);
1329+ kunit_activate_static_stub(test,
1330+ cs_amp_test_hooks->set_efi_variable,
1331+ cs_amp_lib_test_set_efi_variable);
1332+
1333+ /*
1334+ * Write entry to slot 2. The header should be filled in to match
1335+ * the original EFI variable size. A number of amps less than the
1336+ * available preallocated space does not shrink the EFI variable.
1337+ */
1338+ get_random_bytes(&data, sizeof(data));
1339+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, 4, &data));
1340+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1341+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1342+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]);
1343+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]);
1344+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]);
1345+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]);
1346+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data));
1347+ for (i = 3; i < priv->cal_blob->count; i++) {
1348+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]);
1349+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]);
1350+ }
1351+}
1352+
1353+static void cs_amp_lib_test_grow_append_cal_efi_indexed_no_max(struct kunit *test)
1354+{
1355+ struct cs_amp_lib_test_priv *priv = test->priv;
1356+ struct device *dev = &priv->amp_dev->dev;
1357+ const struct cirrus_amp_efi_data *original_blob;
1358+ struct cirrus_amp_cal_data data;
1359+ int i;
1360+
1361+ kunit_activate_static_stub(test,
1362+ cs_amp_test_hooks->get_efi_variable,
1363+ cs_amp_lib_test_get_efi_variable);
1364+ kunit_activate_static_stub(test,
1365+ cs_amp_test_hooks->set_efi_variable,
1366+ cs_amp_lib_test_set_efi_variable);
1367+
1368+ /* Initially 1 entry adding slot 1 */
1369+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1370+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1371+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1372+ get_random_bytes(&data, sizeof(data));
1373+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1374+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data));
1375+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 2);
1376+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1377+ priv->cal_blob->size);
1378+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1379+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1380+ for (i = 2; i < priv->cal_blob->count; i++)
1381+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1382+
1383+ /* Initially 1 entry adding slot 3 */
1384+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1385+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1386+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1387+ get_random_bytes(&data, sizeof(data));
1388+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1389+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data));
1390+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 4);
1391+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1392+ priv->cal_blob->size);
1393+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1394+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
1395+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1396+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1397+ for (i = 4; i < priv->cal_blob->count; i++)
1398+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1399+
1400+ /* Initially 2 entries adding slot 3 */
1401+ priv->cal_blob = NULL;
1402+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1403+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1404+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1405+ get_random_bytes(&data, sizeof(data));
1406+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1407+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data));
1408+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1);
1409+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1410+ priv->cal_blob->size);
1411+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1412+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1413+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1414+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1415+ for (i = 4; i < priv->cal_blob->count; i++)
1416+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1417+
1418+ /* Initially 4 entries adding slot 4 */
1419+ priv->cal_blob = NULL;
1420+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1421+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1422+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1423+ get_random_bytes(&data, sizeof(data));
1424+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1425+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data));
1426+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1);
1427+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1428+ priv->cal_blob->size);
1429+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1430+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1431+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1432+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1433+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1434+ for (i = 5; i < priv->cal_blob->count; i++)
1435+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1436+
1437+ /* Initially 4 entries adding slot 6 */
1438+ priv->cal_blob = NULL;
1439+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1440+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1441+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1442+ get_random_bytes(&data, sizeof(data));
1443+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1444+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 6, -1, &data));
1445+ KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1);
1446+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count),
1447+ priv->cal_blob->size);
1448+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1449+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1450+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1451+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1452+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1453+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1454+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[6], sizeof(data));
1455+ for (i = 7; i < priv->cal_blob->count; i++)
1456+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data)));
1457+}
1458+
1459+static void cs_amp_lib_test_grow_cal_efi_replace_indexed(struct kunit *test)
1460+{
1461+ struct cs_amp_lib_test_priv *priv = test->priv;
1462+ struct device *dev = &priv->amp_dev->dev;
1463+ const struct cirrus_amp_efi_data *original_blob;
1464+ struct cirrus_amp_cal_data data;
1465+
1466+ kunit_activate_static_stub(test,
1467+ cs_amp_test_hooks->get_efi_variable,
1468+ cs_amp_lib_test_get_efi_variable);
1469+ kunit_activate_static_stub(test,
1470+ cs_amp_test_hooks->set_efi_variable,
1471+ cs_amp_lib_test_set_efi_variable);
1472+
1473+ /* Initially 1 entry grown to 2 entries overwriting slot 0 */
1474+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1475+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1476+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1477+ get_random_bytes(&data, sizeof(data));
1478+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1479+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, 2, &data));
1480+ KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count);
1481+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size);
1482+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1483+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
1484+
1485+ /* Initially 2 entries grown to 4 entries overwriting slot 1 */
1486+ priv->cal_blob = NULL;
1487+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1488+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1489+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1490+ get_random_bytes(&data, sizeof(data));
1491+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1492+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 4, &data));
1493+ KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count);
1494+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size);
1495+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1496+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1497+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1498+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1499+
1500+ /* Initially 4 entries grown to 6 entries overwriting slot 1 */
1501+ priv->cal_blob = NULL;
1502+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1503+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1504+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1505+ get_random_bytes(&data, sizeof(data));
1506+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1507+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data));
1508+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1509+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1510+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1511+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1512+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1513+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1514+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1515+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1516+
1517+ /* Initially 4 entries grown to 6 entries overwriting slot 3 */
1518+ priv->cal_blob = NULL;
1519+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1520+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1521+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1522+ get_random_bytes(&data, sizeof(data));
1523+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1524+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, 6, &data));
1525+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1526+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1527+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1528+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1529+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1530+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1531+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1532+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1533+
1534+ /* Initially 6 entries grown to 8 entries overwriting slot 4 */
1535+ priv->cal_blob = NULL;
1536+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
1537+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
1538+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1539+ get_random_bytes(&data, sizeof(data));
1540+ data.calTarget[0] = 0xaaaaaaaa; /* won't match */
1541+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, 8, &data));
1542+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1543+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1544+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1545+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1546+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1547+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1548+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1549+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1550+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[6], sizeof(data)));
1551+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[7], sizeof(data)));
1552+}
1553+
1554+static void cs_amp_lib_test_grow_cal_efi_replace_by_uid(struct kunit *test)
1555+{
1556+ struct cs_amp_lib_test_priv *priv = test->priv;
1557+ struct device *dev = &priv->amp_dev->dev;
1558+ const struct cirrus_amp_efi_data *original_blob;
1559+ struct cirrus_amp_cal_data data;
1560+
1561+ kunit_activate_static_stub(test,
1562+ cs_amp_test_hooks->get_efi_variable,
1563+ cs_amp_lib_test_get_efi_variable);
1564+ kunit_activate_static_stub(test,
1565+ cs_amp_test_hooks->set_efi_variable,
1566+ cs_amp_lib_test_set_efi_variable);
1567+
1568+ /* Initially 1 entry grown to 2 entries overwriting slot 0 */
1569+ cs_amp_lib_test_init_dummy_cal_blob(test, 1);
1570+ KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count);
1571+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1572+ get_random_bytes(&data, sizeof(data));
1573+ memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget));
1574+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data));
1575+ KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count);
1576+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size);
1577+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1578+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data)));
1579+
1580+ /* Initially 2 entries grown to 4 entries overwriting slot 1 */
1581+ priv->cal_blob = NULL;
1582+ cs_amp_lib_test_init_dummy_cal_blob(test, 2);
1583+ KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count);
1584+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1585+ get_random_bytes(&data, sizeof(data));
1586+ memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget));
1587+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data));
1588+ KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count);
1589+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size);
1590+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1591+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1592+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data)));
1593+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data)));
1594+
1595+ /* Initially 4 entries grown to 6 entries overwriting slot 1 */
1596+ priv->cal_blob = NULL;
1597+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1598+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1599+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1600+ get_random_bytes(&data, sizeof(data));
1601+ memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget));
1602+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data));
1603+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1604+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1605+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1606+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1607+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1608+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1609+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1610+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1611+
1612+ /* Initially 4 entries grown to 6 entries overwriting slot 3 */
1613+ priv->cal_blob = NULL;
1614+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1615+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1616+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1617+ get_random_bytes(&data, sizeof(data));
1618+ memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget));
1619+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data));
1620+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1621+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1622+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1623+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1624+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1625+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1626+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data)));
1627+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data)));
1628+
1629+ /* Initially 6 entries grown to 8 entries overwriting slot 4 */
1630+ priv->cal_blob = NULL;
1631+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
1632+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
1633+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1634+ get_random_bytes(&data, sizeof(data));
1635+ memcpy(data.calTarget, priv->cal_blob->data[4].calTarget, sizeof(data.calTarget));
1636+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 8, &data));
1637+ KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count);
1638+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size);
1639+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1640+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1641+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1642+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1643+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1644+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1645+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[6], sizeof(data)));
1646+ KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[7], sizeof(data)));
1647+}
1648+
1649+static void cs_amp_lib_test_cal_efi_replace_by_uid(struct kunit *test)
1650+{
1651+ struct cs_amp_lib_test_priv *priv = test->priv;
1652+ struct device *dev = &priv->amp_dev->dev;
1653+ const struct cirrus_amp_efi_data *original_blob;
1654+ struct cirrus_amp_cal_data data;
1655+
1656+ kunit_activate_static_stub(test,
1657+ cs_amp_test_hooks->get_efi_variable,
1658+ cs_amp_lib_test_get_efi_variable);
1659+ kunit_activate_static_stub(test,
1660+ cs_amp_test_hooks->set_efi_variable,
1661+ cs_amp_lib_test_set_efi_variable);
1662+
1663+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
1664+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
1665+
1666+ /* Replace entry matching slot 0 */
1667+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1668+ get_random_bytes(&data, sizeof(data));
1669+ memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget));
1670+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1671+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1672+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1673+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1674+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1675+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1676+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1677+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1678+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1679+
1680+ /* Replace entry matching slot 4 */
1681+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1682+ get_random_bytes(&data, sizeof(data));
1683+ memcpy(data.calTarget, priv->cal_blob->data[4].calTarget, sizeof(data.calTarget));
1684+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1685+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1686+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1687+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1688+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1689+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1690+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1691+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1692+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1693+
1694+ /* Replace entry matching slot 3 */
1695+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1696+ get_random_bytes(&data, sizeof(data));
1697+ memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget));
1698+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1699+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1700+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1701+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1702+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1703+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1704+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1705+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1706+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1707+
1708+ /* Replace entry matching slot 5 */
1709+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1710+ get_random_bytes(&data, sizeof(data));
1711+ memcpy(data.calTarget, priv->cal_blob->data[5].calTarget, sizeof(data.calTarget));
1712+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1713+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1714+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1715+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1716+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1717+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1718+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1719+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1720+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data));
1721+}
1722+
1723+static void cs_amp_lib_test_cal_efi_replace_by_index(struct kunit *test)
1724+{
1725+ struct cs_amp_lib_test_priv *priv = test->priv;
1726+ struct device *dev = &priv->amp_dev->dev;
1727+ const struct cirrus_amp_efi_data *original_blob;
1728+ struct cirrus_amp_cal_data data;
1729+
1730+ kunit_activate_static_stub(test,
1731+ cs_amp_test_hooks->get_efi_variable,
1732+ cs_amp_lib_test_get_efi_variable);
1733+ kunit_activate_static_stub(test,
1734+ cs_amp_test_hooks->set_efi_variable,
1735+ cs_amp_lib_test_set_efi_variable);
1736+
1737+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
1738+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
1739+
1740+ /*
1741+ * Replace entry matching slot 0.
1742+ * data.calTarget is deliberately set different to current calTarget
1743+ * of the slot to check that the index forces that slot to be used.
1744+ */
1745+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1746+ get_random_bytes(&data, sizeof(data));
1747+ data.calTarget[0] = ~priv->cal_blob->data[0].calTarget[0];
1748+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data));
1749+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1750+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1751+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1752+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1753+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1754+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1755+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1756+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1757+
1758+ /* Replace entry matching slot 4 */
1759+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1760+ get_random_bytes(&data, sizeof(data));
1761+ data.calTarget[0] = ~priv->cal_blob->data[4].calTarget[0];
1762+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data));
1763+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1764+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1765+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1766+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1767+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1768+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1769+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1770+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1771+
1772+ /* Replace entry matching slot 3 */
1773+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1774+ get_random_bytes(&data, sizeof(data));
1775+ data.calTarget[0] = ~priv->cal_blob->data[3].calTarget[0];
1776+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data));
1777+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1778+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1779+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1780+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1781+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1782+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1783+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1784+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1785+
1786+ /* Replace entry matching slot 5 */
1787+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1788+ get_random_bytes(&data, sizeof(data));
1789+ data.calTarget[0] = ~priv->cal_blob->data[5].calTarget[0];
1790+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, -1, &data));
1791+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1792+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1793+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1794+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1795+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1796+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1797+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1798+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data));
1799+}
1800+
1801+static void cs_amp_lib_test_cal_efi_deduplicate(struct kunit *test)
1802+{
1803+ struct cs_amp_lib_test_priv *priv = test->priv;
1804+ struct device *dev = &priv->amp_dev->dev;
1805+ const struct cirrus_amp_efi_data *original_blob;
1806+ struct cirrus_amp_cal_data data;
1807+ int i;
1808+
1809+ kunit_activate_static_stub(test,
1810+ cs_amp_test_hooks->get_efi_variable,
1811+ cs_amp_lib_test_get_efi_variable);
1812+ kunit_activate_static_stub(test,
1813+ cs_amp_test_hooks->set_efi_variable,
1814+ cs_amp_lib_test_set_efi_variable);
1815+
1816+ /*
1817+ * Replace entry matching slot 0.
1818+ * An active entry in slot 1 for the same UID should be marked empty.
1819+ * Other entries are unaltered.
1820+ */
1821+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1822+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1823+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1824+ get_random_bytes(&data, sizeof(data));
1825+ memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget));
1826+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data));
1827+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1828+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]);
1829+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]);
1830+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1831+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1832+
1833+ /*
1834+ * Replace entry matching slot 1.
1835+ * An active entry in slot 0 for the same UID should be marked empty.
1836+ * Other entries are unaltered.
1837+ */
1838+ priv->cal_blob = NULL;
1839+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1840+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1841+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1842+ get_random_bytes(&data, sizeof(data));
1843+ memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget));
1844+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data));
1845+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]);
1846+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]);
1847+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1848+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1849+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1850+
1851+ /*
1852+ * Replace entry matching slot 1.
1853+ * An active entry in slot 3 for the same UID should be marked empty.
1854+ * Other entries are unaltered.
1855+ */
1856+ priv->cal_blob = NULL;
1857+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1858+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1859+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1860+ get_random_bytes(&data, sizeof(data));
1861+ memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget));
1862+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data));
1863+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1864+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data));
1865+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1866+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[0]);
1867+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[1]);
1868+
1869+ /*
1870+ * Worst case, all entries have the same UID
1871+ */
1872+ priv->cal_blob = NULL;
1873+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1874+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
1875+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1876+ get_random_bytes(&data, sizeof(data));
1877+ for (i = 0; i < priv->cal_blob->count; i++) {
1878+ priv->cal_blob->data[i].calTarget[0] = 0xe5e5e5e5;
1879+ priv->cal_blob->data[i].calTarget[1] = 0xa7a7a7a7;
1880+ }
1881+ memcpy(data.calTarget, priv->cal_blob->data[2].calTarget, sizeof(data.calTarget));
1882+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, -1, &data));
1883+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]);
1884+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]);
1885+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]);
1886+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]);
1887+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data));
1888+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[0]);
1889+ KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[1]);
1890+}
1891+
1892+static void cs_amp_lib_test_cal_efi_find_free(struct kunit *test)
1893+{
1894+ struct cs_amp_lib_test_priv *priv = test->priv;
1895+ struct device *dev = &priv->amp_dev->dev;
1896+ const struct cirrus_amp_efi_data *original_blob;
1897+ struct cirrus_amp_cal_data data;
1898+
1899+ kunit_activate_static_stub(test,
1900+ cs_amp_test_hooks->get_efi_variable,
1901+ cs_amp_lib_test_get_efi_variable);
1902+ kunit_activate_static_stub(test,
1903+ cs_amp_test_hooks->set_efi_variable,
1904+ cs_amp_lib_test_set_efi_variable);
1905+
1906+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
1907+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
1908+
1909+ /*
1910+ * Slot 0 is empty.
1911+ * data.calTarget is set to a value that won't match any existing entry.
1912+ */
1913+ memset(&priv->cal_blob->data[0].calTime, 0, sizeof(priv->cal_blob->data[0].calTime));
1914+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1915+ get_random_bytes(&data, sizeof(data));
1916+ data.calTarget[0] = 0xaaaaaaaa;
1917+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1918+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1919+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1920+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
1921+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1922+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1923+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1924+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1925+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1926+
1927+ /* Slot 4 is empty */
1928+ memset(&priv->cal_blob->data[4].calTime, 0, sizeof(priv->cal_blob->data[4].calTime));
1929+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1930+ get_random_bytes(&data, sizeof(data));
1931+ data.calTarget[0] = 0xaaaaaaaa;
1932+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1933+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1934+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1935+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1936+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1937+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1938+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1939+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
1940+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1941+
1942+ /* Slot 3 is empty */
1943+ memset(&priv->cal_blob->data[3].calTime, 0, sizeof(priv->cal_blob->data[3].calTime));
1944+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1945+ get_random_bytes(&data, sizeof(data));
1946+ data.calTarget[0] = 0xaaaaaaaa;
1947+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1948+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1949+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1950+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1951+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1952+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1953+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data));
1954+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1955+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
1956+
1957+ /* Replace entry matching slot 5 */
1958+ memset(&priv->cal_blob->data[5].calTime, 0, sizeof(priv->cal_blob->data[5].calTime));
1959+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
1960+ get_random_bytes(&data, sizeof(data));
1961+ data.calTarget[0] = 0xaaaaaaaa;
1962+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
1963+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
1964+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
1965+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
1966+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
1967+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
1968+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
1969+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data));
1970+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data));
1971+}
1972+
1973+static void cs_amp_lib_test_cal_efi_bad_cal_target(struct kunit *test)
1974+{
1975+ struct cs_amp_lib_test_priv *priv = test->priv;
1976+ struct device *dev = &priv->amp_dev->dev;
1977+ struct cirrus_amp_cal_data data;
1978+
1979+ kunit_activate_static_stub(test,
1980+ cs_amp_test_hooks->get_efi_variable,
1981+ cs_amp_lib_test_get_efi_variable);
1982+ kunit_activate_static_stub(test,
1983+ cs_amp_test_hooks->set_efi_variable,
1984+ cs_amp_lib_test_set_efi_variable);
1985+
1986+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
1987+
1988+ /* Zero calTarget is illegal */
1989+ get_random_bytes(&data, sizeof(data));
1990+ memset(data.calTarget, 0, sizeof(data.calTarget));
1991+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, -1, &data), 0);
1992+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 0, -1, &data), 0);
1993+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 0, 2, &data), 0);
1994+}
1995+
1996+static void cs_amp_lib_test_cal_efi_write_denied(struct kunit *test)
1997+{
1998+ struct cs_amp_lib_test_priv *priv = test->priv;
1999+ struct device *dev = &priv->amp_dev->dev;
2000+ const struct cirrus_amp_efi_data *original_blob;
2001+ struct cirrus_amp_cal_data data;
2002+
2003+ kunit_activate_static_stub(test,
2004+ cs_amp_test_hooks->get_efi_variable,
2005+ cs_amp_lib_test_get_efi_variable);
2006+ kunit_activate_static_stub(test,
2007+ cs_amp_test_hooks->set_efi_variable,
2008+ cs_amp_lib_test_set_efi_variable_denied);
2009+
2010+ cs_amp_lib_test_init_dummy_cal_blob(test, 4);
2011+ KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count);
2012+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
2013+ get_random_bytes(&data, sizeof(data));
2014+
2015+ /* Unspecified slot */
2016+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, -1, &data), 0);
2017+ KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size);
2018+
2019+ /* Unspecified slot with size */
2020+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, 6, &data), 0);
2021+ KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size);
2022+
2023+ /* Specified slot */
2024+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 1, -1, &data), 0);
2025+ KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size);
2026+
2027+ /* Specified slot with size */
2028+ KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 1, 6, &data), 0);
2029+ KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size);
2030+}
2031+
2032+static void cs_amp_lib_test_cal_efi_attr_preserved(struct kunit *test)
2033+{
2034+ struct cs_amp_lib_test_priv *priv = test->priv;
2035+ struct device *dev = &priv->amp_dev->dev;
2036+ struct cirrus_amp_cal_data data;
2037+
2038+ kunit_activate_static_stub(test,
2039+ cs_amp_test_hooks->get_efi_variable,
2040+ cs_amp_lib_test_get_efi_variable);
2041+ kunit_activate_static_stub(test,
2042+ cs_amp_test_hooks->set_efi_variable,
2043+ cs_amp_lib_test_set_efi_variable);
2044+
2045+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
2046+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
2047+ memset(&priv->cal_blob->data[0], 0, sizeof(priv->cal_blob->data[0]));
2048+ get_random_bytes(&data, sizeof(data));
2049+
2050+ /* Set a non-standard attr to return from get_efi_variable() */
2051+ priv->efi_attr = EFI_VARIABLE_HARDWARE_ERROR_RECORD;
2052+
2053+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data));
2054+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data));
2055+ KUNIT_EXPECT_EQ(test, priv->efi_attr, EFI_VARIABLE_HARDWARE_ERROR_RECORD);
2056+}
2057+
2058+static efi_status_t cs_amp_lib_test_set_hp_efi_cal_variable(efi_char16_t *name,
2059+ efi_guid_t *guid,
2060+ u32 attr,
2061+ unsigned long size,
2062+ void *buf)
2063+{
2064+ static const efi_char16_t expected_name[] = HP_CALIBRATION_EFI_NAME;
2065+ static const efi_guid_t expected_guid = HP_CALIBRATION_EFI_GUID;
2066+ struct kunit *test = kunit_get_current_test();
2067+ struct cs_amp_lib_test_priv *priv = test->priv;
2068+
2069+ KUNIT_ASSERT_NOT_NULL(test, name);
2070+ KUNIT_ASSERT_NOT_NULL(test, guid);
2071+
2072+ if (memcmp(name, expected_name, sizeof(expected_name)) ||
2073+ efi_guidcmp(*guid, expected_guid))
2074+ return -EFI_ACCESS_DENIED;
2075+
2076+ KUNIT_ASSERT_NOT_NULL(test, buf);
2077+ KUNIT_ASSERT_NE(test, 0, size);
2078+
2079+ kunit_kfree(test, priv->cal_blob);
2080+ priv->cal_blob = kunit_kmalloc(test, size, GFP_KERNEL);
2081+ KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob);
2082+ memcpy(priv->cal_blob, buf, size);
2083+ priv->efi_attr = attr;
2084+
2085+ return EFI_SUCCESS;
2086+}
2087+
2088+/*
2089+ * If the HP EFI exists it should be the one that is updated.
2090+ */
2091+static void cs_amp_lib_test_cal_efi_update_hp(struct kunit *test)
2092+{
2093+ struct cs_amp_lib_test_priv *priv = test->priv;
2094+ struct device *dev = &priv->amp_dev->dev;
2095+ const struct cirrus_amp_efi_data *original_blob;
2096+ struct cirrus_amp_cal_data data;
2097+
2098+ kunit_activate_static_stub(test,
2099+ cs_amp_test_hooks->get_efi_variable,
2100+ cs_amp_lib_test_get_hp_cal_efi_variable);
2101+ kunit_activate_static_stub(test,
2102+ cs_amp_test_hooks->set_efi_variable,
2103+ cs_amp_lib_test_set_hp_efi_cal_variable);
2104+
2105+ cs_amp_lib_test_init_dummy_cal_blob(test, 6);
2106+ KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count);
2107+
2108+ /* Replace entry matching slot 4 */
2109+ original_blob = cs_amp_lib_test_cal_blob_dup(test);
2110+ get_random_bytes(&data, sizeof(data));
2111+ data.calTarget[0] = ~priv->cal_blob->data[4].calTarget[0];
2112+ KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data));
2113+ KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count);
2114+ KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size);
2115+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data));
2116+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data));
2117+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data));
2118+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data));
2119+ KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data));
2120+ KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data));
2121+}
2122+
7052123 static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test)
7062124 {
7072125 struct cs_amp_lib_test_priv *priv = test->priv;
@@ -716,6 +2134,7 @@ static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test) · 8 unmodified lines
7162134
7172135 static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_t *name,
7182136 efi_guid_t *guid,
2137+ u32 *returned_attr,
7192138 unsigned long *size,
7202139 void *buf)
7212140 {
@@ -734,6 +2153,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_t *nam · 12 unmodified lines
7342153
7352154 static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_t *name,
7362155 efi_guid_t *guid,
2156+ u32 *returned_attr,
7372157 unsigned long *size,
7382158 void *buf)
7392159 {
@@ -752,6 +2172,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_t *nam · 12 unmodified lines
7522172
7532173 static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_00(efi_char16_t *name,
7542174 efi_guid_t *guid,
2175+ u32 *returned_attr,
7552176 unsigned long *size,
7562177 void *buf)
7572178 {
@@ -803,6 +2224,7 @@ static void cs_amp_lib_test_spkid_lenovo_illegal(struct kunit *test) · 45 unmodified lines
8032224
8042225 static efi_status_t cs_amp_lib_test_get_efi_variable_buf_too_small(efi_char16_t *name,
8052226 efi_guid_t *guid,
2227+ u32 *returned_attr,
8062228 unsigned long *size,
8072229 void *buf)
8082230 {
@@ -823,6 +2245,7 @@ static void cs_amp_lib_test_spkid_lenovo_oversize(struct kunit *test) · 14 unmodified lines
8232245
8242246 static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *name,
8252247 efi_guid_t *guid,
2248+ u32 *returned_attr,
8262249 unsigned long *size,
8272250 void *buf)
8282251 {
@@ -841,6 +2264,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *name, · 12 unmodified lines
8412264
8422265 static efi_status_t cs_amp_lib_test_get_efi_variable_hp_31(efi_char16_t *name,
8432266 efi_guid_t *guid,
2267+ u32 *returned_attr,
8442268 unsigned long *size,
8452269 void *buf)
8462270 {
@@ -974,8 +2398,32 @@ static struct kunit_case cs_amp_lib_test_cases[] = { · 127 unmodified lines
9742398 cs_amp_lib_test_get_cal_gen_params),
9752399 KUNIT_CASE(cs_amp_lib_test_get_efi_cal_empty_entry_test),
9762400
977− /* Tests for writing calibration data */
2401+ /* Tests for writing and reading calibration data */
9782402 KUNIT_CASE(cs_amp_lib_test_write_cal_data_test),
2403+ KUNIT_CASE(cs_amp_lib_test_read_cal_data_test),
2404+ KUNIT_CASE(cs_amp_lib_test_write_ambient_test),
2405+
2406+ /* Test cases for writing cal data to UEFI */
2407+ KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi),
2408+ KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi_indexed),
2409+ KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi_indexed_no_max),
2410+ KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first),
2411+ KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_no_shrink),
2412+ KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed),
2413+ KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed_no_shrink),
2414+ KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi),
2415+ KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi_indexed),
2416+ KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi_indexed_no_max),
2417+ KUNIT_CASE(cs_amp_lib_test_grow_cal_efi_replace_indexed),
2418+ KUNIT_CASE(cs_amp_lib_test_grow_cal_efi_replace_by_uid),
2419+ KUNIT_CASE(cs_amp_lib_test_cal_efi_replace_by_uid),
2420+ KUNIT_CASE(cs_amp_lib_test_cal_efi_replace_by_index),
2421+ KUNIT_CASE(cs_amp_lib_test_cal_efi_deduplicate),
2422+ KUNIT_CASE(cs_amp_lib_test_cal_efi_find_free),
2423+ KUNIT_CASE(cs_amp_lib_test_cal_efi_bad_cal_target),
2424+ KUNIT_CASE(cs_amp_lib_test_cal_efi_write_denied),
2425+ KUNIT_CASE(cs_amp_lib_test_cal_efi_attr_preserved),
2426+ KUNIT_CASE(cs_amp_lib_test_cal_efi_update_hp),
9792427
9802428 /* Test cases for speaker ID */
9812429 KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_not_present),
sound/soc/codecs/cs-amp-lib.c+347−25
@@ -7,12 +7,17 @@ · 6 unmodified lines
77
88 #include <asm/byteorder.h>
99 #include <kunit/static_stub.h>
10+#include <linux/cleanup.h>
11+#include <linux/debugfs.h>
1012 #include <linux/dev_printk.h>
1113 #include <linux/efi.h>
1214 #include <linux/firmware/cirrus/cs_dsp.h>
15+#include <linux/math64.h>
1316 #include <linux/module.h>
17+#include <linux/mutex.h>
1418 #include <linux/overflow.h>
1519 #include <linux/slab.h>
20+#include <linux/timekeeping.h>
1621 #include <linux/types.h>
1722 #include <sound/cs-amp-lib.h>
1823
@@ -46,6 +51,23 @@ static const struct cs_amp_lib_cal_efivar { · 27 unmodified lines
4651 },
4752 };
4853
54+#define CS_AMP_CAL_DEFAULT_EFI_ATTR \
55+ (EFI_VARIABLE_NON_VOLATILE | \
56+ EFI_VARIABLE_BOOTSERVICE_ACCESS | \
57+ EFI_VARIABLE_RUNTIME_ACCESS)
58+
59+/* Offset from Unix time to Windows time (100ns since 1 Jan 1601) */
60+#define UNIX_TIME_TO_WINDOWS_TIME_OFFSET 116444736000000000ULL
61+
62+static DEFINE_MUTEX(cs_amp_efi_cal_write_lock);
63+
64+static u64 cs_amp_time_now_in_windows_time(void)
65+{
66+ u64 time_in_100ns = div_u64(ktime_get_real_ns(), 100);
67+
68+ return time_in_100ns + UNIX_TIME_TO_WINDOWS_TIME_OFFSET;
69+}
70+
4971 static int cs_amp_write_cal_coeff(struct cs_dsp *dsp,
5072 const struct cirrus_amp_cal_controls *controls,
5173 const char *ctl_name, u32 val)
@@ -73,6 +95,34 @@ static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, · 21 unmodified lines
7395 return -ENODEV;
7496 }
7597
98+static int cs_amp_read_cal_coeff(struct cs_dsp *dsp,
99+ const struct cirrus_amp_cal_controls *controls,
100+ const char *ctl_name, u32 *val)
101+{
102+ struct cs_dsp_coeff_ctl *cs_ctl;
103+ __be32 beval;
104+ int ret;
105+
106+ KUNIT_STATIC_STUB_REDIRECT(cs_amp_read_cal_coeff, dsp, controls, ctl_name, val);
107+
108+ if (!IS_REACHABLE(CONFIG_FW_CS_DSP))
109+ return -ENODEV;
110+
111+ scoped_guard(mutex, &dsp->pwr_lock) {
112+ cs_ctl = cs_dsp_get_ctl(dsp, ctl_name, controls->mem_region, controls->alg_id);
113+ ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &beval, sizeof(beval));
114+ }
115+
116+ if (ret < 0) {
117+ dev_err(dsp->dev, "Failed to write to '%s': %d\n", ctl_name, ret);
118+ return ret;
119+ }
120+
121+ *val = be32_to_cpu(beval);
122+
123+ return 0;
124+}
125+
76126 static int _cs_amp_write_cal_coeffs(struct cs_dsp *dsp,
77127 const struct cirrus_amp_cal_controls *controls,
78128 const struct cirrus_amp_cal_data *data)
@@ -106,6 +156,45 @@ static int _cs_amp_write_cal_coeffs(struct cs_dsp *dsp, · 27 unmodified lines
106156 return 0;
107157 }
108158
159+static int _cs_amp_read_cal_coeffs(struct cs_dsp *dsp,
160+ const struct cirrus_amp_cal_controls *controls,
161+ struct cirrus_amp_cal_data *data)
162+{
163+ u64 time;
164+ u32 val;
165+ int ret;
166+
167+ if (list_empty(&dsp->ctl_list)) {
168+ dev_info(dsp->dev, "Calibration disabled due to missing firmware controls\n");
169+ return -ENOENT;
170+ }
171+
172+ ret = cs_amp_read_cal_coeff(dsp, controls, controls->ambient, &val);
173+ if (ret)
174+ return ret;
175+
176+ data->calAmbient = (s8)val;
177+
178+ ret = cs_amp_read_cal_coeff(dsp, controls, controls->calr, &val);
179+ if (ret)
180+ return ret;
181+
182+ data->calR = (u16)val;
183+
184+ ret = cs_amp_read_cal_coeff(dsp, controls, controls->status, &val);
185+ if (ret)
186+ return ret;
187+
188+ data->calStatus = (u8)val;
189+
190+ /* Fill in timestamp */
191+ time = cs_amp_time_now_in_windows_time();
192+ data->calTime[0] = (u32)time;
193+ data->calTime[1] = (u32)(time >> 32);
194+
195+ return 0;
196+}
197+
109198 /**
110199 * cs_amp_write_cal_coeffs - Write calibration data to firmware controls.
111200 * @dsp: Pointer to struct cs_dsp.
@@ -125,21 +214,78 @@ int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, · 13 unmodified lines
125214 }
126215 EXPORT_SYMBOL_NS_GPL(cs_amp_write_cal_coeffs, "SND_SOC_CS_AMP_LIB");
127216
217+/**
218+ * cs_amp_read_cal_coeffs - Read calibration data from firmware controls.
219+ * @dsp: Pointer to struct cs_dsp.
220+ * @controls: Pointer to definition of firmware controls to be read.
221+ * @data: Pointer to calibration data where results will be written.
222+ *
223+ * Returns: 0 on success, else negative error value.
224+ */
225+int cs_amp_read_cal_coeffs(struct cs_dsp *dsp,
226+ const struct cirrus_amp_cal_controls *controls,
227+ struct cirrus_amp_cal_data *data)
228+{
229+ if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST))
230+ return _cs_amp_read_cal_coeffs(dsp, controls, data);
231+ else
232+ return -ENODEV;
233+}
234+EXPORT_SYMBOL_NS_GPL(cs_amp_read_cal_coeffs, "SND_SOC_CS_AMP_LIB");
235+
236+/**
237+ * cs_amp_write_ambient_temp - write value to calibration ambient temperature
238+ * @dsp: Pointer to struct cs_dsp.
239+ * @controls: Pointer to definition of firmware controls to be read.
240+ * @temp: Temperature in degrees celcius.
241+ *
242+ * Returns: 0 on success, else negative error value.
243+ */
244+int cs_amp_write_ambient_temp(struct cs_dsp *dsp,
245+ const struct cirrus_amp_cal_controls *controls,
246+ u32 temp)
247+{
248+ if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST))
249+ return cs_amp_write_cal_coeff(dsp, controls, controls->ambient, temp);
250+ else
251+ return -ENODEV;
252+}
253+EXPORT_SYMBOL_NS_GPL(cs_amp_write_ambient_temp, "SND_SOC_CS_AMP_LIB");
254+
128255 static efi_status_t cs_amp_get_efi_variable(efi_char16_t *name,
129256 efi_guid_t *guid,
257+ u32 *returned_attr,
130258 unsigned long *size,
131259 void *buf)
132260 {
133261 u32 attr;
134262
135− KUNIT_STATIC_STUB_REDIRECT(cs_amp_get_efi_variable, name, guid, size, buf);
263+ if (!returned_attr)
264+ returned_attr = &attr;
265+
266+ KUNIT_STATIC_STUB_REDIRECT(cs_amp_get_efi_variable, name, guid,
267+ returned_attr, size, buf);
136268
137269 if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE))
138− return efi.get_variable(name, guid, &attr, size, buf);
270+ return efi.get_variable(name, guid, returned_attr, size, buf);
139271
140272 return EFI_NOT_FOUND;
141273 }
142274
275+static efi_status_t cs_amp_set_efi_variable(efi_char16_t *name,
276+ efi_guid_t *guid,
277+ u32 attr,
278+ unsigned long size,
279+ void *buf)
280+{
281+ KUNIT_STATIC_STUB_REDIRECT(cs_amp_set_efi_variable, name, guid, attr, size, buf);
282+
283+ if (!efi_rt_services_supported(EFI_RT_SUPPORTED_SET_VARIABLE))
284+ return EFI_NOT_FOUND;
285+
286+ return efi.set_variable(name, guid, attr, size, buf);
287+}
288+
143289 static int cs_amp_convert_efi_status(efi_status_t status)
144290 {
145291 switch (status) {
@@ -149,6 +295,7 @@ static int cs_amp_convert_efi_status(efi_status_t status) · 3 unmodified lines
149295 return -ENOENT;
150296 case EFI_BUFFER_TOO_SMALL:
151297 return -EFBIG;
298+ case EFI_WRITE_PROTECTED:
152299 case EFI_UNSUPPORTED:
153300 case EFI_ACCESS_DENIED:
154301 case EFI_SECURITY_VIOLATION:
@@ -158,11 +305,13 @@ static int cs_amp_convert_efi_status(efi_status_t status) · 3 unmodified lines
158305 }
159306 }
160307
161−static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev)
308+static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev,
309+ efi_char16_t **name,
310+ efi_guid_t **guid,
311+ u32 *attr)
162312 {
163− struct cirrus_amp_efi_data *efi_data;
313+ struct cirrus_amp_efi_data *efi_data __free(kfree) = NULL;
164314 unsigned long data_size = 0;
165− u8 *data;
166315 efi_status_t status;
167316 int i, ret;
168317
@@ -170,7 +319,7 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 1 unmodified line
170319 for (i = 0; i < ARRAY_SIZE(cs_amp_lib_cal_efivars); i++) {
171320 status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name,
172321 cs_amp_lib_cal_efivars[i].guid,
173− &data_size, NULL);
322+ attr, &data_size, NULL);
174323 if (status == EFI_BUFFER_TOO_SMALL)
175324 break;
176325 }
@@ -178,25 +327,30 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 1 unmodified line
178327 if (status != EFI_BUFFER_TOO_SMALL)
179328 return ERR_PTR(-ENOENT);
180329
330+ if (name)
331+ *name = cs_amp_lib_cal_efivars[i].name;
332+
333+ if (guid)
334+ *guid = cs_amp_lib_cal_efivars[i].guid;
335+
181336 if (data_size < sizeof(*efi_data)) {
182337 dev_err(dev, "EFI cal variable truncated\n");
183338 return ERR_PTR(-EOVERFLOW);
184339 }
185340
186341 /* Get variable contents into buffer */
187− data = kmalloc(data_size, GFP_KERNEL);
188− if (!data)
342+ efi_data = kmalloc(data_size, GFP_KERNEL);
343+ if (!efi_data)
189344 return ERR_PTR(-ENOMEM);
190345
191346 status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name,
192347 cs_amp_lib_cal_efivars[i].guid,
193− &data_size, data);
348+ attr, &data_size, efi_data);
194349 if (status != EFI_SUCCESS) {
195350 ret = -EINVAL;
196351 goto err;
197352 }
198353
199− efi_data = (struct cirrus_amp_efi_data *)data;
200354 dev_dbg(dev, "Calibration: Size=%d, Amp Count=%d\n", efi_data->size, efi_data->count);
201355
202356 if ((efi_data->count > 128) ||
@@ -206,28 +360,40 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 3 unmodified lines
206360 goto err;
207361 }
208362
209− return efi_data;
363+ /* This could be zero-filled space pre-allocated by the BIOS */
364+ if (efi_data->size == 0)
365+ efi_data->size = data_size;
366+
367+ return_ptr(efi_data);
210368
211369 err:
212− kfree(data);
213370 dev_err(dev, "Failed to read calibration data from EFI: %d\n", ret);
214371
215372 return ERR_PTR(ret);
216373 }
217374
218−static u64 cs_amp_cal_target_u64(const struct cirrus_amp_cal_data *data)
375+static int cs_amp_set_cal_efi_buffer(struct device *dev,
376+ efi_char16_t *name,
377+ efi_guid_t *guid,
378+ u32 attr,
379+ struct cirrus_amp_efi_data *data)
219380 {
220− return ((u64)data->calTarget[1] << 32) | data->calTarget[0];
381+ efi_status_t status;
382+
383+ status = cs_amp_set_efi_variable(name, guid, attr,
384+ struct_size(data, data, data->count), data);
385+
386+ return cs_amp_convert_efi_status(status);
221387 }
222388
223389 static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index,
224390 struct cirrus_amp_cal_data *out_data)
225391 {
226− struct cirrus_amp_efi_data *efi_data;
392+ struct cirrus_amp_efi_data *efi_data __free(kfree) = NULL;
227393 struct cirrus_amp_cal_data *cal = NULL;
228− int i, ret;
394+ int i;
229395
230− efi_data = cs_amp_get_cal_efi_buffer(dev);
396+ efi_data = cs_amp_get_cal_efi_buffer(dev, NULL, NULL, NULL);
231397 if (IS_ERR(efi_data))
232398 return PTR_ERR(efi_data);
233399
@@ -266,17 +432,106 @@ static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, · 32 unmodified lines
266432 dev_warn(dev, "Calibration entry %d does not match silicon ID", amp_index);
267433 }
268434
269− if (cal) {
270− memcpy(out_data, cal, sizeof(*out_data));
271− ret = 0;
272− } else {
435+ if (!cal) {
273436 dev_warn(dev, "No calibration for silicon ID %#llx\n", target_uid);
274− ret = -ENOENT;
437+ return -ENOENT;
438+ }
439+
440+ memcpy(out_data, cal, sizeof(*out_data));
441+
442+ return 0;
443+}
444+
445+static int _cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps,
446+ const struct cirrus_amp_cal_data *in_data)
447+{
448+ u64 cal_target = cs_amp_cal_target_u64(in_data);
449+ unsigned long num_entries;
450+ struct cirrus_amp_efi_data *data __free(kfree) = NULL;
451+ efi_char16_t *name = CIRRUS_LOGIC_CALIBRATION_EFI_NAME;
452+ efi_guid_t *guid = &CIRRUS_LOGIC_CALIBRATION_EFI_GUID;
453+ u32 attr = CS_AMP_CAL_DEFAULT_EFI_ATTR;
454+ int i, ret;
455+
456+ if (cal_target == 0)
457+ return -EINVAL;
458+
459+ data = cs_amp_get_cal_efi_buffer(dev, &name, &guid, &attr);
460+ ret = PTR_ERR_OR_ZERO(data);
461+ if (ret == -ENOENT) {
462+ data = NULL;
463+ goto alloc_new;
464+ } else if (ret) {
465+ return ret;
466+ }
467+
468+ /*
469+ * If the EFI variable is just zero-filled reserved space the count
470+ * must be set.
471+ */
472+ if (data->count == 0)
473+ data->count = (data->size - sizeof(data)) / sizeof(data->data[0]);
474+
475+ if (amp_index < 0) {
476+ /* Is there already a slot for this target? */
477+ for (amp_index = 0; amp_index < data->count; amp_index++) {
478+ if (cs_amp_cal_target_u64(&data->data[amp_index]) == cal_target)
479+ break;
480+ }
481+
482+ /* Else find an empty slot */
483+ if (amp_index >= data->count) {
484+ for (amp_index = 0; amp_index < data->count; amp_index++) {
485+ if ((data->data[amp_index].calTime[0] == 0) &&
486+ (data->data[amp_index].calTime[1] == 0))
487+ break;
488+ }
489+ }
490+ } else {
491+ /*
492+ * If the index is forced there could be another active
493+ * slot with the same calTarget. So deduplicate.
494+ */
495+ for (i = 0; i < data->count; i++) {
496+ if (i == amp_index)
497+ continue;
498+
499+ if ((data->data[i].calTime[0] == 0) && (data->data[i].calTime[1] == 0))
500+ continue;
501+
502+ if (cs_amp_cal_target_u64(&data->data[i]) == cal_target)
503+ memset(data->data[i].calTime, 0, sizeof(data->data[i].calTime));
504+ }
275505 }
276506
277− kfree(efi_data);
507+alloc_new:
508+ if (amp_index < 0)
509+ amp_index = 0;
510+
511+ num_entries = max(num_amps, amp_index + 1);
512+ if (!data || (data->count < num_entries)) {
513+ struct cirrus_amp_efi_data *old_data __free(kfree) = no_free_ptr(data);
514+ unsigned int new_data_size = struct_size(data, data, num_entries);
515+
516+ data = kzalloc(new_data_size, GFP_KERNEL);
517+ if (!data)
518+ return -ENOMEM;
278519
279− return ret;
520+ if (old_data)
521+ memcpy(data, old_data, struct_size(old_data, data, old_data->count));
522+
523+ data->count = num_entries;
524+ data->size = new_data_size;
525+ }
526+
527+ data->data[amp_index] = *in_data;
528+ ret = cs_amp_set_cal_efi_buffer(dev, name, guid, attr, data);
529+ if (ret) {
530+ dev_err(dev, "Failed writing calibration to EFI: %d\n", ret);
531+ return ret;
532+ }
533+
534+ return 0;
280535 }
281536
282537 /**
@@ -325,6 +580,46 @@ int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_ · 42 unmodified lines
325580 }
326581 EXPORT_SYMBOL_NS_GPL(cs_amp_get_efi_calibration_data, "SND_SOC_CS_AMP_LIB");
327582
583+/**
584+ * cs_amp_set_efi_calibration_data - write a calibration data entry to EFI.
585+ * @dev: struct device of the caller.
586+ * @amp_index: Entry index to use, or -1 to use any available slot.
587+ * @num_amps: Maximum number of amps to reserve slots for, or -1 to ignore.
588+ * @in_data: struct cirrus_amp_cal_data entry to be written to EFI.
589+ *
590+ * If a Vendor-specific variable exists it will be updated,
591+ * else if the Cirrus variable exists it will be updated
592+ * else the Cirrus variable will be created.
593+ *
594+ * If amp_index >= 0 the data will be placed in this entry of the calibration
595+ * data array, overwriting what was in that entry. Any other entries with the
596+ * same calTarget will be marked empty.
597+ *
598+ * If amp_index < 0 and in_data->calTarget matches any existing entry, that
599+ * entry will be overwritten. Else the first available free entry will be used,
600+ * extending the size of the EFI variable if there are no free entries.
601+ *
602+ * If num_amps > 0 the EFI variable will be sized to contain at least this
603+ * many calibration entries, with any new entries marked empty.
604+ *
605+ * Return: 0 if the write was successful, -EFBIG if space could not be made in
606+ * the EFI file to add the entry, -EACCES if it was not possible to
607+ * read or write the EFI variable.
608+ */
609+int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps,
610+ const struct cirrus_amp_cal_data *in_data)
611+{
612+ if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) {
613+ scoped_guard(mutex, &cs_amp_efi_cal_write_lock) {
614+ return _cs_amp_set_efi_calibration_data(dev, amp_index,
615+ num_amps, in_data);
616+ }
617+ }
618+
619+ return -ENOENT;
620+}
621+EXPORT_SYMBOL_NS_GPL(cs_amp_set_efi_calibration_data, "SND_SOC_CS_AMP_LIB");
622+
328623 struct cs_amp_spkid_efi {
329624 efi_char16_t *name;
330625 efi_guid_t *guid;
@@ -339,7 +634,7 @@ static int cs_amp_get_efi_byte_spkid(struct device *dev, const struct cs_amp_spk · 8 unmodified lines
339634 int i, ret;
340635
341636 size = sizeof(spkid);
342− status = cs_amp_get_efi_variable(info->name, info->guid, &size, &spkid);
637+ status = cs_amp_get_efi_variable(info->name, info->guid, NULL, &size, &spkid);
343638 ret = cs_amp_convert_efi_status(status);
344639 if (ret < 0)
345640 return ret;
@@ -400,9 +695,36 @@ int cs_amp_get_vendor_spkid(struct device *dev) · 54 unmodified lines
400695 }
401696 EXPORT_SYMBOL_NS_GPL(cs_amp_get_vendor_spkid, "SND_SOC_CS_AMP_LIB");
402697
698+/**
699+ * cs_amp_create_debugfs - create a debugfs directory for a device
700+ *
701+ * @dev: pointer to struct device
702+ *
703+ * Creates a node under "cirrus_logic" in the root of the debugfs filesystem.
704+ * This is for Cirrus-specific debugfs functionality to be grouped in a
705+ * defined way, independently of the debugfs provided by ALSA/ASoC.
706+ * The general ALSA/ASoC debugfs may not be enabled, and does not necessarily
707+ * have a stable layout or naming convention.
708+ *
709+ * Return: Pointer to the dentry for the created directory, or -ENODEV.
710+ */
711+struct dentry *cs_amp_create_debugfs(struct device *dev)
712+{
713+ struct dentry *dir;
714+
715+ dir = debugfs_lookup("cirrus_logic", NULL);
716+ if (!dir)
717+ dir = debugfs_create_dir("cirrus_logic", NULL);
718+
719+ return debugfs_create_dir(dev_name(dev), dir);
720+}
721+EXPORT_SYMBOL_NS_GPL(cs_amp_create_debugfs, "SND_SOC_CS_AMP_LIB");
722+
403723 static const struct cs_amp_test_hooks cs_amp_test_hook_ptrs = {
404724 .get_efi_variable = cs_amp_get_efi_variable,
725+ .set_efi_variable = cs_amp_set_efi_variable,
405726 .write_cal_coeff = cs_amp_write_cal_coeff,
727+ .read_cal_coeff = cs_amp_read_cal_coeff,
406728 };
407729
408730 const struct cs_amp_test_hooks * const cs_amp_test_hooks =
sound/soc/codecs/cs35l33.c+2−2
@@ -547,7 +547,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, · 546 unmodified lines
547547 unsigned int rx_mask, int slots, int slot_width)
548548 {
549549 struct snd_soc_component *component = dai->component;
550− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
550+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
551551 struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
552552 unsigned int reg, bit_pos, i;
553553 int slot, slot_num;
@@ -695,7 +695,7 @@ static int cs35l33_set_hg_data(struct snd_soc_component *component, · 141 unmodified lines
695695 struct cs35l33_pdata *pdata)
696696 {
697697 struct cs35l33_hg *hg_config = &pdata->hg_config;
698− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
698+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
699699 struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
700700
701701 if (hg_config->enable_hg_algo) {
sound/soc/codecs/cs35l36.c+2−4
@@ -455,8 +455,7 @@ static SOC_ENUM_SINGLE_DECL(pcm_sft_ramp, CS35L36_AMP_DIG_VOL_CTRL, 0, · 454 unmodified lines
455455 static int cs35l36_ldm_sel_get(struct snd_kcontrol *kcontrol,
456456 struct snd_ctl_elem_value *ucontrol)
457457 {
458− struct snd_soc_component *component =
459− snd_soc_kcontrol_component(kcontrol);
458+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
460459 struct cs35l36_private *cs35l36 =
461460 snd_soc_component_get_drvdata(component);
462461
@@ -468,8 +467,7 @@ static int cs35l36_ldm_sel_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
468467 static int cs35l36_ldm_sel_put(struct snd_kcontrol *kcontrol,
469468 struct snd_ctl_elem_value *ucontrol)
470469 {
471− struct snd_soc_component *component =
472− snd_soc_kcontrol_component(kcontrol);
470+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
473471 struct cs35l36_private *cs35l36 =
474472 snd_soc_component_get_drvdata(component);
475473 int val = (ucontrol->value.integer.value[0]) ? CS35L36_NG_AMP_EN_MASK :
sound/soc/codecs/cs35l41.c+1−1
@@ -928,7 +928,7 @@ static const struct snd_soc_dapm_widget cs35l41_ext_bst_widget[] = { · 927 unmodified lines
928928 static int cs35l41_component_probe(struct snd_soc_component *component)
929929 {
930930 struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
931− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
931+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
932932 int ret;
933933
934934 if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) {
sound/soc/codecs/cs35l45.c+5−7
@@ -198,8 +198,7 @@ static int cs35l45_activate_ctl(struct snd_soc_component *component, · 197 unmodified lines
198198 static int cs35l45_amplifier_mode_get(struct snd_kcontrol *kcontrol,
199199 struct snd_ctl_elem_value *ucontrol)
200200 {
201− struct snd_soc_component *component =
202− snd_soc_kcontrol_component(kcontrol);
201+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
203202 struct cs35l45_private *cs35l45 =
204203 snd_soc_component_get_drvdata(component);
205204
@@ -211,12 +210,11 @@ static int cs35l45_amplifier_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
211210 static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol,
212211 struct snd_ctl_elem_value *ucontrol)
213212 {
214− struct snd_soc_component *component =
215− snd_soc_kcontrol_component(kcontrol);
213+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
216214 struct cs35l45_private *cs35l45 =
217215 snd_soc_component_get_drvdata(component);
218216 struct snd_soc_dapm_context *dapm =
219− snd_soc_component_get_dapm(component);
217+ snd_soc_component_to_dapm(component);
220218 unsigned int amp_state;
221219 int ret;
222220
@@ -235,7 +233,7 @@ static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines
235233
236234 regmap_clear_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES,
237235 CS35L45_AMP_EN_MASK);
238− snd_soc_component_disable_pin_unlocked(component, "SPK");
236+ snd_soc_dapm_disable_pin_unlocked(dapm, "SPK");
239237 snd_soc_dapm_sync_unlocked(dapm);
240238
241239 if (ucontrol->value.integer.value[0] == AMP_MODE_SPK) {
@@ -289,7 +287,7 @@ static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, · 47 unmodified lines
289287 regmap_set_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES,
290288 CS35L45_AMP_EN_MASK);
291289
292− snd_soc_component_enable_pin_unlocked(component, "SPK");
290+ snd_soc_dapm_enable_pin_unlocked(dapm, "SPK");
293291 snd_soc_dapm_sync_unlocked(dapm);
294292 snd_soc_dapm_mutex_unlock(dapm);
295293
sound/soc/codecs/cs35l56-shared.c+412−27
@@ -6,11 +6,18 @@ · 5 unmodified lines
66 // Cirrus Logic International Semiconductor Ltd.
77
88 #include <linux/array_size.h>
9+#include <linux/cleanup.h>
10+#include <linux/debugfs.h>
911 #include <linux/firmware/cirrus/wmfw.h>
12+#include <linux/fs.h>
1013 #include <linux/gpio/consumer.h>
14+#include <linux/kstrtox.h>
1115 #include <linux/regmap.h>
1216 #include <linux/regulator/consumer.h>
1317 #include <linux/spi/spi.h>
18+#include <linux/stddef.h>
19+#include <linux/string.h>
20+#include <linux/string_choices.h>
1421 #include <linux/types.h>
1522 #include <sound/cs-amp-lib.h>
1623
@@ -206,6 +213,8 @@ static bool cs35l56_readable_reg(struct device *dev, unsigned int reg) · 189 unmodified lines
206213 case CS35L56_IRQ1_MASK_8:
207214 case CS35L56_IRQ1_MASK_18:
208215 case CS35L56_IRQ1_MASK_20:
216+ case CS35L56_MIXER_NGATE_CH1_CFG:
217+ case CS35L56_MIXER_NGATE_CH2_CFG:
209218 case CS35L56_DSP_VIRTUAL1_MBOX_1:
210219 case CS35L56_DSP_VIRTUAL1_MBOX_2:
211220 case CS35L56_DSP_VIRTUAL1_MBOX_3:
@@ -263,6 +272,8 @@ static bool cs35l56_common_volatile_reg(unsigned int reg) · 51 unmodified lines
263272 case CS35L56_IRQ1_EINT_1 ... CS35L56_IRQ1_EINT_8:
264273 case CS35L56_IRQ1_EINT_18:
265274 case CS35L56_IRQ1_EINT_20:
275+ case CS35L56_MIXER_NGATE_CH1_CFG:
276+ case CS35L56_MIXER_NGATE_CH2_CFG:
266277 case CS35L56_DSP_VIRTUAL1_MBOX_1:
267278 case CS35L56_DSP_VIRTUAL1_MBOX_2:
268279 case CS35L56_DSP_VIRTUAL1_MBOX_3:
@@ -724,15 +735,11 @@ static void cs35l56_issue_wake_event(struct cs35l56_base *cs35l56_base) · 455 unmodified lines
724735 cs35l56_wait_control_port_ready();
725736 }
726737
727−int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base)
738+static int cs35l56_wait_for_ps3(struct cs35l56_base *cs35l56_base)
728739 {
729740 unsigned int val;
730741 int ret;
731742
732− if (!cs35l56_base->init_done)
733− return 0;
734−
735− /* Firmware must have entered a power-save state */
736743 ret = regmap_read_poll_timeout(cs35l56_base->regmap,
737744 cs35l56_base->fw_reg->transducer_actual_ps,
738745 val, (val >= CS35L56_PS3),
@@ -741,6 +748,17 @@ int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base) · 2 unmodified lines
741748 if (ret)
742749 dev_warn(cs35l56_base->dev, "PS3 wait failed: %d\n", ret);
743750
751+ return ret;
752+}
753+
754+int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base)
755+{
756+ if (!cs35l56_base->init_done)
757+ return 0;
758+
759+ /* Firmware must have entered a power-save state */
760+ cs35l56_wait_for_ps3(cs35l56_base);
761+
744762 /* Clear BOOT_DONE so it can be used to detect a reboot */
745763 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, CS35L56_OTP_BOOT_DONE_MASK);
746764
@@ -839,6 +857,8 @@ void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_ds · 92 unmodified lines
839857 cs_dsp->mem = cs35l56_dsp1_regions;
840858 cs_dsp->num_mems = ARRAY_SIZE(cs35l56_dsp1_regions);
841859 cs_dsp->no_core_startstop = true;
860+
861+ cs35l56_base->dsp = cs_dsp;
842862 }
843863 EXPORT_SYMBOL_NS_GPL(cs35l56_init_cs_dsp, "SND_SOC_CS35L56_SHARED");
844864
@@ -853,7 +873,7 @@ struct cs35l56_pte { · 8 unmodified lines
853873 } __packed;
854874 static_assert((sizeof(struct cs35l56_pte) % sizeof(u32)) == 0);
855875
856−static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid)
876+static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base)
857877 {
858878 struct cs35l56_pte pte;
859879 u64 unique_id;
@@ -870,14 +890,15 @@ static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) · 10 unmodified lines
870890 unique_id |= (u32)pte.x | ((u32)pte.y << 8) | ((u32)pte.wafer_id << 16) |
871891 ((u32)pte.dvs << 24);
872892
873− *uid = unique_id;
893+ cs35l56_base->silicon_uid = unique_id;
874894
875895 return 0;
876896 }
877897
878−static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid)
898+static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base)
879899 {
880900 u32 tmp[2];
901+ u64 unique_id;
881902 int ret;
882903
883904 ret = regmap_bulk_read(cs35l56_base->regmap, CS35L56_DIE_STS1, tmp, ARRAY_SIZE(tmp));
@@ -886,9 +907,11 @@ static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) · 2 unmodified lines
886907 return ret;
887908 }
888909
889− *uid = tmp[1];
890− *uid <<= 32;
891− *uid |= tmp[0];
910+ unique_id = tmp[1];
911+ unique_id <<= 32;
912+ unique_id |= tmp[0];
913+
914+ cs35l56_base->silicon_uid = unique_id;
892915
893916 return 0;
894917 }
@@ -915,48 +938,378 @@ static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = { · 20 unmodified lines
915938
916939 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base)
917940 {
918− u64 silicon_uid = 0;
919941 int ret;
920942
921943 /* Driver can't apply calibration to a secured part, so skip */
922944 if (cs35l56_base->secured)
923945 return 0;
924946
947+ ret = cs_amp_get_efi_calibration_data(cs35l56_base->dev,
948+ cs35l56_base->silicon_uid,
949+ cs35l56_base->cal_index,
950+ &cs35l56_base->cal_data);
951+
952+ /* Only return an error status if probe should be aborted */
953+ if ((ret == -ENOENT) || (ret == -EOVERFLOW))
954+ return 0;
955+
956+ if (ret < 0)
957+ return ret;
958+
959+ cs35l56_base->cal_data_valid = true;
960+
961+ return 0;
962+}
963+EXPORT_SYMBOL_NS_GPL(cs35l56_get_calibration, "SND_SOC_CS35L56_SHARED");
964+
965+int cs35l56_stash_calibration(struct cs35l56_base *cs35l56_base,
966+ const struct cirrus_amp_cal_data *data)
967+{
968+
969+ /* Ignore if it is empty */
970+ if (!data->calTime[0] && !data->calTime[1])
971+ return -ENODATA;
972+
973+ if (cs_amp_cal_target_u64(data) != cs35l56_base->silicon_uid) {
974+ dev_err(cs35l56_base->dev, "cal_data not for this silicon ID\n");
975+ return -EINVAL;
976+ }
977+
978+ cs35l56_base->cal_data = *data;
979+ cs35l56_base->cal_data_valid = true;
980+
981+ return 0;
982+}
983+EXPORT_SYMBOL_NS_GPL(cs35l56_stash_calibration, "SND_SOC_CS35L56_SHARED");
984+
985+static int cs35l56_perform_calibration(struct cs35l56_base *cs35l56_base)
986+{
987+ const struct cirrus_amp_cal_controls *calibration_controls =
988+ cs35l56_base->calibration_controls;
989+ struct cs_dsp *dsp = cs35l56_base->dsp;
990+ struct cirrus_amp_cal_data cal_data;
991+ struct cs_dsp_coeff_ctl *ctl;
992+ bool ngate_ch1_was_enabled = false;
993+ bool ngate_ch2_was_enabled = false;
994+ int cali_norm_en_alg_id, cali_norm_en_mem;
995+ int ret;
996+ __be32 val;
997+
998+ if (cs35l56_base->silicon_uid == 0) {
999+ dev_err(cs35l56_base->dev, "Cannot calibrate: no silicon UID\n");
1000+ return -ENXIO;
1001+ }
1002+
9251003 switch (cs35l56_base->type) {
9261004 case 0x54:
9271005 case 0x56:
9281006 case 0x57:
929− ret = cs35l56_read_silicon_uid(cs35l56_base, &silicon_uid);
930− break;
931− case 0x63:
932− ret = cs35l63_read_silicon_uid(cs35l56_base, &silicon_uid);
1007+ if (cs35l56_base->rev < 0xb2) {
1008+ cali_norm_en_alg_id = 0x9f22f;
1009+ cali_norm_en_mem = WMFW_ADSP2_YM;
1010+ } else {
1011+ cali_norm_en_alg_id = 0x9f210;
1012+ cali_norm_en_mem = WMFW_ADSP2_XM;
1013+ }
9331014 break;
9341015 default:
935− ret = -ENODEV;
1016+ cali_norm_en_alg_id = 0xbf210;
1017+ cali_norm_en_mem = WMFW_ADSP2_XM;
9361018 break;
9371019 }
9381020
1021+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
1022+ if (ret)
1023+ return ret;
1024+
1025+ ret = cs35l56_wait_for_ps3(cs35l56_base);
1026+ if (ret) {
1027+ ret = -EBUSY;
1028+ goto err_pm_put;
1029+ }
1030+
1031+ regmap_update_bits_check(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH1_CFG,
1032+ CS35L56_AUX_NGATE_CHn_EN, 0, &ngate_ch1_was_enabled);
1033+ regmap_update_bits_check(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH2_CFG,
1034+ CS35L56_AUX_NGATE_CHn_EN, 0, &ngate_ch2_was_enabled);
1035+
1036+ scoped_guard(mutex, &dsp->pwr_lock) {
1037+ ctl = cs_dsp_get_ctl(dsp,
1038+ calibration_controls->status,
1039+ calibration_controls->mem_region,
1040+ calibration_controls->alg_id);
1041+ if (!ctl) {
1042+ dev_err(cs35l56_base->dev, "Could not get %s control\n",
1043+ calibration_controls->status);
1044+ ret = -EIO;
1045+ goto err;
1046+ }
1047+
1048+ val = cpu_to_be32(0);
1049+ ret = cs_dsp_coeff_write_ctrl(cs_dsp_get_ctl(dsp,
1050+ "CALI_NORM_EN",
1051+ cali_norm_en_mem,
1052+ cali_norm_en_alg_id),
1053+ 0, &val, sizeof(val));
1054+ if (ret < 0) {
1055+ dev_err(cs35l56_base->dev, "Could not write %s: %d\n", "CALI_NORM_EN", ret);
1056+ ret = -EIO;
1057+ goto err;
1058+ }
1059+
1060+ ret = cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_AUDIO_CALIBRATION);
1061+ if (ret) {
1062+ ret = -EIO;
1063+ goto err;
1064+ }
1065+
1066+ if (read_poll_timeout(cs_dsp_coeff_read_ctrl, ret,
1067+ (val == cpu_to_be32(1)),
1068+ CS35L56_CALIBRATION_POLL_US,
1069+ CS35L56_CALIBRATION_TIMEOUT_US,
1070+ true,
1071+ ctl, 0, &val, sizeof(val))) {
1072+ dev_err(cs35l56_base->dev, "Calibration timed out (CAL_STATUS: %u)\n",
1073+ be32_to_cpu(val));
1074+ switch (be32_to_cpu(val)) {
1075+ case CS35L56_CAL_STATUS_OUT_OF_RANGE:
1076+ ret = -ERANGE;
1077+ goto err;
1078+ default:
1079+ ret = -ETIMEDOUT;
1080+ goto err;
1081+ }
1082+ }
1083+ }
1084+
1085+ cs35l56_base->cal_data_valid = false;
1086+ memset(&cal_data, 0, sizeof(cal_data));
1087+ ret = cs_amp_read_cal_coeffs(dsp, calibration_controls, &cal_data);
1088+ if (ret) {
1089+ ret = -EIO;
1090+ goto err;
1091+ }
1092+
1093+ dev_info(cs35l56_base->dev, "Cal status:%d calR:%d ambient:%d\n",
1094+ cal_data.calStatus, cal_data.calR, cal_data.calAmbient);
1095+
1096+ cal_data.calTarget[0] = (u32)cs35l56_base->silicon_uid;
1097+ cal_data.calTarget[1] = (u32)(cs35l56_base->silicon_uid >> 32);
1098+ cs35l56_base->cal_data = cal_data;
1099+ cs35l56_base->cal_data_valid = true;
1100+
1101+ ret = 0;
1102+
1103+err:
1104+ if (ngate_ch1_was_enabled) {
1105+ regmap_set_bits(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH1_CFG,
1106+ CS35L56_AUX_NGATE_CHn_EN);
1107+ }
1108+ if (ngate_ch2_was_enabled) {
1109+ regmap_set_bits(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH2_CFG,
1110+ CS35L56_AUX_NGATE_CHn_EN);
1111+ }
1112+err_pm_put:
1113+ pm_runtime_put(cs35l56_base->dev);
1114+
1115+ return ret;
1116+}
1117+
1118+ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base,
1119+ const char __user *from, size_t count,
1120+ loff_t *ppos)
1121+{
1122+ static const char * const options[] = { "factory", "store_uefi" };
1123+ char buf[11] = { 0 };
1124+ int num_amps, ret;
1125+
1126+ if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
1127+ return -ENXIO;
1128+
1129+ if (*ppos)
1130+ return -EINVAL;
1131+
1132+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, from, count);
9391133 if (ret < 0)
9401134 return ret;
9411135
942− dev_dbg(cs35l56_base->dev, "UniqueID = %#llx\n", silicon_uid);
1136+ switch (sysfs_match_string(options, buf)) {
1137+ case 0:
1138+ ret = cs35l56_perform_calibration(cs35l56_base);
1139+ if (ret < 0)
1140+ return ret;
1141+ break;
1142+ case 1:
1143+ if (!cs35l56_base->cal_data_valid)
1144+ return -ENODATA;
1145+
1146+ num_amps = cs35l56_base->num_amps;
1147+ if (num_amps == 0)
1148+ num_amps = -1;
1149+
1150+ ret = cs_amp_set_efi_calibration_data(cs35l56_base->dev,
1151+ cs35l56_base->cal_index,
1152+ num_amps,
1153+ &cs35l56_base->cal_data);
1154+ if (ret < 0)
1155+ return ret;
1156+ break;
1157+ default:
1158+ return -EOPNOTSUPP;
1159+ }
9431160
944− ret = cs_amp_get_efi_calibration_data(cs35l56_base->dev, silicon_uid,
945− cs35l56_base->cal_index,
946− &cs35l56_base->cal_data);
1161+ return count;
1162+}
1163+EXPORT_SYMBOL_NS_GPL(cs35l56_calibrate_debugfs_write, "SND_SOC_CS35L56_SHARED");
9471164
948− /* Only return an error status if probe should be aborted */
949− if ((ret == -ENOENT) || (ret == -EOVERFLOW))
950− return 0;
1165+ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base,
1166+ const char __user *from, size_t count,
1167+ loff_t *ppos)
1168+{
1169+ unsigned long val;
1170+ int ret;
1171+
1172+ if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
1173+ return -ENXIO;
1174+
1175+ if (*ppos)
1176+ return -EINVAL;
1177+
1178+ ret = pm_runtime_resume_and_get(cs35l56_base->dev);
1179+ if (ret)
1180+ return ret;
1181+
1182+ ret = kstrtoul_from_user(from, count, 10, &val);
1183+ if (ret < 0)
1184+ goto out;
1185+
1186+ ret = cs_amp_write_ambient_temp(cs35l56_base->dsp, cs35l56_base->calibration_controls, val);
1187+ if (ret)
1188+ ret = -EIO;
1189+out:
1190+ pm_runtime_put(cs35l56_base->dev);
9511191
9521192 if (ret < 0)
9531193 return ret;
9541194
955− cs35l56_base->cal_data_valid = true;
1195+ return count;
1196+}
1197+EXPORT_SYMBOL_NS_GPL(cs35l56_cal_ambient_debugfs_write, "SND_SOC_CS35L56_SHARED");
9561198
957− return 0;
1199+ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base,
1200+ char __user *to, size_t count,
1201+ loff_t *ppos)
1202+{
1203+ if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
1204+ return -ENXIO;
1205+
1206+ if (!cs35l56_base->cal_data_valid)
1207+ return 0;
1208+
1209+ return simple_read_from_buffer(to, count, ppos, &cs35l56_base->cal_data,
1210+ sizeof(cs35l56_base->cal_data));
9581211 }
959−EXPORT_SYMBOL_NS_GPL(cs35l56_get_calibration, "SND_SOC_CS35L56_SHARED");
1212+EXPORT_SYMBOL_NS_GPL(cs35l56_cal_data_debugfs_read, "SND_SOC_CS35L56_SHARED");
1213+
1214+ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base,
1215+ const char __user *from, size_t count,
1216+ loff_t *ppos)
1217+{
1218+ struct cirrus_amp_cal_data cal_data;
1219+ int ret;
1220+
1221+ if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
1222+ return -ENXIO;
1223+
1224+ /* Only allow a full blob to be written */
1225+ if (*ppos || (count != sizeof(cal_data)))
1226+ return -EMSGSIZE;
1227+
1228+ ret = simple_write_to_buffer(&cal_data, sizeof(cal_data), ppos, from, count);
1229+ if (ret)
1230+ return ret;
1231+
1232+ ret = cs35l56_stash_calibration(cs35l56_base, &cal_data);
1233+ if (ret)
1234+ return ret;
1235+
1236+ return count;
1237+}
1238+EXPORT_SYMBOL_NS_GPL(cs35l56_cal_data_debugfs_write, "SND_SOC_CS35L56_SHARED");
1239+
1240+void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base,
1241+ const struct cs35l56_cal_debugfs_fops *fops)
1242+{
1243+ if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
1244+ return;
1245+
1246+ cs35l56_base->debugfs = cs_amp_create_debugfs(cs35l56_base->dev);
1247+
1248+ debugfs_create_file("calibrate",
1249+ 0200, cs35l56_base->debugfs, cs35l56_base,
1250+ &fops->calibrate);
1251+ debugfs_create_file("cal_temperature",
1252+ 0200, cs35l56_base->debugfs, cs35l56_base,
1253+ &fops->cal_temperature);
1254+ debugfs_create_file("cal_data",
1255+ 0644, cs35l56_base->debugfs, cs35l56_base,
1256+ &fops->cal_data);
1257+}
1258+EXPORT_SYMBOL_NS_GPL(cs35l56_create_cal_debugfs, "SND_SOC_CS35L56_SHARED");
1259+
1260+void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base)
1261+{
1262+ debugfs_remove_recursive(cs35l56_base->debugfs);
1263+}
1264+EXPORT_SYMBOL_NS_GPL(cs35l56_remove_cal_debugfs, "SND_SOC_CS35L56_SHARED");
1265+
1266+const char * const cs35l56_cal_set_status_text[] = {
1267+ "Unknown", "Default", "Set",
1268+};
1269+EXPORT_SYMBOL_NS_GPL(cs35l56_cal_set_status_text, "SND_SOC_CS35L56_SHARED");
1270+
1271+int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base,
1272+ struct snd_ctl_elem_value *uvalue)
1273+{
1274+ struct cs_dsp *dsp = cs35l56_base->dsp;
1275+ __be32 cal_set_status_be;
1276+ int alg_id;
1277+ int ret;
1278+
1279+ switch (cs35l56_base->type) {
1280+ case 0x54:
1281+ case 0x56:
1282+ case 0x57:
1283+ alg_id = 0x9f210;
1284+ break;
1285+ default:
1286+ alg_id = 0xbf210;
1287+ break;
1288+ }
1289+
1290+ scoped_guard(mutex, &dsp->pwr_lock) {
1291+ ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(dsp,
1292+ "CAL_SET_STATUS",
1293+ WMFW_ADSP2_YM, alg_id),
1294+ 0, &cal_set_status_be,
1295+ sizeof(cal_set_status_be));
1296+ }
1297+ if (ret) {
1298+ uvalue->value.enumerated.item[0] = CS35L56_CAL_SET_STATUS_UNKNOWN;
1299+ return 0;
1300+ }
1301+
1302+ switch (be32_to_cpu(cal_set_status_be)) {
1303+ case CS35L56_CAL_SET_STATUS_DEFAULT:
1304+ case CS35L56_CAL_SET_STATUS_SET:
1305+ uvalue->value.enumerated.item[0] = be32_to_cpu(cal_set_status_be);
1306+ return 0;
1307+ default:
1308+ uvalue->value.enumerated.item[0] = CS35L56_CAL_SET_STATUS_UNKNOWN;
1309+ return 0;
1310+ }
1311+}
1312+EXPORT_SYMBOL_NS_GPL(cs35l56_cal_set_status_get, "SND_SOC_CS35L56_SHARED");
9601313
9611314 int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
9621315 bool *fw_missing, unsigned int *fw_version)
@@ -984,6 +1337,23 @@ int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, · 21 unmodified lines
9841337 }
9851338 EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED");
9861339
1340+void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base)
1341+{
1342+ unsigned int firmware_version;
1343+ bool firmware_missing;
1344+ int ret;
1345+
1346+ ret = cs35l56_read_prot_status(cs35l56_base, &firmware_missing, &firmware_version);
1347+ if (ret)
1348+ return;
1349+
1350+ if (!firmware_missing)
1351+ return;
1352+
1353+ dev_warn(cs35l56_base->dev, "FIRMWARE_MISSING\n");
1354+}
1355+EXPORT_SYMBOL_NS_GPL(cs35l56_warn_if_firmware_missing, "SND_SOC_CS35L56_SHARED");
1356+
9871357 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp)
9881358 {
9891359 __be32 pid, sid, tid;
@@ -1111,6 +1481,21 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) · 121 unmodified lines
11111481 CS35L56_TEMP_ERR_EINT1_MASK,
11121482 0);
11131483
1484+ switch (cs35l56_base->type) {
1485+ case 0x54:
1486+ case 0x56:
1487+ case 0x57:
1488+ ret = cs35l56_read_silicon_uid(cs35l56_base);
1489+ break;
1490+ default:
1491+ ret = cs35l63_read_silicon_uid(cs35l56_base);
1492+ break;
1493+ }
1494+ if (ret)
1495+ return ret;
1496+
1497+ dev_dbg(cs35l56_base->dev, "SiliconID = %#llx\n", cs35l56_base->silicon_uid);
1498+
11141499 return 0;
11151500 }
11161501 EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, "SND_SOC_CS35L56_SHARED");
sound/soc/codecs/cs35l56.c+251−1
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/completion.h>
1111 #include <linux/debugfs.h>
1212 #include <linux/delay.h>
13+#include <linux/device.h>
1314 #include <linux/err.h>
1415 #include <linux/gpio/consumer.h>
1516 #include <linux/interrupt.h>
@@ -65,6 +66,18 @@ static int cs35l56_dspwait_put_volsw(struct snd_kcontrol *kcontrol, · 49 unmodified lines
6566
6667 static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0);
6768
69+static SOC_ENUM_SINGLE_DECL(cs35l56_cal_set_status_enum, SND_SOC_NOPM, 0,
70+ cs35l56_cal_set_status_text);
71+
72+static int cs35l56_cal_set_status_ctl_get(struct snd_kcontrol *kcontrol,
73+ struct snd_ctl_elem_value *ucontrol)
74+{
75+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
76+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
77+
78+ return cs35l56_cal_set_status_get(&cs35l56->base, ucontrol);
79+}
80+
6881 static const struct snd_kcontrol_new cs35l56_controls[] = {
6982 SOC_SINGLE_EXT("Speaker Switch",
7083 CS35L56_MAIN_RENDER_USER_MUTE, 0, 1, 1,
@@ -82,6 +95,9 @@ static const struct snd_kcontrol_new cs35l56_controls[] = { · 11 unmodified lines
8295 SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER,
8396 0, 255, 0,
8497 cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
98+ SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
99+ cs35l56_cal_set_status_ctl_get, NULL,
100+ SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
85101 };
86102
87103 static const struct snd_kcontrol_new cs35l63_controls[] = {
@@ -101,6 +117,9 @@ static const struct snd_kcontrol_new cs35l63_controls[] = { · 13 unmodified lines
101117 SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER,
102118 0, 255, 0,
103119 cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
120+ SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
121+ cs35l56_cal_set_status_ctl_get, NULL,
122+ SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
104123 };
105124
106125 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum,
@@ -250,6 +269,8 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = { · 143 unmodified lines
250269 SND_SOC_DAPM_SIGGEN("VDDBMON ADC"),
251270 SND_SOC_DAPM_SIGGEN("VBSTMON ADC"),
252271 SND_SOC_DAPM_SIGGEN("TEMPMON ADC"),
272+
273+ SND_SOC_DAPM_INPUT("Calibrate"),
253274 };
254275
255276 #define CS35L56_SRC_ROUTE(name) \
@@ -286,6 +307,7 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = { · 30 unmodified lines
286307 { "DSP1", NULL, "ASP1RX1" },
287308 { "DSP1", NULL, "ASP1RX2" },
288309 { "DSP1", NULL, "SDW1 Playback" },
310+ { "DSP1", NULL, "Calibrate" },
289311 { "AMP", NULL, "DSP1" },
290312 { "SPK", NULL, "AMP" },
291313
@@ -801,6 +823,9 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing · 509 unmodified lines
801823 goto err_unlock;
802824 }
803825
826+ /* Check if the firmware is still reported missing */
827+ cs35l56_warn_if_firmware_missing(&cs35l56->base);
828+
804829 regmap_clear_bits(cs35l56->base.regmap,
805830 cs35l56->base.fw_reg->prot_sts,
806831 CS35L56_FIRMWARE_MISSING);
@@ -874,6 +899,214 @@ err: · 67 unmodified lines
874899 pm_runtime_put_autosuspend(cs35l56->base.dev);
875900 }
876901
902+static struct snd_soc_dapm_context *cs35l56_power_up_for_cal(struct cs35l56_private *cs35l56)
903+{
904+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(cs35l56->component);
905+ int ret;
906+
907+ ret = snd_soc_dapm_enable_pin(dapm, "Calibrate");
908+ if (ret)
909+ return ERR_PTR(ret);
910+
911+ snd_soc_dapm_sync(dapm);
912+
913+ return dapm;
914+}
915+
916+static void cs35l56_power_down_after_cal(struct cs35l56_private *cs35l56)
917+{
918+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(cs35l56->component);
919+
920+ snd_soc_dapm_disable_pin(dapm, "Calibrate");
921+ snd_soc_dapm_sync(dapm);
922+}
923+
924+static ssize_t cs35l56_debugfs_calibrate_write(struct file *file,
925+ const char __user *from,
926+ size_t count, loff_t *ppos)
927+{
928+ struct cs35l56_base *cs35l56_base = file->private_data;
929+ struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base);
930+ struct snd_soc_dapm_context *dapm;
931+ ssize_t ret;
932+
933+ dapm = cs35l56_power_up_for_cal(cs35l56);
934+ if (IS_ERR(dapm))
935+ return PTR_ERR(dapm);
936+
937+ snd_soc_dapm_mutex_lock(dapm);
938+ ret = cs35l56_calibrate_debugfs_write(&cs35l56->base, from, count, ppos);
939+ snd_soc_dapm_mutex_unlock(dapm);
940+
941+ cs35l56_power_down_after_cal(cs35l56);
942+
943+ return ret;
944+}
945+
946+static ssize_t cs35l56_debugfs_cal_temperature_write(struct file *file,
947+ const char __user *from,
948+ size_t count, loff_t *ppos)
949+{
950+ struct cs35l56_base *cs35l56_base = file->private_data;
951+ struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base);
952+ struct snd_soc_dapm_context *dapm;
953+ ssize_t ret;
954+
955+ dapm = cs35l56_power_up_for_cal(cs35l56);
956+ if (IS_ERR(dapm))
957+ return PTR_ERR(dapm);
958+
959+ ret = cs35l56_cal_ambient_debugfs_write(&cs35l56->base, from, count, ppos);
960+ cs35l56_power_down_after_cal(cs35l56);
961+
962+ return ret;
963+}
964+
965+static ssize_t cs35l56_debugfs_cal_data_read(struct file *file,
966+ char __user *to,
967+ size_t count, loff_t *ppos)
968+{
969+ struct cs35l56_base *cs35l56_base = file->private_data;
970+ struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base);
971+ struct snd_soc_dapm_context *dapm;
972+ ssize_t ret;
973+
974+ dapm = cs35l56_power_up_for_cal(cs35l56);
975+ if (IS_ERR(dapm))
976+ return PTR_ERR(dapm);
977+
978+ ret = cs35l56_cal_data_debugfs_read(&cs35l56->base, to, count, ppos);
979+ cs35l56_power_down_after_cal(cs35l56);
980+
981+ return ret;
982+}
983+
984+static int cs35l56_new_cal_data_apply(struct cs35l56_private *cs35l56)
985+{
986+ struct snd_soc_dapm_context *dapm;
987+ int ret;
988+
989+ if (!cs35l56->base.cal_data_valid)
990+ return -ENXIO;
991+
992+ if (cs35l56->base.secured)
993+ return -EACCES;
994+
995+ dapm = cs35l56_power_up_for_cal(cs35l56);
996+ if (IS_ERR(dapm))
997+ return PTR_ERR(dapm);
998+
999+ snd_soc_dapm_mutex_lock(dapm);
1000+ ret = cs_amp_write_cal_coeffs(&cs35l56->dsp.cs_dsp,
1001+ cs35l56->base.calibration_controls,
1002+ &cs35l56->base.cal_data);
1003+ if (ret == 0)
1004+ cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT);
1005+ else
1006+ ret = -EIO;
1007+
1008+ snd_soc_dapm_mutex_unlock(dapm);
1009+ cs35l56_power_down_after_cal(cs35l56);
1010+
1011+ return ret;
1012+}
1013+
1014+static ssize_t cs35l56_debugfs_cal_data_write(struct file *file,
1015+ const char __user *from,
1016+ size_t count, loff_t *ppos)
1017+{
1018+ struct cs35l56_base *cs35l56_base = file->private_data;
1019+ struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base);
1020+ int ret;
1021+
1022+ ret = cs35l56_cal_data_debugfs_write(&cs35l56->base, from, count, ppos);
1023+ if (ret == -ENODATA)
1024+ return count; /* Ignore writes of empty cal blobs */
1025+ else if (ret < 0)
1026+ return -EIO;
1027+
1028+ ret = cs35l56_new_cal_data_apply(cs35l56);
1029+ if (ret)
1030+ return ret;
1031+
1032+ return count;
1033+}
1034+
1035+static const struct cs35l56_cal_debugfs_fops cs35l56_cal_debugfs_fops = {
1036+ .calibrate = {
1037+ .write = cs35l56_debugfs_calibrate_write,
1038+ },
1039+ .cal_temperature = {
1040+ .write = cs35l56_debugfs_cal_temperature_write,
1041+ },
1042+ .cal_data = {
1043+ .read = cs35l56_debugfs_cal_data_read,
1044+ .write = cs35l56_debugfs_cal_data_write,
1045+ },
1046+};
1047+
1048+static int cs35l56_cal_data_rb_ctl_get(struct snd_kcontrol *kcontrol,
1049+ struct snd_ctl_elem_value *ucontrol)
1050+{
1051+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1052+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
1053+
1054+ if (!cs35l56->base.cal_data_valid)
1055+ return -ENODATA;
1056+
1057+ memcpy(ucontrol->value.bytes.data, &cs35l56->base.cal_data,
1058+ sizeof(cs35l56->base.cal_data));
1059+
1060+ return 0;
1061+}
1062+
1063+static int cs35l56_cal_data_ctl_get(struct snd_kcontrol *kcontrol,
1064+ struct snd_ctl_elem_value *ucontrol)
1065+{
1066+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1067+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
1068+
1069+ /*
1070+ * This control is write-only but mixer libraries often try to read
1071+ * a control before writing it. So we have to implement read.
1072+ * Return zeros so a write of valid data will always be a change
1073+ * from its "current value".
1074+ */
1075+ memset(ucontrol->value.bytes.data, 0, sizeof(cs35l56->base.cal_data));
1076+
1077+ return 0;
1078+}
1079+
1080+static int cs35l56_cal_data_ctl_set(struct snd_kcontrol *kcontrol,
1081+ struct snd_ctl_elem_value *ucontrol)
1082+{
1083+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1084+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
1085+ const struct cirrus_amp_cal_data *cal_data = (const void *)ucontrol->value.bytes.data;
1086+ int ret;
1087+
1088+ if (cs35l56->base.cal_data_valid)
1089+ return -EACCES;
1090+
1091+ ret = cs35l56_stash_calibration(&cs35l56->base, cal_data);
1092+ if (ret)
1093+ return ret;
1094+
1095+ ret = cs35l56_new_cal_data_apply(cs35l56);
1096+ if (ret < 0)
1097+ return ret;
1098+
1099+ return 1;
1100+}
1101+
1102+static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = {
1103+ SND_SOC_BYTES_E("CAL_DATA", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32),
1104+ cs35l56_cal_data_ctl_get, cs35l56_cal_data_ctl_set),
1105+ SND_SOC_BYTES_E_ACC("CAL_DATA_RB", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32),
1106+ cs35l56_cal_data_rb_ctl_get, NULL,
1107+ SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
1108+};
1109+
8771110 static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56)
8781111 {
8791112 if (cs35l56->dsp.fwf_suffix)
@@ -904,6 +1137,7 @@ static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) · 24 unmodified lines
9041137
9051138 static int cs35l56_component_probe(struct snd_soc_component *component)
9061139 {
1140+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
9071141 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
9081142 struct dentry *debugfs_root = component->debugfs_root;
9091143 unsigned short vendor, device;
@@ -968,9 +1202,22 @@ static int cs35l56_component_probe(struct snd_soc_component *component) · 58 unmodified lines
9681202 break;
9691203 }
9701204
1205+ if (!ret && IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_SET_CTRL)) {
1206+ ret = snd_soc_add_component_controls(component,
1207+ cs35l56_cal_data_restore_controls,
1208+ ARRAY_SIZE(cs35l56_cal_data_restore_controls));
1209+ }
1210+
9711211 if (ret)
9721212 return dev_err_probe(cs35l56->base.dev, ret, "unable to add controls\n");
9731213
1214+ ret = snd_soc_dapm_disable_pin(dapm, "Calibrate");
1215+ if (ret)
1216+ return ret;
1217+
1218+ if (IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS))
1219+ cs35l56_create_cal_debugfs(&cs35l56->base, &cs35l56_cal_debugfs_fops);
1220+
9741221 queue_work(cs35l56->dsp_wq, &cs35l56->dsp_work);
9751222
9761223 return 0;
@@ -982,6 +1229,8 @@ static void cs35l56_component_remove(struct snd_soc_component *component) · 5 unmodified lines
9821229
9831230 cancel_work_sync(&cs35l56->dsp_work);
9841231
1232+ cs35l56_remove_cal_debugfs(&cs35l56->base);
1233+
9851234 if (cs35l56->dsp.cs_dsp.booted)
9861235 wm_adsp_power_down(&cs35l56->dsp);
9871236
@@ -1000,6 +1249,7 @@ static int cs35l56_set_bias_level(struct snd_soc_component *component, · 12 unmodified lines
10001249 enum snd_soc_bias_level level)
10011250 {
10021251 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
1252+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10031253
10041254 switch (level) {
10051255 case SND_SOC_BIAS_STANDBY:
@@ -1007,7 +1257,7 @@ static int cs35l56_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
10071257 * Wait for patching to complete when transitioning from
10081258 * BIAS_OFF to BIAS_STANDBY
10091259 */
1010− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
1260+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
10111261 cs35l56_wait_dsp_ready(cs35l56);
10121262
10131263 break;
sound/soc/codecs/cs35l56.h+6−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #define CS35L56_H
1111
1212 #include <linux/completion.h>
13+#include <linux/container_of.h>
1314 #include <linux/regulator/consumer.h>
1415 #include <linux/pm_runtime.h>
1516 #include <linux/workqueue.h>
@@ -54,6 +55,11 @@ struct cs35l56_private { · 38 unmodified lines
5455 u8 sdw_unique_id;
5556 };
5657
58+static inline struct cs35l56_private *cs35l56_private_from_base(struct cs35l56_base *cs35l56_base)
59+{
60+ return container_of(cs35l56_base, struct cs35l56_private, base);
61+}
62+
5763 extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi;
5864
5965 int cs35l56_system_suspend(struct device *dev);
sound/soc/codecs/cs4234.c+4−3
@@ -85,9 +85,9 @@ static SOC_ENUM_SINGLE_DECL(cs4234_max_delay, CS4234_VOLUME_MODE, · 84 unmodified lines
8585 static int cs4234_dac14_grp_delay_put(struct snd_kcontrol *kctrl,
8686 struct snd_ctl_elem_value *uctrl)
8787 {
88− struct snd_soc_component *component = snd_soc_kcontrol_component(kctrl);
88+ struct snd_soc_component *component = snd_kcontrol_chip(kctrl);
8989 struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component);
90− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
90+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
9191 unsigned int val = 0;
9292 int ret = 0;
9393
@@ -126,10 +126,11 @@ static int cs4234_set_bias_level(struct snd_soc_component *component, · 32 unmodified lines
126126 enum snd_soc_bias_level level)
127127 {
128128 struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component);
129+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
129130
130131 switch (level) {
131132 case SND_SOC_BIAS_PREPARE:
132− switch (snd_soc_component_get_bias_level(component)) {
133+ switch (snd_soc_dapm_get_bias_level(dapm)) {
133134 case SND_SOC_BIAS_STANDBY:
134135 wait_for_completion(&cs4234->vq_ramp_complete);
135136 break;
sound/soc/codecs/cs4270.c+1−1
@@ -433,7 +433,7 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute, int direction) · 432 unmodified lines
433433 static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
434434 struct snd_ctl_elem_value *ucontrol)
435435 {
436− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
436+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
437437 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
438438 int left = !ucontrol->value.integer.value[0];
439439 int right = !ucontrol->value.integer.value[1];
sound/soc/codecs/cs4271.c+30−6
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 * DAPM support not implemented.
1111 */
1212
13+#include <linux/clk.h>
1314 #include <linux/module.h>
1415 #include <linux/slab.h>
1516 #include <linux/delay.h>
@@ -163,6 +164,7 @@ struct cs4271_private { · 147 unmodified lines
163164 /* enable soft reset workaround */
164165 bool enable_soft_reset;
165166 struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
167+ struct clk *clk;
166168 };
167169
168170 static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = {
@@ -276,7 +278,7 @@ static int cs4271_set_deemph(struct snd_soc_component *component) · 107 unmodified lines
276278 static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
277279 struct snd_ctl_elem_value *ucontrol)
278280 {
279− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
281+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
280282 struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
281283
282284 ucontrol->value.integer.value[0] = cs4271->deemph;
@@ -286,7 +288,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, · 3 unmodified lines
286288 static int cs4271_put_deemph(struct snd_kcontrol *kcontrol,
287289 struct snd_ctl_elem_value *ucontrol)
288290 {
289− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
291+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
290292 struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
291293
292294 cs4271->deemph = ucontrol->value.integer.value[0];
@@ -505,6 +507,7 @@ static int cs4271_soc_suspend(struct snd_soc_component *component) · 212 unmodified lines
505507 return ret;
506508
507509 regcache_mark_dirty(cs4271->regmap);
510+ clk_disable_unprepare(cs4271->clk);
508511 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies);
509512
510513 return 0;
@@ -522,6 +525,12 @@ static int cs4271_soc_resume(struct snd_soc_component *component) · 11 unmodified lines
522525 return ret;
523526 }
524527
528+ ret = clk_prepare_enable(cs4271->clk);
529+ if (ret) {
530+ dev_err(component->dev, "Failed to enable clk: %d\n", ret);
531+ return ret;
532+ }
533+
525534 /* Do a proper reset after power up */
526535 cs4271_reset(component);
527536
@@ -576,22 +585,30 @@ static int cs4271_component_probe(struct snd_soc_component *component) · 48 unmodified lines
576585 cs4271->enable_soft_reset = cs4271plat->enable_soft_reset;
577586 }
578587
588+ ret = clk_prepare_enable(cs4271->clk);
589+ if (ret) {
590+ dev_err(component->dev, "Failed to enable clk: %d\n", ret);
591+ goto err_disable_regulators;
592+ }
593+
579594 /* Reset codec */
580595 cs4271_reset(component);
581596
582597 ret = regcache_sync(cs4271->regmap);
583598 if (ret < 0)
584− goto err_disable_regulator;
599+ goto err_disable_clk;
585600
586601 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
587602 CS4271_MODE2_PDN | CS4271_MODE2_CPEN,
588603 CS4271_MODE2_PDN | CS4271_MODE2_CPEN);
589604 if (ret < 0)
590− goto err_disable_regulator;
605+ goto err_disable_clk;
606+
591607 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
592608 CS4271_MODE2_PDN, 0);
593609 if (ret < 0)
594− goto err_disable_regulator;
610+ goto err_disable_clk;
611+
595612 /* Power-up sequence requires 85 uS */
596613 udelay(85);
597614
@@ -602,7 +619,9 @@ static int cs4271_component_probe(struct snd_soc_component *component) · 4 unmodified lines
602619
603620 return 0;
604621
605−err_disable_regulator:
622+err_disable_clk:
623+ clk_disable_unprepare(cs4271->clk);
624+err_disable_regulators:
606625 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies);
607626 return ret;
608627 }
@@ -616,6 +635,7 @@ static void cs4271_component_remove(struct snd_soc_component *component) · 7 unmodified lines
616635
617636 regcache_mark_dirty(cs4271->regmap);
618637 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies);
638+ clk_disable_unprepare(cs4271->clk);
619639 };
620640
621641 static const struct snd_soc_component_driver soc_component_dev_cs4271 = {
@@ -650,6 +670,10 @@ static int cs4271_common_probe(struct device *dev, · 28 unmodified lines
650670 "error retrieving RESET GPIO\n");
651671 gpiod_set_consumer_name(cs4271->reset, "CS4271 Reset");
652672
673+ cs4271->clk = devm_clk_get_optional(dev, "mclk");
674+ if (IS_ERR(cs4271->clk))
675+ return dev_err_probe(dev, PTR_ERR(cs4271->clk), "Failed to get mclk\n");
676+
653677 for (i = 0; i < ARRAY_SIZE(supply_names); i++)
654678 cs4271->supplies[i].supply = supply_names[i];
655679
sound/soc/codecs/cs42l42.c+1−1
@@ -403,7 +403,7 @@ static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); · 402 unmodified lines
403403 static int cs42l42_slow_start_put(struct snd_kcontrol *kcontrol,
404404 struct snd_ctl_elem_value *ucontrol)
405405 {
406− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
406+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
407407 u8 val;
408408
409409 /* all bits of SLOW_START_EN must change together */
sound/soc/codecs/cs42l43-jack.c+7−7
@@ -300,7 +300,7 @@ irqreturn_t cs42l43_bias_detect_clamp(int irq, void *data) · 299 unmodified lines
300300 {
301301 struct cs42l43_codec *priv = data;
302302
303− queue_delayed_work(system_wq, &priv->bias_sense_timeout,
303+ queue_delayed_work(system_dfl_wq, &priv->bias_sense_timeout,
304304 msecs_to_jiffies(1000));
305305
306306 return IRQ_HANDLED;
@@ -502,7 +502,7 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv) · 195 unmodified lines
502502
503503 dev_dbg(priv->dev, "Start load detect\n");
504504
505− snd_soc_dapm_mutex_lock(snd_soc_component_get_dapm(priv->component));
505+ snd_soc_dapm_mutex_lock(snd_soc_component_to_dapm(priv->component));
506506
507507 priv->load_detect_running = true;
508508
@@ -539,7 +539,7 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv) · 30 unmodified lines
539539 CS42L43_HPLOAD_DET_EN_MASK,
540540 CS42L43_HPLOAD_DET_EN_MASK);
541541
542− snd_soc_dapm_mutex_unlock(snd_soc_component_get_dapm(priv->component));
542+ snd_soc_dapm_mutex_unlock(snd_soc_component_to_dapm(priv->component));
543543 }
544544
545545 static void cs42l43_stop_load_detect(struct cs42l43_codec *priv)
@@ -548,7 +548,7 @@ static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) · 2 unmodified lines
548548
549549 dev_dbg(priv->dev, "Stop load detect\n");
550550
551− snd_soc_dapm_mutex_lock(snd_soc_component_get_dapm(priv->component));
551+ snd_soc_dapm_mutex_lock(snd_soc_component_to_dapm(priv->component));
552552
553553 regmap_update_bits(cs42l43->regmap, CS42L43_LOADDETENA,
554554 CS42L43_HPLOAD_DET_EN_MASK, 0);
@@ -587,7 +587,7 @@ static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) · 32 unmodified lines
587587
588588 priv->load_detect_running = false;
589589
590− snd_soc_dapm_mutex_unlock(snd_soc_component_get_dapm(priv->component));
590+ snd_soc_dapm_mutex_unlock(snd_soc_component_to_dapm(priv->component));
591591 }
592592
593593 static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic)
@@ -866,7 +866,7 @@ SOC_ENUM_SINGLE_VIRT_DECL(cs42l43_jack_enum, cs42l43_jack_text); · 272 unmodified lines
866866
867867 int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
868868 {
869− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
869+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
870870 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
871871
872872 mutex_lock(&priv->jack_lock);
@@ -878,7 +878,7 @@ int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u · 5 unmodified lines
878878
879879 int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
880880 {
881− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
881+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
882882 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
883883 struct cs42l43 *cs42l43 = priv->core;
884884 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
sound/soc/codecs/cs42l43.c+19−19
@@ -154,14 +154,14 @@ static void cs42l43_hp_ilimit_clear_work(struct work_struct *work) · 153 unmodified lines
154154 {
155155 struct cs42l43_codec *priv = container_of(work, struct cs42l43_codec,
156156 hp_ilimit_clear_work.work);
157− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(priv->component);
157+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(priv->component);
158158
159159 snd_soc_dapm_mutex_lock(dapm);
160160
161161 priv->hp_ilimit_count--;
162162
163163 if (priv->hp_ilimit_count)
164− queue_delayed_work(system_wq, &priv->hp_ilimit_clear_work,
164+ queue_delayed_work(system_dfl_wq, &priv->hp_ilimit_clear_work,
165165 msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS));
166166
167167 snd_soc_dapm_mutex_unlock(dapm);
@@ -170,7 +170,7 @@ static void cs42l43_hp_ilimit_clear_work(struct work_struct *work) · 2 unmodified lines
170170 static irqreturn_t cs42l43_hp_ilimit(int irq, void *data)
171171 {
172172 struct cs42l43_codec *priv = data;
173− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(priv->component);
173+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(priv->component);
174174 struct cs42l43 *cs42l43 = priv->core;
175175
176176 dev_dbg(priv->dev, "headphone ilimit IRQ\n");
@@ -179,7 +179,7 @@ static irqreturn_t cs42l43_hp_ilimit(int irq, void *data) · 2 unmodified lines
179179
180180 if (priv->hp_ilimit_count < CS42L43_HP_ILIMIT_MAX_COUNT) {
181181 if (!priv->hp_ilimit_count)
182− queue_delayed_work(system_wq, &priv->hp_ilimit_clear_work,
182+ queue_delayed_work(system_dfl_wq, &priv->hp_ilimit_clear_work,
183183 msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS));
184184
185185 priv->hp_ilimit_count++;
@@ -451,7 +451,7 @@ static int cs42l43_asp_hw_params(struct snd_pcm_substream *substream, · 265 unmodified lines
451451 static int cs42l43_asp_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
452452 {
453453 struct snd_soc_component *component = dai->component;
454− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
454+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
455455 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
456456 struct cs42l43 *cs42l43 = priv->core;
457457 int provider = regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2,
@@ -949,8 +949,8 @@ CS42L43_DECL_MIXER(amp4, CS42L43_AMP4MIX_INPUT1); · 491 unmodified lines
949949 static int cs42l43_dapm_get_volsw(struct snd_kcontrol *kcontrol,
950950 struct snd_ctl_elem_value *ucontrol)
951951 {
952− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
953− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
952+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
953+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
954954 int ret;
955955
956956 snd_soc_dapm_mutex_lock(dapm);
@@ -963,8 +963,8 @@ static int cs42l43_dapm_get_volsw(struct snd_kcontrol *kcontrol, · 6 unmodified lines
963963 static int cs42l43_dapm_put_volsw(struct snd_kcontrol *kcontrol,
964964 struct snd_ctl_elem_value *ucontrol)
965965 {
966− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
967− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
966+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
967+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
968968 int ret;
969969
970970 snd_soc_dapm_mutex_lock(dapm);
@@ -977,8 +977,8 @@ static int cs42l43_dapm_put_volsw(struct snd_kcontrol *kcontrol, · 6 unmodified lines
977977 static int cs42l43_dapm_get_enum(struct snd_kcontrol *kcontrol,
978978 struct snd_ctl_elem_value *ucontrol)
979979 {
980− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
981− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
980+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
981+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
982982 int ret;
983983
984984 snd_soc_dapm_mutex_lock(dapm);
@@ -991,8 +991,8 @@ static int cs42l43_dapm_get_enum(struct snd_kcontrol *kcontrol, · 6 unmodified lines
991991 static int cs42l43_dapm_put_enum(struct snd_kcontrol *kcontrol,
992992 struct snd_ctl_elem_value *ucontrol)
993993 {
994− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
995− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
994+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
995+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
996996 int ret;
997997
998998 snd_soc_dapm_mutex_lock(dapm);
@@ -1005,7 +1005,7 @@ static int cs42l43_dapm_put_enum(struct snd_kcontrol *kcontrol, · 6 unmodified lines
10051005 static int cs42l43_eq_get(struct snd_kcontrol *kcontrol,
10061006 struct snd_ctl_elem_value *ucontrol)
10071007 {
1008− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1008+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10091009 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
10101010
10111011 memcpy(ucontrol->value.integer.value, priv->eq_coeffs, sizeof(priv->eq_coeffs));
@@ -1016,8 +1016,8 @@ static int cs42l43_eq_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
10161016 static int cs42l43_eq_put(struct snd_kcontrol *kcontrol,
10171017 struct snd_ctl_elem_value *ucontrol)
10181018 {
1019− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1020− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1019+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1020+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10211021 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
10221022
10231023 snd_soc_dapm_mutex_lock(dapm);
@@ -1088,7 +1088,7 @@ error: · 64 unmodified lines
10881088 static int cs42l43_decim_get(struct snd_kcontrol *kcontrol,
10891089 struct snd_ctl_elem_value *ucontrol)
10901090 {
1091− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1091+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10921092 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
10931093 int ret;
10941094
@@ -1104,7 +1104,7 @@ static int cs42l43_decim_get(struct snd_kcontrol *kcontrol, · 9 unmodified lines
11041104 static int cs42l43_spk_get(struct snd_kcontrol *kcontrol,
11051105 struct snd_ctl_elem_value *ucontrol)
11061106 {
1107− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1107+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11081108 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
11091109 int ret;
11101110
@@ -1120,7 +1120,7 @@ static int cs42l43_spk_get(struct snd_kcontrol *kcontrol, · 9 unmodified lines
11201120 static int cs42l43_spk_put(struct snd_kcontrol *kcontrol,
11211121 struct snd_ctl_elem_value *ucontrol)
11221122 {
1123− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1123+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11241124 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
11251125 int ret;
11261126
sound/soc/codecs/cs42l51.c+3−3
@@ -57,7 +57,7 @@ struct cs42l51_private { · 56 unmodified lines
5757 static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
5858 struct snd_ctl_elem_value *ucontrol)
5959 {
60− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
60+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
6161 unsigned long value = snd_soc_component_read(component, CS42L51_PCM_MIXER)&3;
6262
6363 switch (value) {
@@ -85,7 +85,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, · 21 unmodified lines
8585 static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
8686 struct snd_ctl_elem_value *ucontrol)
8787 {
88− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
88+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
8989 unsigned char val;
9090
9191 switch (ucontrol->value.enumerated.item[0]) {
@@ -567,7 +567,7 @@ static int cs42l51_component_probe(struct snd_soc_component *component) · 475 unmodified lines
567567 struct cs42l51_private *cs42l51;
568568
569569 cs42l51 = snd_soc_component_get_drvdata(component);
570− dapm = snd_soc_component_get_dapm(component);
570+ dapm = snd_soc_component_to_dapm(component);
571571
572572 if (cs42l51->mclk_handle)
573573 snd_soc_dapm_new_controls(dapm, cs42l51_dapm_mclk_widgets, 1);
sound/soc/codecs/cs42l52.c+3−2
@@ -851,6 +851,7 @@ static int cs42l52_set_bias_level(struct snd_soc_component *component, · 850 unmodified lines
851851 enum snd_soc_bias_level level)
852852 {
853853 struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
854+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
854855
855856 switch (level) {
856857 case SND_SOC_BIAS_ON:
@@ -860,7 +861,7 @@ static int cs42l52_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
860861 CS42L52_PWRCTL1_PDN_CODEC, 0);
861862 break;
862863 case SND_SOC_BIAS_STANDBY:
863− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
864+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
864865 regcache_cache_only(cs42l52->regmap, false);
865866 regcache_sync(cs42l52->regmap);
866867 }
@@ -919,7 +920,7 @@ static void cs42l52_beep_work(struct work_struct *work) · 52 unmodified lines
919920 struct cs42l52_private *cs42l52 =
920921 container_of(work, struct cs42l52_private, beep_work);
921922 struct snd_soc_component *component = cs42l52->component;
922− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
923+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
923924 int i;
924925 int val = 0;
925926 int best = 0;
sound/soc/codecs/cs42l56.c+3−2
@@ -911,6 +911,7 @@ static int cs42l56_set_bias_level(struct snd_soc_component *component, · 910 unmodified lines
911911 enum snd_soc_bias_level level)
912912 {
913913 struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
914+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
914915 int ret;
915916
916917 switch (level) {
@@ -923,7 +924,7 @@ static int cs42l56_set_bias_level(struct snd_soc_component *component, · 6 unmodified lines
923924 CS42L56_PDN_ALL_MASK, 0);
924925 break;
925926 case SND_SOC_BIAS_STANDBY:
926− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
927+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
927928 regcache_cache_only(cs42l56->regmap, false);
928929 regcache_sync(cs42l56->regmap);
929930 ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies),
@@ -996,7 +997,7 @@ static void cs42l56_beep_work(struct work_struct *work) · 66 unmodified lines
996997 struct cs42l56_private *cs42l56 =
997998 container_of(work, struct cs42l56_private, beep_work);
998999 struct snd_soc_component *component = cs42l56->component;
999− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1000+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10001001 int i;
10011002 int val = 0;
10021003 int best = 0;
sound/soc/codecs/cs42l73.c+2−1
@@ -1101,6 +1101,7 @@ static int cs42l73_set_bias_level(struct snd_soc_component *component, · 1100 unmodified lines
11011101 enum snd_soc_bias_level level)
11021102 {
11031103 struct cs42l73_private *cs42l73 = snd_soc_component_get_drvdata(component);
1104+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11041105
11051106 switch (level) {
11061107 case SND_SOC_BIAS_ON:
@@ -1112,7 +1113,7 @@ static int cs42l73_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines
11121113 break;
11131114
11141115 case SND_SOC_BIAS_STANDBY:
1115− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1116+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
11161117 regcache_cache_only(cs42l73->regmap, false);
11171118 regcache_sync(cs42l73->regmap);
11181119 }
sound/soc/codecs/cs42l84.c+2−2
@@ -84,7 +84,7 @@ static const struct regmap_config cs42l84_regmap = { · 83 unmodified lines
8484 static int cs42l84_put_dac_vol(struct snd_kcontrol *kctl,
8585 struct snd_ctl_elem_value *val)
8686 {
87− struct snd_soc_component *component = snd_soc_kcontrol_component(kctl);
87+ struct snd_soc_component *component = snd_kcontrol_chip(kctl);
8888 struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value;
8989 int vola, volb;
9090 int ret, ret2, updated = 0;
@@ -138,7 +138,7 @@ bail: · 47 unmodified lines
138138 static int cs42l84_get_dac_vol(struct snd_kcontrol *kctl,
139139 struct snd_ctl_elem_value *val)
140140 {
141− struct snd_soc_component *component = snd_soc_kcontrol_component(kctl);
141+ struct snd_soc_component *component = snd_kcontrol_chip(kctl);
142142 struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value;
143143 int vola, volb;
144144 int ret;
sound/soc/codecs/cs42xx8.c+1−1
@@ -465,7 +465,7 @@ EXPORT_SYMBOL_GPL(cs42xx8_regmap_config); · 464 unmodified lines
465465 static int cs42xx8_component_probe(struct snd_soc_component *component)
466466 {
467467 struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component);
468− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
468+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
469469
470470 switch (cs42xx8->drvdata->num_adcs) {
471471 case 3:
sound/soc/codecs/cs43130.c+1−1
@@ -1062,7 +1062,7 @@ static int cs43130_pcm_ch_put(struct snd_kcontrol *kcontrol, · 1061 unmodified lines
10621062 {
10631063 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10641064 unsigned int *item = ucontrol->value.enumerated.item;
1065− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1065+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10661066 struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component);
10671067 unsigned int val;
10681068
sound/soc/codecs/cs47l15.c+5−6
@@ -106,8 +106,7 @@ static int cs47l15_adsp_power_ev(struct snd_soc_dapm_widget *w, · 105 unmodified lines
106106 static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol,
107107 struct snd_ctl_elem_value *ucontrol)
108108 {
109− struct snd_soc_component *component =
110− snd_soc_kcontrol_component(kcontrol);
109+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
111110 struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
112111
113112 ucontrol->value.integer.value[0] = !!cs47l15->in1_lp_mode;
@@ -118,8 +117,7 @@ static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
118117 static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,
119118 struct snd_ctl_elem_value *ucontrol)
120119 {
121− struct snd_soc_component *component =
122− snd_soc_kcontrol_component(kcontrol);
120+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
123121 struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
124122
125123 if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode)
@@ -1280,6 +1278,7 @@ static const struct snd_soc_dapm_route cs47l15_mono_routes[] = { · 1154 unmodified lines
12801278
12811279 static int cs47l15_component_probe(struct snd_soc_component *component)
12821280 {
1281+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12831282 struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
12841283 struct madera *madera = cs47l15->core.madera;
12851284 int ret;
@@ -1287,7 +1286,7 @@ static int cs47l15_component_probe(struct snd_soc_component *component) · 1 unmodified line
12871286 snd_soc_component_init_regmap(component, madera->regmap);
12881287
12891288 mutex_lock(&madera->dapm_ptr_lock);
1290− madera->dapm = snd_soc_component_get_dapm(component);
1289+ madera->dapm = snd_soc_component_to_dapm(component);
12911290 mutex_unlock(&madera->dapm_ptr_lock);
12921291
12931292 ret = madera_init_inputs(component);
@@ -1300,7 +1299,7 @@ static int cs47l15_component_probe(struct snd_soc_component *component) · 6 unmodified lines
13001299 if (ret)
13011300 return ret;
13021301
1303− snd_soc_component_disable_pin(component, "HAPTICS");
1302+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
13041303
13051304 ret = snd_soc_add_component_controls(component,
13061305 madera_adsp_rate_controls,
sound/soc/codecs/cs47l24.c+2−2
@@ -1124,7 +1124,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) · 1123 unmodified lines
11241124
11251125 static int cs47l24_component_probe(struct snd_soc_component *component)
11261126 {
1127− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1127+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11281128 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
11291129 struct arizona *arizona = priv->core.arizona;
11301130 int ret;
@@ -1153,7 +1153,7 @@ static int cs47l24_component_probe(struct snd_soc_component *component) · 22 unmodified lines
11531153 if (ret)
11541154 goto err_adsp2_codec_probe;
11551155
1156− snd_soc_component_disable_pin(component, "HAPTICS");
1156+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
11571157
11581158 return 0;
11591159
sound/soc/codecs/cs47l35.c+3−2
@@ -1559,6 +1559,7 @@ static const struct snd_soc_dapm_route cs47l35_mono_routes[] = { · 1558 unmodified lines
15591559
15601560 static int cs47l35_component_probe(struct snd_soc_component *component)
15611561 {
1562+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15621563 struct cs47l35 *cs47l35 = snd_soc_component_get_drvdata(component);
15631564 struct madera *madera = cs47l35->core.madera;
15641565 int i, ret;
@@ -1566,7 +1567,7 @@ static int cs47l35_component_probe(struct snd_soc_component *component) · 1 unmodified line
15661567 snd_soc_component_init_regmap(component, madera->regmap);
15671568
15681569 mutex_lock(&madera->dapm_ptr_lock);
1569− madera->dapm = snd_soc_component_get_dapm(component);
1570+ madera->dapm = snd_soc_component_to_dapm(component);
15701571 mutex_unlock(&madera->dapm_ptr_lock);
15711572
15721573 ret = madera_init_inputs(component);
@@ -1579,7 +1580,7 @@ static int cs47l35_component_probe(struct snd_soc_component *component) · 6 unmodified lines
15791580 if (ret)
15801581 return ret;
15811582
1582− snd_soc_component_disable_pin(component, "HAPTICS");
1583+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
15831584
15841585 ret = snd_soc_add_component_controls(component,
15851586 madera_adsp_rate_controls,
sound/soc/codecs/cs47l85.c+3−2
@@ -2497,6 +2497,7 @@ static irqreturn_t cs47l85_adsp2_irq(int irq, void *data) · 2496 unmodified lines
24972497
24982498 static int cs47l85_component_probe(struct snd_soc_component *component)
24992499 {
2500+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
25002501 struct cs47l85 *cs47l85 = snd_soc_component_get_drvdata(component);
25012502 struct madera *madera = cs47l85->core.madera;
25022503 int i, ret;
@@ -2504,7 +2505,7 @@ static int cs47l85_component_probe(struct snd_soc_component *component) · 1 unmodified line
25042505 snd_soc_component_init_regmap(component, madera->regmap);
25052506
25062507 mutex_lock(&madera->dapm_ptr_lock);
2507− madera->dapm = snd_soc_component_get_dapm(component);
2508+ madera->dapm = snd_soc_component_to_dapm(component);
25082509 mutex_unlock(&madera->dapm_ptr_lock);
25092510
25102511 ret = madera_init_inputs(component);
@@ -2516,7 +2517,7 @@ static int cs47l85_component_probe(struct snd_soc_component *component) · 5 unmodified lines
25162517 if (ret)
25172518 return ret;
25182519
2519− snd_soc_component_disable_pin(component, "HAPTICS");
2520+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
25202521
25212522 ret = snd_soc_add_component_controls(component,
25222523 madera_adsp_rate_controls,
sound/soc/codecs/cs47l90.c+3−2
@@ -2416,6 +2416,7 @@ static irqreturn_t cs47l90_adsp2_irq(int irq, void *data) · 2415 unmodified lines
24162416
24172417 static int cs47l90_component_probe(struct snd_soc_component *component)
24182418 {
2419+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
24192420 struct cs47l90 *cs47l90 = snd_soc_component_get_drvdata(component);
24202421 struct madera *madera = cs47l90->core.madera;
24212422 int ret, i;
@@ -2423,7 +2424,7 @@ static int cs47l90_component_probe(struct snd_soc_component *component) · 1 unmodified line
24232424 snd_soc_component_init_regmap(component, madera->regmap);
24242425
24252426 mutex_lock(&madera->dapm_ptr_lock);
2426− madera->dapm = snd_soc_component_get_dapm(component);
2427+ madera->dapm = snd_soc_component_to_dapm(component);
24272428 mutex_unlock(&madera->dapm_ptr_lock);
24282429
24292430 ret = madera_init_inputs(component);
@@ -2435,7 +2436,7 @@ static int cs47l90_component_probe(struct snd_soc_component *component) · 5 unmodified lines
24352436 if (ret)
24362437 return ret;
24372438
2438− snd_soc_component_disable_pin(component, "HAPTICS");
2439+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
24392440
24402441 ret = snd_soc_add_component_controls(component,
24412442 madera_adsp_rate_controls,
sound/soc/codecs/cs47l92.c+5−6
@@ -52,10 +52,8 @@ static const char * const cs47l92_outdemux_texts[] = { · 51 unmodified lines
5252 static int cs47l92_put_demux(struct snd_kcontrol *kcontrol,
5353 struct snd_ctl_elem_value *ucontrol)
5454 {
55− struct snd_soc_component *component =
56− snd_soc_dapm_kcontrol_component(kcontrol);
57− struct snd_soc_dapm_context *dapm =
58− snd_soc_component_get_dapm(component);
55+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
56+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
5957 struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
6058 struct madera_priv *priv = &cs47l92->core;
6159 struct madera *madera = priv->madera;
@@ -1887,6 +1885,7 @@ static const struct snd_soc_dapm_route cs47l92_mono_routes[] = { · 1825 unmodified lines
18871885
18881886 static int cs47l92_component_probe(struct snd_soc_component *component)
18891887 {
1888+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
18901889 struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
18911890 struct madera *madera = cs47l92->core.madera;
18921891 int ret;
@@ -1894,7 +1893,7 @@ static int cs47l92_component_probe(struct snd_soc_component *component) · 1 unmodified line
18941893 snd_soc_component_init_regmap(component, madera->regmap);
18951894
18961895 mutex_lock(&madera->dapm_ptr_lock);
1897− madera->dapm = snd_soc_component_get_dapm(component);
1896+ madera->dapm = snd_soc_component_to_dapm(component);
18981897 mutex_unlock(&madera->dapm_ptr_lock);
18991898
19001899 ret = madera_init_inputs(component);
@@ -1907,7 +1906,7 @@ static int cs47l92_component_probe(struct snd_soc_component *component) · 6 unmodified lines
19071906 if (ret)
19081907 return ret;
19091908
1910− snd_soc_component_disable_pin(component, "HAPTICS");
1909+ snd_soc_dapm_disable_pin(dapm, "HAPTICS");
19111910
19121911 ret = snd_soc_add_component_controls(component,
19131912 madera_adsp_rate_controls,
sound/soc/codecs/cs48l32.c+20−20
@@ -231,7 +231,7 @@ static_assert(ARRAY_SIZE(cs48l32_rate_val) == ARRAY_SIZE(cs48l32_rate_text)); · 230 unmodified lines
231231
232232 static int cs48l32_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
233233 {
234− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
234+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
235235 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
236236 int ret;
237237
@@ -320,8 +320,8 @@ static const struct soc_enum cs48l32_sample_rate[] = { · 82 unmodified lines
320320 static int cs48l32_inmux_put(struct snd_kcontrol *kcontrol,
321321 struct snd_ctl_elem_value *ucontrol)
322322 {
323− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
324− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
323+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
324+ struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
325325 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
326326 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
327327 unsigned int mux, src_val, in_type;
@@ -347,7 +347,7 @@ static int cs48l32_inmux_put(struct snd_kcontrol *kcontrol, · 19 unmodified lines
347347 if (in_type == CS48L32_IN_TYPE_SE)
348348 src_val |= 1 << CS48L32_INx_SRC_SHIFT;
349349
350− ret = snd_soc_component_update_bits(dapm->component,
350+ ret = snd_soc_component_update_bits(component,
351351 e->reg,
352352 CS48L32_INx_SRC_MASK,
353353 src_val);
@@ -385,7 +385,7 @@ static const char * const cs48l32_dmode_texts[] = { · 31 unmodified lines
385385 static int cs48l32_dmode_put(struct snd_kcontrol *kcontrol,
386386 struct snd_ctl_elem_value *ucontrol)
387387 {
388− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
388+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
389389 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
390390 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
391391 unsigned int mode;
@@ -704,8 +704,8 @@ static bool cs48l32_is_input_enabled(struct snd_soc_component *component, · 312 unmodified lines
704704 static int cs48l32_in_rate_put(struct snd_kcontrol *kcontrol,
705705 struct snd_ctl_elem_value *ucontrol)
706706 {
707− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
708− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
707+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
708+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
709709 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
710710 int ret;
711711
@@ -755,8 +755,8 @@ static int cs48l32_low_power_mode_put(struct snd_kcontrol *kcontrol, · 43 unmodified lines
755755 struct snd_ctl_elem_value *ucontrol)
756756 {
757757 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
758− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
759− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
758+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
759+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
760760 int ret;
761761
762762 snd_soc_dapm_mutex_lock(dapm);
@@ -912,7 +912,7 @@ static const struct soc_enum cs48l32_lhpf_mode[] = { · 149 unmodified lines
912912 static int cs48l32_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
913913 struct snd_ctl_elem_value *ucontrol)
914914 {
915− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
915+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
916916 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
917917 __be32 *data = (__be32 *)ucontrol->value.bytes.data;
918918 s16 val = (s16)be32_to_cpu(*data);
@@ -947,7 +947,7 @@ static const struct soc_enum cs48l32_eq_mode[] = { · 28 unmodified lines
947947 static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol,
948948 struct snd_ctl_elem_value *ucontrol)
949949 {
950− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
950+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
951951 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
952952 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
953953 unsigned int item;
@@ -961,8 +961,8 @@ static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
961961 static int cs48l32_eq_mode_put(struct snd_kcontrol *kcontrol,
962962 struct snd_ctl_elem_value *ucontrol)
963963 {
964− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
965− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
964+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
965+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
966966 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
967967 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
968968 unsigned int *item = ucontrol->value.enumerated.item;
@@ -1000,7 +1000,7 @@ static int cs48l32_eq_coeff_info(struct snd_kcontrol *kcontrol, · 31 unmodified lines
10001000 static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol,
10011001 struct snd_ctl_elem_value *ucontrol)
10021002 {
1003− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1003+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10041004 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
10051005 struct cs48l32_eq_control *params = (void *)kcontrol->private_value;
10061006 __be16 *coeffs;
@@ -1025,8 +1025,8 @@ static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol, · 18 unmodified lines
10251025 static int cs48l32_eq_coeff_put(struct snd_kcontrol *kcontrol,
10261026 struct snd_ctl_elem_value *ucontrol)
10271027 {
1028− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1029− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1028+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1029+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10301030 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
10311031 struct cs48l32_eq_control *params = (void *)kcontrol->private_value;
10321032 __be16 *coeffs;
@@ -1062,7 +1062,7 @@ static const struct snd_kcontrol_new cs48l32_dsp_trigger_output_mux[] = { · 29 unmodified lines
10621062 static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol,
10631063 struct snd_ctl_elem_value *ucontrol)
10641064 {
1065− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1065+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10661066 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
10671067 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
10681068 unsigned int cached_rate;
@@ -1082,8 +1082,8 @@ static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines
10821082 static int cs48l32_dsp_rate_put(struct snd_kcontrol *kcontrol,
10831083 struct snd_ctl_elem_value *ucontrol)
10841084 {
1085− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1086− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1085+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1086+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10871087 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
10881088 struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
10891089 const unsigned int rate_num = e->mask;
@@ -2465,7 +2465,7 @@ static int cs48l32_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kco · 1375 unmodified lines
24652465 static int cs48l32_in_put_volsw(struct snd_kcontrol *kcontrol,
24662466 struct snd_ctl_elem_value *ucontrol)
24672467 {
2468− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2468+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
24692469 struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
24702470 int ret;
24712471
sound/soc/codecs/cs530x-i2c.c+20−4
@@ -2,8 +2,8 @@ · 1 unmodified line
22 //
33 // CS530x CODEC driver
44 //
5−// Copyright (C) 2024 Cirrus Logic, Inc. and
6−// Cirrus Logic International Semiconductor Ltd.
5+// Copyright (C) 2024-2025 Cirrus Logic, Inc. and
6+// Cirrus Logic International Semiconductor Ltd.
77
88 #include <linux/device.h>
99 #include <linux/module.h>
@@ -14,6 +14,18 @@ · 4 unmodified lines
1414
1515 static const struct of_device_id cs530x_of_match[] = {
1616 {
17+ .compatible = "cirrus,cs4282",
18+ .data = (void *)CS4282,
19+ }, {
20+ .compatible = "cirrus,cs4302",
21+ .data = (void *)CS4302,
22+ }, {
23+ .compatible = "cirrus,cs4304",
24+ .data = (void *)CS4304,
25+ }, {
26+ .compatible = "cirrus,cs4308",
27+ .data = (void *)CS4308,
28+ }, {
1729 .compatible = "cirrus,cs5302",
1830 .data = (void *)CS5302,
1931 }, {
@@ -28,6 +40,10 @@ static const struct of_device_id cs530x_of_match[] = { · 8 unmodified lines
2840 MODULE_DEVICE_TABLE(of, cs530x_of_match);
2941
3042 static const struct i2c_device_id cs530x_i2c_id[] = {
43+ { "cs4282", CS4282 },
44+ { "cs4302", CS4302 },
45+ { "cs4304", CS4304 },
46+ { "cs4308", CS4308 },
3147 { "cs5302", CS5302 },
3248 { "cs5304", CS5304 },
3349 { "cs5308", CS5308 },
@@ -45,10 +61,10 @@ static int cs530x_i2c_probe(struct i2c_client *client) · 11 unmodified lines
4561
4662 i2c_set_clientdata(client, cs530x);
4763
48− cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap);
64+ cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap_i2c);
4965 if (IS_ERR(cs530x->regmap))
5066 return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap),
51− "Failed to allocate register map\n");
67+ "Failed to allocate register map\n");
5268
5369 cs530x->devtype = (uintptr_t)i2c_get_match_data(client);
5470 cs530x->dev = &client->dev;
sound/soc/codecs/cs530x-spi.c+92−0
@@ -0,0 +1,92 @@
1+// SPDX-License-Identifier: GPL-2.0
2+//
3+// CS530x CODEC driver
4+//
5+// Copyright (C) 2025 Cirrus Logic, Inc. and
6+// Cirrus Logic International Semiconductor Ltd.
7+
8+#include <linux/module.h>
9+#include <linux/platform_device.h>
10+#include <linux/spi/spi.h>
11+
12+#include "cs530x.h"
13+
14+static const struct of_device_id cs530x_of_match[] = {
15+ {
16+ .compatible = "cirrus,cs4282",
17+ .data = (void *)CS4282,
18+ }, {
19+ .compatible = "cirrus,cs4302",
20+ .data = (void *)CS4302,
21+ }, {
22+ .compatible = "cirrus,cs4304",
23+ .data = (void *)CS4304,
24+ }, {
25+ .compatible = "cirrus,cs4308",
26+ .data = (void *)CS4308,
27+ }, {
28+ .compatible = "cirrus,cs5302",
29+ .data = (void *)CS5302,
30+ }, {
31+ .compatible = "cirrus,cs5304",
32+ .data = (void *)CS5304,
33+ }, {
34+ .compatible = "cirrus,cs5304",
35+ .data = (void *)CS5308,
36+ },
37+ {}
38+};
39+MODULE_DEVICE_TABLE(of, cs530x_of_match);
40+
41+static const struct spi_device_id cs530x_spi_id[] = {
42+ { "cs4282", CS4282 },
43+ { "cs4302", CS4302 },
44+ { "cs4304", CS4304 },
45+ { "cs4308", CS4308 },
46+ { "cs5302", CS5302 },
47+ { "cs5304", CS5304 },
48+ { "cs5308", CS5308 },
49+ { }
50+};
51+MODULE_DEVICE_TABLE(spi, cs530x_spi_id);
52+
53+static int cs530x_spi_probe(struct spi_device *spi)
54+{
55+ struct cs530x_priv *cs530x;
56+ struct device *dev = &spi->dev;
57+ int ret;
58+
59+ cs530x = devm_kzalloc(dev, sizeof(struct cs530x_priv), GFP_KERNEL);
60+ if (cs530x == NULL)
61+ return -ENOMEM;
62+
63+ spi_set_drvdata(spi, cs530x);
64+
65+ cs530x->regmap = devm_regmap_init_spi(spi, &cs530x_regmap_spi);
66+ if (IS_ERR(cs530x->regmap)) {
67+ ret = PTR_ERR(cs530x->regmap);
68+ dev_err(dev, "Failed to allocate register map: %d\n", ret);
69+ return ret;
70+ }
71+
72+ cs530x->devtype = (unsigned long)spi_get_device_match_data(spi);
73+ cs530x->dev = &spi->dev;
74+
75+ return cs530x_probe(cs530x);
76+}
77+
78+static struct spi_driver cs530x_spi_driver = {
79+ .driver = {
80+ .name = "cs530x",
81+ .of_match_table = cs530x_of_match,
82+ },
83+ .id_table = cs530x_spi_id,
84+ .probe = cs530x_spi_probe,
85+};
86+
87+module_spi_driver(cs530x_spi_driver);
88+
89+MODULE_DESCRIPTION("SPI CS530X driver");
90+MODULE_IMPORT_NS("SND_SOC_CS530X");
91+MODULE_AUTHOR("Vitaly Rodionov <vitalyr@opensource.cirrus.com>");
92+MODULE_LICENSE("GPL");
sound/soc/codecs/cs530x.c+449−77
@@ -2,28 +2,26 @@ · 1 unmodified line
22 //
33 // CS530x CODEC driver
44 //
5−// Copyright (C) 2024 Cirrus Logic, Inc. and
6−// Cirrus Logic International Semiconductor Ltd.
5+// Copyright (C) 2024-2025 Cirrus Logic, Inc. and
6+// Cirrus Logic International Semiconductor Ltd.
77
8−#include <sound/core.h>
98 #include <linux/delay.h>
109 #include <linux/i2c.h>
1110 #include <linux/init.h>
12−#include <sound/initval.h>
1311 #include <linux/module.h>
14−#include <sound/pcm.h>
15−#include <sound/pcm_params.h>
1612 #include <linux/pm.h>
1713 #include <linux/property.h>
1814 #include <linux/slab.h>
15+#include <linux/spi/spi.h>
16+#include <sound/core.h>
17+#include <sound/initval.h>
18+#include <sound/pcm.h>
19+#include <sound/pcm_params.h>
1920 #include <sound/soc.h>
2021 #include <sound/tlv.h>
2122
2223 #include "cs530x.h"
2324
24−#define CS530X_MAX_ADC_CH 8
25−#define CS530X_MIN_ADC_CH 2
26−
2725 static const char *cs530x_supply_names[CS530X_NUM_SUPPLIES] = {
2826 "vdd-a",
2927 "vdd-io",
@@ -48,6 +46,18 @@ static const struct reg_default cs530x_reg_defaults[] = { · 18 unmodified lines
4846 { CS530X_IN_VOL_CTRL3_1, 0x8000 },
4947 { CS530X_IN_VOL_CTRL4_0, 0x8000 },
5048 { CS530X_IN_VOL_CTRL4_1, 0x8000 },
49+ { CS530X_OUT_ENABLES, 0 },
50+ { CS530X_OUT_RAMP_SUM, 0x0022 },
51+ { CS530X_OUT_FILTER, 0 },
52+ { CS530X_OUT_INV, 0 },
53+ { CS530X_OUT_VOL_CTRL1_0, 0x8000 },
54+ { CS530X_OUT_VOL_CTRL1_1, 0x8000 },
55+ { CS530X_OUT_VOL_CTRL2_0, 0x8000 },
56+ { CS530X_OUT_VOL_CTRL2_1, 0x8000 },
57+ { CS530X_OUT_VOL_CTRL3_0, 0x8000 },
58+ { CS530X_OUT_VOL_CTRL3_1, 0x8000 },
59+ { CS530X_OUT_VOL_CTRL4_0, 0x8000 },
60+ { CS530X_OUT_VOL_CTRL4_1, 0x8000 },
5161 { CS530X_PAD_FN, 0 },
5262 { CS530X_PAD_LVL, 0 },
5363 };
@@ -73,6 +83,19 @@ static bool cs530x_read_and_write_regs(unsigned int reg) · 19 unmodified lines
7383 case CS530X_IN_VOL_CTRL3_1:
7484 case CS530X_IN_VOL_CTRL4_0:
7585 case CS530X_IN_VOL_CTRL4_1:
86+ case CS530X_OUT_ENABLES:
87+ case CS530X_OUT_RAMP_SUM:
88+ case CS530X_OUT_DEEMPH:
89+ case CS530X_OUT_FILTER:
90+ case CS530X_OUT_INV:
91+ case CS530X_OUT_VOL_CTRL1_0:
92+ case CS530X_OUT_VOL_CTRL1_1:
93+ case CS530X_OUT_VOL_CTRL2_0:
94+ case CS530X_OUT_VOL_CTRL2_1:
95+ case CS530X_OUT_VOL_CTRL3_0:
96+ case CS530X_OUT_VOL_CTRL3_1:
97+ case CS530X_OUT_VOL_CTRL4_0:
98+ case CS530X_OUT_VOL_CTRL4_1:
7699 case CS530X_PAD_FN:
77100 case CS530X_PAD_LVL:
78101 return true;
@@ -97,6 +120,7 @@ static bool cs530x_writeable_register(struct device *dev, unsigned int reg) · 18 unmodified lines
97120 switch (reg) {
98121 case CS530X_SW_RESET:
99122 case CS530X_IN_VOL_CTRL5:
123+ case CS530X_OUT_VOL_CTRL5:
100124 return true;
101125 default:
102126 return cs530x_read_and_write_regs(reg);
@@ -104,10 +128,10 @@ static bool cs530x_writeable_register(struct device *dev, unsigned int reg) · 1 unmodified line
104128 }
105129
106130 static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol,
107− struct snd_ctl_elem_value *ucontrol)
131+ struct snd_ctl_elem_value *ucontrol)
108132 {
109− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
110− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
133+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
134+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
111135 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
112136 struct regmap *regmap = cs530x->regmap;
113137 int ret;
@@ -118,8 +142,8 @@ static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol, · 4 unmodified lines
118142 if (ret)
119143 goto volsw_err;
120144
121− /* Write IN_VU bit for the volume change to take effect */
122− regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_IN_VU);
145+ /* Write INOUT_VU bit for the volume change to take effect */
146+ regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_INOUT_VU);
123147
124148 volsw_err:
125149 snd_soc_dapm_mutex_unlock(dapm);
@@ -129,7 +153,7 @@ volsw_err: · 3 unmodified lines
129153
130154 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1270, 50, 0);
131155
132−static const char * const cs530x_in_filter_text[] = {
156+static const char * const cs530x_inout_filter_text[] = {
133157 "Min Phase Slow Roll-off",
134158 "Min Phase Fast Roll-off",
135159 "Linear Phase Slow Roll-off",
@@ -137,24 +161,36 @@ static const char * const cs530x_in_filter_text[] = { · 1 unmodified line
137161 };
138162
139163 static SOC_ENUM_SINGLE_DECL(cs530x_in_filter_enum, CS530X_IN_FILTER,
140− CS530X_IN_FILTER_SHIFT,
141− cs530x_in_filter_text);
164+ CS530X_INOUT_FILTER_SHIFT,
165+ cs530x_inout_filter_text);
142166
143−static const char * const cs530x_in_4ch_sum_text[] = {
167+static SOC_ENUM_SINGLE_DECL(cs530x_out_filter_enum, CS530X_OUT_FILTER,
168+ CS530X_INOUT_FILTER_SHIFT,
169+ cs530x_inout_filter_text);
170+
171+static const char * const cs530x_4ch_sum_text[] = {
144172 "None",
145173 "Groups of 2",
146174 "Groups of 4",
147175 };
148176
149177 static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch4_enum, CS530X_IN_RAMP_SUM,
150− CS530X_IN_SUM_MODE_SHIFT,
151− cs530x_in_4ch_sum_text);
178+ CS530X_INOUT_SUM_MODE_SHIFT,
179+ cs530x_4ch_sum_text);
152180
153181 static const struct snd_kcontrol_new cs530x_in_sum_4ch_controls[] = {
154182 SOC_ENUM("IN Sum Select", cs530x_in_sum_ch4_enum),
155183 };
156184
157−static const char * const cs530x_in_8ch_sum_text[] = {
185+static SOC_ENUM_SINGLE_DECL(cs530x_out_sum_ch4_enum, CS530X_OUT_RAMP_SUM,
186+ CS530X_INOUT_SUM_MODE_SHIFT,
187+ cs530x_4ch_sum_text);
188+
189+static const struct snd_kcontrol_new cs530x_out_sum_4ch_controls[] = {
190+SOC_ENUM("OUT Sum Select", cs530x_out_sum_ch4_enum),
191+};
192+
193+static const char * const cs530x_8ch_sum_text[] = {
158194 "None",
159195 "Groups of 2",
160196 "Groups of 4",
@@ -162,13 +198,20 @@ static const char * const cs530x_in_8ch_sum_text[] = { · 1 unmodified line
162198 };
163199
164200 static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch8_enum, CS530X_IN_RAMP_SUM,
165− CS530X_IN_SUM_MODE_SHIFT,
166− cs530x_in_8ch_sum_text);
201+ CS530X_INOUT_SUM_MODE_SHIFT,
202+ cs530x_8ch_sum_text);
167203
168204 static const struct snd_kcontrol_new cs530x_in_sum_8ch_controls[] = {
169205 SOC_ENUM("IN Sum Select", cs530x_in_sum_ch8_enum),
170206 };
171207
208+static SOC_ENUM_SINGLE_DECL(cs530x_out_sum_ch8_enum, CS530X_OUT_RAMP_SUM,
209+ CS530X_INOUT_SUM_MODE_SHIFT,
210+ cs530x_8ch_sum_text);
211+
212+static const struct snd_kcontrol_new cs530x_out_sum_8ch_controls[] = {
213+SOC_ENUM("OUT Sum Select", cs530x_out_sum_ch8_enum),
214+};
172215
173216 static const char * const cs530x_vol_ramp_text[] = {
174217 "0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB",
@@ -193,8 +236,8 @@ SOC_ENUM("IN DEC Filter Select", cs530x_in_filter_enum), · 18 unmodified lines
193236 SOC_ENUM("Input Ramp Up", cs530x_ramp_inc_enum),
194237 SOC_ENUM("Input Ramp Down", cs530x_ramp_dec_enum),
195238
196−SOC_SINGLE("ADC1 Invert Switch", CS530X_IN_INV, CS530X_IN1_INV_SHIFT, 1, 0),
197−SOC_SINGLE("ADC2 Invert Switch", CS530X_IN_INV, CS530X_IN2_INV_SHIFT, 1, 0),
239+SOC_SINGLE("ADC1 Invert Switch", CS530X_IN_INV, CS530X_INOUT1_INV_SHIFT, 1, 0),
240+SOC_SINGLE("ADC2 Invert Switch", CS530X_IN_INV, CS530X_INOUT2_INV_SHIFT, 1, 0),
198241 };
199242
200243 static const struct snd_kcontrol_new cs530x_in_3_to_4_controls[] = {
@@ -203,8 +246,8 @@ SOC_SINGLE_EXT_TLV("IN3 Volume", CS530X_IN_VOL_CTRL2_0, 0, 255, 1, · 2 unmodified lines
203246 SOC_SINGLE_EXT_TLV("IN4 Volume", CS530X_IN_VOL_CTRL2_1, 0, 255, 1,
204247 snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
205248
206−SOC_SINGLE("ADC3 Invert Switch", CS530X_IN_INV, CS530X_IN3_INV_SHIFT, 1, 0),
207−SOC_SINGLE("ADC4 Invert Switch", CS530X_IN_INV, CS530X_IN4_INV_SHIFT, 1, 0),
249+SOC_SINGLE("ADC3 Invert Switch", CS530X_IN_INV, CS530X_INOUT3_INV_SHIFT, 1, 0),
250+SOC_SINGLE("ADC4 Invert Switch", CS530X_IN_INV, CS530X_INOUT4_INV_SHIFT, 1, 0),
208251 };
209252
210253 static const struct snd_kcontrol_new cs530x_in_5_to_8_controls[] = {
@@ -217,14 +260,14 @@ SOC_SINGLE_EXT_TLV("IN7 Volume", CS530X_IN_VOL_CTRL4_0, 0, 255, 1, · 6 unmodified lines
217260 SOC_SINGLE_EXT_TLV("IN8 Volume", CS530X_IN_VOL_CTRL4_1, 0, 255, 1,
218261 snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
219262
220−SOC_SINGLE("ADC5 Invert Switch", CS530X_IN_INV, CS530X_IN5_INV_SHIFT, 1, 0),
221−SOC_SINGLE("ADC6 Invert Switch", CS530X_IN_INV, CS530X_IN6_INV_SHIFT, 1, 0),
222−SOC_SINGLE("ADC7 Invert Switch", CS530X_IN_INV, CS530X_IN7_INV_SHIFT, 1, 0),
223−SOC_SINGLE("ADC8 Invert Switch", CS530X_IN_INV, CS530X_IN8_INV_SHIFT, 1, 0),
263+SOC_SINGLE("ADC5 Invert Switch", CS530X_IN_INV, CS530X_INOUT5_INV_SHIFT, 1, 0),
264+SOC_SINGLE("ADC6 Invert Switch", CS530X_IN_INV, CS530X_INOUT6_INV_SHIFT, 1, 0),
265+SOC_SINGLE("ADC7 Invert Switch", CS530X_IN_INV, CS530X_INOUT7_INV_SHIFT, 1, 0),
266+SOC_SINGLE("ADC8 Invert Switch", CS530X_IN_INV, CS530X_INOUT8_INV_SHIFT, 1, 0),
224267 };
225268
226269 static int cs530x_adc_event(struct snd_soc_dapm_widget *w,
227− struct snd_kcontrol *kcontrol, int event)
270+ struct snd_kcontrol *kcontrol, int event)
228271 {
229272 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
230273 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
@@ -236,24 +279,110 @@ static int cs530x_adc_event(struct snd_soc_dapm_widget *w, · 5 unmodified lines
236279 break;
237280 case SND_SOC_DAPM_POST_PMU:
238281 regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 +
239− (w->shift * 2), CS530X_IN_MUTE);
282+ (w->shift * 2), CS530X_INOUT_MUTE);
240283 regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 +
241− ((w->shift+1) * 2), CS530X_IN_MUTE);
284+ ((w->shift + 1) * 2), CS530X_INOUT_MUTE);
242285
243286 cs530x->adc_pairs_count--;
244287 if (!cs530x->adc_pairs_count) {
245288 usleep_range(1000, 1100);
246289 return regmap_write(regmap, CS530X_IN_VOL_CTRL5,
247− CS530X_IN_VU);
290+ CS530X_INOUT_VU);
248291 }
249292 break;
250293 case SND_SOC_DAPM_PRE_PMD:
251294 regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 +
252− (w->shift * 2), CS530X_IN_MUTE);
295+ (w->shift * 2), CS530X_INOUT_MUTE);
253296 regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 +
254− ((w->shift+1) * 2), CS530X_IN_MUTE);
297+ ((w->shift + 1) * 2), CS530X_INOUT_MUTE);
255298 return regmap_write(regmap, CS530X_IN_VOL_CTRL5,
256− CS530X_IN_VU);
299+ CS530X_INOUT_VU);
300+ default:
301+ return -EINVAL;
302+ }
303+
304+ return 0;
305+}
306+
307+static SOC_ENUM_SINGLE_DECL(cs530x_ramp_out_inc_enum, CS530X_OUT_RAMP_SUM,
308+ CS530X_RAMP_RATE_INC_SHIFT,
309+ cs530x_vol_ramp_text);
310+
311+static SOC_ENUM_SINGLE_DECL(cs530x_ramp_out_dec_enum, CS530X_OUT_RAMP_SUM,
312+ CS530X_RAMP_RATE_DEC_SHIFT,
313+ cs530x_vol_ramp_text);
314+
315+static const struct snd_kcontrol_new cs530x_out_1_to_2_controls[] = {
316+SOC_SINGLE_EXT_TLV("OUT1 Volume", CS530X_OUT_VOL_CTRL1_0, 0, 255, 1,
317+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
318+SOC_SINGLE_EXT_TLV("OUT2 Volume", CS530X_OUT_VOL_CTRL1_1, 0, 255, 1,
319+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
320+
321+SOC_ENUM("OUT DEC Filter Select", cs530x_out_filter_enum),
322+SOC_ENUM("Output Ramp Up", cs530x_ramp_out_inc_enum),
323+SOC_ENUM("Output Ramp Down", cs530x_ramp_out_dec_enum),
324+
325+SOC_SINGLE("DAC1 Invert Switch", CS530X_OUT_INV, CS530X_INOUT1_INV_SHIFT, 1, 0),
326+SOC_SINGLE("DAC2 Invert Switch", CS530X_OUT_INV, CS530X_INOUT2_INV_SHIFT, 1, 0),
327+};
328+
329+static const struct snd_kcontrol_new cs530x_out_3_to_4_controls[] = {
330+SOC_SINGLE_EXT_TLV("OUT3 Volume", CS530X_OUT_VOL_CTRL2_0, 0, 255, 1,
331+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
332+SOC_SINGLE_EXT_TLV("OUT4 Volume", CS530X_OUT_VOL_CTRL2_1, 0, 255, 1,
333+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
334+
335+SOC_SINGLE("DAC3 Invert Switch", CS530X_OUT_INV, CS530X_INOUT3_INV_SHIFT, 1, 0),
336+SOC_SINGLE("DAC4 Invert Switch", CS530X_OUT_INV, CS530X_INOUT4_INV_SHIFT, 1, 0),
337+};
338+
339+static const struct snd_kcontrol_new cs530x_out_5_to_8_controls[] = {
340+SOC_SINGLE_EXT_TLV("OUT5 Volume", CS530X_OUT_VOL_CTRL3_0, 0, 255, 1,
341+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
342+SOC_SINGLE_EXT_TLV("OUT6 Volume", CS530X_OUT_VOL_CTRL3_1, 0, 255, 1,
343+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
344+SOC_SINGLE_EXT_TLV("OUT7 Volume", CS530X_OUT_VOL_CTRL4_0, 0, 255, 1,
345+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
346+SOC_SINGLE_EXT_TLV("OUT8 Volume", CS530X_OUT_VOL_CTRL4_1, 0, 255, 1,
347+ snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv),
348+
349+SOC_SINGLE("DAC5 Invert Switch", CS530X_OUT_INV, CS530X_INOUT5_INV_SHIFT, 1, 0),
350+SOC_SINGLE("DAC6 Invert Switch", CS530X_OUT_INV, CS530X_INOUT6_INV_SHIFT, 1, 0),
351+SOC_SINGLE("DAC7 Invert Switch", CS530X_OUT_INV, CS530X_INOUT7_INV_SHIFT, 1, 0),
352+SOC_SINGLE("DAC8 Invert Switch", CS530X_OUT_INV, CS530X_INOUT8_INV_SHIFT, 1, 0),
353+};
354+
355+static int cs530x_dac_event(struct snd_soc_dapm_widget *w,
356+ struct snd_kcontrol *kcontrol, int event)
357+{
358+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
359+ struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
360+ struct regmap *regmap = cs530x->regmap;
361+
362+ switch (event) {
363+ case SND_SOC_DAPM_PRE_PMU:
364+ cs530x->dac_pairs_count++;
365+ break;
366+ case SND_SOC_DAPM_POST_PMU:
367+ regmap_clear_bits(regmap, CS530X_OUT_VOL_CTRL1_0 +
368+ (w->shift * 2), CS530X_INOUT_MUTE);
369+ regmap_clear_bits(regmap, CS530X_OUT_VOL_CTRL1_0 +
370+ ((w->shift + 1) * 2), CS530X_INOUT_MUTE);
371+
372+ cs530x->dac_pairs_count--;
373+ if (!cs530x->dac_pairs_count) {
374+ usleep_range(1000, 1100);
375+ return regmap_write(regmap, CS530X_OUT_VOL_CTRL5,
376+ CS530X_INOUT_VU);
377+ }
378+ break;
379+ case SND_SOC_DAPM_PRE_PMD:
380+ regmap_set_bits(regmap, CS530X_OUT_VOL_CTRL1_0 +
381+ (w->shift * 2), CS530X_INOUT_MUTE);
382+ regmap_set_bits(regmap, CS530X_OUT_VOL_CTRL1_0 +
383+ ((w->shift + 1) * 2), CS530X_INOUT_MUTE);
384+ return regmap_write(regmap, CS530X_OUT_VOL_CTRL5,
385+ CS530X_INOUT_VU);
257386 default:
258387 return -EINVAL;
259388 }
@@ -263,18 +392,24 @@ static int cs530x_adc_event(struct snd_soc_dapm_widget *w, · 3 unmodified lines
263392
264393 static const struct snd_kcontrol_new adc12_ctrl =
265394 SOC_DAPM_SINGLE_VIRT("Switch", 1);
266−
267395 static const struct snd_kcontrol_new adc34_ctrl =
268396 SOC_DAPM_SINGLE_VIRT("Switch", 1);
269−
270397 static const struct snd_kcontrol_new adc56_ctrl =
271398 SOC_DAPM_SINGLE_VIRT("Switch", 1);
272−
273399 static const struct snd_kcontrol_new adc78_ctrl =
274400 SOC_DAPM_SINGLE_VIRT("Switch", 1);
275−
401+static const struct snd_kcontrol_new dac12_ctrl =
402+ SOC_DAPM_SINGLE_VIRT("Switch", 1);
403+static const struct snd_kcontrol_new dac34_ctrl =
404+ SOC_DAPM_SINGLE_VIRT("Switch", 1);
405+static const struct snd_kcontrol_new dac56_ctrl =
406+ SOC_DAPM_SINGLE_VIRT("Switch", 1);
407+static const struct snd_kcontrol_new dac78_ctrl =
408+ SOC_DAPM_SINGLE_VIRT("Switch", 1);
276409 static const struct snd_kcontrol_new in_hpf_ctrl =
277410 SOC_DAPM_SINGLE_VIRT("Switch", 1);
411+static const struct snd_kcontrol_new out_hpf_ctrl =
412+ SOC_DAPM_SINGLE_VIRT("Switch", 1);
278413
279414 /* General DAPM widgets for all devices */
280415 static const struct snd_soc_dapm_widget cs530x_gen_dapm_widgets[] = {
@@ -291,7 +426,7 @@ SND_SOC_DAPM_ADC_E("ADC1", NULL, CS530X_IN_ENABLES, 0, 0, · 10 unmodified lines
291426 SND_SOC_DAPM_PRE_PMU),
292427 SND_SOC_DAPM_ADC("ADC2", NULL, CS530X_IN_ENABLES, 1, 0),
293428 SND_SOC_DAPM_SWITCH("ADC12 Enable", SND_SOC_NOPM, 0, 0, &adc12_ctrl),
294−SND_SOC_DAPM_SWITCH("IN HPF", CS530X_IN_FILTER, CS530X_IN_HPF_EN_SHIFT,
429+SND_SOC_DAPM_SWITCH("IN HPF", CS530X_IN_FILTER, CS530X_INOUT_HPF_EN_SHIFT,
295430 0, &in_hpf_ctrl),
296431 };
297432
@@ -387,7 +522,7 @@ static const struct snd_soc_dapm_route adc_ch5_8_routes[] = { · 89 unmodified lines
387522
388523 static void cs530x_add_12_adc_widgets(struct snd_soc_component *component)
389524 {
390− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
525+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
391526
392527 snd_soc_add_component_controls(component,
393528 cs530x_in_1_to_2_controls,
@@ -402,7 +537,7 @@ static void cs530x_add_12_adc_widgets(struct snd_soc_component *component) · 8 unmodified lines
402537
403538 static void cs530x_add_34_adc_widgets(struct snd_soc_component *component)
404539 {
405− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
540+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
406541
407542 snd_soc_add_component_controls(component,
408543 cs530x_in_3_to_4_controls,
@@ -415,6 +550,153 @@ static void cs530x_add_34_adc_widgets(struct snd_soc_component *component) · 6 unmodified lines
415550 ARRAY_SIZE(adc_ch3_4_routes));
416551 }
417552
553+/* DAC's Channels 1 and 2 plus generic DAC DAPM events */
554+static const struct snd_soc_dapm_widget cs530x_dac_ch12_dapm_widgets[] = {
555+SND_SOC_DAPM_OUTPUT("OUT1"),
556+SND_SOC_DAPM_OUTPUT("OUT2"),
557+SND_SOC_DAPM_DAC_E("DAC1", NULL, CS530X_OUT_ENABLES, 0, 0,
558+ cs530x_dac_event,
559+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU |
560+ SND_SOC_DAPM_PRE_PMU),
561+SND_SOC_DAPM_DAC("DAC2", NULL, CS530X_OUT_ENABLES, 1, 0),
562+SND_SOC_DAPM_SWITCH("DAC12 Enable", SND_SOC_NOPM, 0, 0, &dac12_ctrl),
563+SND_SOC_DAPM_SWITCH("OUT HPF", CS530X_OUT_FILTER, CS530X_INOUT_HPF_EN_SHIFT,
564+ 0, &out_hpf_ctrl),
565+};
566+
567+/* DAC's Channels 3 and 4 */
568+static const struct snd_soc_dapm_widget cs530x_dac_ch34_dapm_widgets[] = {
569+SND_SOC_DAPM_OUTPUT("OUT3"),
570+SND_SOC_DAPM_OUTPUT("OUT4"),
571+SND_SOC_DAPM_DAC_E("DAC3", NULL, CS530X_OUT_ENABLES, 2, 0,
572+ cs530x_dac_event,
573+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU |
574+ SND_SOC_DAPM_PRE_PMU),
575+SND_SOC_DAPM_DAC("DAC4", NULL, CS530X_OUT_ENABLES, 3, 0),
576+SND_SOC_DAPM_SWITCH("DAC34 Enable", SND_SOC_NOPM, 0, 0, &dac34_ctrl),
577+};
578+
579+/* DAC's Channels 5 to 8 */
580+static const struct snd_soc_dapm_widget cs530x_dac_ch58_dapm_widgets[] = {
581+SND_SOC_DAPM_OUTPUT("OUT5"),
582+SND_SOC_DAPM_OUTPUT("OUT6"),
583+SND_SOC_DAPM_OUTPUT("OUT7"),
584+SND_SOC_DAPM_OUTPUT("OUT8"),
585+SND_SOC_DAPM_DAC_E("DAC5", NULL, CS530X_OUT_ENABLES, 4, 0,
586+ cs530x_dac_event,
587+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU |
588+ SND_SOC_DAPM_PRE_PMU),
589+SND_SOC_DAPM_DAC("DAC6", NULL, CS530X_OUT_ENABLES, 5, 0),
590+SND_SOC_DAPM_SWITCH("DAC56 Enable", SND_SOC_NOPM, 0, 0, &dac56_ctrl),
591+SND_SOC_DAPM_DAC_E("DAC7", NULL, CS530X_OUT_ENABLES, 6, 0,
592+ cs530x_dac_event,
593+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU |
594+ SND_SOC_DAPM_PRE_PMU),
595+SND_SOC_DAPM_DAC("DAC8", NULL, CS530X_OUT_ENABLES, 7, 0),
596+SND_SOC_DAPM_SWITCH("DAC78 Enable", SND_SOC_NOPM, 0, 0, &dac78_ctrl),
597+};
598+
599+static const struct snd_soc_dapm_route dac_ch1_2_routes[] = {
600+ { "DAC1", NULL, "Global Enable" },
601+ { "DAC2", NULL, "Global Enable" },
602+
603+ { "DAC12 Enable", "Switch", "OUT1" },
604+ { "DAC12 Enable", "Switch", "OUT2" },
605+ { "DAC1", NULL, "DAC12 Enable" },
606+ { "DAC2", NULL, "DAC12 Enable" },
607+ { "OUT HPF", "Switch", "DAC1" },
608+ { "OUT HPF", "Switch", "DAC2" },
609+
610+ { "OUT HPF", NULL, "AIF Playback" },
611+ { "DAC1", NULL, "AIF Playback" },
612+ { "DAC2", NULL, "AIF Playback" },
613+
614+ { "OUT1", NULL, "DAC1" },
615+ { "OUT2", NULL, "DAC2" },
616+};
617+
618+static const struct snd_soc_dapm_route dac_ch3_4_routes[] = {
619+ { "DAC3", NULL, "Global Enable" },
620+ { "DAC4", NULL, "Global Enable" },
621+
622+ { "DAC34 Enable", "Switch", "OUT3" },
623+ { "DAC34 Enable", "Switch", "OUT4" },
624+ { "DAC3", NULL, "DAC34 Enable" },
625+ { "DAC4", NULL, "DAC34 Enable" },
626+ { "OUT HPF", "Switch", "DAC3" },
627+ { "OUT HPF", "Switch", "DAC4" },
628+
629+ { "DAC3", NULL, "AIF Playback" },
630+ { "DAC4", NULL, "AIF Playback" },
631+
632+ { "OUT3", NULL, "DAC3" },
633+ { "OUT4", NULL, "DAC4" },
634+};
635+
636+static const struct snd_soc_dapm_route dac_ch5_8_routes[] = {
637+ { "DAC5", NULL, "Global Enable" },
638+ { "DAC6", NULL, "Global Enable" },
639+
640+ { "DAC56 Enable", "Switch", "OUT5" },
641+ { "DAC56 Enable", "Switch", "OUT6" },
642+ { "DAC5", NULL, "DAC56 Enable" },
643+ { "DAC6", NULL, "DAC56 Enable" },
644+ { "OUT HPF", "Switch", "DAC5" },
645+ { "OUT HPF", "Switch", "DAC6" },
646+
647+ { "DAC5", NULL, "AIF Playback" },
648+ { "DAC6", NULL, "AIF Playback" },
649+
650+ { "OUT5", NULL, "DAC5" },
651+ { "OUT6", NULL, "DAC6" },
652+
653+ { "DAC7", NULL, "Global Enable" },
654+ { "DAC8", NULL, "Global Enable" },
655+
656+ { "DAC78 Enable", "Switch", "OUT7" },
657+ { "DAC78 Enable", "Switch", "OUT8" },
658+ { "DAC7", NULL, "DAC78 Enable" },
659+ { "DAC8", NULL, "DAC78 Enable" },
660+ { "OUT HPF", "Switch", "DAC7" },
661+ { "OUT HPF", "Switch", "DAC8" },
662+
663+ { "DAC7", NULL, "AIF Playback" },
664+ { "DAC8", NULL, "AIF Playback" },
665+
666+ { "OUT7", NULL, "DAC7" },
667+ { "OUT8", NULL, "DAC8" },
668+};
669+
670+static void cs530x_add_12_dac_widgets(struct snd_soc_component *component)
671+{
672+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
673+
674+ snd_soc_add_component_controls(component,
675+ cs530x_out_1_to_2_controls,
676+ ARRAY_SIZE(cs530x_out_1_to_2_controls));
677+
678+ snd_soc_dapm_new_controls(dapm, cs530x_dac_ch12_dapm_widgets,
679+ ARRAY_SIZE(cs530x_dac_ch12_dapm_widgets));
680+
681+ snd_soc_dapm_add_routes(dapm, dac_ch1_2_routes,
682+ ARRAY_SIZE(dac_ch1_2_routes));
683+}
684+
685+static void cs530x_add_34_dac_widgets(struct snd_soc_component *component)
686+{
687+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
688+
689+ snd_soc_add_component_controls(component,
690+ cs530x_out_3_to_4_controls,
691+ ARRAY_SIZE(cs530x_out_3_to_4_controls));
692+
693+ snd_soc_dapm_new_controls(dapm, cs530x_dac_ch34_dapm_widgets,
694+ ARRAY_SIZE(cs530x_dac_ch34_dapm_widgets));
695+
696+ snd_soc_dapm_add_routes(dapm, dac_ch3_4_routes,
697+ ARRAY_SIZE(dac_ch3_4_routes));
698+}
699+
418700 static int cs530x_set_bclk(struct snd_soc_component *component, const int freq)
419701 {
420702 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
@@ -450,7 +732,7 @@ static int cs530x_set_bclk(struct snd_soc_component *component, const int freq) · 29 unmodified lines
450732 }
451733
452734 static int cs530x_set_pll_refclk(struct snd_soc_component *component,
453− const unsigned int freq)
735+ const unsigned int freq)
454736 {
455737 struct cs530x_priv *priv = snd_soc_component_get_drvdata(component);
456738 struct regmap *regmap = priv->regmap;
@@ -492,37 +774,35 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream, · 35 unmodified lines
492774 int ret = 0, fs = params_rate(params), bclk;
493775 unsigned int fs_val;
494776
495−
496777 switch (fs) {
497778 case 32000:
498779 fs_val = CS530X_FS_32K;
499780 break;
500781 case 44100:
501782 case 48000:
502− fs_val = CS530X_FS_48K_44P1K;
783+ fs_val = CS530X_FS_44P1K_48K;
503784 break;
504785 case 88200:
505786 case 96000:
506− fs_val = CS530X_FS_96K_88P2K;
787+ fs_val = CS530X_FS_88P2K_96K;
507788 break;
508789 case 176400:
509790 case 192000:
510− fs_val = CS530X_FS_192K_176P4K;
791+ fs_val = CS530X_FS_176P4K_192K;
511792 break;
512793 case 356800:
513794 case 384000:
514− fs_val = CS530X_FS_384K_356P8K;
795+ fs_val = CS530X_FS_356P8K_384K;
515796 break;
516797 case 705600:
517798 case 768000:
518− fs_val = CS530X_FS_768K_705P6K;
799+ fs_val = CS530X_FS_705P6K_768K;
519800 break;
520801 default:
521802 dev_err(component->dev, "Invalid sample rate %d\n", fs);
522803 return -EINVAL;
523804 }
524805
525− cs530x->fs = fs;
526806 regmap_update_bits(regmap, CS530X_CLK_CFG_1,
527807 CS530X_SAMPLE_RATE_MASK, fs_val);
528808
@@ -540,7 +820,7 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream, · 11 unmodified lines
540820 }
541821
542822 if (!regmap_test_bits(regmap, CS530X_CLK_CFG_0,
543− CS530X_PLL_REFCLK_SRC_MASK)) {
823+ CS530X_PLL_REFCLK_SRC_MASK)) {
544824 ret = cs530x_set_pll_refclk(component, bclk);
545825 if (ret)
546826 return ret;
@@ -614,7 +894,7 @@ static bool cs530x_check_mclk_freq(struct snd_soc_component *component, · 67 unmodified lines
614894 }
615895
616896 static int cs530x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
617− unsigned int rx_mask, int slots, int slot_width)
897+ unsigned int rx_mask, int slots, int slot_width)
618898 {
619899 struct snd_soc_component *component = dai->component;
620900 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
@@ -675,8 +955,11 @@ static const struct snd_soc_dai_driver cs530x_dai = { · 54 unmodified lines
675955 .name = "cs530x-dai",
676956 .capture = {
677957 .stream_name = "AIF Capture",
678− .channels_min = 2,
679− .channels_max = 8,
958+ .rates = SNDRV_PCM_RATE_KNOT,
959+ .formats = SNDRV_PCM_FMTBIT_S32_LE,
960+ },
961+ .playback = {
962+ .stream_name = "AIF Playback",
680963 .rates = SNDRV_PCM_RATE_KNOT,
681964 .formats = SNDRV_PCM_FMTBIT_S32_LE,
682965 },
@@ -686,8 +969,8 @@ static const struct snd_soc_dai_driver cs530x_dai = { · 3 unmodified lines
686969 };
687970
688971 static int cs530x_set_pll(struct snd_soc_component *component, int pll_id,
689− int source, unsigned int freq_in,
690− unsigned int freq_out)
972+ int source, unsigned int freq_in,
973+ unsigned int freq_out)
691974 {
692975 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
693976 struct regmap *regmap = cs530x->regmap;
@@ -724,13 +1007,50 @@ static int cs530x_set_pll(struct snd_soc_component *component, int pll_id, · 30 unmodified lines
7241007 static int cs530x_component_probe(struct snd_soc_component *component)
7251008 {
7261009 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
727− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1010+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
7281011 int num_widgets;
7291012
7301013 snd_soc_dapm_new_controls(dapm, cs530x_gen_dapm_widgets,
7311014 ARRAY_SIZE(cs530x_gen_dapm_widgets));
7321015
7331016 switch (cs530x->devtype) {
1017+ case CS4282:
1018+ cs530x_add_12_adc_widgets(component);
1019+ cs530x_add_12_dac_widgets(component);
1020+ break;
1021+ case CS4302:
1022+ cs530x_add_12_dac_widgets(component);
1023+ break;
1024+ case CS4304:
1025+ cs530x_add_12_dac_widgets(component);
1026+ cs530x_add_34_dac_widgets(component);
1027+
1028+ num_widgets = ARRAY_SIZE(cs530x_out_sum_4ch_controls);
1029+ snd_soc_add_component_controls(component,
1030+ cs530x_out_sum_4ch_controls,
1031+ num_widgets);
1032+ break;
1033+ case CS4308:
1034+ cs530x_add_12_dac_widgets(component);
1035+ cs530x_add_34_dac_widgets(component);
1036+
1037+ num_widgets = ARRAY_SIZE(cs530x_out_5_to_8_controls);
1038+ snd_soc_add_component_controls(component,
1039+ cs530x_out_5_to_8_controls,
1040+ num_widgets);
1041+
1042+ num_widgets = ARRAY_SIZE(cs530x_out_sum_8ch_controls);
1043+ snd_soc_add_component_controls(component,
1044+ cs530x_out_sum_8ch_controls,
1045+ num_widgets);
1046+
1047+ num_widgets = ARRAY_SIZE(cs530x_dac_ch58_dapm_widgets);
1048+ snd_soc_dapm_new_controls(dapm, cs530x_dac_ch58_dapm_widgets,
1049+ num_widgets);
1050+
1051+ snd_soc_dapm_add_routes(dapm, dac_ch5_8_routes,
1052+ ARRAY_SIZE(dac_ch5_8_routes));
1053+ break;
7341054 case CS5302:
7351055 cs530x_add_12_adc_widgets(component);
7361056 break;
@@ -743,7 +1063,6 @@ static int cs530x_component_probe(struct snd_soc_component *component) · 6 unmodified lines
7431063 cs530x_in_sum_4ch_controls,
7441064 num_widgets);
7451065 break;
746−
7471066 case CS5308:
7481067 cs530x_add_12_adc_widgets(component);
7491068 cs530x_add_34_adc_widgets(component);
@@ -775,20 +1094,21 @@ static int cs530x_component_probe(struct snd_soc_component *component) · 25 unmodified lines
7751094 }
7761095
7771096 static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id,
778− int source, unsigned int freq, int dir)
1097+ int source, unsigned int freq, int dir)
7791098 {
7801099 struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component);
7811100 struct regmap *regmap = cs530x->regmap;
7821101
7831102 switch (source) {
7841103 case CS530X_SYSCLK_SRC_MCLK:
785− if (freq != 24560000 && freq != 22572000) {
786− dev_err(component->dev, "Invalid MCLK source rate %d\n",
787− freq);
1104+ switch (freq) {
1105+ case CS530X_SYSCLK_REF_45_1MHZ:
1106+ case CS530X_SYSCLK_REF_49_1MHZ:
1107+ break;
1108+ default:
1109+ dev_err(component->dev, "Invalid MCLK source rate %d\n", freq);
7881110 return -EINVAL;
7891111 }
790−
791− cs530x->mclk_rate = freq;
7921112 break;
7931113 case CS530X_SYSCLK_SRC_PLL:
7941114 break;
@@ -809,7 +1129,7 @@ static const struct snd_soc_component_driver soc_component_dev_cs530x = { · 14 unmodified lines
8091129 .endianness = 1,
8101130 };
8111131
812−const struct regmap_config cs530x_regmap = {
1132+const struct regmap_config cs530x_regmap_i2c = {
8131133 .reg_bits = 16,
8141134 .val_bits = 16,
8151135
@@ -821,7 +1141,27 @@ const struct regmap_config cs530x_regmap = { · 5 unmodified lines
8211141 .reg_defaults = cs530x_reg_defaults,
8221142 .num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults),
8231143 };
824−EXPORT_SYMBOL_NS_GPL(cs530x_regmap, "SND_SOC_CS530X");
1144+EXPORT_SYMBOL_NS_GPL(cs530x_regmap_i2c, "SND_SOC_CS530X");
1145+
1146+const struct regmap_config cs530x_regmap_spi = {
1147+ .reg_bits = 16,
1148+ .pad_bits = 16,
1149+ .val_bits = 16,
1150+
1151+ .reg_stride = 2,
1152+
1153+ .reg_format_endian = REGMAP_ENDIAN_BIG,
1154+ .val_format_endian = REGMAP_ENDIAN_BIG,
1155+
1156+ .max_register = CS530X_MAX_REGISTER,
1157+ .writeable_reg = cs530x_writeable_register,
1158+ .readable_reg = cs530x_readable_register,
1159+
1160+ .cache_type = REGCACHE_MAPLE,
1161+ .reg_defaults = cs530x_reg_defaults,
1162+ .num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults),
1163+};
1164+EXPORT_SYMBOL_NS_GPL(cs530x_regmap_spi, "SND_SOC_CS530X");
8251165
8261166 static int cs530x_check_device_id(struct cs530x_priv *cs530x)
8271167 {
@@ -837,9 +1177,20 @@ static int cs530x_check_device_id(struct cs530x_priv *cs530x) · 9 unmodified lines
8371177 if (ret)
8381178 return dev_err_probe(dev, ret, "Can't read REV ID\n");
8391179
840− dev_dbg(dev, "Device ID 0x%x Rev ID 0x%x\n", dev_id, rev);
841−
8421180 switch (dev_id) {
1181+ case CS530X_2CH_CODEC_DEV_ID:
1182+ cs530x->num_dacs = 2;
1183+ cs530x->num_adcs = 2;
1184+ break;
1185+ case CS530X_2CH_DAC_DEV_ID:
1186+ cs530x->num_dacs = 2;
1187+ break;
1188+ case CS530X_4CH_DAC_DEV_ID:
1189+ cs530x->num_dacs = 4;
1190+ break;
1191+ case CS530X_8CH_DAC_DEV_ID:
1192+ cs530x->num_dacs = 8;
1193+ break;
8431194 case CS530X_2CH_ADC_DEV_ID:
8441195 cs530x->num_adcs = 2;
8451196 break;
@@ -854,6 +1205,15 @@ static int cs530x_check_device_id(struct cs530x_priv *cs530x) · 8 unmodified lines
8541205 dev_id);
8551206 }
8561207
1208+ if (cs530x->devtype != dev_id) {
1209+ dev_err(dev, "Read device ID 0x%x is not the expected devtype 0x%x\n",
1210+ dev_id, cs530x->devtype);
1211+ return -EINVAL;
1212+ }
1213+
1214+ dev_dbg(dev, "Device ID 0x%x Rev ID 0x%x (%d in %d out)\n", dev_id, rev,
1215+ cs530x->num_adcs, cs530x->num_dacs);
1216+
8571217 return 0;
8581218 }
8591219
@@ -882,6 +1242,9 @@ static int cs530x_parse_device_properties(struct cs530x_priv *cs530x) · 22 unmodified lines
8821242 val |= CS530X_IN12_HIZ;
8831243
8841244 return regmap_set_bits(regmap, CS530X_IN_HIZ, val);
1245+ case 0:
1246+ /* No ADCs */
1247+ return 0;
8851248 default:
8861249 return dev_err_probe(dev, -EINVAL,
8871250 "Invalid number of adcs %d\n",
@@ -895,8 +1258,8 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 7 unmodified lines
8951258 int ret, i;
8961259
8971260 cs530x->dev_dai = devm_kmemdup(dev, &cs530x_dai,
898− sizeof(*(cs530x->dev_dai)),
899− GFP_KERNEL);
1261+ sizeof(*(cs530x->dev_dai)),
1262+ GFP_KERNEL);
9001263 if (!cs530x->dev_dai)
9011264 return -ENOMEM;
9021265
@@ -914,10 +1277,10 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 11 unmodified lines
9141277 return dev_err_probe(dev, ret, "Failed to enable supplies");
9151278
9161279 cs530x->reset_gpio = devm_gpiod_get_optional(dev, "reset",
917− GPIOD_OUT_HIGH);
1280+ GPIOD_OUT_HIGH);
9181281 if (IS_ERR(cs530x->reset_gpio)) {
9191282 ret = dev_err_probe(dev, PTR_ERR(cs530x->reset_gpio),
920− "Reset gpio not available\n");
1283+ "Reset gpio not available\n");
9211284 goto err_regulator;
9221285 }
9231286
@@ -944,10 +1307,19 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 20 unmodified lines
9441307 if (ret)
9451308 goto err_reset;
9461309
947− cs530x->dev_dai->capture.channels_max = cs530x->num_adcs;
1310+ if (cs530x->num_adcs) {
1311+ cs530x->dev_dai->capture.channels_min = 2;
1312+ cs530x->dev_dai->capture.channels_max = cs530x->num_adcs;
1313+ }
1314+
1315+ if (cs530x->num_dacs) {
1316+ cs530x->dev_dai->playback.channels_min = 2;
1317+ cs530x->dev_dai->playback.channels_max = cs530x->num_dacs;
1318+ }
9481319
9491320 ret = devm_snd_soc_register_component(dev,
950− &soc_component_dev_cs530x, cs530x->dev_dai, 1);
1321+ &soc_component_dev_cs530x,
1322+ cs530x->dev_dai, 1);
9511323 if (ret) {
9521324 dev_err_probe(dev, ret, "Can't register cs530x component\n");
9531325 goto err_reset;
sound/soc/codecs/cs530x.h+60−30
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /*
33 * CS530x CODEC driver internal data
44 *
5− * Copyright (C) 2023-2024 Cirrus Logic, Inc. and
5+ * Copyright (C) 2023-2025 Cirrus Logic, Inc. and
66 * Cirrus Logic International Semiconductor Ltd.
77 */
88
@@ -15,6 +15,10 @@ · 6 unmodified lines
1515 #include <linux/regulator/consumer.h>
1616
1717 /* Devices */
18+#define CS530X_2CH_CODEC_DEV_ID 0x4282
19+#define CS530X_2CH_DAC_DEV_ID 0x4302
20+#define CS530X_4CH_DAC_DEV_ID 0x4304
21+#define CS530X_8CH_DAC_DEV_ID 0x4308
1822 #define CS530X_2CH_ADC_DEV_ID 0x5302
1923 #define CS530X_4CH_ADC_DEV_ID 0x5304
2024 #define CS530X_8CH_ADC_DEV_ID 0x5308
@@ -45,6 +49,21 @@ · 24 unmodified lines
4549 #define CS530X_IN_VOL_CTRL4_1 0x000009E
4650 #define CS530X_IN_VOL_CTRL5 0x00000A0
4751
52+#define CS530X_OUT_ENABLES 0x00000C0
53+#define CS530X_OUT_RAMP_SUM 0x00000C2
54+#define CS530X_OUT_DEEMPH 0x00000C4
55+#define CS530X_OUT_FILTER 0x00000C6
56+#define CS530X_OUT_INV 0x00000CA
57+#define CS530X_OUT_VOL_CTRL1_0 0x00000D0
58+#define CS530X_OUT_VOL_CTRL1_1 0x00000D2
59+#define CS530X_OUT_VOL_CTRL2_0 0x00000D4
60+#define CS530X_OUT_VOL_CTRL2_1 0x00000D6
61+#define CS530X_OUT_VOL_CTRL3_0 0x00000D8
62+#define CS530X_OUT_VOL_CTRL3_1 0x00000DA
63+#define CS530X_OUT_VOL_CTRL4_0 0x00000DC
64+#define CS530X_OUT_VOL_CTRL4_1 0x00000DE
65+#define CS530X_OUT_VOL_CTRL5 0x00000E0
66+
4867 #define CS530X_PAD_FN 0x0003D24
4968 #define CS530X_PAD_LVL 0x0003D28
5069
@@ -73,11 +92,11 @@ · 22 unmodified lines
7392 /* CLK_CFG_1 */
7493 #define CS530X_SAMPLE_RATE_MASK GENMASK(2, 0)
7594 #define CS530X_FS_32K 0
76−#define CS530X_FS_48K_44P1K 1
77−#define CS530X_FS_96K_88P2K 2
78−#define CS530X_FS_192K_176P4K 3
79−#define CS530X_FS_384K_356P8K 4
80−#define CS530X_FS_768K_705P6K 5
95+#define CS530X_FS_44P1K_48K 1
96+#define CS530X_FS_88P2K_96K 2
97+#define CS530X_FS_176P4K_192K 3
98+#define CS530X_FS_356P8K_384K 4
99+#define CS530X_FS_705P6K_768K 5
81100
82101 /* CHIP_ENABLE */
83102 #define CS530X_GLOBAL_EN BIT(0)
@@ -99,7 +118,7 @@ · 15 unmodified lines
99118 #define CS530X_TDM_EN_MASK BIT(2)
100119 #define CS530X_ASP_FMT_I2S 0
101120 #define CS530X_ASP_FMT_LJ 1
102−#define CS530X_ASP_FMT_DSP_A 0x6
121+#define CS530X_ASP_FMT_DSP_A 6
103122
104123 /* TDM Slots */
105124 #define CS530X_0_1_TDM_SLOT_MASK GENMASK(1, 0)
@@ -132,14 +151,14 @@ · 26 unmodified lines
132151 #define CS530X_14_15_TDM_SLOT_MASK GENMASK(15, 14)
133152 #define CS530X_14_15_TDM_SLOT_VAL 7
134153
135−/* IN_RAMP_SUM */
154+/* IN_RAMP_SUM and OUT_RAMP_SUM */
136155 #define CS530X_RAMP_RATE_INC_SHIFT 0
137156 #define CS530X_RAMP_RATE_DEC_SHIFT 4
138−#define CS530X_IN_SUM_MODE_SHIFT 13
157+#define CS530X_INOUT_SUM_MODE_SHIFT 13
139158
140−/* IN_FILTER */
141−#define CS530X_IN_FILTER_SHIFT 8
142−#define CS530X_IN_HPF_EN_SHIFT 12
159+/* IN_FILTER and OUT_FILTER */
160+#define CS530X_INOUT_FILTER_SHIFT 8
161+#define CS530X_INOUT_HPF_EN_SHIFT 12
143162
144163 /* IN_HIZ */
145164 #define CS530X_IN12_HIZ BIT(0)
@@ -147,18 +166,18 @@ · 1 unmodified line
147166 #define CS530X_IN56_HIZ BIT(2)
148167 #define CS530X_IN78_HIZ BIT(3)
149168
150−/* IN_INV */
151−#define CS530X_IN1_INV_SHIFT 0
152−#define CS530X_IN2_INV_SHIFT 1
153−#define CS530X_IN3_INV_SHIFT 2
154−#define CS530X_IN4_INV_SHIFT 3
155−#define CS530X_IN5_INV_SHIFT 4
156−#define CS530X_IN6_INV_SHIFT 5
157−#define CS530X_IN7_INV_SHIFT 6
158−#define CS530X_IN8_INV_SHIFT 7
169+/* IN_INV and OUT_INV */
170+#define CS530X_INOUT1_INV_SHIFT 0
171+#define CS530X_INOUT2_INV_SHIFT 1
172+#define CS530X_INOUT3_INV_SHIFT 2
173+#define CS530X_INOUT4_INV_SHIFT 3
174+#define CS530X_INOUT5_INV_SHIFT 4
175+#define CS530X_INOUT6_INV_SHIFT 5
176+#define CS530X_INOUT7_INV_SHIFT 6
177+#define CS530X_INOUT8_INV_SHIFT 7
159178
160−/* IN_VOL_CTLy_z */
161−#define CS530X_IN_MUTE BIT(15)
179+/* IN_VOL_CTLy_z and OUT_VOL_CTLy_z */
180+#define CS530X_INOUT_MUTE BIT(15)
162181
163182 /* IN_VOL_CTL5 */
164183 #define CS530X_IN_VU BIT(0)
@@ -178,6 +197,14 @@ · 13 unmodified lines
178197 #define CS530X_CONFIG3_LVL BIT(7)
179198 #define CS530X_CONFIG4_LVL BIT(8)
180199 #define CS530X_CONFIG5_LVL BIT(9)
200+/* IN_VOL_CTL5 and OUT_VOL_CTL5 */
201+#define CS530X_INOUT_VU BIT(0)
202+
203+/* MCLK Reference Source Frequency */
204+/* 41KHz related */
205+#define CS530X_SYSCLK_REF_45_1MHZ 45158400
206+/* 48KHz related */
207+#define CS530X_SYSCLK_REF_49_1MHZ 49152000
181208
182209 /* System Clock Source */
183210 #define CS530X_SYSCLK_SRC_MCLK 0
@@ -190,9 +217,13 @@ · 6 unmodified lines
190217 #define CS530X_NUM_SUPPLIES 2
191218
192219 enum cs530x_type {
193− CS5302,
194− CS5304,
195− CS5308,
220+ CS4282 = CS530X_2CH_CODEC_DEV_ID,
221+ CS4302 = CS530X_2CH_DAC_DEV_ID,
222+ CS4304 = CS530X_4CH_DAC_DEV_ID,
223+ CS4308 = CS530X_8CH_DAC_DEV_ID,
224+ CS5302 = CS530X_2CH_ADC_DEV_ID,
225+ CS5304 = CS530X_4CH_ADC_DEV_ID,
226+ CS5308 = CS530X_8CH_ADC_DEV_ID,
196227 };
197228
198229 /* codec private data */
@@ -207,17 +238,16 @@ struct cs530x_priv { · 8 unmodified lines
207238
208239 struct regulator_bulk_data supplies[CS530X_NUM_SUPPLIES];
209240
210− unsigned int mclk_rate;
211−
212241 int tdm_width;
213242 int tdm_slots;
214− int fs;
215243 int adc_pairs_count;
244+ int dac_pairs_count;
216245
217246 struct gpio_desc *reset_gpio;
218247 };
219248
220−extern const struct regmap_config cs530x_regmap;
249+extern const struct regmap_config cs530x_regmap_i2c;
250+extern const struct regmap_config cs530x_regmap_spi;
221251 int cs530x_probe(struct cs530x_priv *cs530x);
222252
223253 #endif
sound/soc/codecs/cs53l30.c+5−4
@@ -649,8 +649,9 @@ static int cs53l30_pcm_hw_params(struct snd_pcm_substream *substream, · 648 unmodified lines
649649 static int cs53l30_set_bias_level(struct snd_soc_component *component,
650650 enum snd_soc_bias_level level)
651651 {
652− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
652+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
653653 struct cs53l30_private *priv = snd_soc_component_get_drvdata(component);
654+ enum snd_soc_bias_level bias_level = snd_soc_dapm_get_bias_level(dapm);
654655 unsigned int reg;
655656 int i, inter_max_check, ret;
656657
@@ -658,12 +659,12 @@ static int cs53l30_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
658659 case SND_SOC_BIAS_ON:
659660 break;
660661 case SND_SOC_BIAS_PREPARE:
661− if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
662+ if (bias_level == SND_SOC_BIAS_STANDBY)
662663 regmap_update_bits(priv->regmap, CS53L30_PWRCTL,
663664 CS53L30_PDN_LP_MASK, 0);
664665 break;
665666 case SND_SOC_BIAS_STANDBY:
666− if (dapm->bias_level == SND_SOC_BIAS_OFF) {
667+ if (bias_level == SND_SOC_BIAS_OFF) {
667668 ret = clk_prepare_enable(priv->mclk);
668669 if (ret) {
669670 dev_err(component->dev,
@@ -857,7 +858,7 @@ static struct snd_soc_dai_driver cs53l30_dai = { · 187 unmodified lines
857858 static int cs53l30_component_probe(struct snd_soc_component *component)
858859 {
859860 struct cs53l30_private *priv = snd_soc_component_get_drvdata(component);
860− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
861+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
861862
862863 if (priv->use_sdout2)
863864 snd_soc_dapm_add_routes(dapm, cs53l30_dapm_routes_sdout2,
sound/soc/codecs/cx20442.c+3−2
@@ -315,11 +315,12 @@ static int cx20442_set_bias_level(struct snd_soc_component *component, · 314 unmodified lines
315315 enum snd_soc_bias_level level)
316316 {
317317 struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component);
318+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
318319 int err = 0;
319320
320321 switch (level) {
321322 case SND_SOC_BIAS_PREPARE:
322− if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_STANDBY)
323+ if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_STANDBY)
323324 break;
324325 if (IS_ERR(cx20442->por))
325326 err = PTR_ERR(cx20442->por);
@@ -327,7 +328,7 @@ static int cx20442_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
327328 err = regulator_enable(cx20442->por);
328329 break;
329330 case SND_SOC_BIAS_STANDBY:
330− if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_PREPARE)
331+ if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_PREPARE)
331332 break;
332333 if (IS_ERR(cx20442->por))
333334 err = PTR_ERR(cx20442->por);
sound/soc/codecs/cx2072x.c+3−3
@@ -1341,8 +1341,8 @@ static int cx2072x_set_bias_level(struct snd_soc_component *codec, · 1340 unmodified lines
13411341 enum snd_soc_bias_level level)
13421342 {
13431343 struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec);
1344− const enum snd_soc_bias_level old_level =
1345− snd_soc_component_get_bias_level(codec);
1344+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
1345+ const enum snd_soc_bias_level old_level = snd_soc_dapm_get_bias_level(dapm);
13461346
13471347 if (level == SND_SOC_BIAS_STANDBY && old_level == SND_SOC_BIAS_OFF)
13481348 regmap_write(cx2072x->regmap, CX2072X_AFG_POWER_STATE, 0);
@@ -1363,7 +1363,7 @@ static int cx2072x_set_bias_level(struct snd_soc_component *codec, · 14 unmodified lines
13631363 static void cx2072x_enable_jack_detect(struct snd_soc_component *codec)
13641364 {
13651365 struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec);
1366− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
1366+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
13671367
13681368 /* No-sticky input type */
13691369 regmap_write(cx2072x->regmap, CX2072X_GPIO_STICKY_MASK, 0x1f);
sound/soc/codecs/da7210.c+2−2
@@ -326,7 +326,7 @@ static SOC_ENUM_SINGLE_DECL(da7210_hp_mode_sel, · 325 unmodified lines
326326 static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol,
327327 struct snd_ctl_elem_value *ucontrol)
328328 {
329− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
329+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
330330
331331 if (ucontrol->value.integer.value[0]) {
332332 /* Check if noise suppression is enabled */
@@ -349,7 +349,7 @@ static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, · 16 unmodified lines
349349 static int da7210_put_noise_sup_sw(struct snd_kcontrol *kcontrol,
350350 struct snd_ctl_elem_value *ucontrol)
351351 {
352− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
352+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
353353 u8 val;
354354
355355 if (ucontrol->value.integer.value[0]) {
sound/soc/codecs/da7213.c+11−10
@@ -214,7 +214,7 @@ static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_release_rate, · 213 unmodified lines
214214 static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol,
215215 struct snd_ctl_elem_value *ucontrol)
216216 {
217− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
217+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
218218 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
219219 int ret;
220220
@@ -228,7 +228,7 @@ static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
228228 static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol,
229229 struct snd_ctl_elem_value *ucontrol)
230230 {
231− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
231+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
232232 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
233233 int ret;
234234
@@ -242,7 +242,7 @@ static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines
242242 static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol,
243243 struct snd_ctl_elem_value *ucontrol)
244244 {
245− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
245+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
246246 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
247247 int ret;
248248
@@ -256,7 +256,7 @@ static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
256256 static int da7213_enum_locked_put(struct snd_kcontrol *kcontrol,
257257 struct snd_ctl_elem_value *ucontrol)
258258 {
259− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
259+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
260260 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
261261 int ret;
262262
@@ -420,7 +420,7 @@ static void da7213_alc_calib(struct snd_soc_component *component) · 157 unmodified lines
420420 static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol,
421421 struct snd_ctl_elem_value *ucontrol)
422422 {
423− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
423+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
424424 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
425425 int ret;
426426
@@ -436,7 +436,7 @@ static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol, · 9 unmodified lines
436436 static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol,
437437 struct snd_ctl_elem_value *ucontrol)
438438 {
439− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
439+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
440440 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
441441
442442 /* Force ALC offset calibration if enabling ALC */
@@ -457,7 +457,7 @@ static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol, · 14 unmodified lines
457457 static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol,
458458 struct snd_ctl_elem_value *ucontrol)
459459 {
460− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
460+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
461461 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
462462 struct soc_mixer_control *mixer_ctrl =
463463 (struct soc_mixer_control *) kcontrol->private_value;
@@ -484,7 +484,7 @@ static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 20 unmodified lines
484484 static int da7213_tonegen_freq_put(struct snd_kcontrol *kcontrol,
485485 struct snd_ctl_elem_value *ucontrol)
486486 {
487− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
487+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
488488 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
489489 struct soc_mixer_control *mixer_ctrl =
490490 (struct soc_mixer_control *) kcontrol->private_value;
@@ -1816,6 +1816,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 1325 unmodified lines
18161816 enum snd_soc_bias_level level)
18171817 {
18181818 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
1819+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
18191820 int ret;
18201821
18211822 switch (level) {
@@ -1823,7 +1824,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
18231824 break;
18241825 case SND_SOC_BIAS_PREPARE:
18251826 /* Enable MCLK for transition to ON state */
1826− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) {
1827+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
18271828 if (da7213->mclk) {
18281829 ret = clk_prepare_enable(da7213->mclk);
18291830 if (ret) {
@@ -1837,7 +1838,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 7 unmodified lines
18371838 }
18381839 break;
18391840 case SND_SOC_BIAS_STANDBY:
1840− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1841+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
18411842 /* Enable VMID reference & master bias */
18421843 snd_soc_component_update_bits(component, DA7213_REFERENCES,
18431844 DA7213_VMID_EN | DA7213_BIAS_EN,
sound/soc/codecs/da7218.c+11−10
@@ -425,7 +425,7 @@ static void da7218_alc_calib(struct snd_soc_component *component) · 424 unmodified lines
425425 static int da7218_mixin_gain_put(struct snd_kcontrol *kcontrol,
426426 struct snd_ctl_elem_value *ucontrol)
427427 {
428− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
428+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
429429 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
430430 int ret;
431431
@@ -446,7 +446,7 @@ static int da7218_alc_sw_put(struct snd_kcontrol *kcontrol, · 14 unmodified lines
446446 {
447447 struct soc_mixer_control *mc =
448448 (struct soc_mixer_control *) kcontrol->private_value;
449− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
449+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
450450 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
451451 unsigned int lvalue = ucontrol->value.integer.value[0];
452452 unsigned int rvalue = ucontrol->value.integer.value[1];
@@ -469,7 +469,7 @@ static int da7218_alc_sw_put(struct snd_kcontrol *kcontrol, · 16 unmodified lines
469469 static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol,
470470 struct snd_ctl_elem_value *ucontrol)
471471 {
472− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
472+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
473473 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
474474 struct soc_mixer_control *mixer_ctrl =
475475 (struct soc_mixer_control *) kcontrol->private_value;
@@ -493,7 +493,7 @@ static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 17 unmodified lines
493493 static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol,
494494 struct snd_ctl_elem_value *ucontrol)
495495 {
496− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
496+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
497497 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
498498 struct soc_mixer_control *mixer_ctrl =
499499 (struct soc_mixer_control *) kcontrol->private_value;
@@ -513,7 +513,7 @@ static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol, · 13 unmodified lines
513513 static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol,
514514 struct snd_ctl_elem_value *ucontrol)
515515 {
516− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
516+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
517517 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
518518 struct soc_mixer_control *mixer_ctrl =
519519 (struct soc_mixer_control *) kcontrol->private_value;
@@ -540,7 +540,7 @@ static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol, · 20 unmodified lines
540540 static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol,
541541 struct snd_ctl_elem_value *ucontrol)
542542 {
543− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
543+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
544544 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
545545 struct soc_mixer_control *mixer_ctrl =
546546 (struct soc_mixer_control *) kcontrol->private_value;
@@ -560,7 +560,7 @@ static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines
560560 static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol,
561561 struct snd_ctl_elem_value *ucontrol)
562562 {
563− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
563+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
564564 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
565565 struct soc_bytes_ext *bytes_ext =
566566 (struct soc_bytes_ext *) kcontrol->private_value;
@@ -585,7 +585,7 @@ static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol, · 18 unmodified lines
585585 static int da7218_biquad_coeff_put(struct snd_kcontrol *kcontrol,
586586 struct snd_ctl_elem_value *ucontrol)
587587 {
588− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
588+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
589589 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
590590 struct soc_bytes_ext *bytes_ext =
591591 (struct soc_bytes_ext *) kcontrol->private_value;
@@ -2562,6 +2562,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 1970 unmodified lines
25622562 enum snd_soc_bias_level level)
25632563 {
25642564 struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component);
2565+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
25652566 int ret;
25662567
25672568 switch (level) {
@@ -2569,7 +2570,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
25692570 break;
25702571 case SND_SOC_BIAS_PREPARE:
25712572 /* Enable MCLK for transition to ON state */
2572− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) {
2573+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
25732574 if (da7218->mclk) {
25742575 ret = clk_prepare_enable(da7218->mclk);
25752576 if (ret) {
@@ -2581,7 +2582,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines
25812582
25822583 break;
25832584 case SND_SOC_BIAS_STANDBY:
2584− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
2585+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
25852586 /* Master bias */
25862587 snd_soc_component_update_bits(component, DA7218_REFERENCES,
25872588 DA7218_BIAS_EN_MASK,
sound/soc/codecs/da7219-aad.c+5−5
@@ -53,7 +53,7 @@ static void da7219_aad_btn_det_work(struct work_struct *work) · 52 unmodified lines
5353 struct da7219_aad_priv *da7219_aad =
5454 container_of(work, struct da7219_aad_priv, btn_det_work);
5555 struct snd_soc_component *component = da7219_aad->component;
56− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
56+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
5757 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
5858 u8 statusa, micbias_ctrl;
5959 bool micbias_up = false;
@@ -109,7 +109,7 @@ static void da7219_aad_hptest_work(struct work_struct *work) · 49 unmodified lines
109109 struct da7219_aad_priv *da7219_aad =
110110 container_of(work, struct da7219_aad_priv, hptest_work);
111111 struct snd_soc_component *component = da7219_aad->component;
112− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
112+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
113113 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
114114
115115 __le16 tonegen_freq_hptest;
@@ -351,7 +351,7 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) · 235 unmodified lines
351351 {
352352 struct da7219_aad_priv *da7219_aad = data;
353353 struct snd_soc_component *component = da7219_aad->component;
354− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
354+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
355355 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
356356 u8 events[DA7219_AAD_IRQ_REG_MAX];
357357 u8 statusa;
@@ -928,7 +928,7 @@ void da7219_aad_suspend(struct snd_soc_component *component) · 570 unmodified lines
928928 {
929929 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
930930 struct da7219_aad_priv *da7219_aad = da7219->aad;
931− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
931+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
932932 u8 micbias_ctrl;
933933
934934 disable_irq(da7219_aad->irq);
@@ -962,7 +962,7 @@ void da7219_aad_resume(struct snd_soc_component *component) · 27 unmodified lines
962962 {
963963 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
964964 struct da7219_aad_priv *da7219_aad = da7219->aad;
965− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
965+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
966966
967967 if (da7219_aad->jack) {
968968 /* Re-enable micbias if previously enabled for 4-pole jack */
sound/soc/codecs/da7219.c+16−13
@@ -254,7 +254,7 @@ static const struct soc_enum da7219_cp_track_mode = · 253 unmodified lines
254254 static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol,
255255 struct snd_ctl_elem_value *ucontrol)
256256 {
257− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
257+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
258258 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
259259 int ret;
260260
@@ -268,7 +268,7 @@ static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
268268 static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol,
269269 struct snd_ctl_elem_value *ucontrol)
270270 {
271− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
271+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
272272 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
273273 int ret;
274274
@@ -282,7 +282,7 @@ static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines
282282 static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol,
283283 struct snd_ctl_elem_value *ucontrol)
284284 {
285− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
285+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
286286 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
287287 int ret;
288288
@@ -296,7 +296,7 @@ static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
296296 static int da7219_enum_locked_put(struct snd_kcontrol *kcontrol,
297297 struct snd_ctl_elem_value *ucontrol)
298298 {
299− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
299+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
300300 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
301301 int ret;
302302
@@ -376,7 +376,7 @@ static void da7219_alc_calib(struct snd_soc_component *component) · 73 unmodified lines
376376 static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol,
377377 struct snd_ctl_elem_value *ucontrol)
378378 {
379− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
379+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
380380 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
381381 int ret;
382382
@@ -395,7 +395,7 @@ static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines
395395 static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol,
396396 struct snd_ctl_elem_value *ucontrol)
397397 {
398− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
398+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
399399 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
400400
401401
@@ -414,7 +414,7 @@ static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines
414414 static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol,
415415 struct snd_ctl_elem_value *ucontrol)
416416 {
417− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
417+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
418418 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
419419 struct soc_mixer_control *mixer_ctrl =
420420 (struct soc_mixer_control *) kcontrol->private_value;
@@ -441,7 +441,7 @@ static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 20 unmodified lines
441441 static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
442442 struct snd_ctl_elem_value *ucontrol)
443443 {
444− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
444+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
445445 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
446446 struct soc_mixer_control *mixer_ctrl =
447447 (struct soc_mixer_control *) kcontrol->private_value;
@@ -1807,6 +1807,7 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 1359 unmodified lines
18071807 enum snd_soc_bias_level level)
18081808 {
18091809 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
1810+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
18101811 int ret;
18111812
18121813 switch (level) {
@@ -1814,7 +1815,7 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
18141815 break;
18151816 case SND_SOC_BIAS_PREPARE:
18161817 /* Enable MCLK for transition to ON state */
1817− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) {
1818+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
18181819 if (da7219->mclk) {
18191820 ret = clk_prepare_enable(da7219->mclk);
18201821 if (ret) {
@@ -1827,13 +1828,13 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 6 unmodified lines
18271828
18281829 break;
18291830 case SND_SOC_BIAS_STANDBY:
1830− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
1831+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
18311832 /* Master bias */
18321833 snd_soc_component_update_bits(component, DA7219_REFERENCES,
18331834 DA7219_BIAS_EN_MASK,
18341835 DA7219_BIAS_EN_MASK);
18351836
1836− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE) {
1837+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_PREPARE) {
18371838 /* Remove MCLK */
18381839 if (da7219->mclk)
18391840 clk_disable_unprepare(da7219->mclk);
@@ -2613,12 +2614,13 @@ static void da7219_remove(struct snd_soc_component *component) · 773 unmodified lines
26132614 static int da7219_suspend(struct snd_soc_component *component)
26142615 {
26152616 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
2617+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
26162618
26172619 /* Suspend AAD if we're not a wake-up source */
26182620 if (!da7219->wakeup_source)
26192621 da7219_aad_suspend(component);
26202622
2621− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2623+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
26222624
26232625 return 0;
26242626 }
@@ -2626,8 +2628,9 @@ static int da7219_suspend(struct snd_soc_component *component) · 1 unmodified line
26262628 static int da7219_resume(struct snd_soc_component *component)
26272629 {
26282630 struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
2631+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
26292632
2630− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
2633+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
26312634
26322635 /* Resume AAD if previously suspended */
26332636 if (!da7219->wakeup_source)
sound/soc/codecs/da732x.c+4−3
@@ -323,7 +323,7 @@ static SOC_ENUM_SINGLE_DECL(da732x_adc2_voice_filter_enum, · 322 unmodified lines
323323 static int da732x_hpf_set(struct snd_kcontrol *kcontrol,
324324 struct snd_ctl_elem_value *ucontrol)
325325 {
326− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
326+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
327327 struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value;
328328 unsigned int reg = enum_ctrl->reg;
329329 unsigned int sel = ucontrol->value.enumerated.item[0];
@@ -351,7 +351,7 @@ static int da732x_hpf_set(struct snd_kcontrol *kcontrol, · 21 unmodified lines
351351 static int da732x_hpf_get(struct snd_kcontrol *kcontrol,
352352 struct snd_ctl_elem_value *ucontrol)
353353 {
354− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
354+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
355355 struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value;
356356 unsigned int reg = enum_ctrl->reg;
357357 int val;
@@ -1408,6 +1408,7 @@ static int da732x_set_bias_level(struct snd_soc_component *component, · 1050 unmodified lines
14081408 enum snd_soc_bias_level level)
14091409 {
14101410 struct da732x_priv *da732x = snd_soc_component_get_drvdata(component);
1411+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
14111412
14121413 switch (level) {
14131414 case SND_SOC_BIAS_ON:
@@ -1418,7 +1419,7 @@ static int da732x_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
14181419 case SND_SOC_BIAS_PREPARE:
14191420 break;
14201421 case SND_SOC_BIAS_STANDBY:
1421− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1422+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
14221423 /* Init Codec */
14231424 snd_soc_component_write(component, DA732X_REG_REF1,
14241425 DA732X_VMID_FASTCHG);
sound/soc/codecs/da9055.c+4−2
@@ -476,7 +476,7 @@ static int da9055_get_alc_data(struct snd_soc_component *component, u8 reg_val) · 475 unmodified lines
476476 static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
477477 struct snd_ctl_elem_value *ucontrol)
478478 {
479− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
479+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
480480 u8 reg_val, adc_left, adc_right, mic_left, mic_right;
481481 int avg_left_data, avg_right_data, offset_l, offset_r;
482482
@@ -1352,12 +1352,14 @@ static struct snd_soc_dai_driver da9055_dai = { · 869 unmodified lines
13521352 static int da9055_set_bias_level(struct snd_soc_component *component,
13531353 enum snd_soc_bias_level level)
13541354 {
1355+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
1356+
13551357 switch (level) {
13561358 case SND_SOC_BIAS_ON:
13571359 case SND_SOC_BIAS_PREPARE:
13581360 break;
13591361 case SND_SOC_BIAS_STANDBY:
1360− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1362+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
13611363 /* Enable VMID reference & master bias */
13621364 snd_soc_component_update_bits(component, DA9055_REFERENCES,
13631365 DA9055_VMID_EN | DA9055_BIAS_EN,
sound/soc/codecs/es7134.c+1−1
@@ -104,7 +104,7 @@ static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 103 unmodified lines
104104
105105 static int es7134_component_probe(struct snd_soc_component *c)
106106 {
107− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(c);
107+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(c);
108108 struct es7134_data *priv = snd_soc_component_get_drvdata(c);
109109 const struct es7134_chip *chip = priv->chip;
110110 int ret;
sound/soc/codecs/es8311.c+2−1
@@ -760,6 +760,7 @@ static int es8311_set_bias_level(struct snd_soc_component *component, · 759 unmodified lines
760760 enum snd_soc_bias_level level)
761761 {
762762 struct es8311_priv *es8311 = snd_soc_component_get_drvdata(component);
763+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
763764
764765 switch (level) {
765766 case SND_SOC_BIAS_ON:
@@ -767,7 +768,7 @@ static int es8311_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
767768 case SND_SOC_BIAS_PREPARE:
768769 break;
769770 case SND_SOC_BIAS_STANDBY:
770− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
771+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
771772 int ret = clk_prepare_enable(es8311->mclk);
772773 if (ret) {
773774 dev_err(component->dev,
sound/soc/codecs/es8316.c+2−2
@@ -590,7 +590,7 @@ static struct snd_soc_dai_driver es8316_dai = { · 589 unmodified lines
590590 static void es8316_enable_micbias_for_mic_gnd_short_detect(
591591 struct snd_soc_component *component)
592592 {
593− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
593+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
594594
595595 snd_soc_dapm_mutex_lock(dapm);
596596 snd_soc_dapm_force_enable_pin_unlocked(dapm, "Bias");
@@ -605,7 +605,7 @@ static void es8316_enable_micbias_for_mic_gnd_short_detect( · 8 unmodified lines
605605 static void es8316_disable_micbias_for_mic_gnd_short_detect(
606606 struct snd_soc_component *component)
607607 {
608− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
608+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
609609
610610 snd_soc_dapm_mutex_lock(dapm);
611611 snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Bias");
sound/soc/codecs/es8326.c+8−8
@@ -737,7 +737,7 @@ static struct snd_soc_dai_driver es8326_dai = { · 736 unmodified lines
737737
738738 static void es8326_enable_micbias(struct snd_soc_component *component)
739739 {
740− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
740+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
741741
742742 snd_soc_dapm_mutex_lock(dapm);
743743 snd_soc_dapm_force_enable_pin_unlocked(dapm, "MICBIAS1");
@@ -748,7 +748,7 @@ static void es8326_enable_micbias(struct snd_soc_component *component) · 4 unmodified lines
748748
749749 static void es8326_disable_micbias(struct snd_soc_component *component)
750750 {
751− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
751+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
752752
753753 snd_soc_dapm_mutex_lock(dapm);
754754 snd_soc_dapm_disable_pin_unlocked(dapm, "MICBIAS1");
@@ -812,12 +812,12 @@ static void es8326_jack_button_handler(struct work_struct *work) · 57 unmodified lines
812812 press_count = 0;
813813 }
814814 button_to_report = cur_button;
815− queue_delayed_work(system_wq, &es8326->button_press_work,
815+ queue_delayed_work(system_dfl_wq, &es8326->button_press_work,
816816 msecs_to_jiffies(35));
817817 } else if (prev_button != cur_button) {
818818 /* mismatch, detect again */
819819 prev_button = cur_button;
820− queue_delayed_work(system_wq, &es8326->button_press_work,
820+ queue_delayed_work(system_dfl_wq, &es8326->button_press_work,
821821 msecs_to_jiffies(35));
822822 } else {
823823 /* released or no pressed */
@@ -912,7 +912,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 88 unmodified lines
912912 (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
913913 regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
914914 regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x0d);
915− queue_delayed_work(system_wq, &es8326->jack_detect_work,
915+ queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work,
916916 msecs_to_jiffies(400));
917917 es8326->hp = 1;
918918 goto exit;
@@ -923,7 +923,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 4 unmodified lines
923923 regmap_write(es8326->regmap, ES8326_INT_SOURCE,
924924 (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
925925 es8326_enable_micbias(es8326->component);
926− queue_delayed_work(system_wq, &es8326->button_press_work, 10);
926+ queue_delayed_work(system_dfl_wq, &es8326->button_press_work, 10);
927927 goto exit;
928928 }
929929 if ((iface & ES8326_HPBUTTON_FLAG) == 0x01) {
@@ -958,10 +958,10 @@ static irqreturn_t es8326_irq(int irq, void *dev_id) · 28 unmodified lines
958958 goto out;
959959
960960 if (es8326->jack->status & SND_JACK_HEADSET)
961− queue_delayed_work(system_wq, &es8326->jack_detect_work,
961+ queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work,
962962 msecs_to_jiffies(10));
963963 else
964− queue_delayed_work(system_wq, &es8326->jack_detect_work,
964+ queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work,
965965 msecs_to_jiffies(300));
966966
967967 out:
sound/soc/codecs/es8328.c+5−3
@@ -142,7 +142,7 @@ static int es8328_set_deemph(struct snd_soc_component *component) · 141 unmodified lines
142142 static int es8328_get_deemph(struct snd_kcontrol *kcontrol,
143143 struct snd_ctl_elem_value *ucontrol)
144144 {
145− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
145+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
146146 struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
147147
148148 ucontrol->value.integer.value[0] = es8328->deemph;
@@ -152,7 +152,7 @@ static int es8328_get_deemph(struct snd_kcontrol *kcontrol, · 3 unmodified lines
152152 static int es8328_put_deemph(struct snd_kcontrol *kcontrol,
153153 struct snd_ctl_elem_value *ucontrol)
154154 {
155− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
155+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
156156 struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
157157 unsigned int deemph = ucontrol->value.integer.value[0];
158158 int ret;
@@ -643,6 +643,8 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai, · 484 unmodified lines
643643 static int es8328_set_bias_level(struct snd_soc_component *component,
644644 enum snd_soc_bias_level level)
645645 {
646+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
647+
646648 switch (level) {
647649 case SND_SOC_BIAS_ON:
648650 break;
@@ -658,7 +660,7 @@ static int es8328_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines
658660 break;
659661
660662 case SND_SOC_BIAS_STANDBY:
661− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
663+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
662664 snd_soc_component_update_bits(component, ES8328_CONTROL1,
663665 ES8328_CONTROL1_VMIDSEL_MASK |
664666 ES8328_CONTROL1_ENREF,
sound/soc/codecs/es8389.c+2−2
@@ -57,8 +57,8 @@ static const DECLARE_TLV_DB_SCALE(alc_max_level, -3200, 200, 0); · 56 unmodified lines
5757 static int es8389_dmic_set(struct snd_kcontrol *kcontrol,
5858 struct snd_ctl_elem_value *ucontrol)
5959 {
60− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
61− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
60+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
61+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
6262 struct es8389_private *es8389 = snd_soc_component_get_drvdata(component);
6363 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
6464 unsigned int val;
sound/soc/codecs/fs210x.c+1−1
@@ -924,7 +924,7 @@ static int fs210x_get_drvdata_from_kctrl(struct snd_kcontrol *kctrl, · 923 unmodified lines
924924 return -EINVAL;
925925 }
926926
927− cmpnt = snd_soc_kcontrol_component(kctrl);
927+ cmpnt = snd_kcontrol_chip(kctrl);
928928 if (!cmpnt) {
929929 pr_err("fs210x: component is null\n");
930930 return -EINVAL;
sound/soc/codecs/hda.c+1−1
@@ -96,7 +96,7 @@ static int hda_codec_register_dais(struct hda_codec *codec, struct snd_soc_compo · 95 unmodified lines
9696 if (ret < 0)
9797 return ret;
9898
99− dapm = snd_soc_component_get_dapm(component);
99+ dapm = snd_soc_component_to_dapm(component);
100100
101101 list_for_each_entry(pcm, &codec->pcm_list_head, list) {
102102 struct snd_soc_dai *dai;
sound/soc/codecs/hdac_hda.c+1−3
@@ -405,8 +405,6 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) · 404 unmodified lines
405405 {
406406 struct hdac_hda_priv *hda_pvt =
407407 snd_soc_component_get_drvdata(component);
408− struct snd_soc_dapm_context *dapm =
409− snd_soc_component_get_dapm(component);
410408 struct hdac_device *hdev = &hda_pvt->codec->core;
411409 struct hda_codec *hcodec = hda_pvt->codec;
412410 struct hda_codec_driver *driver = hda_codec_to_driver(hcodec);
@@ -470,7 +468,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) · 57 unmodified lines
470468 */
471469 pm_runtime_get_noresume(&hdev->dev);
472470
473− hcodec->bus->card = dapm->card->snd_card;
471+ hcodec->bus->card = component->card->snd_card;
474472
475473 ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name);
476474 if (ret < 0) {
sound/soc/codecs/hdac_hdmi.c+20−15
@@ -769,7 +769,8 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w, · 768 unmodified lines
769769 struct snd_kcontrol *kc, int event)
770770 {
771771 struct hdac_hdmi_port *port = w->priv;
772− struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
772+ struct device *dev = snd_soc_dapm_to_dev(w->dapm);
773+ struct hdac_device *hdev = dev_to_hdac_dev(dev);
773774 struct hdac_hdmi_pcm *pcm;
774775
775776 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n",
@@ -814,7 +815,8 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w, · 38 unmodified lines
814815 struct snd_kcontrol *kc, int event)
815816 {
816817 struct hdac_hdmi_cvt *cvt = w->priv;
817− struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
818+ struct device *dev = snd_soc_dapm_to_dev(w->dapm);
819+ struct hdac_device *hdev = dev_to_hdac_dev(dev);
818820 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
819821 struct hdac_hdmi_pcm *pcm;
820822
@@ -869,7 +871,8 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, · 48 unmodified lines
869871 struct snd_kcontrol *kc, int event)
870872 {
871873 struct hdac_hdmi_port *port = w->priv;
872− struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
874+ struct device *dev = snd_soc_dapm_to_dev(w->dapm);
875+ struct hdac_device *hdev = dev_to_hdac_dev(dev);
873876 int mux_idx;
874877
875878 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n",
@@ -878,7 +881,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, · 2 unmodified lines
878881 if (!kc)
879882 kc = w->kcontrols[0];
880883
881− mux_idx = dapm_kcontrol_get_value(kc);
884+ mux_idx = snd_soc_dapm_kcontrol_get_value(kc);
882885
883886 /* set the device if pin is mst_capable */
884887 if (hdac_hdmi_port_select_set(hdev, port) < 0)
@@ -901,10 +904,11 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol, · 16 unmodified lines
901904 int ret;
902905 struct hdac_hdmi_port *p, *p_next;
903906 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
904− struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
907+ struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_to_widget(kcontrol);
905908 struct snd_soc_dapm_context *dapm = w->dapm;
909+ struct device *dev = snd_soc_dapm_to_dev(dapm);
906910 struct hdac_hdmi_port *port = w->priv;
907− struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev);
911+ struct hdac_device *hdev = dev_to_hdac_dev(dev);
908912 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
909913 struct hdac_hdmi_pcm *pcm;
910914 const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]];
@@ -1070,9 +1074,11 @@ static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_device *hdev, · 159 unmodified lines
10701074 */
10711075 static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
10721076 {
1077+ struct device *dev = snd_soc_dapm_to_dev(dapm);
1078+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
10731079 struct snd_soc_dapm_widget *widgets;
10741080 struct snd_soc_dapm_route *route;
1075− struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev);
1081+ struct hdac_device *hdev = dev_to_hdac_dev(dev);
10761082 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
10771083 struct snd_soc_dai_driver *dai_drv = hdmi->dai_drv;
10781084 char widget_name[NAME_SIZE];
@@ -1083,7 +1089,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 4 unmodified lines
10831089 if (list_empty(&hdmi->cvt_list) || list_empty(&hdmi->pin_list))
10841090 return -EINVAL;
10851091
1086− widgets = devm_kzalloc(dapm->dev, (sizeof(*widgets) *
1092+ widgets = devm_kzalloc(dev, (sizeof(*widgets) *
10871093 ((2 * hdmi->num_ports) + hdmi->num_cvt)),
10881094 GFP_KERNEL);
10891095
@@ -1093,7 +1099,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 3 unmodified lines
10931099 /* DAPM widgets to represent each converter widget */
10941100 list_for_each_entry(cvt, &hdmi->cvt_list, head) {
10951101 sprintf(widget_name, "Converter %d", cvt->nid);
1096− ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i],
1102+ ret = hdac_hdmi_fill_widget_info(dev, &widgets[i],
10971103 snd_soc_dapm_aif_in, cvt,
10981104 widget_name, dai_drv[i].playback.stream_name, NULL, 0,
10991105 hdac_hdmi_cvt_output_widget_event,
@@ -1107,7 +1113,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 7 unmodified lines
11071113 for (j = 0; j < pin->num_ports; j++) {
11081114 sprintf(widget_name, "hif%d-%d Output",
11091115 pin->nid, pin->ports[j].id);
1110− ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i],
1116+ ret = hdac_hdmi_fill_widget_info(dev, &widgets[i],
11111117 snd_soc_dapm_output, &pin->ports[j],
11121118 widget_name, NULL, NULL, 0,
11131119 hdac_hdmi_pin_output_widget_event,
@@ -1140,7 +1146,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 26 unmodified lines
11401146 }
11411147 }
11421148
1143− route = devm_kzalloc(dapm->dev, (sizeof(*route) * num_routes),
1149+ route = devm_kzalloc(dev, (sizeof(*route) * num_routes),
11441150 GFP_KERNEL);
11451151 if (!route)
11461152 return -ENOMEM;
@@ -1166,7 +1172,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 19 unmodified lines
11661172 ((2 * hdmi->num_ports) + hdmi->num_cvt));
11671173
11681174 snd_soc_dapm_add_routes(dapm, route, num_routes);
1169− snd_soc_dapm_new_widgets(dapm->card);
1175+ snd_soc_dapm_new_widgets(card);
11701176
11711177 return 0;
11721178
@@ -1666,8 +1672,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component) · 493 unmodified lines
16661672 {
16671673 struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component);
16681674 struct hdac_device *hdev = hdmi->hdev;
1669− struct snd_soc_dapm_context *dapm =
1670− snd_soc_component_get_dapm(component);
1675+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
16711676 struct hdac_ext_link *hlink;
16721677 int ret;
16731678
@@ -1698,7 +1703,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component) · 24 unmodified lines
16981703
16991704 hdac_hdmi_present_sense_all_pins(hdev, hdmi, true);
17001705 /* Imp: Store the card pointer in hda_codec */
1701− hdmi->card = dapm->card->snd_card;
1706+ hdmi->card = component->card->snd_card;
17021707
17031708 /*
17041709 * Setup a device_link between card device and HDMI codec device.
sound/soc/codecs/hdmi-codec.c+1−1
@@ -908,7 +908,7 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) · 907 unmodified lines
908908 };
909909 int ret, i;
910910
911− dapm = snd_soc_component_get_dapm(dai->component);
911+ dapm = snd_soc_component_to_dapm(dai->component);
912912
913913 /* One of the directions might be omitted for unidirectional DAIs */
914914 for (i = 0; i < ARRAY_SIZE(route); i++) {
sound/soc/codecs/idt821034.c+4−4
@@ -402,7 +402,7 @@ static int idt821034_kctrl_gain_get(struct snd_kcontrol *kcontrol, · 401 unmodified lines
402402 struct snd_ctl_elem_value *ucontrol)
403403 {
404404 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
405− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
405+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
406406 struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component);
407407 int min = mc->min;
408408 int max = mc->max;
@@ -433,7 +433,7 @@ static int idt821034_kctrl_gain_put(struct snd_kcontrol *kcontrol, · 24 unmodified lines
433433 struct snd_ctl_elem_value *ucontrol)
434434 {
435435 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
436− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
436+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
437437 struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component);
438438 struct idt821034_amp *amp;
439439 int min = mc->min;
@@ -487,7 +487,7 @@ end: · 47 unmodified lines
487487 static int idt821034_kctrl_mute_get(struct snd_kcontrol *kcontrol,
488488 struct snd_ctl_elem_value *ucontrol)
489489 {
490− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
490+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
491491 struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component);
492492 int id = kcontrol->private_value;
493493 bool is_muted;
@@ -509,7 +509,7 @@ static int idt821034_kctrl_mute_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines
509509 static int idt821034_kctrl_mute_put(struct snd_kcontrol *kcontrol,
510510 struct snd_ctl_elem_value *ucontrol)
511511 {
512− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
512+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
513513 struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component);
514514 int id = kcontrol->private_value;
515515 struct idt821034_amp *amp;
sound/soc/codecs/jz4740.c+2−1
@@ -231,6 +231,7 @@ static void jz4740_codec_wakeup(struct regmap *regmap) · 230 unmodified lines
231231 static int jz4740_codec_set_bias_level(struct snd_soc_component *component,
232232 enum snd_soc_bias_level level)
233233 {
234+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
234235 struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component);
235236 struct regmap *regmap = jz4740_codec->regmap;
236237 unsigned int mask;
@@ -247,7 +248,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_component *component, · 10 unmodified lines
247248 break;
248249 case SND_SOC_BIAS_STANDBY:
249250 /* The only way to clear the suspend flag is to reset the codec */
250− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
251+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
251252 jz4740_codec_wakeup(regmap);
252253
253254 mask = JZ4740_CODEC_1_VREF_DISABLE |
sound/soc/codecs/jz4760.c+4−3
@@ -197,7 +197,7 @@ static int jz4760_codec_startup(struct snd_pcm_substream *substream, · 196 unmodified lines
197197 struct snd_soc_dai *dai)
198198 {
199199 struct snd_soc_component *codec = dai->component;
200− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
200+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
201201 int ret = 0;
202202
203203 /*
@@ -214,7 +214,7 @@ static void jz4760_codec_shutdown(struct snd_pcm_substream *substream, · 10 unmodified lines
214214 struct snd_soc_dai *dai)
215215 {
216216 struct snd_soc_component *codec = dai->component;
217− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
217+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
218218
219219 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
220220 snd_soc_dapm_disable_pin(dapm, "SYSCLK");
@@ -225,6 +225,7 @@ static int jz4760_codec_pcm_trigger(struct snd_pcm_substream *substream, · 4 unmodified lines
225225 int cmd, struct snd_soc_dai *dai)
226226 {
227227 struct snd_soc_component *codec = dai->component;
228+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
228229 int ret = 0;
229230
230231 switch (cmd) {
@@ -232,7 +233,7 @@ static int jz4760_codec_pcm_trigger(struct snd_pcm_substream *substream, · 1 unmodified line
232233 case SNDRV_PCM_TRIGGER_RESUME:
233234 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
234235 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
235− snd_soc_component_force_bias_level(codec, SND_SOC_BIAS_ON);
236+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON);
236237 break;
237238 case SNDRV_PCM_TRIGGER_STOP:
238239 case SNDRV_PCM_TRIGGER_SUSPEND:
sound/soc/codecs/jz4770.c+4−4
@@ -217,7 +217,7 @@ static int jz4770_codec_startup(struct snd_pcm_substream *substream, · 216 unmodified lines
217217 struct snd_soc_dai *dai)
218218 {
219219 struct snd_soc_component *codec = dai->component;
220− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
220+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
221221
222222 /*
223223 * SYSCLK output from the codec to the AIC is required to keep the
@@ -234,7 +234,7 @@ static void jz4770_codec_shutdown(struct snd_pcm_substream *substream, · 10 unmodified lines
234234 struct snd_soc_dai *dai)
235235 {
236236 struct snd_soc_component *codec = dai->component;
237− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
237+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
238238
239239 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
240240 snd_soc_dapm_disable_pin(dapm, "SYSCLK");
@@ -245,6 +245,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream, · 4 unmodified lines
245245 int cmd, struct snd_soc_dai *dai)
246246 {
247247 struct snd_soc_component *codec = dai->component;
248+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
248249 int ret = 0;
249250
250251 switch (cmd) {
@@ -252,8 +253,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream, · 1 unmodified line
252253 case SNDRV_PCM_TRIGGER_RESUME:
253254 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
254255 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
255− snd_soc_component_force_bias_level(codec,
256− SND_SOC_BIAS_ON);
256+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON);
257257 break;
258258 case SNDRV_PCM_TRIGGER_STOP:
259259 case SNDRV_PCM_TRIGGER_SUSPEND:
sound/soc/codecs/lm49453.c+2−1
@@ -1255,6 +1255,7 @@ static int lm49453_set_bias_level(struct snd_soc_component *component, · 1254 unmodified lines
12551255 enum snd_soc_bias_level level)
12561256 {
12571257 struct lm49453_priv *lm49453 = snd_soc_component_get_drvdata(component);
1258+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12581259
12591260 switch (level) {
12601261 case SND_SOC_BIAS_ON:
@@ -1262,7 +1263,7 @@ static int lm49453_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
12621263 break;
12631264
12641265 case SND_SOC_BIAS_STANDBY:
1265− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
1266+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
12661267 regcache_sync(lm49453->regmap);
12671268
12681269 snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG,
sound/soc/codecs/lpass-rx-macro.c+56−60
@@ -1682,7 +1682,7 @@ static const struct regmap_config rx_regmap_config = { · 1681 unmodified lines
16821682 static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol,
16831683 struct snd_ctl_elem_value *ucontrol)
16841684 {
1685− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
1685+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
16861686 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
16871687 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
16881688 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -1905,52 +1905,48 @@ static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) · 216 unmodified lines
19051905 {
19061906 struct snd_soc_component *component = dai->component;
19071907 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1908− uint16_t j, reg, mix_reg, dsm_reg;
1909− u16 int_mux_cfg0, int_mux_cfg1;
1908+ u32 port, j, reg, mix_reg, int_mux_cfg0, int_mux_cfg1;
1909+ u32 mask, val;
19101910 u8 int_mux_cfg0_val, int_mux_cfg1_val;
19111911
1912− switch (dai->id) {
1913− case RX_MACRO_AIF1_PB:
1914− case RX_MACRO_AIF2_PB:
1915− case RX_MACRO_AIF3_PB:
1916− case RX_MACRO_AIF4_PB:
1917− for (j = 0; j < INTERP_MAX; j++) {
1918− reg = CDC_RX_RXn_RX_PATH_CTL(rx, j);
1919− mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j);
1920− dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, j);
1921−
1922− if (mute) {
1923− snd_soc_component_update_bits(component, reg,
1924− CDC_RX_PATH_PGA_MUTE_MASK,
1925− CDC_RX_PATH_PGA_MUTE_ENABLE);
1926− snd_soc_component_update_bits(component, mix_reg,
1927− CDC_RX_PATH_PGA_MUTE_MASK,
1928− CDC_RX_PATH_PGA_MUTE_ENABLE);
1929− } else {
1930− snd_soc_component_update_bits(component, reg,
1931− CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
1932− snd_soc_component_update_bits(component, mix_reg,
1933− CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
1912+ if (stream != SNDRV_PCM_STREAM_PLAYBACK)
1913+ return 0;
1914+
1915+ for (j = 0; j < INTERP_MAX; j++) {
1916+ reg = CDC_RX_RXn_RX_PATH_CTL(rx, j);
1917+ mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j);
1918+
1919+ mask = CDC_RX_PATH_PGA_MUTE_MASK;
1920+ val = 0;
1921+ if (mute)
1922+ val |= CDC_RX_PATH_PGA_MUTE_ENABLE;
1923+ if (rx->main_clk_users[j] > 0) {
1924+ mask |= CDC_RX_PATH_CLK_EN_MASK;
1925+ val |= CDC_RX_PATH_CLK_ENABLE;
1926+ }
1927+
1928+ int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8;
1929+ int_mux_cfg1 = int_mux_cfg0 + 4;
1930+ int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0);
1931+ int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1);
1932+
1933+ for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) {
1934+ if (((int_mux_cfg0_val & 0x0f) == port + INTn_1_INP_SEL_RX0) ||
1935+ ((int_mux_cfg0_val >> 4) == port + INTn_1_INP_SEL_RX0) ||
1936+ ((int_mux_cfg1_val >> 4) == port + INTn_1_INP_SEL_RX0)) {
1937+ snd_soc_component_update_bits(component, reg, mask, val);
19341938 }
19351939
1936− int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8;
1937− int_mux_cfg1 = int_mux_cfg0 + 4;
1938− int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0);
1939− int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1);
1940−
1941− if (snd_soc_component_read(component, dsm_reg) & 0x01) {
1942− if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0))
1943− snd_soc_component_update_bits(component, reg, 0x20, 0x20);
1944− if (int_mux_cfg1_val & 0x0F) {
1945− snd_soc_component_update_bits(component, reg, 0x20, 0x20);
1946− snd_soc_component_update_bits(component, mix_reg, 0x20,
1947− 0x20);
1940+ if ((int_mux_cfg1_val & 0x0f) == port + INTn_2_INP_SEL_RX0) {
1941+ snd_soc_component_update_bits(component, mix_reg, mask, val);
1942+ /* main clock needs to be enabled for mix to be useful: */
1943+ if (rx->main_clk_users[j] > 0) {
1944+ snd_soc_component_update_bits(component, reg,
1945+ CDC_RX_PATH_CLK_EN_MASK,
1946+ CDC_RX_PATH_CLK_ENABLE);
19481947 }
19491948 }
19501949 }
1951− break;
1952− default:
1953− break;
19541950 }
19551951 return 0;
19561952 }
@@ -2434,8 +2430,7 @@ static void rx_macro_hd2_control(struct snd_soc_component *component, · 477 unmodified lines
24342430 static int rx_macro_get_compander(struct snd_kcontrol *kcontrol,
24352431 struct snd_ctl_elem_value *ucontrol)
24362432 {
2437− struct snd_soc_component *component =
2438− snd_soc_kcontrol_component(kcontrol);
2433+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
24392434 int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
24402435 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
24412436
@@ -2446,7 +2441,7 @@ static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, · 4 unmodified lines
24462441 static int rx_macro_set_compander(struct snd_kcontrol *kcontrol,
24472442 struct snd_ctl_elem_value *ucontrol)
24482443 {
2449− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2444+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
24502445 int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
24512446 int value = ucontrol->value.integer.value[0];
24522447 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
@@ -2459,7 +2454,7 @@ static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, · 6 unmodified lines
24592454 static int rx_macro_mux_get(struct snd_kcontrol *kcontrol,
24602455 struct snd_ctl_elem_value *ucontrol)
24612456 {
2462− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
2457+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
24632458 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
24642459 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
24652460
@@ -2471,7 +2466,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
24712466 static int rx_macro_mux_put(struct snd_kcontrol *kcontrol,
24722467 struct snd_ctl_elem_value *ucontrol)
24732468 {
2474− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
2469+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
24752470 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
24762471 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
24772472 struct snd_soc_dapm_update *update = NULL;
@@ -2548,7 +2543,7 @@ static const struct snd_kcontrol_new rx_macro_rx5_mux = · 70 unmodified lines
25482543 static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol,
25492544 struct snd_ctl_elem_value *ucontrol)
25502545 {
2551− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2546+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
25522547 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
25532548
25542549 ucontrol->value.integer.value[0] = rx->is_ear_mode_on;
@@ -2558,7 +2553,7 @@ static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
25582553 static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol,
25592554 struct snd_ctl_elem_value *ucontrol)
25602555 {
2561− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2556+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
25622557 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
25632558
25642559 rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true);
@@ -2568,7 +2563,7 @@ static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
25682563 static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol,
25692564 struct snd_ctl_elem_value *ucontrol)
25702565 {
2571− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2566+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
25722567 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
25732568
25742569 ucontrol->value.integer.value[0] = rx->hph_hd2_mode;
@@ -2578,7 +2573,7 @@ static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
25782573 static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol,
25792574 struct snd_ctl_elem_value *ucontrol)
25802575 {
2581− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2576+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
25822577 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
25832578
25842579 rx->hph_hd2_mode = ucontrol->value.integer.value[0];
@@ -2588,7 +2583,7 @@ static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
25882583 static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol,
25892584 struct snd_ctl_elem_value *ucontrol)
25902585 {
2591− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2586+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
25922587 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
25932588
25942589 ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode;
@@ -2598,7 +2593,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
25982593 static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol,
25992594 struct snd_ctl_elem_value *ucontrol)
26002595 {
2601− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2596+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
26022597 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
26032598
26042599 rx->hph_pwr_mode = ucontrol->value.enumerated.item[0];
@@ -2608,7 +2603,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines
26082603 static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol,
26092604 struct snd_ctl_elem_value *ucontrol)
26102605 {
2611− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2606+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
26122607 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
26132608
26142609 ucontrol->value.integer.value[0] = rx->is_softclip_on;
@@ -2619,7 +2614,7 @@ static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
26192614 static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
26202615 struct snd_ctl_elem_value *ucontrol)
26212616 {
2622− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2617+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
26232618 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
26242619
26252620 rx->is_softclip_on = ucontrol->value.integer.value[0];
@@ -2630,7 +2625,7 @@ static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines
26302625 static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol,
26312626 struct snd_ctl_elem_value *ucontrol)
26322627 {
2633− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2628+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
26342629 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
26352630
26362631 ucontrol->value.integer.value[0] = rx->is_aux_hpf_on;
@@ -2641,7 +2636,7 @@ static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
26412636 static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol,
26422637 struct snd_ctl_elem_value *ucontrol)
26432638 {
2644− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2639+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
26452640 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
26462641
26472642 rx->is_aux_hpf_on = ucontrol->value.integer.value[0];
@@ -2930,8 +2925,7 @@ static int rx_macro_put_iir_band_audio_mixer( · 282 unmodified lines
29302925 struct snd_kcontrol *kcontrol,
29312926 struct snd_ctl_elem_value *ucontrol)
29322927 {
2933− struct snd_soc_component *component =
2934− snd_soc_kcontrol_component(kcontrol);
2928+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
29352929 struct wcd_iir_filter_ctl *ctl =
29362930 (struct wcd_iir_filter_ctl *)kcontrol->private_value;
29372931 struct soc_bytes_ext *params = &ctl->bytes_ext;
@@ -2959,8 +2953,7 @@ static int rx_macro_put_iir_band_audio_mixer( · 21 unmodified lines
29592953 static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol,
29602954 struct snd_ctl_elem_value *ucontrol)
29612955 {
2962− struct snd_soc_component *component =
2963− snd_soc_kcontrol_component(kcontrol);
2956+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
29642957 struct wcd_iir_filter_ctl *ctl =
29652958 (struct wcd_iir_filter_ctl *)kcontrol->private_value;
29662959 struct soc_bytes_ext *params = &ctl->bytes_ext;
@@ -3612,7 +3605,7 @@ static const struct snd_soc_dapm_route rx_audio_map[] = { · 645 unmodified lines
36123605
36133606 static int rx_macro_component_probe(struct snd_soc_component *component)
36143607 {
3615− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3608+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
36163609 struct rx_macro *rx = snd_soc_component_get_drvdata(component);
36173610 const struct snd_soc_dapm_widget *widgets;
36183611 const struct snd_kcontrol_new *controls;
@@ -3954,6 +3947,9 @@ static const struct of_device_id rx_macro_dt_match[] = { · 335 unmodified lines
39543947 .compatible = "qcom,sc7280-lpass-rx-macro",
39553948 .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
39563949
3950+ }, {
3951+ .compatible = "qcom,sm6115-lpass-rx-macro",
3952+ .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
39573953 }, {
39583954 .compatible = "qcom,sm8250-lpass-rx-macro",
39593955 .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
sound/soc/codecs/lpass-tx-macro.c+10−9
@@ -800,7 +800,7 @@ static void tx_macro_update_smic_sel_v9_2(struct snd_soc_component *component, · 799 unmodified lines
800800 static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
801801 struct snd_ctl_elem_value *ucontrol)
802802 {
803− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
803+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
804804 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
805805 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
806806 struct tx_macro *tx = snd_soc_component_get_drvdata(component);
@@ -859,7 +859,7 @@ static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol, · 52 unmodified lines
859859 static int tx_macro_tx_mixer_get(struct snd_kcontrol *kcontrol,
860860 struct snd_ctl_elem_value *ucontrol)
861861 {
862− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
862+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
863863 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
864864 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
865865 u32 dai_id = widget->shift;
@@ -877,7 +877,7 @@ static int tx_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, · 11 unmodified lines
877877 static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
878878 struct snd_ctl_elem_value *ucontrol)
879879 {
880− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
880+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
881881 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
882882 struct snd_soc_dapm_update *update = NULL;
883883 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
@@ -1070,7 +1070,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, · 186 unmodified lines
10701070 static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol,
10711071 struct snd_ctl_elem_value *ucontrol)
10721072 {
1073− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1073+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10741074 struct tx_macro *tx = snd_soc_component_get_drvdata(component);
10751075 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10761076 int path = e->shift_l;
@@ -1083,7 +1083,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines
10831083 static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
10841084 struct snd_ctl_elem_value *ucontrol)
10851085 {
1086− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1086+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10871087 int value = ucontrol->value.integer.value[0];
10881088 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10891089 int path = e->shift_l;
@@ -1100,7 +1100,7 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, · 10 unmodified lines
11001100 static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol,
11011101 struct snd_ctl_elem_value *ucontrol)
11021102 {
1103− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1103+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11041104 struct tx_macro *tx = snd_soc_component_get_drvdata(component);
11051105
11061106 ucontrol->value.integer.value[0] = tx->bcs_enable;
@@ -1111,7 +1111,7 @@ static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, · 4 unmodified lines
11111111 static int tx_macro_set_bcs(struct snd_kcontrol *kcontrol,
11121112 struct snd_ctl_elem_value *ucontrol)
11131113 {
1114− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1114+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11151115 int value = ucontrol->value.integer.value[0];
11161116 struct tx_macro *tx = snd_soc_component_get_drvdata(component);
11171117
@@ -2081,7 +2081,7 @@ static const struct snd_kcontrol_new tx_macro_snd_controls[] = { · 963 unmodified lines
20812081
20822082 static int tx_macro_component_extend(struct snd_soc_component *comp)
20832083 {
2084− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(comp);
2084+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp);
20852085 struct tx_macro *tx = snd_soc_component_get_drvdata(comp);
20862086 int ret;
20872087
@@ -2473,7 +2473,8 @@ static const struct tx_macro_data lpass_ver_9_2 = { · 385 unmodified lines
24732473 };
24742474
24752475 static const struct tx_macro_data lpass_ver_10_sm6115 = {
2476− .flags = LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
2476+ .flags = LPASS_MACRO_FLAG_HAS_NPL_CLOCK |
2477+ LPASS_MACRO_FLAG_RESET_SWR,
24772478 .ver = LPASS_VER_10_0_0,
24782479 .extra_widgets = tx_macro_dapm_widgets_v9_2,
24792480 .extra_widgets_num = ARRAY_SIZE(tx_macro_dapm_widgets_v9_2),
sound/soc/codecs/lpass-va-macro.c+69−35
@@ -1,6 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
33
4+#include <linux/bitfield.h>
45 #include <linux/clk.h>
56 #include <linux/clk-provider.h>
67 #include <linux/init.h>
@@ -64,8 +65,15 @@ · 57 unmodified lines
6465 #define CDC_VA_TOP_CSR_I2S_CLK (0x00A8)
6566 #define CDC_VA_TOP_CSR_I2S_RESET (0x00AC)
6667 #define CDC_VA_TOP_CSR_CORE_ID_0 (0x00C0)
68+ #define CORE_ID_0_REV_MAJ GENMASK(7, 0)
6769 #define CDC_VA_TOP_CSR_CORE_ID_1 (0x00C4)
70+#define CORE_ID_1_HAS_WSAMACRO BIT(0)
71+#define CORE_ID_1_HAS_RXMACRO BIT(1)
72+#define CORE_ID_1_HAS_TXMACRO BIT(2)
73+#define CORE_ID_1_HAS_VAMACRO BIT(3)
6874 #define CDC_VA_TOP_CSR_CORE_ID_2 (0x00C8)
75+ #define CORE_ID_2_REV_MIN GENMASK(7, 4)
76+ #define CORE_ID_2_REV_STEP GENMASK(3, 0)
6977 #define CDC_VA_TOP_CSR_CORE_ID_3 (0x00CC)
7078 #define CDC_VA_TOP_CSR_SWR_MIC_CTL0 (0x00D0)
7179 #define CDC_VA_TOP_CSR_SWR_MIC_CTL1 (0x00D4)
@@ -516,8 +524,7 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w, · 444 unmodified lines
516524 static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
517525 struct snd_ctl_elem_value *ucontrol)
518526 {
519− struct snd_soc_dapm_widget *widget =
520− snd_soc_dapm_kcontrol_widget(kcontrol);
527+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
521528 struct snd_soc_component *component =
522529 snd_soc_dapm_to_component(widget->dapm);
523530 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -556,8 +563,7 @@ static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol, · 32 unmodified lines
556563 static int va_macro_tx_mixer_get(struct snd_kcontrol *kcontrol,
557564 struct snd_ctl_elem_value *ucontrol)
558565 {
559− struct snd_soc_dapm_widget *widget =
560− snd_soc_dapm_kcontrol_widget(kcontrol);
566+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
561567 struct snd_soc_component *component =
562568 snd_soc_dapm_to_component(widget->dapm);
563569 struct soc_mixer_control *mc =
@@ -577,8 +583,7 @@ static int va_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines
577583 static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
578584 struct snd_ctl_elem_value *ucontrol)
579585 {
580− struct snd_soc_dapm_widget *widget =
581− snd_soc_dapm_kcontrol_widget(kcontrol);
586+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
582587 struct snd_soc_component *component =
583588 snd_soc_dapm_to_component(widget->dapm);
584589 struct snd_soc_dapm_update *update = NULL;
@@ -819,7 +824,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, · 234 unmodified lines
819824 static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol,
820825 struct snd_ctl_elem_value *ucontrol)
821826 {
822− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
827+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
823828 struct va_macro *va = snd_soc_component_get_drvdata(comp);
824829 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
825830 int path = e->shift_l;
@@ -832,7 +837,7 @@ static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines
832837 static int va_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
833838 struct snd_ctl_elem_value *ucontrol)
834839 {
835− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
840+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
836841 int value = ucontrol->value.enumerated.item[0];
837842 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
838843 int path = e->shift_l;
@@ -1462,39 +1467,63 @@ undefined_rate: · 623 unmodified lines
14621467 return dmic_sample_rate;
14631468 }
14641469
1465−static void va_macro_set_lpass_codec_version(struct va_macro *va)
1470+static int va_macro_set_lpass_codec_version(struct va_macro *va)
14661471 {
1467− int core_id_0 = 0, core_id_1 = 0, core_id_2 = 0;
14681472 int version = LPASS_CODEC_VERSION_UNKNOWN;
1473+ u32 maj, min, step;
1474+ u32 val;
14691475
1470− regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &core_id_0);
1471− regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &core_id_1);
1472− regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_2, &core_id_2);
1476+ regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &val);
1477+ maj = FIELD_GET(CORE_ID_0_REV_MAJ, val);
14731478
1474− if ((core_id_0 == 0x01) && (core_id_1 == 0x0F))
1475− version = LPASS_CODEC_VERSION_2_0;
1476− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && core_id_2 == 0x01)
1479+ regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &val);
1480+ if (!FIELD_GET(CORE_ID_1_HAS_VAMACRO, val)) {
1481+ dev_err(va->dev, "This is not a VA macro instance\n");
1482+ return -ENODEV;
1483+ }
1484+
1485+ regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_2, &val);
1486+ min = FIELD_GET(CORE_ID_2_REV_MIN, val);
1487+ step = FIELD_GET(CORE_ID_2_REV_STEP, val);
1488+
1489+ if (maj == 1) {
14771490 version = LPASS_CODEC_VERSION_2_0;
1478− if ((core_id_0 == 0x02) && (core_id_1 == 0x0E))
1479− version = LPASS_CODEC_VERSION_2_1;
1480− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x50 || core_id_2 == 0x51))
1481− version = LPASS_CODEC_VERSION_2_5;
1482− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x60 || core_id_2 == 0x61))
1483− version = LPASS_CODEC_VERSION_2_6;
1484− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x70 || core_id_2 == 0x71))
1485− version = LPASS_CODEC_VERSION_2_7;
1486− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x80 || core_id_2 == 0x81))
1487− version = LPASS_CODEC_VERSION_2_8;
1488− if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x90 || core_id_2 == 0x91))
1489− version = LPASS_CODEC_VERSION_2_9;
1490−
1491− if (version == LPASS_CODEC_VERSION_UNKNOWN)
1492− dev_warn(va->dev, "Unknown Codec version, ID: %02x / %02x / %02x\n",
1493− core_id_0, core_id_1, core_id_2);
1491+ } else if (maj == 2) {
1492+ switch (min) {
1493+ case 0:
1494+ version = LPASS_CODEC_VERSION_2_0;
1495+ break;
1496+ case 5:
1497+ version = LPASS_CODEC_VERSION_2_5;
1498+ break;
1499+ case 6:
1500+ version = LPASS_CODEC_VERSION_2_6;
1501+ break;
1502+ case 7:
1503+ version = LPASS_CODEC_VERSION_2_7;
1504+ break;
1505+ case 8:
1506+ version = LPASS_CODEC_VERSION_2_8;
1507+ break;
1508+ case 9:
1509+ version = LPASS_CODEC_VERSION_2_9;
1510+ break;
1511+ default:
1512+ break;
1513+ }
1514+ }
1515+
1516+ if (version == LPASS_CODEC_VERSION_UNKNOWN) {
1517+ dev_err(va->dev, "VA Macro v%u.%u.%u is not supported\n",
1518+ maj, min, step);
1519+ return -EOPNOTSUPP;
1520+ }
14941521
14951522 lpass_macro_set_codec_version(version);
14961523
14971524 dev_dbg(va->dev, "LPASS Codec Version %s\n", lpass_macro_get_codec_version_string(version));
1525+
1526+ return 0;
14981527 }
14991528
15001529 static int va_macro_probe(struct platform_device *pdev)
@@ -1594,10 +1623,14 @@ static int va_macro_probe(struct platform_device *pdev) · 93 unmodified lines
15941623 * old version of codecs do not have a reliable way to determine the
15951624 * version from registers, get them from soc specific data
15961625 */
1597− if (data->version)
1626+ if (data->version) {
15981627 lpass_macro_set_codec_version(data->version);
1599− else /* read version from register */
1600− va_macro_set_lpass_codec_version(va);
1628+ } else {
1629+ /* read version from register */
1630+ ret = va_macro_set_lpass_codec_version(va);
1631+ if (ret)
1632+ goto err_clkout;
1633+ }
16011634
16021635 if (va->has_swr_master) {
16031636 /* Set default CLK div to 1 */
@@ -1723,6 +1756,7 @@ static const struct dev_pm_ops va_macro_pm_ops = { · 119 unmodified lines
17231756
17241757 static const struct of_device_id va_macro_dt_match[] = {
17251758 { .compatible = "qcom,sc7280-lpass-va-macro", .data = &sm8250_va_data },
1759+ { .compatible = "qcom,sm6115-lpass-va-macro", .data = &sm8450_va_data },
17261760 { .compatible = "qcom,sm8250-lpass-va-macro", .data = &sm8250_va_data },
17271761 { .compatible = "qcom,sm8450-lpass-va-macro", .data = &sm8450_va_data },
17281762 { .compatible = "qcom,sm8550-lpass-va-macro", .data = &sm8550_va_data },
sound/soc/codecs/lpass-wsa-macro.c+30−139
@@ -297,8 +297,7 @@ enum { · 296 unmodified lines
297297 enum {
298298 WSA_MACRO_RX0 = 0,
299299 WSA_MACRO_RX1,
300− WSA_MACRO_RX_MIX,
301− WSA_MACRO_RX_MIX0 = WSA_MACRO_RX_MIX,
300+ WSA_MACRO_RX_MIX0,
302301 WSA_MACRO_RX_MIX1,
303302 WSA_MACRO_RX_MAX,
304303 };
@@ -1168,12 +1167,6 @@ static int wsa_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai, · 863 unmodified lines
11681167
11691168 for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) {
11701169 int_1_mix1_inp = port;
1171− if ((int_1_mix1_inp < WSA_MACRO_RX0) || (int_1_mix1_inp > WSA_MACRO_RX_MIX1)) {
1172− dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n",
1173− __func__, dai->id);
1174− return -EINVAL;
1175− }
1176−
11771170 int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0;
11781171
11791172 /*
@@ -1220,11 +1213,6 @@ static int wsa_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai, · 40 unmodified lines
12201213
12211214 for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) {
12221215 int_2_inp = port;
1223− if ((int_2_inp < WSA_MACRO_RX0) || (int_2_inp > WSA_MACRO_RX_MIX1)) {
1224− dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n",
1225− __func__, dai->id);
1226− return -EINVAL;
1227− }
12281216
12291217 int_mux_cfg1 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG1;
12301218 for (j = 0; j < NUM_INTERPOLATORS; j++) {
@@ -1574,41 +1562,6 @@ static int wsa_macro_enable_vi_feedback(struct snd_soc_dapm_widget *w, · 343 unmodified lines
15741562 return 0;
15751563 }
15761564
1577−static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w,
1578− struct snd_kcontrol *kcontrol, int event)
1579−{
1580− struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1581− u16 path_reg, gain_reg;
1582− int val;
1583−
1584− switch (w->shift) {
1585− case WSA_MACRO_RX_MIX0:
1586− path_reg = CDC_WSA_RX0_RX_PATH_MIX_CTL;
1587− gain_reg = CDC_WSA_RX0_RX_VOL_MIX_CTL;
1588− break;
1589− case WSA_MACRO_RX_MIX1:
1590− path_reg = CDC_WSA_RX1_RX_PATH_MIX_CTL;
1591− gain_reg = CDC_WSA_RX1_RX_VOL_MIX_CTL;
1592− break;
1593− default:
1594− return 0;
1595− }
1596−
1597− switch (event) {
1598− case SND_SOC_DAPM_POST_PMU:
1599− val = snd_soc_component_read(component, gain_reg);
1600− snd_soc_component_write(component, gain_reg, val);
1601− break;
1602− case SND_SOC_DAPM_POST_PMD:
1603− snd_soc_component_update_bits(component, path_reg,
1604− CDC_WSA_RX_PATH_MIX_CLK_EN_MASK,
1605− CDC_WSA_RX_PATH_MIX_CLK_DISABLE);
1606− break;
1607− }
1608−
1609− return 0;
1610−}
1611−
16121565 static void wsa_macro_hd2_control(struct snd_soc_component *component,
16131566 u16 reg, int event)
16141567 {
@@ -1772,59 +1725,6 @@ static int wsa_macro_config_softclip(struct snd_soc_component *component, · 157 unmodified lines
17721725 return 0;
17731726 }
17741727
1775−static bool wsa_macro_adie_lb(struct snd_soc_component *component,
1776− int interp_idx)
1777−{
1778− struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
1779− u16 int_mux_cfg0, int_mux_cfg1;
1780− u8 int_n_inp0, int_n_inp1, int_n_inp2;
1781−
1782− int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0 + interp_idx * 8;
1783− int_mux_cfg1 = int_mux_cfg0 + 4;
1784−
1785− int_n_inp0 = snd_soc_component_read_field(component, int_mux_cfg0,
1786− wsa->reg_layout->rx_intx_1_mix_inp0_sel_mask);
1787− if (int_n_inp0 == INTn_1_INP_SEL_DEC0 ||
1788− int_n_inp0 == INTn_1_INP_SEL_DEC1)
1789− return true;
1790−
1791− int_n_inp1 = snd_soc_component_read_field(component, int_mux_cfg0,
1792− wsa->reg_layout->rx_intx_1_mix_inp1_sel_mask);
1793− if (int_n_inp1 == INTn_1_INP_SEL_DEC0 ||
1794− int_n_inp1 == INTn_1_INP_SEL_DEC1)
1795− return true;
1796−
1797− int_n_inp2 = snd_soc_component_read_field(component, int_mux_cfg1,
1798− wsa->reg_layout->rx_intx_1_mix_inp2_sel_mask);
1799− if (int_n_inp2 == INTn_1_INP_SEL_DEC0 ||
1800− int_n_inp2 == INTn_1_INP_SEL_DEC1)
1801− return true;
1802−
1803− return false;
1804−}
1805−
1806−static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w,
1807− struct snd_kcontrol *kcontrol,
1808− int event)
1809−{
1810− struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1811− u16 reg;
1812−
1813− reg = CDC_WSA_RX0_RX_PATH_CTL + WSA_MACRO_RX_PATH_OFFSET * w->shift;
1814− switch (event) {
1815− case SND_SOC_DAPM_PRE_PMU:
1816− if (wsa_macro_adie_lb(component, w->shift)) {
1817− snd_soc_component_update_bits(component, reg,
1818− CDC_WSA_RX_PATH_CLK_EN_MASK,
1819− CDC_WSA_RX_PATH_CLK_ENABLE);
1820− }
1821− break;
1822− default:
1823− break;
1824− }
1825− return 0;
1826−}
1827−
18281728 static int wsa_macro_interp_get_primary_reg(u16 reg, u16 *ind)
18291729 {
18301730 u16 prim_int_reg = 0;
@@ -1942,7 +1842,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 111 unmodified lines
19421842 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
19431843 u16 gain_reg;
19441844 u16 reg;
1945− int val;
19461845 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
19471846
19481847 if (w->shift == WSA_MACRO_COMP1) {
@@ -1982,8 +1881,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 33 unmodified lines
19821881 CDC_WSA_RX_PGA_HALF_DB_MASK,
19831882 CDC_WSA_RX_PGA_HALF_DB_ENABLE);
19841883 }
1985− val = snd_soc_component_read(component, gain_reg);
1986− snd_soc_component_write(component, gain_reg, val);
19871884 wsa_macro_config_ear_spkr_gain(component, wsa,
19881885 event, gain_reg);
19891886 break;
@@ -2114,7 +2011,7 @@ static int wsa_macro_get_ec_hq(struct snd_kcontrol *kcontrol, · 124 unmodified lines
21142011 struct snd_ctl_elem_value *ucontrol)
21152012 {
21162013
2117− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2014+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21182015 int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
21192016 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
21202017
@@ -2126,7 +2023,7 @@ static int wsa_macro_get_ec_hq(struct snd_kcontrol *kcontrol, · 5 unmodified lines
21262023 static int wsa_macro_set_ec_hq(struct snd_kcontrol *kcontrol,
21272024 struct snd_ctl_elem_value *ucontrol)
21282025 {
2129− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2026+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21302027 int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
21312028 int value = ucontrol->value.integer.value[0];
21322029 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
@@ -2140,7 +2037,7 @@ static int wsa_macro_get_compander(struct snd_kcontrol *kcontrol, · 7 unmodified lines
21402037 struct snd_ctl_elem_value *ucontrol)
21412038 {
21422039
2143− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2040+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21442041 int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
21452042 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
21462043
@@ -2151,7 +2048,7 @@ static int wsa_macro_get_compander(struct snd_kcontrol *kcontrol, · 4 unmodified lines
21512048 static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol,
21522049 struct snd_ctl_elem_value *ucontrol)
21532050 {
2154− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2051+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21552052 int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
21562053 int value = ucontrol->value.integer.value[0];
21572054 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
@@ -2164,7 +2061,7 @@ static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol, · 6 unmodified lines
21642061 static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
21652062 struct snd_ctl_elem_value *ucontrol)
21662063 {
2167− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2064+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21682065 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
21692066
21702067 ucontrol->value.integer.value[0] = wsa->ear_spkr_gain;
@@ -2175,7 +2072,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
21752072 static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
21762073 struct snd_ctl_elem_value *ucontrol)
21772074 {
2178− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2075+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
21792076 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
21802077
21812078 wsa->ear_spkr_gain = ucontrol->value.integer.value[0];
@@ -2186,8 +2083,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines
21862083 static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol,
21872084 struct snd_ctl_elem_value *ucontrol)
21882085 {
2189− struct snd_soc_dapm_widget *widget =
2190− snd_soc_dapm_kcontrol_widget(kcontrol);
2086+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
21912087 struct snd_soc_component *component =
21922088 snd_soc_dapm_to_component(widget->dapm);
21932089 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
@@ -2200,8 +2096,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines
22002096 static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
22012097 struct snd_ctl_elem_value *ucontrol)
22022098 {
2203− struct snd_soc_dapm_widget *widget =
2204− snd_soc_dapm_kcontrol_widget(kcontrol);
2099+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
22052100 struct snd_soc_component *component =
22062101 snd_soc_dapm_to_component(widget->dapm);
22072102 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -2259,7 +2154,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, · 51 unmodified lines
22592154 static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol,
22602155 struct snd_ctl_elem_value *ucontrol)
22612156 {
2262− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2157+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
22632158 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
22642159 int path = ((struct soc_mixer_control *)kcontrol->private_value)->shift;
22652160
@@ -2271,7 +2166,7 @@ static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
22712166 static int wsa_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
22722167 struct snd_ctl_elem_value *ucontrol)
22732168 {
2274− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2169+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
22752170 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
22762171 int path = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
22772172
@@ -2297,6 +2192,10 @@ static const struct snd_kcontrol_new wsa_macro_snd_controls[] = { · 19 unmodified lines
22972192 -84, 40, digital_gain),
22982193 SOC_SINGLE_S8_TLV("WSA_RX1 Digital Volume", CDC_WSA_RX1_RX_VOL_CTL,
22992194 -84, 40, digital_gain),
2195+ SOC_SINGLE_S8_TLV("WSA_RX0_MIX Digital Volume", CDC_WSA_RX0_RX_VOL_MIX_CTL,
2196+ -84, 40, digital_gain),
2197+ SOC_SINGLE_S8_TLV("WSA_RX1_MIX Digital Volume", CDC_WSA_RX1_RX_VOL_MIX_CTL,
2198+ -84, 40, digital_gain),
23002199
23012200 SOC_SINGLE("WSA_RX0 Digital Mute", CDC_WSA_RX0_RX_PATH_CTL, 4, 1, 0),
23022201 SOC_SINGLE("WSA_RX1 Digital Mute", CDC_WSA_RX1_RX_PATH_CTL, 4, 1, 0),
@@ -2331,7 +2230,7 @@ static const struct snd_kcontrol_new rx_mux[WSA_MACRO_RX_MAX] = { · 28 unmodified lines
23312230 static int wsa_macro_vi_feed_mixer_get(struct snd_kcontrol *kcontrol,
23322231 struct snd_ctl_elem_value *ucontrol)
23332232 {
2334− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
2233+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
23352234 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
23362235 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
23372236 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
@@ -2349,7 +2248,7 @@ static int wsa_macro_vi_feed_mixer_get(struct snd_kcontrol *kcontrol, · 11 unmodified lines
23492248 static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
23502249 struct snd_ctl_elem_value *ucontrol)
23512250 {
2352− struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol);
2251+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol);
23532252 struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
23542253 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
23552254 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
@@ -2440,10 +2339,8 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets[] = { · 84 unmodified lines
24402339 SND_SOC_DAPM_MIXER("WSA RX_MIX0", SND_SOC_NOPM, 0, 0, NULL, 0),
24412340 SND_SOC_DAPM_MIXER("WSA RX_MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
24422341
2443− SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0,
2444− wsa_macro_enable_main_path, SND_SOC_DAPM_PRE_PMU),
2445− SND_SOC_DAPM_MIXER_E("WSA_RX INT1 MIX", SND_SOC_NOPM, 1, 0, NULL, 0,
2446− wsa_macro_enable_main_path, SND_SOC_DAPM_PRE_PMU),
2342+ SND_SOC_DAPM_MIXER("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
2343+ SND_SOC_DAPM_MIXER("WSA_RX INT1 MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
24472344
24482345 SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
24492346 SND_SOC_DAPM_MIXER("WSA_RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -2494,30 +2391,22 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets_v2_1[] = { · 44 unmodified lines
24942391 SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_1),
24952392 SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_1),
24962393 SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_1),
2497− SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX0,
2498− 0, &rx0_mix_mux_v2_1, wsa_macro_enable_mix_path,
2499− SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
2394+ SND_SOC_DAPM_MUX("WSA_RX0 MIX INP", SND_SOC_NOPM, 0, 0, &rx0_mix_mux_v2_1),
25002395 SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_1),
25012396 SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_1),
25022397 SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_1),
2503− SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX1,
2504− 0, &rx1_mix_mux_v2_1, wsa_macro_enable_mix_path,
2505− SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
2398+ SND_SOC_DAPM_MUX("WSA_RX1 MIX INP", SND_SOC_NOPM, 0, 0, &rx1_mix_mux_v2_1),
25062399 };
25072400
25082401 static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets_v2_5[] = {
25092402 SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_5),
25102403 SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_5),
25112404 SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_5),
2512− SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX0,
2513− 0, &rx0_mix_mux_v2_5, wsa_macro_enable_mix_path,
2514− SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
2405+ SND_SOC_DAPM_MUX("WSA_RX0 MIX INP", SND_SOC_NOPM, 0, 0, &rx0_mix_mux_v2_5),
25152406 SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_5),
25162407 SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_5),
25172408 SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_5),
2518− SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX1,
2519− 0, &rx1_mix_mux_v2_5, wsa_macro_enable_mix_path,
2520− SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
2409+ SND_SOC_DAPM_MUX("WSA_RX1 MIX INP", SND_SOC_NOPM, 0, 0, &rx1_mix_mux_v2_5),
25212410 };
25222411
25232412 static const struct snd_soc_dapm_route wsa_audio_map[] = {
@@ -2553,10 +2442,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 29 unmodified lines
25532442 {"WSA RX_MIX0", NULL, "WSA RX_MIX0 MUX"},
25542443 {"WSA RX_MIX1", NULL, "WSA RX_MIX1 MUX"},
25552444
2556− {"WSA RX0", NULL, "WSA_RX0_CLK"},
2557− {"WSA RX1", NULL, "WSA_RX1_CLK"},
2558− {"WSA RX_MIX0", NULL, "WSA_RX_MIX0_CLK"},
2559− {"WSA RX_MIX1", NULL, "WSA_RX_MIX1_CLK"},
2445+ {"WSA_RX INT0 MIX", NULL, "WSA_RX0_CLK"},
2446+ {"WSA_RX INT1 MIX", NULL, "WSA_RX1_CLK"},
25602447
25612448 {"WSA_RX0 INP0", "RX0", "WSA RX0"},
25622449 {"WSA_RX0 INP0", "RX1", "WSA RX1"},
@@ -2586,6 +2473,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 23 unmodified lines
25862473 {"WSA_RX0 MIX INP", "RX1", "WSA RX1"},
25872474 {"WSA_RX0 MIX INP", "RX_MIX0", "WSA RX_MIX0"},
25882475 {"WSA_RX0 MIX INP", "RX_MIX1", "WSA RX_MIX1"},
2476+ {"WSA_RX0 MIX INP", NULL, "WSA_RX0_CLK"},
2477+ {"WSA_RX0 MIX INP", NULL, "WSA_RX_MIX0_CLK"},
25892478 {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX0 MIX INP"},
25902479
25912480 {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX INT0 MIX"},
@@ -2625,6 +2514,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 33 unmodified lines
26252514 {"WSA_RX1 MIX INP", "RX1", "WSA RX1"},
26262515 {"WSA_RX1 MIX INP", "RX_MIX0", "WSA RX_MIX0"},
26272516 {"WSA_RX1 MIX INP", "RX_MIX1", "WSA RX_MIX1"},
2517+ {"WSA_RX1 MIX INP", NULL, "WSA_RX1_CLK"},
2518+ {"WSA_RX1 MIX INP", NULL, "WSA_RX_MIX1_CLK"},
26282519 {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX1 MIX INP"},
26292520
26302521 {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX INT1 MIX"},
@@ -2665,7 +2556,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) · 34 unmodified lines
26652556
26662557 static int wsa_macro_component_probe(struct snd_soc_component *comp)
26672558 {
2668− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(comp);
2559+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp);
26692560 struct wsa_macro *wsa = snd_soc_component_get_drvdata(comp);
26702561 const struct snd_soc_dapm_widget *widgets;
26712562 unsigned int num_widgets;
sound/soc/codecs/madera.c+16−32
@@ -541,10 +541,8 @@ EXPORT_SYMBOL_GPL(madera_domain_clk_ev); · 540 unmodified lines
541541 int madera_out1_demux_put(struct snd_kcontrol *kcontrol,
542542 struct snd_ctl_elem_value *ucontrol)
543543 {
544− struct snd_soc_component *component =
545− snd_soc_dapm_kcontrol_component(kcontrol);
546− struct snd_soc_dapm_context *dapm =
547− snd_soc_dapm_kcontrol_dapm(kcontrol);
544+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
545+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
548546 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
549547 struct madera *madera = priv->madera;
550548 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -632,8 +630,7 @@ EXPORT_SYMBOL_GPL(madera_out1_demux_put); · 81 unmodified lines
632630 int madera_out1_demux_get(struct snd_kcontrol *kcontrol,
633631 struct snd_ctl_elem_value *ucontrol)
634632 {
635− struct snd_soc_component *component =
636− snd_soc_dapm_kcontrol_component(kcontrol);
633+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
637634 unsigned int val;
638635
639636 val = snd_soc_component_read(component, MADERA_OUTPUT_ENABLES_1);
@@ -648,10 +645,8 @@ EXPORT_SYMBOL_GPL(madera_out1_demux_get); · 8 unmodified lines
648645 static int madera_inmux_put(struct snd_kcontrol *kcontrol,
649646 struct snd_ctl_elem_value *ucontrol)
650647 {
651− struct snd_soc_component *component =
652− snd_soc_dapm_kcontrol_component(kcontrol);
653− struct snd_soc_dapm_context *dapm =
654− snd_soc_dapm_kcontrol_dapm(kcontrol);
648+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
649+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
655650 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
656651 struct madera *madera = priv->madera;
657652 struct regmap *regmap = madera->regmap;
@@ -873,8 +868,7 @@ static bool madera_can_change_grp_rate(const struct madera_priv *priv, · 215 unmodified lines
873868 static int madera_adsp_rate_get(struct snd_kcontrol *kcontrol,
874869 struct snd_ctl_elem_value *ucontrol)
875870 {
876− struct snd_soc_component *component =
877− snd_soc_kcontrol_component(kcontrol);
871+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
878872 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
879873 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
880874 unsigned int cached_rate;
@@ -894,8 +888,7 @@ static int madera_adsp_rate_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines
894888 static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,
895889 struct snd_ctl_elem_value *ucontrol)
896890 {
897− struct snd_soc_component *component =
898− snd_soc_kcontrol_component(kcontrol);
891+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
899892 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
900893 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
901894 const int adsp_num = e->shift_l;
@@ -1054,8 +1047,7 @@ EXPORT_SYMBOL_GPL(madera_set_adsp_clk); · 152 unmodified lines
10541047 int madera_rate_put(struct snd_kcontrol *kcontrol,
10551048 struct snd_ctl_elem_value *ucontrol)
10561049 {
1057− struct snd_soc_component *component =
1058− snd_soc_kcontrol_component(kcontrol);
1050+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10591051 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
10601052 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10611053 unsigned int item = ucontrol->value.enumerated.item[0];
@@ -1214,8 +1206,7 @@ int madera_init_outputs(struct snd_soc_component *component, · 152 unmodified lines
12141206 const struct snd_soc_dapm_route *routes,
12151207 int n_mono_routes, int n_real)
12161208 {
1217− struct snd_soc_dapm_context *dapm =
1218− snd_soc_component_get_dapm(component);
1209+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12191210 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
12201211 struct madera *madera = priv->madera;
12211212 const struct madera_codec_pdata *pdata = &madera->pdata.codec;
@@ -2163,10 +2154,8 @@ EXPORT_SYMBOL_GPL(madera_output_anc_src); · 941 unmodified lines
21632154 int madera_dfc_put(struct snd_kcontrol *kcontrol,
21642155 struct snd_ctl_elem_value *ucontrol)
21652156 {
2166− struct snd_soc_component *component =
2167− snd_soc_kcontrol_component(kcontrol);
2168− struct snd_soc_dapm_context *dapm =
2169− snd_soc_component_get_dapm(component);
2157+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
2158+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
21702159 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
21712160 unsigned int reg = e->reg;
21722161 unsigned int val;
@@ -2196,10 +2185,8 @@ int madera_lp_mode_put(struct snd_kcontrol *kcontrol, · 23 unmodified lines
21962185 {
21972186 struct soc_mixer_control *mc =
21982187 (struct soc_mixer_control *)kcontrol->private_value;
2199− struct snd_soc_component *component =
2200− snd_soc_kcontrol_component(kcontrol);
2201− struct snd_soc_dapm_context *dapm =
2202− snd_soc_component_get_dapm(component);
2188+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
2189+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
22032190 unsigned int val, mask;
22042191 int ret;
22052192
@@ -3241,8 +3228,7 @@ static int madera_dai_set_sysclk(struct snd_soc_dai *dai, · 1035 unmodified lines
32413228 int clk_id, unsigned int freq, int dir)
32423229 {
32433230 struct snd_soc_component *component = dai->component;
3244− struct snd_soc_dapm_context *dapm =
3245− snd_soc_component_get_dapm(component);
3231+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
32463232 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
32473233 struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1];
32483234 struct snd_soc_dapm_route routes[2];
@@ -4742,8 +4728,7 @@ static bool madera_eq_filter_unstable(bool mode, __be16 _a, __be16 _b) · 1493 unmodified lines
47424728 int madera_eq_coeff_put(struct snd_kcontrol *kcontrol,
47434729 struct snd_ctl_elem_value *ucontrol)
47444730 {
4745− struct snd_soc_component *component =
4746− snd_soc_kcontrol_component(kcontrol);
4731+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
47474732 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
47484733 struct madera *madera = priv->madera;
47494734 struct soc_bytes *params = (void *)kcontrol->private_value;
@@ -4789,8 +4774,7 @@ EXPORT_SYMBOL_GPL(madera_eq_coeff_put); · 39 unmodified lines
47894774 int madera_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
47904775 struct snd_ctl_elem_value *ucontrol)
47914776 {
4792− struct snd_soc_component *component =
4793− snd_soc_kcontrol_component(kcontrol);
4777+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
47944778 struct madera_priv *priv = snd_soc_component_get_drvdata(component);
47954779 struct madera *madera = priv->madera;
47964780 __be16 *data = (__be16 *)ucontrol->value.bytes.data;
sound/soc/codecs/max9759.c+4−4
@@ -42,7 +42,7 @@ static const DECLARE_TLV_DB_SCALE(speaker_gain_tlv, 600, 600, 0); · 41 unmodified lines
4242 static int speaker_gain_control_get(struct snd_kcontrol *kcontrol,
4343 struct snd_ctl_elem_value *ucontrol)
4444 {
45− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
45+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
4646 struct max9759 *priv = snd_soc_component_get_drvdata(c);
4747
4848 ucontrol->value.integer.value[0] = priv->gain;
@@ -61,7 +61,7 @@ static const bool speaker_gain_table[4][2] = { · 12 unmodified lines
6161 static int speaker_gain_control_put(struct snd_kcontrol *kcontrol,
6262 struct snd_ctl_elem_value *ucontrol)
6363 {
64− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
64+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
6565 struct max9759 *priv = snd_soc_component_get_drvdata(c);
6666
6767 if (ucontrol->value.integer.value[0] < 0 ||
@@ -83,7 +83,7 @@ static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, · 15 unmodified lines
8383 static int speaker_mute_get(struct snd_kcontrol *kcontrol,
8484 struct snd_ctl_elem_value *ucontrol)
8585 {
86− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
86+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
8787 struct max9759 *priv = snd_soc_component_get_drvdata(c);
8888
8989 ucontrol->value.integer.value[0] = !priv->is_mute;
@@ -94,7 +94,7 @@ static int speaker_mute_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
9494 static int speaker_mute_put(struct snd_kcontrol *kcontrol,
9595 struct snd_ctl_elem_value *ucontrol)
9696 {
97− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
97+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
9898 struct max9759 *priv = snd_soc_component_get_drvdata(c);
9999
100100 priv->is_mute = !ucontrol->value.integer.value[0];
sound/soc/codecs/max9768.c+2−2
@@ -40,7 +40,7 @@ static const struct reg_default max9768_default_regs[] = { · 39 unmodified lines
4040 static int max9768_get_gpio(struct snd_kcontrol *kcontrol,
4141 struct snd_ctl_elem_value *ucontrol)
4242 {
43− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
43+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
4444 struct max9768 *max9768 = snd_soc_component_get_drvdata(c);
4545 int val = gpiod_get_value_cansleep(max9768->mute);
4646
@@ -52,7 +52,7 @@ static int max9768_get_gpio(struct snd_kcontrol *kcontrol, · 5 unmodified lines
5252 static int max9768_set_gpio(struct snd_kcontrol *kcontrol,
5353 struct snd_ctl_elem_value *ucontrol)
5454 {
55− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
55+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
5656 struct max9768 *max9768 = snd_soc_component_get_drvdata(c);
5757 bool val = !ucontrol->value.integer.value[0];
5858 int ret;
sound/soc/codecs/max98088.c+9−9
@@ -380,7 +380,7 @@ static SOC_ENUM_SINGLE_DECL(max98088_dai1_adc_filter_enum, · 379 unmodified lines
380380 static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol,
381381 struct snd_ctl_elem_value *ucontrol)
382382 {
383− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
383+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
384384 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
385385 unsigned int sel = ucontrol->value.integer.value[0];
386386
@@ -394,7 +394,7 @@ static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines
394394 static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol,
395395 struct snd_ctl_elem_value *ucontrol)
396396 {
397− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
397+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
398398 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
399399
400400 ucontrol->value.integer.value[0] = max98088->mic1pre;
@@ -404,7 +404,7 @@ static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
404404 static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol,
405405 struct snd_ctl_elem_value *ucontrol)
406406 {
407− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
407+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
408408 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
409409 unsigned int sel = ucontrol->value.integer.value[0];
410410
@@ -418,7 +418,7 @@ static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines
418418 static int max98088_mic2pre_get(struct snd_kcontrol *kcontrol,
419419 struct snd_ctl_elem_value *ucontrol)
420420 {
421− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
421+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
422422 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
423423
424424 ucontrol->value.integer.value[0] = max98088->mic2pre;
@@ -1296,6 +1296,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 871 unmodified lines
12961296 enum snd_soc_bias_level level)
12971297 {
12981298 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
1299+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12991300 int ret;
13001301
13011302 switch (level) {
@@ -1311,8 +1312,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines
13111312 * enable it.
13121313 */
13131314 if (!IS_ERR(max98088->mclk)) {
1314− if (snd_soc_component_get_bias_level(component) ==
1315− SND_SOC_BIAS_ON) {
1315+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
13161316 clk_disable_unprepare(max98088->mclk);
13171317 } else {
13181318 ret = clk_prepare_enable(max98088->mclk);
@@ -1323,7 +1323,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
13231323 break;
13241324
13251325 case SND_SOC_BIAS_STANDBY:
1326− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
1326+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
13271327 regcache_sync(max98088->regmap);
13281328
13291329 snd_soc_component_update_bits(component, M98088_REG_4C_PWR_EN_IN,
@@ -1500,7 +1500,7 @@ static void max98088_setup_eq2(struct snd_soc_component *component) · 170 unmodified lines
15001500 static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol,
15011501 struct snd_ctl_elem_value *ucontrol)
15021502 {
1503− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1503+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
15041504 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
15051505 struct max98088_pdata *pdata = max98088->pdata;
15061506 int channel = max98088_get_channel(component, kcontrol->id.name);
@@ -1532,7 +1532,7 @@ static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol, · 25 unmodified lines
15321532 static int max98088_get_eq_enum(struct snd_kcontrol *kcontrol,
15331533 struct snd_ctl_elem_value *ucontrol)
15341534 {
1535− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1535+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
15361536 struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
15371537 int channel = max98088_get_channel(component, kcontrol->id.name);
15381538 struct max98088_cdata *cdata;
sound/soc/codecs/max98090.c+44−10
@@ -347,7 +347,7 @@ static const DECLARE_TLV_DB_RANGE(max98090_rcv_lout_tlv, · 346 unmodified lines
347347 static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
348348 struct snd_ctl_elem_value *ucontrol)
349349 {
350− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
350+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
351351 struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
352352 struct soc_mixer_control *mc =
353353 (struct soc_mixer_control *)kcontrol->private_value;
@@ -387,7 +387,7 @@ static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, · 33 unmodified lines
387387 static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
388388 struct snd_ctl_elem_value *ucontrol)
389389 {
390− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
390+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
391391 struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
392392 struct soc_mixer_control *mc =
393393 (struct soc_mixer_control *)kcontrol->private_value;
@@ -817,6 +817,16 @@ static SOC_ENUM_SINGLE_VIRT_DECL(dmic_mux_enum, dmic_mux_text); · 423 unmodified lines
817817 static const struct snd_kcontrol_new max98090_dmic_mux =
818818 SOC_DAPM_ENUM("DMIC Mux", dmic_mux_enum);
819819
820+static const char * const dmic_mX_mux_text[] = { "Enable", "Disable" };
821+
822+static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m1_enum, dmic_mX_mux_text);
823+static const struct snd_kcontrol_new max98090_dmic_m1_mux =
824+ SOC_DAPM_ENUM("DMIC M1 Mux", dmic_m1_enum);
825+
826+static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m2_enum, dmic_mX_mux_text);
827+static const struct snd_kcontrol_new max98090_dmic_m2_mux =
828+ SOC_DAPM_ENUM("DMIC M2 Mux", dmic_m2_enum);
829+
820830 /* LINEA mixer switch */
821831 static const struct snd_kcontrol_new max98090_linea_mixer_controls[] = {
822832 SOC_DAPM_SINGLE("IN1 Switch", M98090_REG_LINE_INPUT_CONFIG,
@@ -1106,6 +1116,9 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { · 283 unmodified lines
11061116
11071117 SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &max98090_dmic_mux),
11081118
1119+ SND_SOC_DAPM_MUX("DMIC M1 Mux", SND_SOC_NOPM, 0, 0,
1120+ &max98090_dmic_m1_mux),
1121+
11091122 SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
11101123 M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
11111124 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
@@ -1144,7 +1157,7 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { · 32 unmodified lines
11441157
11451158 SND_SOC_DAPM_AIF_OUT("AIFOUTL", "HiFi Capture", 0,
11461159 SND_SOC_NOPM, 0, 0),
1147− SND_SOC_DAPM_AIF_OUT("AIFOUTR", "HiFi Capture", 1,
1160+ SND_SOC_DAPM_AIF_OUT("AIFOUTR", "HiFi Capture", 0,
11481161 SND_SOC_NOPM, 0, 0),
11491162
11501163 SND_SOC_DAPM_MUX("LBENL Mux", SND_SOC_NOPM,
@@ -1241,6 +1254,14 @@ static const struct snd_soc_dapm_widget max98091_dapm_widgets[] = { · 90 unmodified lines
12411254 SND_SOC_DAPM_POST_PMU),
12421255 SND_SOC_DAPM_SUPPLY("DMIC34_HPF", M98090_REG_FILTER_CONFIG,
12431256 M98090_FLT_DMIC34HPF_SHIFT, 0, NULL, 0),
1257+
1258+ SND_SOC_DAPM_MUX("DMIC M2 Mux", SND_SOC_NOPM, 0, 0,
1259+ &max98090_dmic_m2_mux),
1260+
1261+ SND_SOC_DAPM_AIF_OUT("AIFOUT2L", "HiFi Capture", 0,
1262+ SND_SOC_NOPM, 0, 0),
1263+ SND_SOC_DAPM_AIF_OUT("AIFOUT2R", "HiFi Capture", 0,
1264+ SND_SOC_NOPM, 0, 0),
12441265 };
12451266
12461267 static const struct snd_soc_dapm_route max98090_dapm_routes[] = {
@@ -1304,10 +1325,12 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = { · 57 unmodified lines
13041325 {"ADCL", NULL, "SHDN"},
13051326 {"ADCR", NULL, "SHDN"},
13061327
1328+ {"DMIC M1 Mux", "Enable", "DMICL"},
1329+ {"DMIC M1 Mux", "Enable", "DMICR"},
1330+
13071331 {"DMIC Mux", "ADC", "ADCL"},
13081332 {"DMIC Mux", "ADC", "ADCR"},
1309− {"DMIC Mux", "DMIC", "DMICL"},
1310− {"DMIC Mux", "DMIC", "DMICR"},
1333+ {"DMIC Mux", "DMIC", "DMIC M1 Mux"},
13111334
13121335 {"LBENL Mux", "Normal", "DMIC Mux"},
13131336 {"LBENL Mux", "Loopback", "LTENL Mux"},
@@ -1431,12 +1454,22 @@ static const struct snd_soc_dapm_route max98091_dapm_routes[] = { · 117 unmodified lines
14311454 {"DMIC4", NULL, "DMIC4_ENA"},
14321455 {"DMIC3", NULL, "DMIC34_HPF"},
14331456 {"DMIC4", NULL, "DMIC34_HPF"},
1457+
1458+ {"DMIC M2 Mux", "Enable", "DMIC3"},
1459+ {"DMIC M2 Mux", "Enable", "DMIC4"},
1460+
1461+ {"AIFOUT2L", NULL, "DMIC M2 Mux"},
1462+ {"AIFOUT2R", NULL, "DMIC M2 Mux"},
1463+ {"AIFOUT2L", NULL, "SHDN"},
1464+ {"AIFOUT2R", NULL, "SHDN"},
1465+ {"AIFOUT2L", NULL, "SDOEN"},
1466+ {"AIFOUT2R", NULL, "SDOEN"},
14341467 };
14351468
14361469 static int max98090_add_widgets(struct snd_soc_component *component)
14371470 {
14381471 struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
1439− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1472+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
14401473
14411474 snd_soc_add_component_controls(component, max98090_snd_controls,
14421475 ARRAY_SIZE(max98090_snd_controls));
@@ -1718,6 +1751,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 275 unmodified lines
17181751 enum snd_soc_bias_level level)
17191752 {
17201753 struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
1754+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
17211755 int ret;
17221756
17231757 switch (level) {
@@ -1735,7 +1769,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 11 unmodified lines
17351769 if (IS_ERR(max98090->mclk))
17361770 break;
17371771
1738− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1772+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
17391773 clk_disable_unprepare(max98090->mclk);
17401774 } else {
17411775 ret = clk_prepare_enable(max98090->mclk);
@@ -1745,7 +1779,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
17451779 break;
17461780
17471781 case SND_SOC_BIAS_STANDBY:
1748− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1782+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
17491783 ret = regcache_sync(max98090->regmap);
17501784 if (ret != 0) {
17511785 dev_err(component->dev,
@@ -2371,11 +2405,11 @@ static struct snd_soc_dai_driver max98090_dai = { · 619 unmodified lines
23712405 .capture = {
23722406 .stream_name = "HiFi Capture",
23732407 .channels_min = 1,
2374− .channels_max = 2,
2408+ .channels_max = 4,
23752409 .rates = MAX98090_RATES,
23762410 .formats = MAX98090_FORMATS,
23772411 },
2378− .ops = &max98090_dai_ops,
2412+ .ops = &max98090_dai_ops,
23792413 };
23802414
23812415 static int max98090_probe(struct snd_soc_component *component)
sound/soc/codecs/max98095.c+15−12
@@ -350,7 +350,7 @@ static SOC_ENUM_SINGLE_DECL(max98095_dai3_dac_filter_enum, · 349 unmodified lines
350350 static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol,
351351 struct snd_ctl_elem_value *ucontrol)
352352 {
353− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
353+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
354354 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
355355 unsigned int sel = ucontrol->value.integer.value[0];
356356
@@ -364,7 +364,7 @@ static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines
364364 static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol,
365365 struct snd_ctl_elem_value *ucontrol)
366366 {
367− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
367+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
368368 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
369369
370370 ucontrol->value.integer.value[0] = max98095->mic1pre;
@@ -374,7 +374,7 @@ static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
374374 static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol,
375375 struct snd_ctl_elem_value *ucontrol)
376376 {
377− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
377+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
378378 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
379379 unsigned int sel = ucontrol->value.integer.value[0];
380380
@@ -388,7 +388,7 @@ static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines
388388 static int max98095_mic2pre_get(struct snd_kcontrol *kcontrol,
389389 struct snd_ctl_elem_value *ucontrol)
390390 {
391− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
391+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
392392 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
393393
394394 ucontrol->value.integer.value[0] = max98095->mic2pre;
@@ -1359,6 +1359,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 964 unmodified lines
13591359 enum snd_soc_bias_level level)
13601360 {
13611361 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
1362+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
13621363 int ret;
13631364
13641365 switch (level) {
@@ -1376,7 +1377,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 11 unmodified lines
13761377 if (IS_ERR(max98095->mclk))
13771378 break;
13781379
1379− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1380+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
13801381 clk_disable_unprepare(max98095->mclk);
13811382 } else {
13821383 ret = clk_prepare_enable(max98095->mclk);
@@ -1386,7 +1387,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
13861387 break;
13871388
13881389 case SND_SOC_BIAS_STANDBY:
1389− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1390+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
13901391 ret = regcache_sync(max98095->regmap);
13911392
13921393 if (ret != 0) {
@@ -1485,7 +1486,7 @@ static int max98095_get_eq_channel(const char *name) · 92 unmodified lines
14851486 static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
14861487 struct snd_ctl_elem_value *ucontrol)
14871488 {
1488− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1489+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
14891490 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
14901491 struct max98095_pdata *pdata = max98095->pdata;
14911492 int channel = max98095_get_eq_channel(kcontrol->id.name);
@@ -1549,7 +1550,7 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, · 57 unmodified lines
15491550 static int max98095_get_eq_enum(struct snd_kcontrol *kcontrol,
15501551 struct snd_ctl_elem_value *ucontrol)
15511552 {
1552− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1553+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
15531554 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
15541555 int channel = max98095_get_eq_channel(kcontrol->id.name);
15551556 struct max98095_cdata *cdata;
@@ -1636,7 +1637,7 @@ static int max98095_get_bq_channel(struct snd_soc_component *component, · 80 unmodified lines
16361637 static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
16371638 struct snd_ctl_elem_value *ucontrol)
16381639 {
1639− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1640+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
16401641 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
16411642 struct max98095_pdata *pdata = max98095->pdata;
16421643 int channel = max98095_get_bq_channel(component, kcontrol->id.name);
@@ -1697,7 +1698,7 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, · 54 unmodified lines
16971698 static int max98095_get_bq_enum(struct snd_kcontrol *kcontrol,
16981699 struct snd_ctl_elem_value *ucontrol)
16991700 {
1700− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1701+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
17011702 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
17021703 int channel = max98095_get_bq_channel(component, kcontrol->id.name);
17031704 struct max98095_cdata *cdata;
@@ -1917,11 +1918,12 @@ EXPORT_SYMBOL_GPL(max98095_jack_detect); · 213 unmodified lines
19171918 static int max98095_suspend(struct snd_soc_component *component)
19181919 {
19191920 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
1921+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
19201922
19211923 if (max98095->headphone_jack || max98095->mic_jack)
19221924 max98095_jack_detect_disable(component);
19231925
1924− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
1926+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
19251927
19261928 return 0;
19271929 }
@@ -1930,8 +1932,9 @@ static int max98095_resume(struct snd_soc_component *component) · 2 unmodified lines
19301932 {
19311933 struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component);
19321934 struct i2c_client *client = to_i2c_client(component->dev);
1935+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
19331936
1934− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
1937+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
19351938
19361939 if (max98095->headphone_jack || max98095->mic_jack) {
19371940 max98095_jack_detect_enable(component);
sound/soc/codecs/max98373.c+2−1
@@ -174,12 +174,13 @@ static int max98373_feedback_get(struct snd_kcontrol *kcontrol, · 173 unmodified lines
174174 struct snd_ctl_elem_value *ucontrol)
175175 {
176176 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
177+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
177178 struct soc_mixer_control *mc =
178179 (struct soc_mixer_control *)kcontrol->private_value;
179180 struct max98373_priv *max98373 = snd_soc_component_get_drvdata(component);
180181 int i;
181182
182− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
183+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
183184 /*
184185 * Register values will be cached before suspend. The cached value
185186 * will be a valid value and userspace will happy with that.
sound/soc/codecs/max98390.c+8−14
@@ -534,8 +534,7 @@ static SOC_ENUM_SINGLE_DECL(max98390_current_limit, · 533 unmodified lines
534534 static int max98390_ref_rdc_put(struct snd_kcontrol *kcontrol,
535535 struct snd_ctl_elem_value *ucontrol)
536536 {
537− struct snd_soc_component *component =
538− snd_soc_kcontrol_component(kcontrol);
537+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
539538 struct max98390_priv *max98390 =
540539 snd_soc_component_get_drvdata(component);
541540
@@ -554,8 +553,7 @@ static int max98390_ref_rdc_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines
554553 static int max98390_ref_rdc_get(struct snd_kcontrol *kcontrol,
555554 struct snd_ctl_elem_value *ucontrol)
556555 {
557− struct snd_soc_component *component =
558− snd_soc_kcontrol_component(kcontrol);
556+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
559557 struct max98390_priv *max98390 =
560558 snd_soc_component_get_drvdata(component);
561559
@@ -567,8 +565,7 @@ static int max98390_ref_rdc_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
567565 static int max98390_ambient_temp_put(struct snd_kcontrol *kcontrol,
568566 struct snd_ctl_elem_value *ucontrol)
569567 {
570− struct snd_soc_component *component =
571− snd_soc_kcontrol_component(kcontrol);
568+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
572569 struct max98390_priv *max98390 =
573570 snd_soc_component_get_drvdata(component);
574571
@@ -585,8 +582,7 @@ static int max98390_ambient_temp_put(struct snd_kcontrol *kcontrol, · 10 unmodified lines
585582 static int max98390_ambient_temp_get(struct snd_kcontrol *kcontrol,
586583 struct snd_ctl_elem_value *ucontrol)
587584 {
588− struct snd_soc_component *component =
589− snd_soc_kcontrol_component(kcontrol);
585+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
590586 struct max98390_priv *max98390 =
591587 snd_soc_component_get_drvdata(component);
592588
@@ -598,8 +594,7 @@ static int max98390_ambient_temp_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
598594 static int max98390_adaptive_rdc_put(struct snd_kcontrol *kcontrol,
599595 struct snd_ctl_elem_value *ucontrol)
600596 {
601− struct snd_soc_component *component =
602− snd_soc_kcontrol_component(kcontrol);
597+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
603598
604599 dev_warn(component->dev, "Put adaptive rdc not supported\n");
605600
@@ -610,8 +605,7 @@ static int max98390_adaptive_rdc_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
610605 struct snd_ctl_elem_value *ucontrol)
611606 {
612607 int rdc, rdc0;
613− struct snd_soc_component *component =
614− snd_soc_kcontrol_component(kcontrol);
608+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
615609 struct max98390_priv *max98390 =
616610 snd_soc_component_get_drvdata(component);
617611
@@ -632,9 +626,9 @@ static int max98390_dsm_calib_get(struct snd_kcontrol *kcontrol, · 14 unmodified lines
632626 static int max98390_dsm_calib_put(struct snd_kcontrol *kcontrol,
633627 struct snd_ctl_elem_value *ucontrol)
634628 {
635− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
629+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
636630 struct max98390_priv *max98390 = snd_soc_component_get_drvdata(component);
637− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
631+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
638632 unsigned int rdc, rdc_cal_result, rdc_integer, rdc_factor, temp, val;
639633
640634 snd_soc_dapm_mutex_lock(dapm);
sound/soc/codecs/max98396.c+5−6
@@ -953,8 +953,7 @@ static const DECLARE_TLV_DB_RANGE(max98397_spk_tlv, · 952 unmodified lines
953953 static int max98396_mux_get(struct snd_kcontrol *kcontrol,
954954 struct snd_ctl_elem_value *ucontrol)
955955 {
956− struct snd_soc_component *component =
957− snd_soc_dapm_kcontrol_component(kcontrol);
956+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
958957 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
959958 int reg, val;
960959
@@ -973,9 +972,8 @@ static int max98396_mux_get(struct snd_kcontrol *kcontrol, · 12 unmodified lines
973972 static int max98396_mux_put(struct snd_kcontrol *kcontrol,
974973 struct snd_ctl_elem_value *ucontrol)
975974 {
976− struct snd_soc_component *component =
977− snd_soc_dapm_kcontrol_component(kcontrol);
978− struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
975+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
976+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
979977 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
980978 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
981979 unsigned int *item = ucontrol->value.enumerated.item;
@@ -1107,6 +1105,7 @@ static int max98396_adc_value_get(struct snd_kcontrol *kcontrol, · 125 unmodified lines
11071105 struct snd_ctl_elem_value *ucontrol)
11081106 {
11091107 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1108+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11101109 struct soc_mixer_control *mc =
11111110 (struct soc_mixer_control *)kcontrol->private_value;
11121111 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
@@ -1115,7 +1114,7 @@ static int max98396_adc_value_get(struct snd_kcontrol *kcontrol, · 2 unmodified lines
11151114 int reg = mc->reg;
11161115
11171116 /* ADC value is not available if the device is powered down */
1118− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
1117+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
11191118 goto exit;
11201119
11211120 if (max98396->device_id == CODEC_TYPE_MAX98397) {
sound/soc/codecs/max9850.c+2−1
@@ -225,6 +225,7 @@ static int max9850_set_bias_level(struct snd_soc_component *component, · 224 unmodified lines
225225 enum snd_soc_bias_level level)
226226 {
227227 struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component);
228+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
228229 int ret;
229230
230231 switch (level) {
@@ -233,7 +234,7 @@ static int max9850_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines
233234 case SND_SOC_BIAS_PREPARE:
234235 break;
235236 case SND_SOC_BIAS_STANDBY:
236− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
237+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
237238 ret = regcache_sync(max9850->regmap);
238239 if (ret) {
239240 dev_err(component->dev,
sound/soc/codecs/max9867.c+10−5
@@ -78,7 +78,7 @@ static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w, · 77 unmodified lines
7878 static int max9867_filter_get(struct snd_kcontrol *kcontrol,
7979 struct snd_ctl_elem_value *ucontrol)
8080 {
81− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
81+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
8282 struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
8383 unsigned int reg;
8484 int ret;
@@ -98,7 +98,7 @@ static int max9867_filter_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines
9898 static int max9867_filter_set(struct snd_kcontrol *kcontrol,
9999 struct snd_ctl_elem_value *ucontrol)
100100 {
101− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
101+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
102102 struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
103103 unsigned int reg, mode = ucontrol->value.enumerated.item[0];
104104 int ret;
@@ -556,14 +556,18 @@ static struct snd_soc_dai_driver max9867_dai[] = { · 451 unmodified lines
556556 #ifdef CONFIG_PM
557557 static int max9867_suspend(struct snd_soc_component *component)
558558 {
559− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
559+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
560+
561+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
560562
561563 return 0;
562564 }
563565
564566 static int max9867_resume(struct snd_soc_component *component)
565567 {
566− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
568+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
569+
570+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
567571
568572 return 0;
569573 }
@@ -577,6 +581,7 @@ static int max9867_set_bias_level(struct snd_soc_component *component, · 7 unmodified lines
577581 {
578582 int err;
579583 struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
584+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
580585
581586 switch (level) {
582587 case SND_SOC_BIAS_ON:
@@ -585,7 +590,7 @@ static int max9867_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines
585590 return err;
586591 break;
587592 case SND_SOC_BIAS_STANDBY:
588− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
593+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
589594 err = regcache_sync(max9867->regmap);
590595 if (err)
591596 return err;
sound/soc/codecs/max98925.c+1−1
@@ -97,7 +97,7 @@ static const struct snd_kcontrol_new max98925_dai_sel_mux = · 96 unmodified lines
9797 static int max98925_dac_event(struct snd_soc_dapm_widget *w,
9898 struct snd_kcontrol *kcontrol, int event)
9999 {
100− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
100+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
101101 struct max98925_priv *max98925 = snd_soc_component_get_drvdata(component);
102102
103103 switch (event) {
sound/soc/codecs/ml26124.c+2−1
@@ -459,6 +459,7 @@ static int ml26124_set_bias_level(struct snd_soc_component *component, · 458 unmodified lines
459459 enum snd_soc_bias_level level)
460460 {
461461 struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
462+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
462463
463464 switch (level) {
464465 case SND_SOC_BIAS_ON:
@@ -473,7 +474,7 @@ static int ml26124_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines
473474 break;
474475 case SND_SOC_BIAS_STANDBY:
475476 /* VMID ON */
476− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
477+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
477478 snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG,
478479 ML26124_VMID, ML26124_VMID);
479480 msleep(500);
sound/soc/codecs/msm8916-wcd-digital.c+2−4
@@ -423,8 +423,7 @@ static int msm8x16_wcd_get_iir_band_audio_mixer( · 422 unmodified lines
423423 struct snd_ctl_elem_value *ucontrol)
424424 {
425425
426− struct snd_soc_component *component =
427− snd_soc_kcontrol_component(kcontrol);
426+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
428427 struct wcd_iir_filter_ctl *ctl =
429428 (struct wcd_iir_filter_ctl *)kcontrol->private_value;
430429 struct soc_bytes_ext *params = &ctl->bytes_ext;
@@ -469,8 +468,7 @@ static int msm8x16_wcd_put_iir_band_audio_mixer( · 38 unmodified lines
469468 struct snd_kcontrol *kcontrol,
470469 struct snd_ctl_elem_value *ucontrol)
471470 {
472− struct snd_soc_component *component =
473− snd_soc_kcontrol_component(kcontrol);
471+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
474472 struct wcd_iir_filter_ctl *ctl =
475473 (struct wcd_iir_filter_ctl *)kcontrol->private_value;
476474 struct soc_bytes_ext *params = &ctl->bytes_ext;
sound/soc/codecs/mt6357.c+1−1
@@ -597,7 +597,7 @@ static int mt_mic_type_event(struct snd_soc_dapm_widget *w, · 596 unmodified lines
597597 {
598598 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
599599 struct mt6357_priv *priv = snd_soc_component_get_drvdata(cmpnt);
600− unsigned int mic_type = dapm_kcontrol_get_value(w->kcontrols[0]);
600+ unsigned int mic_type = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
601601
602602 switch (event) {
603603 case SND_SOC_DAPM_PRE_PMU:
sound/soc/codecs/mt6358.c+12−13
@@ -320,8 +320,7 @@ static void headset_volume_ramp(struct mt6358_priv *priv, int from, int to) · 319 unmodified lines
320320 static int mt6358_put_volsw(struct snd_kcontrol *kcontrol,
321321 struct snd_ctl_elem_value *ucontrol)
322322 {
323− struct snd_soc_component *component =
324− snd_soc_kcontrol_component(kcontrol);
323+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
325324 struct mt6358_priv *priv = snd_soc_component_get_drvdata(component);
326325 struct soc_mixer_control *mc =
327326 (struct soc_mixer_control *)kcontrol->private_value;
@@ -442,7 +441,7 @@ static int mt6358_disable_wov_phase2(struct mt6358_priv *priv) · 114 unmodified lines
442441 static int mt6358_get_wov(struct snd_kcontrol *kcontrol,
443442 struct snd_ctl_elem_value *ucontrol)
444443 {
445− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
444+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
446445 struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
447446
448447 ucontrol->value.integer.value[0] = priv->wov_enabled;
@@ -452,7 +451,7 @@ static int mt6358_get_wov(struct snd_kcontrol *kcontrol, · 3 unmodified lines
452451 static int mt6358_put_wov(struct snd_kcontrol *kcontrol,
453452 struct snd_ctl_elem_value *ucontrol)
454453 {
455− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
454+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
456455 struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
457456 int enabled = ucontrol->value.integer.value[0];
458457
@@ -476,7 +475,7 @@ static int mt6358_put_wov(struct snd_kcontrol *kcontrol, · 17 unmodified lines
476475 static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol,
477476 struct snd_ctl_elem_value *ucontrol)
478477 {
479− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
478+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
480479 struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
481480
482481 ucontrol->value.integer.value[0] = priv->dmic_one_wire_mode;
@@ -488,7 +487,7 @@ static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
488487 static int mt6358_dmic_mode_set(struct snd_kcontrol *kcontrol,
489488 struct snd_ctl_elem_value *ucontrol)
490489 {
491− struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
490+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
492491 struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
493492 int enabled = ucontrol->value.integer.value[0];
494493
@@ -1288,7 +1287,7 @@ static int mt_hp_event(struct snd_soc_dapm_widget *w, · 793 unmodified lines
12881287 {
12891288 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
12901289 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1291− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1290+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
12921291 int device = DEVICE_HP;
12931292
12941293 dev_info(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n",
@@ -1350,7 +1349,7 @@ static int mt_rcv_event(struct snd_soc_dapm_widget *w, · 55 unmodified lines
13501349 dev_info(priv->dev, "%s(), event 0x%x, mux %u\n",
13511350 __func__,
13521351 event,
1353− dapm_kcontrol_get_value(w->kcontrols[0]));
1352+ snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]));
13541353
13551354 switch (event) {
13561355 case SND_SOC_DAPM_PRE_PMU:
@@ -1829,7 +1828,7 @@ static int mt_mic_type_event(struct snd_soc_dapm_widget *w, · 472 unmodified lines
18291828 {
18301829 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
18311830 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1832− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1831+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
18331832
18341833 dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n",
18351834 __func__, event, mux);
@@ -1875,7 +1874,7 @@ static int mt_adc_l_event(struct snd_soc_dapm_widget *w, · 39 unmodified lines
18751874 {
18761875 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
18771876 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1878− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1877+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
18791878
18801879 dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n",
18811880 __func__, event, mux);
@@ -1891,7 +1890,7 @@ static int mt_adc_r_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines
18911890 {
18921891 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
18931892 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1894− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1893+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
18951894
18961895 dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n",
18971896 __func__, event, mux);
@@ -1907,7 +1906,7 @@ static int mt_pga_left_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines
19071906 {
19081907 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
19091908 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1910− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1909+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
19111910
19121911 dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n",
19131912 __func__, event, mux);
@@ -1923,7 +1922,7 @@ static int mt_pga_right_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines
19231922 {
19241923 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
19251924 struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1926− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1925+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
19271926
19281927 dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n",
19291928 __func__, event, mux);
sound/soc/codecs/mt6359.c+8−10
@@ -367,8 +367,7 @@ static void headset_volume_ramp(struct mt6359_priv *priv, · 366 unmodified lines
367367 static int mt6359_put_volsw(struct snd_kcontrol *kcontrol,
368368 struct snd_ctl_elem_value *ucontrol)
369369 {
370− struct snd_soc_component *component =
371− snd_soc_kcontrol_component(kcontrol);
370+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
372371 struct mt6359_priv *priv = snd_soc_component_get_drvdata(component);
373372 struct soc_mixer_control *mc =
374373 (struct soc_mixer_control *)kcontrol->private_value;
@@ -468,8 +467,7 @@ static int mt6359_put_volsw(struct snd_kcontrol *kcontrol, · 93 unmodified lines
468467 static int mt6359_get_playback_volsw(struct snd_kcontrol *kcontrol,
469468 struct snd_ctl_elem_value *ucontrol)
470469 {
471− struct snd_soc_component *component =
472− snd_soc_kcontrol_component(kcontrol);
470+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
473471 struct mt6359_priv *priv = snd_soc_component_get_drvdata(component);
474472 struct soc_mixer_control *mc =
475473 (struct soc_mixer_control *)kcontrol->private_value;
@@ -1045,7 +1043,7 @@ static int mt_hp_event(struct snd_soc_dapm_widget *w, · 569 unmodified lines
10451043 {
10461044 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
10471045 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1048− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1046+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
10491047 int device = DEVICE_HP;
10501048
10511049 dev_dbg(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n",
@@ -1077,7 +1075,7 @@ static int mt_rcv_event(struct snd_soc_dapm_widget *w, · 25 unmodified lines
10771075 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
10781076
10791077 dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n",
1080− __func__, event, dapm_kcontrol_get_value(w->kcontrols[0]));
1078+ __func__, event, snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]));
10811079
10821080 switch (event) {
10831081 case SND_SOC_DAPM_PRE_PMU:
@@ -1159,7 +1157,7 @@ static int mt_lo_event(struct snd_soc_dapm_widget *w, · 75 unmodified lines
11591157 {
11601158 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
11611159 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1162− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1160+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
11631161
11641162 dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n",
11651163 __func__, event, mux);
@@ -1639,7 +1637,7 @@ static int mt_pga_l_mux_event(struct snd_soc_dapm_widget *w, · 473 unmodified lines
16391637 {
16401638 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
16411639 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1642− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1640+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
16431641
16441642 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux);
16451643 priv->mux_select[MUX_PGA_L] = mux >> RG_AUDPREAMPLINPUTSEL_SFT;
@@ -1652,7 +1650,7 @@ static int mt_pga_r_mux_event(struct snd_soc_dapm_widget *w, · 6 unmodified lines
16521650 {
16531651 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
16541652 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1655− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1653+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
16561654
16571655 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux);
16581656 priv->mux_select[MUX_PGA_R] = mux >> RG_AUDPREAMPRINPUTSEL_SFT;
@@ -1665,7 +1663,7 @@ static int mt_pga_3_mux_event(struct snd_soc_dapm_widget *w, · 6 unmodified lines
16651663 {
16661664 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
16671665 struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
1668− unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]);
1666+ unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]);
16691667
16701668 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux);
16711669 priv->mux_select[MUX_PGA_3] = mux >> RG_AUDPREAMP3INPUTSEL_SFT;
sound/soc/codecs/mt6660.c+1−2
@@ -187,8 +187,7 @@ static const struct snd_soc_dapm_route mt6660_component_dapm_routes[] = { · 186 unmodified lines
187187 static int mt6660_component_get_volsw(struct snd_kcontrol *kcontrol,
188188 struct snd_ctl_elem_value *ucontrol)
189189 {
190− struct snd_soc_component *component =
191− snd_soc_kcontrol_component(kcontrol);
190+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
192191 struct mt6660_chip *chip = (struct mt6660_chip *)
193192 snd_soc_component_get_drvdata(component);
194193
sound/soc/codecs/nau8325.c+2−3
@@ -422,7 +422,7 @@ static int nau8325_clksrc_choose(struct nau8325 *nau8325, · 421 unmodified lines
422422 *n1_sel = i;
423423 *mult_sel = j;
424424 ratio_sel = ratio;
425− goto proc_done;
425+ goto proc_done;
426426 }
427427 }
428428 }
@@ -829,8 +829,7 @@ static int nau8325_read_device_properties(struct device *dev, · 400 unmodified lines
829829 return 0;
830830 }
831831
832−static int nau8325_i2c_probe(struct i2c_client *i2c,
833− const struct i2c_device_id *id)
832+static int nau8325_i2c_probe(struct i2c_client *i2c)
834833 {
835834 struct device *dev = &i2c->dev;
836835 struct nau8325 *nau8325 = dev_get_platdata(dev);
sound/soc/codecs/nau8810.c+4−3
@@ -164,7 +164,7 @@ static bool nau8810_volatile_reg(struct device *dev, unsigned int reg) · 163 unmodified lines
164164 static int nau8810_eq_get(struct snd_kcontrol *kcontrol,
165165 struct snd_ctl_elem_value *ucontrol)
166166 {
167− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
167+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
168168 struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component);
169169 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
170170 int i, reg, reg_val;
@@ -196,7 +196,7 @@ static int nau8810_eq_get(struct snd_kcontrol *kcontrol, · 25 unmodified lines
196196 static int nau8810_eq_put(struct snd_kcontrol *kcontrol,
197197 struct snd_ctl_elem_value *ucontrol)
198198 {
199− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
199+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
200200 struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component);
201201 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
202202 void *data;
@@ -775,6 +775,7 @@ static int nau8810_pcm_hw_params(struct snd_pcm_substream *substream, · 572 unmodified lines
775775 static int nau8810_set_bias_level(struct snd_soc_component *component,
776776 enum snd_soc_bias_level level)
777777 {
778+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
778779 struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component);
779780 struct regmap *map = nau8810->regmap;
780781
@@ -790,7 +791,7 @@ static int nau8810_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines
790791 NAU8810_IOBUF_EN | NAU8810_ABIAS_EN,
791792 NAU8810_IOBUF_EN | NAU8810_ABIAS_EN);
792793
793− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
794+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
794795 regcache_sync(map);
795796 regmap_update_bits(map, NAU8810_REG_POWER1,
796797 NAU8810_REFIMP_MASK, NAU8810_REFIMP_3K);
sound/soc/codecs/nau8821.c+11−17
@@ -1047,7 +1047,6 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 1046 unmodified lines
10471047 {
10481048 struct snd_soc_dapm_context *dapm = nau8821->dapm;
10491049 struct regmap *regmap = nau8821->regmap;
1050− struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
10511050
10521051 /* Detach 2kOhm Resistors from MICBIAS to MICGND */
10531052 regmap_update_bits(regmap, NAU8821_R74_MIC_BIAS,
@@ -1055,7 +1054,7 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 1 unmodified line
10551054 /* HPL/HPR short to ground */
10561055 regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL,
10571056 NAU8821_SPKR_DWN1R | NAU8821_SPKR_DWN1L, 0);
1058− snd_soc_component_disable_pin(component, "MICBIAS");
1057+ snd_soc_dapm_disable_pin(dapm, "MICBIAS");
10591058 snd_soc_dapm_sync(dapm);
10601059
10611060 /* Disable & mask both insertion & ejection IRQs */
@@ -1080,7 +1079,7 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 18 unmodified lines
10801079 NAU8821_JACK_DET_DB_BYPASS, NAU8821_JACK_DET_DB_BYPASS);
10811080
10821081 /* Close clock for jack type detection at manual mode */
1083− if (dapm->bias_level < SND_SOC_BIAS_PREPARE)
1082+ if (snd_soc_dapm_get_bias_level(dapm) < SND_SOC_BIAS_PREPARE)
10841083 nau8821_configure_sysclk(nau8821, NAU8821_CLK_DIS, 0);
10851084
10861085 /* Recover to normal channel input */
@@ -1106,7 +1105,6 @@ static void nau8821_jdet_work(struct work_struct *work) · 19 unmodified lines
11061105 struct nau8821 *nau8821 =
11071106 container_of(work, struct nau8821, jdet_work.work);
11081107 struct snd_soc_dapm_context *dapm = nau8821->dapm;
1109− struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
11101108 struct regmap *regmap = nau8821->regmap;
11111109 int jack_status_reg, mic_detected, event = 0, event_mask = 0;
11121110
@@ -1133,13 +1131,13 @@ static void nau8821_jdet_work(struct work_struct *work) · 20 unmodified lines
11331131 NAU8821_IRQ_KEY_RELEASE_DIS |
11341132 NAU8821_IRQ_KEY_PRESS_DIS, 0);
11351133 } else {
1136− snd_soc_component_disable_pin(component, "MICBIAS");
1137− snd_soc_dapm_sync(nau8821->dapm);
1134+ snd_soc_dapm_disable_pin(dapm, "MICBIAS");
1135+ snd_soc_dapm_sync(dapm);
11381136 }
11391137 } else {
11401138 dev_dbg(nau8821->dev, "Headphone connected\n");
11411139 event |= SND_JACK_HEADPHONE;
1142− snd_soc_component_disable_pin(component, "MICBIAS");
1140+ snd_soc_dapm_disable_pin(dapm, "MICBIAS");
11431141 snd_soc_dapm_sync(dapm);
11441142 }
11451143
@@ -1162,7 +1160,7 @@ static void nau8821_setup_inserted_irq(struct nau8821 *nau8821) · 16 unmodified lines
11621160 nau8821_irq_status_clear(regmap, NAU8821_JACK_INSERT_DETECTED);
11631161
11641162 /* Enable internal VCO needed for interruptions */
1165− if (nau8821->dapm->bias_level < SND_SOC_BIAS_PREPARE)
1163+ if (snd_soc_dapm_get_bias_level(nau8821->dapm) < SND_SOC_BIAS_PREPARE)
11661164 nau8821_configure_sysclk(nau8821, NAU8821_CLK_INTERNAL, 0);
11671165
11681166 /* Chip needs one FSCLK cycle in order to generate interruptions,
@@ -1191,7 +1189,6 @@ static irqreturn_t nau8821_interrupt(int irq, void *data) · 22 unmodified lines
11911189 {
11921190 struct nau8821 *nau8821 = (struct nau8821 *)data;
11931191 struct regmap *regmap = nau8821->regmap;
1194− struct snd_soc_component *component;
11951192 int active_irq, event = 0, event_mask = 0;
11961193
11971194 if (regmap_read(regmap, NAU8821_R10_IRQ_STATUS, &active_irq)) {
@@ -1222,8 +1219,7 @@ static irqreturn_t nau8821_interrupt(int irq, void *data) · 24 unmodified lines
12221219 NAU8821_MICDET_MASK, NAU8821_MICDET_EN);
12231220 if (nau8821_is_jack_inserted(regmap)) {
12241221 /* Detect microphone and jack type */
1225− component = snd_soc_dapm_to_component(nau8821->dapm);
1226− snd_soc_component_force_enable_pin(component, "MICBIAS");
1222+ snd_soc_dapm_force_enable_pin(nau8821->dapm, "MICBIAS");
12271223 snd_soc_dapm_sync(nau8821->dapm);
12281224 schedule_delayed_work(&nau8821->jdet_work, msecs_to_jiffies(20));
12291225 /* Turn off insertion interruption at manual mode */
@@ -1261,8 +1257,7 @@ static const struct regmap_config nau8821_regmap_config = { · 31 unmodified lines
12611257 static int nau8821_component_probe(struct snd_soc_component *component)
12621258 {
12631259 struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
1264− struct snd_soc_dapm_context *dapm =
1265− snd_soc_component_get_dapm(component);
1260+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12661261
12671262 nau8821->dapm = dapm;
12681263
@@ -1564,8 +1559,7 @@ static int nau8821_set_bias_level(struct snd_soc_component *component, · 295 unmodified lines
15641559
15651560 case SND_SOC_BIAS_STANDBY:
15661561 /* Setup codec configuration after resume */
1567− if (snd_soc_component_get_bias_level(component) ==
1568− SND_SOC_BIAS_OFF)
1562+ if (snd_soc_dapm_get_bias_level(nau8821->dapm) == SND_SOC_BIAS_OFF)
15691563 nau8821_resume_setup(nau8821);
15701564 break;
15711565
@@ -1603,9 +1597,9 @@ static int __maybe_unused nau8821_suspend(struct snd_soc_component *component) · 31 unmodified lines
16031597
16041598 if (nau8821->irq)
16051599 disable_irq(nau8821->irq);
1606− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
1600+ snd_soc_dapm_force_bias_level(nau8821->dapm, SND_SOC_BIAS_OFF);
16071601 /* Power down codec power; don't support button wakeup */
1608− snd_soc_component_disable_pin(component, "MICBIAS");
1602+ snd_soc_dapm_disable_pin(nau8821->dapm, "MICBIAS");
16091603 snd_soc_dapm_sync(nau8821->dapm);
16101604 regcache_cache_only(nau8821->regmap, true);
16111605 regcache_mark_dirty(nau8821->regmap);
sound/soc/codecs/nau8822.c+10−10
@@ -180,8 +180,7 @@ static bool nau8822_volatile(struct device *dev, unsigned int reg) · 179 unmodified lines
180180 static int nau8822_eq_get(struct snd_kcontrol *kcontrol,
181181 struct snd_ctl_elem_value *ucontrol)
182182 {
183− struct snd_soc_component *component =
184− snd_soc_kcontrol_component(kcontrol);
183+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
185184 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
186185 int i, reg;
187186 u16 reg_val, *val;
@@ -212,8 +211,7 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol, · 24 unmodified lines
212211 static int nau8822_eq_put(struct snd_kcontrol *kcontrol,
213212 struct snd_ctl_elem_value *ucontrol)
214213 {
215− struct snd_soc_component *component =
216− snd_soc_kcontrol_component(kcontrol);
214+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
217215 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
218216 void *data;
219217 u16 *val, value;
@@ -959,6 +957,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 739 unmodified lines
959957 enum snd_soc_bias_level level)
960958 {
961959 struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component);
960+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
962961
963962 switch (level) {
964963 case SND_SOC_BIAS_ON:
@@ -966,7 +965,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
966965
967966 case SND_SOC_BIAS_PREPARE:
968967 if (nau8822->mclk &&
969− snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON) {
968+ snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_ON) {
970969 int ret = clk_prepare_enable(nau8822->mclk);
971970
972971 if (ret) {
@@ -983,7 +982,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 10 unmodified lines
983982
984983 case SND_SOC_BIAS_STANDBY:
985984 if (nau8822->mclk &&
986− snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_OFF)
985+ snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF)
987986 clk_disable_unprepare(nau8822->mclk);
988987
989988 snd_soc_component_update_bits(component,
@@ -991,8 +990,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
991990 NAU8822_IOBUF_EN | NAU8822_ABIAS_EN,
992991 NAU8822_IOBUF_EN | NAU8822_ABIAS_EN);
993992
994− if (snd_soc_component_get_bias_level(component) ==
995− SND_SOC_BIAS_OFF) {
993+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
996994 snd_soc_component_update_bits(component,
997995 NAU8822_REG_POWER_MANAGEMENT_1,
998996 NAU8822_REFIMP_MASK, NAU8822_REFIMP_3K);
@@ -1055,8 +1053,9 @@ static struct snd_soc_dai_driver nau8822_dai = { · 56 unmodified lines
10551053 static int nau8822_suspend(struct snd_soc_component *component)
10561054 {
10571055 struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component);
1056+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10581057
1059− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
1058+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
10601059
10611060 regcache_mark_dirty(nau8822->regmap);
10621061
@@ -1066,10 +1065,11 @@ static int nau8822_suspend(struct snd_soc_component *component) · 3 unmodified lines
10661065 static int nau8822_resume(struct snd_soc_component *component)
10671066 {
10681067 struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component);
1068+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10691069
10701070 regcache_sync(nau8822->regmap);
10711071
1072− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
1072+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
10731073
10741074 return 0;
10751075 }
sound/soc/codecs/nau8824.c+5−5
@@ -876,7 +876,7 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) · 875 unmodified lines
876876 NAU8824_JD_SLEEP_MODE, NAU8824_JD_SLEEP_MODE);
877877
878878 /* Close clock for jack type detection at manual mode */
879− if (dapm->bias_level < SND_SOC_BIAS_PREPARE)
879+ if (snd_soc_dapm_get_bias_level(dapm) < SND_SOC_BIAS_PREPARE)
880880 nau8824_config_sysclk(nau8824, NAU8824_CLK_DIS, 0);
881881 }
882882
@@ -931,7 +931,7 @@ static void nau8824_setup_auto_irq(struct nau8824 *nau8824) · 48 unmodified lines
931931 regmap_update_bits(regmap, NAU8824_REG_INTERRUPT_SETTING,
932932 NAU8824_IRQ_EJECT_DIS, 0);
933933 /* Enable internal VCO needed for interruptions */
934− if (nau8824->dapm->bias_level < SND_SOC_BIAS_PREPARE)
934+ if (snd_soc_dapm_get_bias_level(nau8824->dapm) < SND_SOC_BIAS_PREPARE)
935935 nau8824_config_sysclk(nau8824, NAU8824_CLK_INTERNAL, 0);
936936 regmap_update_bits(regmap, NAU8824_REG_ENA_CTRL,
937937 NAU8824_JD_SLEEP_MODE, 0);
@@ -1498,7 +1498,7 @@ static int nau8824_set_bias_level(struct snd_soc_component *component, · 560 unmodified lines
14981498 break;
14991499
15001500 case SND_SOC_BIAS_STANDBY:
1501− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1501+ if (snd_soc_dapm_get_bias_level(nau8824->dapm) == SND_SOC_BIAS_OFF) {
15021502 /* Setup codec configuration after resume */
15031503 nau8824_resume_setup(nau8824);
15041504 }
@@ -1519,7 +1519,7 @@ static int nau8824_set_bias_level(struct snd_soc_component *component, · 14 unmodified lines
15191519 static int nau8824_component_probe(struct snd_soc_component *component)
15201520 {
15211521 struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
1522− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1522+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15231523
15241524 nau8824->dapm = dapm;
15251525
@@ -1532,7 +1532,7 @@ static int __maybe_unused nau8824_suspend(struct snd_soc_component *component) · 6 unmodified lines
15321532
15331533 if (nau8824->irq) {
15341534 disable_irq(nau8824->irq);
1535− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
1535+ snd_soc_dapm_force_bias_level(nau8824->dapm, SND_SOC_BIAS_OFF);
15361536 }
15371537 regcache_cache_only(nau8824->regmap, true);
15381538 regcache_mark_dirty(nau8824->regmap);
sound/soc/codecs/nau8825.c+3−3
@@ -2226,7 +2226,7 @@ static const struct regmap_config nau8825_regmap_config = { · 2225 unmodified lines
22262226 static int nau8825_component_probe(struct snd_soc_component *component)
22272227 {
22282228 struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component);
2229− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2229+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
22302230
22312231 nau8825->dapm = dapm;
22322232
@@ -2630,7 +2630,7 @@ static int nau8825_set_bias_level(struct snd_soc_component *component, · 397 unmodified lines
26302630 break;
26312631
26322632 case SND_SOC_BIAS_STANDBY:
2633− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
2633+ if (snd_soc_dapm_get_bias_level(nau8825->dapm) == SND_SOC_BIAS_OFF) {
26342634 if (nau8825->mclk_freq) {
26352635 ret = clk_prepare_enable(nau8825->mclk);
26362636 if (ret) {
@@ -2673,7 +2673,7 @@ static int __maybe_unused nau8825_suspend(struct snd_soc_component *component) · 36 unmodified lines
26732673 struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component);
26742674
26752675 disable_irq(nau8825->irq);
2676− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2676+ snd_soc_dapm_force_bias_level(nau8825->dapm, SND_SOC_BIAS_OFF);
26772677 /* Power down codec power; don't suppoet button wakeup */
26782678 snd_soc_dapm_disable_pin(nau8825->dapm, "SAR");
26792679 snd_soc_dapm_disable_pin(nau8825->dapm, "MICBIAS");
sound/soc/codecs/ntp8835.c+2−2
@@ -92,7 +92,7 @@ static int ntp8835_mute_info(struct snd_kcontrol *kcontrol, · 91 unmodified lines
9292 static int ntp8835_mute_get(struct snd_kcontrol *kcontrol,
9393 struct snd_ctl_elem_value *ucontrol)
9494 {
95− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
95+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
9696 unsigned int val;
9797
9898 val = snd_soc_component_read(component, NTP8835_SOFT_MUTE);
@@ -104,7 +104,7 @@ static int ntp8835_mute_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
104104 static int ntp8835_mute_put(struct snd_kcontrol *kcontrol,
105105 struct snd_ctl_elem_value *ucontrol)
106106 {
107− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
107+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
108108 unsigned int val;
109109
110110 val = ucontrol->value.integer.value[0] ? 0 : 7;
sound/soc/codecs/pcm1681.c+2−2
@@ -108,7 +108,7 @@ static int pcm1681_set_deemph(struct snd_soc_component *component) · 107 unmodified lines
108108 static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
109109 struct snd_ctl_elem_value *ucontrol)
110110 {
111− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
111+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
112112 struct pcm1681_private *priv = snd_soc_component_get_drvdata(component);
113113
114114 ucontrol->value.integer.value[0] = priv->deemph;
@@ -119,7 +119,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, · 4 unmodified lines
119119 static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol,
120120 struct snd_ctl_elem_value *ucontrol)
121121 {
122− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
122+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
123123 struct pcm1681_private *priv = snd_soc_component_get_drvdata(component);
124124
125125 priv->deemph = ucontrol->value.integer.value[0];
sound/soc/codecs/pcm186x.c+4−2
@@ -546,8 +546,10 @@ static int pcm186x_power_off(struct snd_soc_component *component) · 545 unmodified lines
546546 static int pcm186x_set_bias_level(struct snd_soc_component *component,
547547 enum snd_soc_bias_level level)
548548 {
549+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
550+
549551 dev_dbg(component->dev, "## %s: %d -> %d\n", __func__,
550− snd_soc_component_get_bias_level(component), level);
552+ snd_soc_dapm_get_bias_level(dapm), level);
551553
552554 switch (level) {
553555 case SND_SOC_BIAS_ON:
@@ -555,7 +557,7 @@ static int pcm186x_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
555557 case SND_SOC_BIAS_PREPARE:
556558 break;
557559 case SND_SOC_BIAS_STANDBY:
558− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
560+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
559561 pcm186x_power_on(component);
560562 break;
561563 case SND_SOC_BIAS_OFF:
sound/soc/codecs/pcm512x.c+14−11
@@ -224,7 +224,7 @@ static bool pcm512x_volatile(struct device *dev, unsigned int reg) · 223 unmodified lines
224224 static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol,
225225 struct snd_ctl_elem_value *ucontrol)
226226 {
227− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
227+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
228228 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
229229
230230 ucontrol->value.integer.value[0] = pcm512x->overclock_pll;
@@ -234,10 +234,11 @@ static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
234234 static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol,
235235 struct snd_ctl_elem_value *ucontrol)
236236 {
237− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
237+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
238+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
238239 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
239240
240− switch (snd_soc_component_get_bias_level(component)) {
241+ switch (snd_soc_dapm_get_bias_level(dapm)) {
241242 case SND_SOC_BIAS_OFF:
242243 case SND_SOC_BIAS_STANDBY:
243244 break;
@@ -252,7 +253,7 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines
252253 static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol,
253254 struct snd_ctl_elem_value *ucontrol)
254255 {
255− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
256+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
256257 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
257258
258259 ucontrol->value.integer.value[0] = pcm512x->overclock_dsp;
@@ -262,10 +263,11 @@ static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
262263 static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol,
263264 struct snd_ctl_elem_value *ucontrol)
264265 {
265− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
266+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
267+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
266268 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
267269
268− switch (snd_soc_component_get_bias_level(component)) {
270+ switch (snd_soc_dapm_get_bias_level(dapm)) {
269271 case SND_SOC_BIAS_OFF:
270272 case SND_SOC_BIAS_STANDBY:
271273 break;
@@ -280,7 +282,7 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines
280282 static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol,
281283 struct snd_ctl_elem_value *ucontrol)
282284 {
283− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
285+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
284286 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
285287
286288 ucontrol->value.integer.value[0] = pcm512x->overclock_dac;
@@ -290,10 +292,11 @@ static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines
290292 static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol,
291293 struct snd_ctl_elem_value *ucontrol)
292294 {
293− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
295+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
296+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
294297 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
295298
296− switch (snd_soc_component_get_bias_level(component)) {
299+ switch (snd_soc_dapm_get_bias_level(dapm)) {
297300 case SND_SOC_BIAS_OFF:
298301 case SND_SOC_BIAS_STANDBY:
299302 break;
@@ -393,7 +396,7 @@ static int pcm512x_update_mute(struct pcm512x_priv *pcm512x) · 93 unmodified lines
393396 static int pcm512x_digital_playback_switch_get(struct snd_kcontrol *kcontrol,
394397 struct snd_ctl_elem_value *ucontrol)
395398 {
396− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
399+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
397400 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
398401
399402 mutex_lock(&pcm512x->mutex);
@@ -407,7 +410,7 @@ static int pcm512x_digital_playback_switch_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines
407410 static int pcm512x_digital_playback_switch_put(struct snd_kcontrol *kcontrol,
408411 struct snd_ctl_elem_value *ucontrol)
409412 {
410− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
413+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
411414 struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
412415 int ret, changed = 0;
413416
sound/soc/codecs/pcm6240.c+3−6
@@ -1139,8 +1139,7 @@ static int pcmdevice_info_profile( · 1138 unmodified lines
11391139 struct snd_kcontrol *kcontrol,
11401140 struct snd_ctl_elem_info *uinfo)
11411141 {
1142− struct snd_soc_component *codec
1143− = snd_soc_kcontrol_component(kcontrol);
1142+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
11441143 struct pcmdevice_priv *pcm_dev =
11451144 snd_soc_component_get_drvdata(codec);
11461145
@@ -1156,8 +1155,7 @@ static int pcmdevice_get_profile_id( · 9 unmodified lines
11561155 struct snd_kcontrol *kcontrol,
11571156 struct snd_ctl_elem_value *ucontrol)
11581157 {
1159− struct snd_soc_component *codec
1160− = snd_soc_kcontrol_component(kcontrol);
1158+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
11611159 struct pcmdevice_priv *pcm_dev =
11621160 snd_soc_component_get_drvdata(codec);
11631161
@@ -1170,8 +1168,7 @@ static int pcmdevice_set_profile_id( · 6 unmodified lines
11701168 struct snd_kcontrol *kcontrol,
11711169 struct snd_ctl_elem_value *ucontrol)
11721170 {
1173− struct snd_soc_component *codec
1174− = snd_soc_kcontrol_component(kcontrol);
1171+ struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
11751172 struct pcmdevice_priv *pcm_dev =
11761173 snd_soc_component_get_drvdata(codec);
11771174 int nr_profile = ucontrol->value.integer.value[0];
sound/soc/codecs/peb2466.c+3−3
@@ -276,7 +276,7 @@ static int peb2466_lkup_ctrl_put(struct snd_kcontrol *kcontrol, · 275 unmodified lines
276276 {
277277 struct peb2466_lkup_ctrl *lkup_ctrl =
278278 (struct peb2466_lkup_ctrl *)kcontrol->private_value;
279− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
279+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
280280 struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component);
281281 unsigned int index;
282282 int ret;
@@ -377,7 +377,7 @@ static const struct soc_enum peb2466_tg_freq[][2] = { · 94 unmodified lines
377377 static int peb2466_tg_freq_get(struct snd_kcontrol *kcontrol,
378378 struct snd_ctl_elem_value *ucontrol)
379379 {
380− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
380+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
381381 struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component);
382382 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
383383
@@ -415,7 +415,7 @@ static int peb2466_tg_freq_get(struct snd_kcontrol *kcontrol, · 31 unmodified lines
415415 static int peb2466_tg_freq_put(struct snd_kcontrol *kcontrol,
416416 struct snd_ctl_elem_value *ucontrol)
417417 {
418− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
418+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
419419 struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component);
420420 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
421421 unsigned int *tg_freq_item;
sound/soc/codecs/pm4125-sdw.c+7−57
@@ -20,12 +20,12 @@ · 19 unmodified lines
2020 #include <sound/soc.h>
2121 #include "pm4125.h"
2222
23−static struct pm4125_sdw_ch_info pm4125_sdw_rx_ch_info[] = {
23+static struct wcd_sdw_ch_info pm4125_sdw_rx_ch_info[] = {
2424 WCD_SDW_CH(PM4125_HPH_L, PM4125_HPH_PORT, BIT(0)),
2525 WCD_SDW_CH(PM4125_HPH_R, PM4125_HPH_PORT, BIT(1)),
2626 };
2727
28−static struct pm4125_sdw_ch_info pm4125_sdw_tx_ch_info[] = {
28+static struct wcd_sdw_ch_info pm4125_sdw_tx_ch_info[] = {
2929 WCD_SDW_CH(PM4125_ADC1, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(0)),
3030 WCD_SDW_CH(PM4125_ADC2, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(1)),
3131 };
@@ -46,12 +46,6 @@ static struct sdw_dpn_prop pm4125_dpn_prop[PM4125_MAX_SWR_PORTS] = { · 14 unmodified lines
4646 }
4747 };
4848
49−struct device *pm4125_sdw_device_get(struct device_node *np)
50−{
51− return bus_find_device_by_of_node(&sdw_bus_type, np);
52−}
53−EXPORT_SYMBOL_GPL(pm4125_sdw_device_get);
54−
5549 int pm4125_sdw_hw_params(struct pm4125_sdw_priv *priv, struct snd_pcm_substream *substream,
5650 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
5751 {
@@ -83,19 +77,6 @@ int pm4125_sdw_hw_params(struct pm4125_sdw_priv *priv, struct snd_pcm_substream · 25 unmodified lines
8377 }
8478 EXPORT_SYMBOL_GPL(pm4125_sdw_hw_params);
8579
86−static int pm4125_update_status(struct sdw_slave *slave, enum sdw_slave_status status)
87−{
88− struct pm4125_sdw_priv *priv = dev_get_drvdata(&slave->dev);
89−
90− if (priv->regmap && status == SDW_SLAVE_ATTACHED) {
91− /* Write out any cached changes that happened between probe and attach */
92− regcache_cache_only(priv->regmap, false);
93− return regcache_sync(priv->regmap);
94− }
95−
96− return 0;
97−}
98−
9980 /*
10081 * Handle Soundwire out-of-band interrupt event by triggering the first irq of the slave_irq
10182 * irq domain, which then will be handled by the regmap_irq threaded irq.
@@ -104,18 +85,9 @@ static int pm4125_update_status(struct sdw_slave *slave, enum sdw_slave_status s · 2 unmodified lines
10485 static int pm4125_interrupt_callback(struct sdw_slave *slave, struct sdw_slave_intr_status *status)
10586 {
10687 struct pm4125_sdw_priv *priv = dev_get_drvdata(&slave->dev);
107− struct irq_domain *slave_irq = priv->slave_irq;
108− u32 sts1, sts2, sts3;
109−
110− do {
111− handle_nested_irq(irq_find_mapping(slave_irq, 0));
112− regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_0, &sts1);
113− regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_1, &sts2);
114− regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_2, &sts3);
11588
116− } while (sts1 || sts2 || sts3);
117−
118− return IRQ_HANDLED;
89+ return wcd_interrupt_callback(slave, priv->slave_irq, PM4125_DIG_SWR_INTR_STATUS_0,
90+ PM4125_DIG_SWR_INTR_STATUS_1, PM4125_DIG_SWR_INTR_STATUS_2);
11991 }
12092
12193 static const struct reg_default pm4125_defaults[] = {
@@ -369,32 +341,10 @@ static const struct regmap_config pm4125_regmap_config = { · 247 unmodified lines
369341 };
370342
371343 static const struct sdw_slave_ops pm4125_slave_ops = {
372− .update_status = pm4125_update_status,
344+ .update_status = wcd_update_status,
373345 .interrupt_callback = pm4125_interrupt_callback,
374346 };
375347
376−static int pm4125_sdw_component_bind(struct device *dev, struct device *master, void *data)
377−{
378− pm_runtime_set_autosuspend_delay(dev, 3000);
379− pm_runtime_use_autosuspend(dev);
380− pm_runtime_set_active(dev);
381− pm_runtime_enable(dev);
382−
383− return 0;
384−}
385−
386−static void pm4125_sdw_component_unbind(struct device *dev, struct device *master, void *data)
387−{
388− pm_runtime_disable(dev);
389− pm_runtime_set_suspended(dev);
390− pm_runtime_dont_use_autosuspend(dev);
391−}
392−
393−static const struct component_ops pm4125_sdw_component_ops = {
394− .bind = pm4125_sdw_component_bind,
395− .unbind = pm4125_sdw_component_unbind,
396−};
397−
398348 static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id)
399349 {
400350 struct device *dev = &pdev->dev;
@@ -476,7 +426,7 @@ static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) · 75 unmodified lines
476426 priv->ch_info[i].master_ch_mask = PM4125_SWRM_CH_MASK(master_ch_mask[i]);
477427 }
478428
479− ret = component_add(dev, &pm4125_sdw_component_ops);
429+ ret = component_add(dev, &wcd_sdw_component_ops);
480430 if (ret)
481431 return ret;
482432
@@ -490,7 +440,7 @@ static int pm4125_remove(struct sdw_slave *pdev) · 7 unmodified lines
490440 {
491441 struct device *dev = &pdev->dev;
492442
493− component_del(dev, &pm4125_sdw_component_ops);
443+ component_del(dev, &wcd_sdw_component_ops);
494444
495445 return 0;
496446 }
sound/soc/codecs/pm4125.c+53−72
@@ -69,16 +69,14 @@ struct pm4125_priv { · 68 unmodified lines
6969 struct wcd_mbhc *wcd_mbhc;
7070 struct wcd_mbhc_config mbhc_cfg;
7171 struct wcd_mbhc_intr intr_ids;
72+ struct wcd_common common;
7273 struct irq_domain *virq;
73− const struct regmap_irq_chip *pm4125_regmap_irq_chip;
74+ const struct regmap_irq_chip *chip_desc;
7475 struct regmap_irq_chip_data *irq_chip;
7576 struct snd_soc_jack *jack;
7677 unsigned long status_mask;
7778 s32 micb_ref[PM4125_MAX_MICBIAS];
7879 s32 pullup_ref[PM4125_MAX_MICBIAS];
79− u32 micb1_mv;
80− u32 micb2_mv;
81− u32 micb3_mv;
8280
8381 int hphr_pdm_wd_int;
8482 int hphl_pdm_wd_int;
@@ -179,7 +177,7 @@ static const u32 pm4125_config_regs[] = { · 94 unmodified lines
179177 PM4125_DIG_SWR_INTR_LEVEL_0,
180178 };
181179
182−static struct regmap_irq_chip pm4125_regmap_irq_chip = {
180+static const struct regmap_irq_chip pm4125_regmap_irq_chip = {
183181 .name = "pm4125",
184182 .irqs = pm4125_irqs,
185183 .num_irqs = ARRAY_SIZE(pm4125_irqs),
@@ -644,16 +642,6 @@ static int pm4125_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, · 458 unmodified lines
644642 return 0;
645643 }
646644
647−static int pm4125_get_micb_vout_ctl_val(struct device *dev, u32 micb_mv)
648−{
649− if (micb_mv < 1600 || micb_mv > 2850) {
650− dev_err(dev, "%s: unsupported micbias voltage (%u mV)\n", __func__, micb_mv);
651− return -EINVAL;
652− }
653−
654− return (micb_mv - 1600) / 50;
655−}
656−
657645 static int pm4125_codec_enable_adc(struct snd_soc_dapm_widget *w,
658646 struct snd_kcontrol *kcontrol, int event)
659647 {
@@ -691,7 +679,7 @@ static int pm4125_codec_enable_adc(struct snd_soc_dapm_widget *w, · 31 unmodified lines
691679 0x00);
692680 pm4125_global_mbias_disable(component);
693681 break;
694− };
682+ }
695683
696684 return 0;
697685 }
@@ -756,7 +744,7 @@ static int pm4125_micbias_control(struct snd_soc_component *component, int micb_ · 58 unmodified lines
756744 dev_err(component->dev, "%s: Invalid micbias number: %d\n",
757745 __func__, micb_num);
758746 return -EINVAL;
759− };
747+ }
760748
761749 switch (req) {
762750 case MICB_PULLUP_ENABLE:
@@ -799,7 +787,7 @@ static int pm4125_micbias_control(struct snd_soc_component *component, int micb_ · 36 unmodified lines
799787 pm4125_global_mbias_disable(component);
800788 }
801789 break;
802− };
790+ }
803791
804792 return 0;
805793 }
@@ -855,7 +843,7 @@ static int pm4125_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w, · 49 unmodified lines
855843 static int pm4125_connect_port(struct pm4125_sdw_priv *sdw_priv, u8 port_idx, u8 ch_id, bool enable)
856844 {
857845 struct sdw_port_config *port_config = &sdw_priv->port_config[port_idx - 1];
858− const struct pm4125_sdw_ch_info *ch_info = &sdw_priv->ch_info[ch_id];
846+ const struct wcd_sdw_ch_info *ch_info = &sdw_priv->ch_info[ch_id];
859847 struct sdw_slave *sdev = sdw_priv->sdev;
860848 u8 port_num = ch_info->port_num;
861849 u8 ch_mask = ch_info->ch_mask;
@@ -879,7 +867,7 @@ static int pm4125_connect_port(struct pm4125_sdw_priv *sdw_priv, u8 port_idx, u8 · 17 unmodified lines
879867
880868 static int pm4125_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
881869 {
882− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
870+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
883871 struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component);
884872 struct soc_mixer_control *mc;
885873 bool hphr;
@@ -893,7 +881,7 @@ static int pm4125_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_el · 7 unmodified lines
893881
894882 static int pm4125_set_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
895883 {
896− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
884+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
897885 struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component);
898886 struct pm4125_sdw_priv *sdw_priv = pm4125->sdw_priv[AIF1_PB];
899887 int value = ucontrol->value.integer.value[0];
@@ -926,7 +914,7 @@ static int pm4125_set_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_el · 26 unmodified lines
926914 static int pm4125_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
927915 {
928916 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
929− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
917+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
930918 struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp);
931919 struct pm4125_sdw_priv *sdw_priv;
932920 int dai_id = mixer->shift;
@@ -944,7 +932,7 @@ static int pm4125_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_ele · 11 unmodified lines
944932 static int pm4125_set_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
945933 {
946934 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
947− struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
935+ struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
948936 struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp);
949937 struct pm4125_sdw_priv *sdw_priv;
950938 int dai_id = mixer->shift;
@@ -1266,15 +1254,8 @@ static const struct snd_soc_dapm_route pm4125_audio_map[] = { · 315 unmodified lines
12661254
12671255 static int pm4125_set_micbias_data(struct device *dev, struct pm4125_priv *pm4125)
12681256 {
1269− int vout_ctl;
1270−
1271− /* Set micbias voltage */
1272− vout_ctl = pm4125_get_micb_vout_ctl_val(dev, pm4125->micb1_mv);
1273− if (vout_ctl < 0)
1274− return -EINVAL;
1275−
12761257 regmap_update_bits(pm4125->regmap, PM4125_ANA_MICBIAS_LDO_1_SETTING,
1277− PM4125_ANA_MICBIAS_MICB_OUT_VAL_MASK, vout_ctl << 3);
1258+ PM4125_ANA_MICBIAS_MICB_OUT_VAL_MASK, pm4125->common.micb_vout[0]);
12781259 return 0;
12791260 }
12801261
@@ -1320,10 +1301,8 @@ static int pm4125_irq_init(struct pm4125_priv *pm4125, struct device *dev) · 39 unmodified lines
13201301 return -EINVAL;
13211302 }
13221303
1323− pm4125_regmap_irq_chip.irq_drv_data = pm4125;
1324−
13251304 return devm_regmap_add_irq_chip(dev, pm4125->regmap, irq_create_mapping(pm4125->virq, 0),
1326− IRQF_ONESHOT, 0, &pm4125_regmap_irq_chip,
1305+ IRQF_ONESHOT, 0, pm4125->chip_desc,
13271306 &pm4125->irq_chip);
13281307 }
13291308
@@ -1418,31 +1397,6 @@ static const struct snd_soc_component_driver soc_codec_dev_pm4125 = { · 88 unmodified lines
14181397 .endianness = 1,
14191398 };
14201399
1421−static void pm4125_dt_parse_micbias_info(struct device *dev, struct pm4125_priv *priv)
1422−{
1423− struct device_node *np = dev->of_node;
1424− u32 prop_val = 0;
1425− int ret;
1426−
1427− ret = of_property_read_u32(np, "qcom,micbias1-microvolt", &prop_val);
1428− if (!ret)
1429− priv->micb1_mv = prop_val / 1000;
1430− else
1431− dev_warn(dev, "Micbias1 DT property not found\n");
1432−
1433− ret = of_property_read_u32(np, "qcom,micbias2-microvolt", &prop_val);
1434− if (!ret)
1435− priv->micb2_mv = prop_val / 1000;
1436− else
1437− dev_warn(dev, "Micbias2 DT property not found\n");
1438−
1439− ret = of_property_read_u32(np, "qcom,micbias3-microvolt", &prop_val);
1440− if (!ret)
1441− priv->micb3_mv = prop_val / 1000;
1442− else
1443− dev_warn(dev, "Micbias3 DT property not found\n");
1444−}
1445−
14461400 static int pm4125_codec_hw_params(struct snd_pcm_substream *substream,
14471401 struct snd_pcm_hw_params *params,
14481402 struct snd_soc_dai *dai)
@@ -1551,6 +1505,10 @@ static int pm4125_bind(struct device *dev) · 102 unmodified lines
15511505 struct device_link *devlink;
15521506 int ret;
15531507
1508+ /* Initialize device pointers to NULL for safe cleanup */
1509+ pm4125->rxdev = NULL;
1510+ pm4125->txdev = NULL;
1511+
15541512 /* Give the soundwire subdevices some more time to settle */
15551513 usleep_range(15000, 15010);
15561514
@@ -1560,7 +1518,7 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines
15601518 return ret;
15611519 }
15621520
1563− pm4125->rxdev = pm4125_sdw_device_get(pm4125->rxnode);
1521+ pm4125->rxdev = of_sdw_find_device_by_node(pm4125->rxnode);
15641522 if (!pm4125->rxdev) {
15651523 dev_err(dev, "could not find rxslave with matching of node\n");
15661524 ret = -EINVAL;
@@ -1570,11 +1528,11 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines
15701528 pm4125->sdw_priv[AIF1_PB] = dev_get_drvdata(pm4125->rxdev);
15711529 pm4125->sdw_priv[AIF1_PB]->pm4125 = pm4125;
15721530
1573− pm4125->txdev = pm4125_sdw_device_get(pm4125->txnode);
1531+ pm4125->txdev = of_sdw_find_device_by_node(pm4125->txnode);
15741532 if (!pm4125->txdev) {
15751533 dev_err(dev, "could not find txslave with matching of node\n");
15761534 ret = -EINVAL;
1577− goto error_unbind_all;
1535+ goto error_put_rx;
15781536 }
15791537
15801538 pm4125->sdw_priv[AIF1_CAP] = dev_get_drvdata(pm4125->txdev);
@@ -1584,7 +1542,7 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines
15841542 if (!pm4125->tx_sdw_dev) {
15851543 dev_err(dev, "could not get txslave with matching of dev\n");
15861544 ret = -EINVAL;
1587− goto error_unbind_all;
1545+ goto error_put_tx;
15881546 }
15891547
15901548 /*
@@ -1596,7 +1554,7 @@ static int pm4125_bind(struct device *dev) · 5 unmodified lines
15961554 if (!devlink) {
15971555 dev_err(dev, "Could not devlink TX and RX\n");
15981556 ret = -EINVAL;
1599− goto error_unbind_all;
1557+ goto error_put_tx;
16001558 }
16011559
16021560 devlink = device_link_add(dev, pm4125->txdev,
@@ -1615,7 +1573,7 @@ static int pm4125_bind(struct device *dev) · 12 unmodified lines
16151573 goto link_remove_dev_tx;
16161574 }
16171575
1618− pm4125->regmap = dev_get_regmap(&pm4125->tx_sdw_dev->dev, NULL);
1576+ pm4125->regmap = pm4125->sdw_priv[AIF1_CAP]->regmap;
16191577 if (!pm4125->regmap) {
16201578 dev_err(dev, "could not get TX device regmap\n");
16211579 ret = -EINVAL;
@@ -1631,11 +1589,7 @@ static int pm4125_bind(struct device *dev) · 9 unmodified lines
16311589 pm4125->sdw_priv[AIF1_PB]->slave_irq = pm4125->virq;
16321590 pm4125->sdw_priv[AIF1_CAP]->slave_irq = pm4125->virq;
16331591
1634− ret = pm4125_set_micbias_data(dev, pm4125);
1635− if (ret < 0) {
1636− dev_err(dev, "Bad micbias pdata\n");
1637− goto link_remove_dev_rx;
1638− }
1592+ pm4125_set_micbias_data(dev, pm4125);
16391593
16401594 ret = snd_soc_register_component(dev, &soc_codec_dev_pm4125,
16411595 pm4125_dais, ARRAY_SIZE(pm4125_dais));
@@ -1650,6 +1604,10 @@ link_remove_dev_tx: · 8 unmodified lines
16501604 device_link_remove(dev, pm4125->txdev);
16511605 link_remove_rx_tx:
16521606 device_link_remove(pm4125->rxdev, pm4125->txdev);
1607+error_put_tx:
1608+ put_device(pm4125->txdev);
1609+error_put_rx:
1610+ put_device(pm4125->rxdev);
16531611 error_unbind_all:
16541612 component_unbind_all(dev, pm4125);
16551613 return ret;
@@ -1660,9 +1618,18 @@ static void pm4125_unbind(struct device *dev) · 4 unmodified lines
16601618 struct pm4125_priv *pm4125 = dev_get_drvdata(dev);
16611619
16621620 snd_soc_unregister_component(dev);
1621+ devm_regmap_del_irq_chip(dev, irq_find_mapping(pm4125->virq, 0),
1622+ pm4125->irq_chip);
16631623 device_link_remove(dev, pm4125->txdev);
16641624 device_link_remove(dev, pm4125->rxdev);
16651625 device_link_remove(pm4125->rxdev, pm4125->txdev);
1626+
1627+ /* Release device references acquired in bind */
1628+ if (pm4125->txdev)
1629+ put_device(pm4125->txdev);
1630+ if (pm4125->rxdev)
1631+ put_device(pm4125->rxdev);
1632+
16661633 component_unbind_all(dev, pm4125);
16671634 }
16681635
@@ -1695,6 +1662,7 @@ static int pm4125_probe(struct platform_device *pdev) · 26 unmodified lines
16951662 {
16961663 struct component_match *match = NULL;
16971664 struct device *dev = &pdev->dev;
1665+ struct regmap_irq_chip *chip_desc;
16981666 struct pm4125_priv *pm4125;
16991667 struct wcd_mbhc_config *cfg;
17001668 int ret;
@@ -1705,6 +1673,14 @@ static int pm4125_probe(struct platform_device *pdev) · 4 unmodified lines
17051673
17061674 dev_set_drvdata(dev, pm4125);
17071675
1676+ chip_desc = devm_kmemdup(dev, &pm4125_regmap_irq_chip,
1677+ sizeof(pm4125_regmap_irq_chip),
1678+ GFP_KERNEL);
1679+ if (!chip_desc)
1680+ return -ENOMEM;
1681+ chip_desc->irq_drv_data = pm4125;
1682+ pm4125->chip_desc = chip_desc;
1683+
17081684 ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(pm4125_power_supplies),
17091685 pm4125_power_supplies);
17101686 if (ret)
@@ -1716,7 +1692,12 @@ static int pm4125_probe(struct platform_device *pdev) · 5 unmodified lines
17161692
17171693 pm4125_reset(pm4125);
17181694
1719− pm4125_dt_parse_micbias_info(dev, pm4125);
1695+ pm4125->common.dev = dev;
1696+ pm4125->common.max_bias = 3;
1697+ ret = wcd_dt_parse_micbias_info(&pm4125->common);
1698+ if (ret)
1699+ return dev_err_probe(dev, ret, "Failed to get micbias\n");
1700+
17201701 atomic_set(&pm4125->gloal_mbias_cnt, 0);
17211702
17221703 cfg = &pm4125->mbhc_cfg;
@@ -1724,7 +1705,7 @@ static int pm4125_probe(struct platform_device *pdev) · 1 unmodified line
17241705 cfg->anc_micbias = MIC_BIAS_2;
17251706 cfg->v_hs_max = WCD_MBHC_HS_V_MAX;
17261707 cfg->num_btn = PM4125_MBHC_MAX_BUTTONS;
1727− cfg->micb_mv = pm4125->micb2_mv;
1708+ cfg->micb_mv = pm4125->common.micb_mv[1];
17281709 cfg->linein_th = 5000;
17291710 cfg->hs_thr = 1700;
17301711 cfg->hph_thr = 50;
sound/soc/codecs/pm4125.h+2−16
@@ -7,6 +7,7 @@ · 6 unmodified lines
77
88 #include <linux/soundwire/sdw.h>
99 #include <linux/soundwire/sdw_type.h>
10+#include "wcd-common.h"
1011
1112 #define PM4125_ANA_BASE_ADDR 0x3000
1213 #define PM4125_DIG_BASE_ADDR 0x3400
@@ -202,26 +203,13 @@ enum pm4125_rx_sdw_ports { · 189 unmodified lines
202203 PM4125_MAX_SWR_PORTS = PM4125_COMP_PORT,
203204 };
204205
205−struct pm4125_sdw_ch_info {
206− int port_num;
207− unsigned int ch_mask;
208− unsigned int master_ch_mask;
209−};
210−
211−#define WCD_SDW_CH(id, pn, cmask) \
212− [id] = { \
213− .port_num = pn, \
214− .ch_mask = cmask, \
215− .master_ch_mask = cmask, \
216− }
217−
218206 struct pm4125_priv;
219207 struct pm4125_sdw_priv {
220208 struct sdw_slave *sdev;
221209 struct sdw_stream_config sconfig;
222210 struct sdw_stream_runtime *sruntime;
223211 struct sdw_port_config port_config[PM4125_MAX_SWR_PORTS];
224− struct pm4125_sdw_ch_info *ch_info;
212+ struct wcd_sdw_ch_info *ch_info;
225213 bool port_enable[PM4125_MAX_SWR_CH_IDS];
226214 unsigned int master_channel_map[SDW_MAX_PORTS];
227215 int active_ports;
@@ -240,8 +228,6 @@ int pm4125_sdw_set_sdw_stream(struct pm4125_sdw_priv *pm4125, struct snd_soc_dai · 12 unmodified lines
240228 int pm4125_sdw_hw_params(struct pm4125_sdw_priv *pm4125, struct snd_pcm_substream *substream,
241229 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
242230
243−struct device *pm4125_sdw_device_get(struct device_node *np);
244−
245231 #else
246232 static inline int pm4125_sdw_free(struct pm4125_sdw_priv *pm4125,
247233 struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
sound/soc/codecs/rk3308_codec.c+2−1
@@ -786,6 +786,7 @@ static int rk3308_codec_set_bias_level(struct snd_soc_component *component, · 785 unmodified lines
786786 enum snd_soc_bias_level level)
787787 {
788788 struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
789+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
789790
790791 switch (level) {
791792 case SND_SOC_BIAS_ON:
@@ -793,7 +794,7 @@ static int rk3308_codec_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
793794 case SND_SOC_BIAS_PREPARE:
794795 break;
795796 case SND_SOC_BIAS_STANDBY:
796− if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_OFF)
797+ if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF)
797798 break;
798799
799800 /* Sequence from TRM Section 8.6.3 "Power Up" */
sound/soc/codecs/rt1011.c+15−21
@@ -1034,8 +1034,7 @@ static void rt1011_reset(struct regmap *regmap) · 1033 unmodified lines
10341034 static int rt1011_recv_spk_mode_get(struct snd_kcontrol *kcontrol,
10351035 struct snd_ctl_elem_value *ucontrol)
10361036 {
1037− struct snd_soc_component *component =
1038− snd_soc_kcontrol_component(kcontrol);
1037+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10391038 struct rt1011_priv *rt1011 =
10401039 snd_soc_component_get_drvdata(component);
10411040
@@ -1047,15 +1046,15 @@ static int rt1011_recv_spk_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
10471046 static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol,
10481047 struct snd_ctl_elem_value *ucontrol)
10491048 {
1050− struct snd_soc_component *component =
1051− snd_soc_kcontrol_component(kcontrol);
1049+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1050+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
10521051 struct rt1011_priv *rt1011 =
10531052 snd_soc_component_get_drvdata(component);
10541053
10551054 if (ucontrol->value.integer.value[0] == rt1011->recv_spk_mode)
10561055 return 0;
10571056
1058− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1057+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
10591058 rt1011->recv_spk_mode = ucontrol->value.integer.value[0];
10601059
10611060 if (rt1011->recv_spk_mode) {
@@ -1110,8 +1109,7 @@ static bool rt1011_validate_bq_drc_coeff(unsigned short reg) · 48 unmodified lines
11101109 static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol,
11111110 struct snd_ctl_elem_value *ucontrol)
11121111 {
1113− struct snd_soc_component *component =
1114− snd_soc_kcontrol_component(kcontrol);
1112+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11151113 struct rt1011_priv *rt1011 =
11161114 snd_soc_component_get_drvdata(component);
11171115 struct rt1011_bq_drc_params *bq_drc_info;
@@ -1147,8 +1145,7 @@ static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol, · 29 unmodified lines
11471145 static int rt1011_bq_drc_coeff_put(struct snd_kcontrol *kcontrol,
11481146 struct snd_ctl_elem_value *ucontrol)
11491147 {
1150− struct snd_soc_component *component =
1151− snd_soc_kcontrol_component(kcontrol);
1148+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
11521149 struct rt1011_priv *rt1011 =
11531150 snd_soc_component_get_drvdata(component);
11541151 struct rt1011_bq_drc_params *bq_drc_info;
@@ -1224,10 +1221,11 @@ static int rt1011_r0_cali_put(struct snd_kcontrol *kcontrol, · 69 unmodified lines
12241221 struct snd_ctl_elem_value *ucontrol)
12251222 {
12261223 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1224+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12271225 struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component);
12281226
12291227 rt1011->cali_done = 0;
1230− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF &&
1228+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF &&
12311229 ucontrol->value.integer.value[0])
12321230 rt1011_calibrate(rt1011, 1);
12331231
@@ -1264,6 +1262,7 @@ static int rt1011_r0_load_mode_put(struct snd_kcontrol *kcontrol, · 30 unmodified lines
12641262 struct snd_ctl_elem_value *ucontrol)
12651263 {
12661264 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1265+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12671266 struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component);
12681267 struct device *dev;
12691268 unsigned int r0_integer, r0_factor, format;
@@ -1275,7 +1274,7 @@ static int rt1011_r0_load_mode_put(struct snd_kcontrol *kcontrol, · 5 unmodified lines
12751274 return -EINVAL;
12761275
12771276 dev = regmap_get_device(rt1011->regmap);
1278− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1277+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
12791278 rt1011->r0_reg = ucontrol->value.integer.value[0];
12801279
12811280 format = 2147483648U; /* 2^24 * 128 */
@@ -1319,8 +1318,7 @@ static SOC_ENUM_SINGLE_DECL(rt1011_i2s_ref_enum, 0, 0, · 37 unmodified lines
13191318 static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol,
13201319 struct snd_ctl_elem_value *ucontrol)
13211320 {
1322− struct snd_soc_component *component =
1323− snd_soc_kcontrol_component(kcontrol);
1321+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
13241322 struct rt1011_priv *rt1011 =
13251323 snd_soc_component_get_drvdata(component);
13261324
@@ -1348,8 +1346,7 @@ static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines
13481346 static int rt1011_i2s_ref_get(struct snd_kcontrol *kcontrol,
13491347 struct snd_ctl_elem_value *ucontrol)
13501348 {
1351− struct snd_soc_component *component =
1352− snd_soc_kcontrol_component(kcontrol);
1349+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
13531350 struct rt1011_priv *rt1011 =
13541351 snd_soc_component_get_drvdata(component);
13551352
@@ -1664,8 +1661,7 @@ static int rt1011_hw_params(struct snd_pcm_substream *substream, · 308 unmodified lines
16641661 static int rt1011_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
16651662 {
16661663 struct snd_soc_component *component = dai->component;
1667− struct snd_soc_dapm_context *dapm =
1668− snd_soc_component_get_dapm(component);
1664+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
16691665 unsigned int reg_val = 0, reg_bclk_inv = 0;
16701666 int ret = 0;
16711667
@@ -1845,8 +1841,7 @@ static int rt1011_set_tdm_slot(struct snd_soc_dai *dai, · 173 unmodified lines
18451841 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
18461842 {
18471843 struct snd_soc_component *component = dai->component;
1848− struct snd_soc_dapm_context *dapm =
1849− snd_soc_component_get_dapm(component);
1844+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
18501845 unsigned int val = 0, tdm_en = 0, rx_slotnum, tx_slotnum;
18511846 int ret = 0, first_bit, last_bit;
18521847
@@ -2218,8 +2213,7 @@ static int rt1011_calibrate(struct rt1011_priv *rt1011, unsigned char cali_flag) · 365 unmodified lines
22182213 unsigned int dc_offset;
22192214 unsigned int r0_integer, r0_factor, format;
22202215 struct device *dev = regmap_get_device(rt1011->regmap);
2221− struct snd_soc_dapm_context *dapm =
2222− snd_soc_component_get_dapm(rt1011->component);
2216+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt1011->component);
22232217 int ret = 0;
22242218
22252219 snd_soc_dapm_mutex_lock(dapm);
sound/soc/codecs/rt1015.c+7−10
@@ -427,8 +427,7 @@ static SOC_ENUM_SINGLE_DECL(rt1015_boost_mode_enum, 0, 0, · 426 unmodified lines
427427 static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol,
428428 struct snd_ctl_elem_value *ucontrol)
429429 {
430− struct snd_soc_component *component =
431− snd_soc_kcontrol_component(kcontrol);
430+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
432431 struct rt1015_priv *rt1015 =
433432 snd_soc_component_get_drvdata(component);
434433
@@ -440,8 +439,7 @@ static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
440439 static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol,
441440 struct snd_ctl_elem_value *ucontrol)
442441 {
443− struct snd_soc_component *component =
444− snd_soc_kcontrol_component(kcontrol);
442+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
445443 struct rt1015_priv *rt1015 =
446444 snd_soc_component_get_drvdata(component);
447445 int boost_mode = ucontrol->value.integer.value[0];
@@ -481,8 +479,7 @@ static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, · 33 unmodified lines
481479 static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol,
482480 struct snd_ctl_elem_value *ucontrol)
483481 {
484− struct snd_soc_component *component =
485− snd_soc_kcontrol_component(kcontrol);
482+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
486483 struct rt1015_priv *rt1015 =
487484 snd_soc_component_get_drvdata(component);
488485
@@ -494,9 +491,10 @@ static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
494491 static void rt1015_calibrate(struct rt1015_priv *rt1015)
495492 {
496493 struct snd_soc_component *component = rt1015->component;
494+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
497495 struct regmap *regmap = rt1015->regmap;
498496
499− snd_soc_dapm_mutex_lock(&component->dapm);
497+ snd_soc_dapm_mutex_lock(dapm);
500498 regcache_cache_bypass(regmap, true);
501499
502500 regmap_write(regmap, RT1015_CLK_DET, 0x0000);
@@ -518,14 +516,13 @@ static void rt1015_calibrate(struct rt1015_priv *rt1015) · 15 unmodified lines
518516 regcache_cache_bypass(regmap, false);
519517 regcache_mark_dirty(regmap);
520518 regcache_sync(regmap);
521− snd_soc_dapm_mutex_unlock(&component->dapm);
519+ snd_soc_dapm_mutex_unlock(dapm);
522520 }
523521
524522 static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
525523 struct snd_ctl_elem_value *ucontrol)
526524 {
527− struct snd_soc_component *component =
528− snd_soc_kcontrol_component(kcontrol);
525+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
529526 struct rt1015_priv *rt1015 =
530527 snd_soc_component_get_drvdata(component);
531528
sound/soc/codecs/rt1318.c+2−2
@@ -505,7 +505,7 @@ static int rt1318_dac_event(struct snd_soc_dapm_widget *w, · 504 unmodified lines
505505 static int rt1318_dvol_put(struct snd_kcontrol *kcontrol,
506506 struct snd_ctl_elem_value *ucontrol)
507507 {
508− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
508+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
509509 struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component);
510510
511511 rt1318->rt1318_dvol = ucontrol->value.integer.value[0];
@@ -528,7 +528,7 @@ static int rt1318_dvol_put(struct snd_kcontrol *kcontrol, · 16 unmodified lines
528528 static int rt1318_dvol_get(struct snd_kcontrol *kcontrol,
529529 struct snd_ctl_elem_value *ucontrol)
530530 {
531− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
531+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
532532 struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component);
533533
534534 ucontrol->value.integer.value[0] = rt1318->rt1318_dvol;
sound/soc/codecs/rt274.c+3−2
@@ -925,10 +925,11 @@ static int rt274_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, · 924 unmodified lines
925925 static int rt274_set_bias_level(struct snd_soc_component *component,
926926 enum snd_soc_bias_level level)
927927 {
928+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
929+
928930 switch (level) {
929931 case SND_SOC_BIAS_PREPARE:
930− if (SND_SOC_BIAS_STANDBY ==
931− snd_soc_component_get_bias_level(component)) {
932+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
932933 snd_soc_component_write(component,
933934 RT274_SET_AUDIO_POWER, AC_PWRST_D0);
934935 }
sound/soc/codecs/rt286.c+5−3
@@ -223,7 +223,7 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) · 222 unmodified lines
223223 if (!rt286->component)
224224 return -EINVAL;
225225
226− dapm = snd_soc_component_get_dapm(rt286->component);
226+ dapm = snd_soc_component_to_dapm(rt286->component);
227227
228228 if (rt286->pdata.cbj_en) {
229229 regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf);
@@ -314,7 +314,7 @@ static void rt286_jack_detect_work(struct work_struct *work) · 84 unmodified lines
314314 static int rt286_mic_detect(struct snd_soc_component *component,
315315 struct snd_soc_jack *jack, void *data)
316316 {
317− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
317+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
318318 struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component);
319319
320320 rt286->jack = jack;
@@ -887,9 +887,11 @@ static int rt286_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 566 unmodified lines
887887 static int rt286_set_bias_level(struct snd_soc_component *component,
888888 enum snd_soc_bias_level level)
889889 {
890+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
891+
890892 switch (level) {
891893 case SND_SOC_BIAS_PREPARE:
892− if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
894+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
893895 snd_soc_component_write(component,
894896 RT286_SET_AUDIO_POWER, AC_PWRST_D0);
895897 snd_soc_component_update_bits(component,
sound/soc/codecs/rt298.c+5−4
@@ -227,7 +227,7 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) · 226 unmodified lines
227227 if (!rt298->component)
228228 return -EINVAL;
229229
230− dapm = snd_soc_component_get_dapm(rt298->component);
230+ dapm = snd_soc_component_to_dapm(rt298->component);
231231
232232 if (rt298->pdata.cbj_en) {
233233 regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf);
@@ -329,7 +329,7 @@ static void rt298_jack_detect_work(struct work_struct *work) · 95 unmodified lines
329329 static int rt298_mic_detect(struct snd_soc_component *component,
330330 struct snd_soc_jack *jack, void *data)
331331 {
332− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
332+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
333333 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
334334
335335 rt298->jack = jack;
@@ -949,10 +949,11 @@ static int rt298_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 613 unmodified lines
949949 static int rt298_set_bias_level(struct snd_soc_component *component,
950950 enum snd_soc_bias_level level)
951951 {
952+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
953+
952954 switch (level) {
953955 case SND_SOC_BIAS_PREPARE:
954− if (SND_SOC_BIAS_STANDBY ==
955− snd_soc_component_get_bias_level(component)) {
956+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
956957 snd_soc_component_write(component,
957958 RT298_SET_AUDIO_POWER, AC_PWRST_D0);
958959 snd_soc_component_update_bits(component, 0x0d, 0x200, 0x200);
sound/soc/codecs/rt5514.c+5−3
@@ -325,6 +325,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, · 324 unmodified lines
325325 struct snd_ctl_elem_value *ucontrol)
326326 {
327327 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
328+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
328329 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
329330 const struct firmware *fw = NULL;
330331 u8 buf[8];
@@ -332,7 +333,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, · 1 unmodified line
332333 if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled)
333334 return 0;
334335
335− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
336+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
336337 rt5514->dsp_enabled = ucontrol->value.integer.value[0];
337338
338339 if (rt5514->dsp_enabled) {
@@ -1050,11 +1051,12 @@ static int rt5514_set_bias_level(struct snd_soc_component *component, · 711 unmodified lines
10501051 enum snd_soc_bias_level level)
10511052 {
10521053 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
1054+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10531055 int ret;
10541056
10551057 switch (level) {
10561058 case SND_SOC_BIAS_PREPARE:
1057− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1059+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
10581060 clk_disable_unprepare(rt5514->mclk);
10591061 } else {
10601062 ret = clk_prepare_enable(rt5514->mclk);
@@ -1064,7 +1066,7 @@ static int rt5514_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
10641066 break;
10651067
10661068 case SND_SOC_BIAS_STANDBY:
1067− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1069+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
10681070 /*
10691071 * If the DSP is enabled in start of recording, the DSP
10701072 * should be disabled, and sync back to normal recording
sound/soc/codecs/rt5616.c+3−2
@@ -1159,6 +1159,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 1158 unmodified lines
11591159 enum snd_soc_bias_level level)
11601160 {
11611161 struct rt5616_priv *rt5616 = snd_soc_component_get_drvdata(component);
1162+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
11621163 int ret;
11631164
11641165 switch (level) {
@@ -1174,7 +1175,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines
11741175 * away from ON. Disable the clock in that case, otherwise
11751176 * enable it.
11761177 */
1177− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1178+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
11781179 clk_disable_unprepare(rt5616->mclk);
11791180 } else {
11801181 ret = clk_prepare_enable(rt5616->mclk);
@@ -1184,7 +1185,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
11841185 break;
11851186
11861187 case SND_SOC_BIAS_STANDBY:
1187− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1188+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
11881189 snd_soc_component_update_bits(component, RT5616_PWR_ANLG1,
11891190 RT5616_PWR_VREF1 | RT5616_PWR_MB |
11901191 RT5616_PWR_BG | RT5616_PWR_VREF2,
sound/soc/codecs/rt5631.c+6−4
@@ -183,7 +183,7 @@ static const DECLARE_TLV_DB_RANGE(mic_bst_tlv, · 182 unmodified lines
183183 static int rt5631_dmic_get(struct snd_kcontrol *kcontrol,
184184 struct snd_ctl_elem_value *ucontrol)
185185 {
186− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
186+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
187187 struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component);
188188
189189 ucontrol->value.integer.value[0] = rt5631->dmic_used_flag;
@@ -194,7 +194,7 @@ static int rt5631_dmic_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines
194194 static int rt5631_dmic_put(struct snd_kcontrol *kcontrol,
195195 struct snd_ctl_elem_value *ucontrol)
196196 {
197− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
197+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
198198 struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component);
199199
200200 rt5631->dmic_used_flag = ucontrol->value.integer.value[0];
@@ -1535,6 +1535,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 1334 unmodified lines
15351535 enum snd_soc_bias_level level)
15361536 {
15371537 struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component);
1538+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15381539
15391540 switch (level) {
15401541 case SND_SOC_BIAS_ON:
@@ -1545,7 +1546,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
15451546 break;
15461547
15471548 case SND_SOC_BIAS_STANDBY:
1548− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1549+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
15491550 snd_soc_component_update_bits(component, RT5631_PWR_MANAG_ADD3,
15501551 RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS,
15511552 RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS);
@@ -1575,6 +1576,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 23 unmodified lines
15751576 static int rt5631_probe(struct snd_soc_component *component)
15761577 {
15771578 struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component);
1579+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15781580 unsigned int val;
15791581
15801582 val = rt5631_read_index(component, RT5631_ADDA_MIXER_INTL_REG3);
@@ -1613,7 +1615,7 @@ static int rt5631_probe(struct snd_soc_component *component) · 32 unmodified lines
16131615 RT5631_DMIC_R_CH_LATCH_RISING);
16141616 }
16151617
1616− snd_soc_component_init_bias_level(component, SND_SOC_BIAS_STANDBY);
1618+ snd_soc_dapm_init_bias_level(dapm, SND_SOC_BIAS_STANDBY);
16171619
16181620 return 0;
16191621 }
sound/soc/codecs/rt5640.c+10−9
@@ -1935,6 +1935,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 1934 unmodified lines
19351935 enum snd_soc_bias_level level)
19361936 {
19371937 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
1938+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
19381939 int ret;
19391940
19401941 switch (level) {
@@ -1949,7 +1950,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines
19491950 * away from ON. Disable the clock in that case, otherwise
19501951 * enable it.
19511952 */
1952− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1953+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
19531954 clk_disable_unprepare(rt5640->mclk);
19541955 } else {
19551956 ret = clk_prepare_enable(rt5640->mclk);
@@ -1959,7 +1960,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
19591960 break;
19601961
19611962 case SND_SOC_BIAS_STANDBY:
1962− if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) {
1963+ if (SND_SOC_BIAS_OFF == snd_soc_dapm_get_bias_level(dapm)) {
19631964 snd_soc_component_update_bits(component, RT5640_PWR_ANLG1,
19641965 RT5640_PWR_VREF1 | RT5640_PWR_MB |
19651966 RT5640_PWR_BG | RT5640_PWR_VREF2,
@@ -2098,7 +2099,7 @@ EXPORT_SYMBOL_GPL(rt5640_sel_asrc_clk_src); · 132 unmodified lines
20982099
20992100 void rt5640_enable_micbias1_for_ovcd(struct snd_soc_component *component)
21002101 {
2101− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2102+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
21022103 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
21032104
21042105 snd_soc_dapm_mutex_lock(dapm);
@@ -2114,7 +2115,7 @@ EXPORT_SYMBOL_GPL(rt5640_enable_micbias1_for_ovcd); · 9 unmodified lines
21142115
21152116 void rt5640_disable_micbias1_for_ovcd(struct snd_soc_component *component)
21162117 {
2117− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2118+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
21182119 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
21192120
21202121 snd_soc_dapm_mutex_lock(dapm);
@@ -2586,8 +2587,7 @@ static void rt5640_enable_hda_jack_detect( · 465 unmodified lines
25862587 struct snd_soc_component *component, struct snd_soc_jack *jack)
25872588 {
25882589 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
2589− struct snd_soc_dapm_context *dapm =
2590− snd_soc_component_get_dapm(component);
2590+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
25912591 int ret;
25922592
25932593 /* Select JD1 for Mic */
@@ -2652,7 +2652,7 @@ static int rt5640_set_jack(struct snd_soc_component *component, · 58 unmodified lines
26522652
26532653 static int rt5640_probe(struct snd_soc_component *component)
26542654 {
2655− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2655+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
26562656 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
26572657 u32 dmic1_data_pin = 0;
26582658 u32 dmic2_data_pin = 0;
@@ -2666,7 +2666,7 @@ static int rt5640_probe(struct snd_soc_component *component) · 7 unmodified lines
26662666
26672667 rt5640->component = component;
26682668
2669− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2669+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
26702670
26712671 snd_soc_component_update_bits(component, RT5640_GCTL1, 0x0301, 0x0301);
26722672 snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030);
@@ -2796,6 +2796,7 @@ static void rt5640_remove(struct snd_soc_component *component) · 123 unmodified lines
27962796 static int rt5640_suspend(struct snd_soc_component *component)
27972797 {
27982798 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
2799+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
27992800
28002801 if (rt5640->jack) {
28012802 /* disable jack interrupts during system suspend */
@@ -2804,7 +2805,7 @@ static int rt5640_suspend(struct snd_soc_component *component) · 2 unmodified lines
28042805 cancel_delayed_work_sync(&rt5640->bp_work);
28052806 }
28062807
2807− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2808+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
28082809 rt5640_reset(component);
28092810 regcache_cache_only(rt5640->regmap, true);
28102811 regcache_mark_dirty(rt5640->regmap);
sound/soc/codecs/rt5645.c+8−7
@@ -3071,10 +3071,11 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 3070 unmodified lines
30713071 enum snd_soc_bias_level level)
30723072 {
30733073 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
3074+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
30743075
30753076 switch (level) {
30763077 case SND_SOC_BIAS_PREPARE:
3077− if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
3078+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
30783079 snd_soc_component_update_bits(component, RT5645_PWR_ANLG1,
30793080 RT5645_PWR_VREF1 | RT5645_PWR_MB |
30803081 RT5645_PWR_BG | RT5645_PWR_VREF2,
@@ -3099,7 +3100,7 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 18 unmodified lines
30993100 snd_soc_component_update_bits(component, RT5645_PWR_ANLG1,
31003101 RT5645_PWR_FV1 | RT5645_PWR_FV2,
31013102 RT5645_PWR_FV1 | RT5645_PWR_FV2);
3102− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
3103+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
31033104 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140);
31043105 msleep(40);
31053106 if (rt5645->en_button_func)
@@ -3130,7 +3131,7 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 24 unmodified lines
31303131 static void rt5645_enable_push_button_irq(struct snd_soc_component *component,
31313132 bool enable)
31323133 {
3133− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3134+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
31343135 int ret;
31353136
31363137 if (enable) {
@@ -3169,7 +3170,7 @@ static void rt5645_enable_push_button_irq(struct snd_soc_component *component, · 32 unmodified lines
31693170
31703171 static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insert)
31713172 {
3172− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3173+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
31733174 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
31743175 unsigned int val;
31753176
@@ -3180,7 +3181,7 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inse · 4 unmodified lines
31803181 snd_soc_dapm_force_enable_pin(dapm, "LDO2");
31813182 snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power");
31823183 snd_soc_dapm_sync(dapm);
3183− if (!snd_soc_card_is_instantiated(dapm->card)) {
3184+ if (!snd_soc_card_is_instantiated(component->card)) {
31843185 /* Power up necessary bits for JD if dapm is
31853186 not ready yet */
31863187 regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1,
@@ -3449,7 +3450,7 @@ static void rt5645_btn_check_callback(struct timer_list *t) · 262 unmodified lines
34493450
34503451 static int rt5645_probe(struct snd_soc_component *component)
34513452 {
3452− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3453+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
34533454 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
34543455
34553456 rt5645->component = component;
@@ -3478,7 +3479,7 @@ static int rt5645_probe(struct snd_soc_component *component) · 22 unmodified lines
34783479 break;
34793480 }
34803481
3481− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
3482+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
34823483
34833484 /* for JD function */
34843485 if (rt5645->pdata.jd_mode) {
sound/soc/codecs/rt5651.c+8−5
@@ -1511,16 +1511,18 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, · 1510 unmodified lines
15111511 static int rt5651_set_bias_level(struct snd_soc_component *component,
15121512 enum snd_soc_bias_level level)
15131513 {
1514+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
1515+
15141516 switch (level) {
15151517 case SND_SOC_BIAS_PREPARE:
1516− if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
1518+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
15171519 if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200)
15181520 snd_soc_component_update_bits(component, RT5651_D_MISC,
15191521 0xc00, 0xc00);
15201522 }
15211523 break;
15221524 case SND_SOC_BIAS_STANDBY:
1523− if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) {
1525+ if (SND_SOC_BIAS_OFF == snd_soc_dapm_get_bias_level(dapm)) {
15241526 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
15251527 RT5651_PWR_VREF1 | RT5651_PWR_MB |
15261528 RT5651_PWR_BG | RT5651_PWR_VREF2,
@@ -1557,7 +1559,7 @@ static int rt5651_set_bias_level(struct snd_soc_component *component, · 30 unmodified lines
15571559
15581560 static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component)
15591561 {
1560− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1562+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15611563
15621564 snd_soc_dapm_mutex_lock(dapm);
15631565 snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO");
@@ -1570,7 +1572,7 @@ static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component) · 6 unmodified lines
15701572
15711573 static void rt5651_disable_micbias1_for_ovcd(struct snd_soc_component *component)
15721574 {
1573− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1575+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
15741576
15751577 snd_soc_dapm_mutex_lock(dapm);
15761578 snd_soc_dapm_disable_pin_unlocked(dapm, "Platform Clock");
@@ -2058,13 +2060,14 @@ static void rt5651_apply_properties(struct snd_soc_component *component) · 481 unmodified lines
20582060 static int rt5651_probe(struct snd_soc_component *component)
20592061 {
20602062 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
2063+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
20612064
20622065 rt5651->component = component;
20632066
20642067 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
20652068 RT5651_PWR_LDO_DVO_MASK, RT5651_PWR_LDO_DVO_1_2V);
20662069
2067− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2070+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
20682071
20692072 rt5651_apply_properties(component);
20702073
sound/soc/codecs/rt5659.c+6−7
@@ -1197,7 +1197,7 @@ static const struct snd_kcontrol_new rt5659_if3_adc_swap_mux = · 1196 unmodified lines
11971197 static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol,
11981198 struct snd_ctl_elem_value *ucontrol)
11991199 {
1200− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1200+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
12011201 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
12021202
12031203 if (snd_soc_component_read(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) {
@@ -1213,7 +1213,7 @@ static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol, · 9 unmodified lines
12131213 static void rt5659_enable_push_button_irq(struct snd_soc_component *component,
12141214 bool enable)
12151215 {
1216− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1216+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12171217
12181218 if (enable) {
12191219 snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, 0x000b);
@@ -1257,7 +1257,7 @@ static void rt5659_enable_push_button_irq(struct snd_soc_component *component, · 37 unmodified lines
12571257
12581258 static int rt5659_headset_detect(struct snd_soc_component *component, int jack_insert)
12591259 {
1260− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1260+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
12611261 int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30};
12621262 int reg_63;
12631263
@@ -3611,7 +3611,7 @@ static int rt5659_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 2347 unmodified lines
36113611 static int rt5659_set_bias_level(struct snd_soc_component *component,
36123612 enum snd_soc_bias_level level)
36133613 {
3614− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3614+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
36153615 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
36163616 int ret;
36173617
@@ -3631,7 +3631,7 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, · 13 unmodified lines
36313631 break;
36323632
36333633 case SND_SOC_BIAS_STANDBY:
3634− if (dapm->bias_level == SND_SOC_BIAS_OFF) {
3634+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
36353635 ret = clk_prepare_enable(rt5659->mclk);
36363636 if (ret) {
36373637 dev_err(component->dev,
@@ -3662,8 +3662,7 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, · 24 unmodified lines
36623662
36633663 static int rt5659_probe(struct snd_soc_component *component)
36643664 {
3665− struct snd_soc_dapm_context *dapm =
3666− snd_soc_component_get_dapm(component);
3665+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
36673666 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
36683667
36693668 rt5659->component = component;
sound/soc/codecs/rt5660.c+3−2
@@ -1069,6 +1069,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 1068 unmodified lines
10691069 enum snd_soc_bias_level level)
10701070 {
10711071 struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component);
1072+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10721073 int ret;
10731074
10741075 switch (level) {
@@ -1079,7 +1080,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines
10791080 snd_soc_component_update_bits(component, RT5660_GEN_CTRL1,
10801081 RT5660_DIG_GATE_CTRL, RT5660_DIG_GATE_CTRL);
10811082
1082− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1083+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
10831084 clk_disable_unprepare(rt5660->mclk);
10841085 } else {
10851086 ret = clk_prepare_enable(rt5660->mclk);
@@ -1089,7 +1090,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines
10891090 break;
10901091
10911092 case SND_SOC_BIAS_STANDBY:
1092− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1093+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
10931094 snd_soc_component_update_bits(component, RT5660_PWR_ANLG1,
10941095 RT5660_PWR_VREF1 | RT5660_PWR_MB |
10951096 RT5660_PWR_BG | RT5660_PWR_VREF2,
sound/soc/codecs/rt5663.c+5−5
@@ -1463,7 +1463,7 @@ static void rt5663_enable_push_button_irq(struct snd_soc_component *component, · 1462 unmodified lines
14631463
14641464 static int rt5663_v2_jack_detect(struct snd_soc_component *component, int jack_insert)
14651465 {
1466− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1466+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
14671467 struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
14681468 int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30};
14691469
@@ -1859,7 +1859,7 @@ static irqreturn_t rt5663_irq(int irq, void *data) · 389 unmodified lines
18591859 dev_dbg(regmap_get_device(rt5663->regmap), "%s IRQ queue work\n",
18601860 __func__);
18611861
1862− queue_delayed_work(system_wq, &rt5663->jack_detect_work,
1862+ queue_delayed_work(system_dfl_wq, &rt5663->jack_detect_work,
18631863 msecs_to_jiffies(250));
18641864
18651865 return IRQ_HANDLED;
@@ -1974,7 +1974,7 @@ static void rt5663_jack_detect_work(struct work_struct *work) · 108 unmodified lines
19741974 cancel_delayed_work_sync(
19751975 &rt5663->jd_unplug_work);
19761976 } else {
1977− queue_delayed_work(system_wq,
1977+ queue_delayed_work(system_dfl_wq,
19781978 &rt5663->jd_unplug_work,
19791979 msecs_to_jiffies(500));
19801980 }
@@ -2024,7 +2024,7 @@ static void rt5663_jd_unplug_work(struct work_struct *work) · 43 unmodified lines
20242024 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
20252025 SND_JACK_BTN_2 | SND_JACK_BTN_3);
20262026 } else {
2027− queue_delayed_work(system_wq, &rt5663->jd_unplug_work,
2027+ queue_delayed_work(system_dfl_wq, &rt5663->jd_unplug_work,
20282028 msecs_to_jiffies(500));
20292029 }
20302030 }
@@ -3140,7 +3140,7 @@ static int rt5663_set_bias_level(struct snd_soc_component *component, · 1109 unmodified lines
31403140
31413141 static int rt5663_probe(struct snd_soc_component *component)
31423142 {
3143− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3143+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
31443144 struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
31453145
31463146 rt5663->component = component;
sound/soc/codecs/rt5665.c+3−3
@@ -993,7 +993,7 @@ static const struct snd_kcontrol_new rt5665_if3_adc_swap_mux = · 992 unmodified lines
993993 static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol,
994994 struct snd_ctl_elem_value *ucontrol)
995995 {
996− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
996+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
997997 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
998998
999999 if (snd_soc_component_read(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) {
@@ -1009,7 +1009,7 @@ static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol, · 9 unmodified lines
10091009 static int rt5665_mono_vol_put(struct snd_kcontrol *kcontrol,
10101010 struct snd_ctl_elem_value *ucontrol)
10111011 {
1012− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1012+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
10131013 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
10141014
10151015 if (snd_soc_component_read(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) {
@@ -1067,7 +1067,7 @@ static void rt5665_enable_push_button_irq(struct snd_soc_component *component, · 51 unmodified lines
10671067 static int rt5665_headset_detect(struct snd_soc_component *component, int jack_insert)
10681068 {
10691069 struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component);
1070− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1070+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10711071 unsigned int sar_hs_type, val;
10721072
10731073 if (jack_insert) {
sound/soc/codecs/rt5668.c+1−2
@@ -853,8 +853,7 @@ static int rt5668_headset_detect(struct snd_soc_component *component, · 852 unmodified lines
853853 int jack_insert)
854854 {
855855 struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component);
856− struct snd_soc_dapm_context *dapm =
857− snd_soc_component_get_dapm(component);
856+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
858857 unsigned int val, count;
859858
860859 if (jack_insert) {
sound/soc/codecs/rt5670.c+24−19
@@ -431,7 +431,7 @@ static bool rt5670_readable_register(struct device *dev, unsigned int reg) · 430 unmodified lines
431431 static int rt5670_headset_detect(struct snd_soc_component *component, int jack_insert)
432432 {
433433 int val;
434− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
434+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
435435 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
436436
437437 if (jack_insert) {
@@ -652,7 +652,7 @@ static void rt5670_update_ad_da_mixer_dac1_m_bits(struct rt5670_priv *rt5670) · 214 unmodified lines
652652 static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol,
653653 struct snd_ctl_elem_value *ucontrol)
654654 {
655− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
655+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
656656 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
657657
658658 ucontrol->value.integer.value[0] = rt5670->dac1_playback_switch_l;
@@ -664,7 +664,7 @@ static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines
664664 static int rt5670_dac1_playback_switch_put(struct snd_kcontrol *kcontrol,
665665 struct snd_ctl_elem_value *ucontrol)
666666 {
667− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
667+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
668668 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
669669
670670 if (rt5670->dac1_playback_switch_l == ucontrol->value.integer.value[0] &&
@@ -966,7 +966,7 @@ static int rt5670_put_dac1_mix_dac1_switch(struct snd_kcontrol *kcontrol, · 295 unmodified lines
966966 struct snd_ctl_elem_value *ucontrol)
967967 {
968968 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
969− struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
969+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
970970 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
971971 int ret;
972972
@@ -1153,25 +1153,29 @@ static SOC_ENUM_SINGLE_DECL(rt5670_dac1r_enum, RT5670_AD_DA_MIXER, · 180 unmodified lines
11531153 static const struct snd_kcontrol_new rt5670_dac1r_mux =
11541154 SOC_DAPM_ENUM("DAC1 R source", rt5670_dac1r_enum);
11551155
1156−/*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */
1157−/* TODO Use SOC_VALUE_ENUM_SINGLE_DECL */
1158−static const char * const rt5670_dac12_src[] = {
1159− "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC",
1160− "Bass", "VAD_ADC", "IF4 DAC"
1161−};
1156+/* DAC2 L source*/ /* MX-1B [6:4] */
1157+static const char *const rt5670_dac12_src[] = {
1158+ "IF1 DAC", "IF2 DAC", "TxDC DAC", "VAD_ADC"
1159+}; /* VAD_ADC or TxDP_ADC_R */
1160+
1161+static const unsigned int rt5670_dac12_values[] = { 0, 1, 3, 5 };
11621162
1163−static SOC_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL,
1164− RT5670_DAC2_L_SEL_SFT, rt5670_dac12_src);
1163+static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL,
1164+ RT5670_DAC2_L_SEL_SFT, RT5670_DAC2_L_SEL_MASK,
1165+ rt5670_dac12_src, rt5670_dac12_values);
11651166
11661167 static const struct snd_kcontrol_new rt5670_dac_l2_mux =
11671168 SOC_DAPM_ENUM("DAC2 L source", rt5670_dac2l_enum);
11681169
1169−static const char * const rt5670_dacr2_src[] = {
1170− "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", "TxDP ADC", "IF4 DAC"
1171−};
1170+/*DAC2 R source*/ /* MX-1B [2:0] */
1171+static const char *const rt5670_dacr2_src[] = { "IF1 DAC", "IF2 DAC",
1172+ "TxDC DAC", "TxDP ADC" };
1173+
1174+static const unsigned int rt5670_dacr2_values[] = { 0, 1, 3, 4 };
11721175
1173−static SOC_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL,
1174− RT5670_DAC2_R_SEL_SFT, rt5670_dacr2_src);
1176+static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL,
1177+ RT5670_DAC2_R_SEL_SFT, RT5670_DAC2_R_SEL_MASK,
1178+ rt5670_dacr2_src, rt5670_dacr2_values);
11751179
11761180 static const struct snd_kcontrol_new rt5670_dac_r2_mux =
11771181 SOC_DAPM_ENUM("DAC2 R source", rt5670_dac2r_enum);
@@ -2666,10 +2670,11 @@ static int rt5670_set_bias_level(struct snd_soc_component *component, · 1488 unmodified lines
26662670 enum snd_soc_bias_level level)
26672671 {
26682672 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
2673+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
26692674
26702675 switch (level) {
26712676 case SND_SOC_BIAS_PREPARE:
2672− if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
2677+ if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) {
26732678 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1,
26742679 RT5670_PWR_VREF1 | RT5670_PWR_MB |
26752680 RT5670_PWR_BG | RT5670_PWR_VREF2,
@@ -2719,7 +2724,7 @@ static int rt5670_set_bias_level(struct snd_soc_component *component, · 43 unmodified lines
27192724
27202725 static int rt5670_probe(struct snd_soc_component *component)
27212726 {
2722− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2727+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
27232728 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
27242729
27252730 switch (snd_soc_component_read(component, RT5670_RESET) & RT5670_ID_MASK) {
sound/soc/codecs/rt5677.c+7−7
@@ -706,8 +706,7 @@ static void rt5677_set_dsp_mode(struct rt5677_priv *rt5677, bool on) · 705 unmodified lines
706706
707707 static unsigned int rt5677_set_vad_source(struct rt5677_priv *rt5677)
708708 {
709− struct snd_soc_dapm_context *dapm =
710− snd_soc_component_get_dapm(rt5677->component);
709+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt5677->component);
711710 /* Force dapm to sync before we enable the
712711 * DSP to prevent write corruption
713712 */
@@ -2733,11 +2732,12 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w, · 2019 unmodified lines
27332732 struct snd_kcontrol *kcontrol, int event)
27342733 {
27352734 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
2735+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
27362736 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
27372737
27382738 switch (event) {
27392739 case SND_SOC_DAPM_POST_PMU:
2740− if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON &&
2740+ if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_ON &&
27412741 !rt5677->is_vref_slow) {
27422742 mdelay(20);
27432743 regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1,
@@ -4643,8 +4643,8 @@ static int rt5677_set_bias_level(struct snd_soc_component *component, · 1899 unmodified lines
46434643 enum snd_soc_bias_level level)
46444644 {
46454645 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
4646− enum snd_soc_bias_level prev_bias =
4647− snd_soc_component_get_bias_level(component);
4646+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
4647+ enum snd_soc_bias_level prev_bias = snd_soc_dapm_get_bias_level(dapm);
46484648
46494649 switch (level) {
46504650 case SND_SOC_BIAS_ON:
@@ -4880,7 +4880,7 @@ static void rt5677_free_gpio(struct i2c_client *i2c) · 229 unmodified lines
48804880
48814881 static int rt5677_probe(struct snd_soc_component *component)
48824882 {
4883− struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
4883+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
48844884 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
48854885 int i;
48864886
@@ -4896,7 +4896,7 @@ static int rt5677_probe(struct snd_soc_component *component) · 9 unmodified lines
48964896 ARRAY_SIZE(rt5677_dmic2_clk_1));
48974897 }
48984898
4899− snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
4899+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
49004900
49014901 regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC,
49024902 ~RT5677_IRQ_DEBOUNCE_SEL_MASK, 0x0020);
sound/soc/codecs/rt5682.c+5−5
@@ -928,7 +928,7 @@ static void rt5682_enable_push_button_irq(struct snd_soc_component *component, · 927 unmodified lines
928928 static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
929929 {
930930 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
931− struct snd_soc_dapm_context *dapm = &component->dapm;
931+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
932932 unsigned int val, count;
933933
934934 if (jack_insert) {
@@ -1115,7 +1115,7 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 180 unmodified lines
11151115 }
11161116 }
11171117
1118− dapm = snd_soc_component_get_dapm(rt5682->component);
1118+ dapm = snd_soc_component_to_dapm(rt5682->component);
11191119
11201120 snd_soc_dapm_mutex_lock(dapm);
11211121 mutex_lock(&rt5682->calibrate_mutex);
@@ -2595,7 +2595,7 @@ static int rt5682_wclk_prepare(struct clk_hw *hw) · 1473 unmodified lines
25952595 return -EINVAL;
25962596
25972597 component = rt5682->component;
2598− dapm = snd_soc_component_get_dapm(component);
2598+ dapm = snd_soc_component_to_dapm(component);
25992599
26002600 snd_soc_dapm_mutex_lock(dapm);
26012601
@@ -2633,7 +2633,7 @@ static void rt5682_wclk_unprepare(struct clk_hw *hw) · 31 unmodified lines
26332633 return;
26342634
26352635 component = rt5682->component;
2636− dapm = snd_soc_component_get_dapm(component);
2636+ dapm = snd_soc_component_to_dapm(component);
26372637
26382638 snd_soc_dapm_mutex_lock(dapm);
26392639
@@ -2928,9 +2928,9 @@ EXPORT_SYMBOL_GPL(rt5682_register_dai_clks); · 288 unmodified lines
29282928 static int rt5682_probe(struct snd_soc_component *component)
29292929 {
29302930 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
2931+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
29312932 struct sdw_slave *slave;
29322933 unsigned long time;
2933− struct snd_soc_dapm_context *dapm = &component->dapm;
29342934
29352935 rt5682->component = component;
29362936
sound/soc/codecs/rt5682s.c+3−2
@@ -841,7 +841,7 @@ static void rt5682s_jack_detect_handler(struct work_struct *work) · 840 unmodified lines
841841 return;
842842 }
843843
844− dapm = snd_soc_component_get_dapm(rt5682s->component);
844+ dapm = snd_soc_component_to_dapm(rt5682s->component);
845845
846846 snd_soc_dapm_mutex_lock(dapm);
847847 mutex_lock(&rt5682s->calibrate_mutex);
@@ -2485,6 +2485,7 @@ static int rt5682s_set_bias_level(struct snd_soc_component *component, · 1637 unmodified lines
24852485 enum snd_soc_bias_level level)
24862486 {
24872487 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2488+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
24882489
24892490 switch (level) {
24902491 case SND_SOC_BIAS_PREPARE:
@@ -2492,7 +2493,7 @@ static int rt5682s_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
24922493 RT5682S_PWR_LDO, RT5682S_PWR_LDO);
24932494 break;
24942495 case SND_SOC_BIAS_STANDBY:
2495− if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
2496+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF)
24962497 regmap_update_bits(rt5682s->regmap, RT5682S_PWR_DIG_1,
24972498 RT5682S_DIG_GATE_CTRL, RT5682S_DIG_GATE_CTRL);
24982499 break;
sound/soc/codecs/rt700.c+11−17
@@ -272,11 +272,10 @@ io_error: · 271 unmodified lines
272272
273273 static void rt700_jack_init(struct rt700_priv *rt700)
274274 {
275− struct snd_soc_dapm_context *dapm =
276− snd_soc_component_get_dapm(rt700->component);
275+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt700->component);
277276
278277 /* power on */
279− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
278+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
280279 regmap_write(rt700->regmap,
281280 RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0);
282281
@@ -307,7 +306,7 @@ static void rt700_jack_init(struct rt700_priv *rt700) · 24 unmodified lines
307306 }
308307
309308 /* power off */
310− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
309+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
311310 regmap_write(rt700->regmap,
312311 RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
313312 }
@@ -362,8 +361,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 48 unmodified lines
362361 struct snd_ctl_elem_value *ucontrol)
363362 {
364363 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
365− struct snd_soc_dapm_context *dapm =
366− snd_soc_component_get_dapm(component);
364+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
367365 struct soc_mixer_control *mc =
368366 (struct soc_mixer_control *)kcontrol->private_value;
369367 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component);
@@ -398,7 +396,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 28 unmodified lines
398396 val_ll |= read_ll;
399397 }
400398
401− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
399+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
402400 regmap_write(rt700->regmap,
403401 RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0);
404402
@@ -450,7 +448,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 45 unmodified lines
450448 break;
451449 }
452450
453− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
451+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
454452 regmap_write(rt700->regmap,
455453 RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
456454 return 0;
@@ -524,8 +522,7 @@ static const struct snd_kcontrol_new rt700_snd_controls[] = { · 67 unmodified lines
524522 static int rt700_mux_get(struct snd_kcontrol *kcontrol,
525523 struct snd_ctl_elem_value *ucontrol)
526524 {
527− struct snd_soc_component *component =
528− snd_soc_dapm_kcontrol_component(kcontrol);
525+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
529526 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component);
530527 unsigned int reg, val = 0, nid;
531528 int ret;
@@ -553,10 +550,8 @@ static int rt700_mux_get(struct snd_kcontrol *kcontrol, · 21 unmodified lines
553550 static int rt700_mux_put(struct snd_kcontrol *kcontrol,
554551 struct snd_ctl_elem_value *ucontrol)
555552 {
556− struct snd_soc_component *component =
557− snd_soc_dapm_kcontrol_component(kcontrol);
558− struct snd_soc_dapm_context *dapm =
559− snd_soc_dapm_kcontrol_dapm(kcontrol);
553+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
554+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
560555 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component);
561556 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
562557 unsigned int *item = ucontrol->value.enumerated.item;
@@ -839,13 +834,12 @@ static int rt700_probe(struct snd_soc_component *component) · 276 unmodified lines
839834 static int rt700_set_bias_level(struct snd_soc_component *component,
840835 enum snd_soc_bias_level level)
841836 {
842− struct snd_soc_dapm_context *dapm =
843− snd_soc_component_get_dapm(component);
837+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
844838 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component);
845839
846840 switch (level) {
847841 case SND_SOC_BIAS_PREPARE:
848− if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
842+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
849843 regmap_write(rt700->regmap,
850844 RT700_SET_AUDIO_POWER_STATE,
851845 AC_PWRST_D0);
sound/soc/codecs/rt711-sdca.c+5−8
@@ -813,7 +813,7 @@ static int rt711_sdca_ge_select_get(struct snd_kcontrol *kcontrol, · 812 unmodified lines
813813 struct snd_ctl_elem_value *ucontrol)
814814 {
815815 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
816− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
816+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
817817 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component);
818818 unsigned int val, item;
819819
@@ -828,7 +828,7 @@ static int rt711_sdca_ge_select_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines
828828 {
829829 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
830830 unsigned int *item = ucontrol->value.enumerated.item;
831− struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
831+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
832832 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component);
833833 unsigned int val, change = 0;
834834
@@ -900,8 +900,7 @@ static const struct snd_kcontrol_new rt711_sdca_snd_controls[] = { · 65 unmodified lines
900900 static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol,
901901 struct snd_ctl_elem_value *ucontrol)
902902 {
903− struct snd_soc_component *component =
904− snd_soc_dapm_kcontrol_component(kcontrol);
903+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
905904 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component);
906905 unsigned int val = 0, mask_sft;
907906
@@ -923,10 +922,8 @@ static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines
923922 static int rt711_sdca_mux_put(struct snd_kcontrol *kcontrol,
924923 struct snd_ctl_elem_value *ucontrol)
925924 {
926− struct snd_soc_component *component =
927− snd_soc_dapm_kcontrol_component(kcontrol);
928− struct snd_soc_dapm_context *dapm =
929− snd_soc_dapm_kcontrol_dapm(kcontrol);
925+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
926+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
930927 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component);
931928 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
932929 unsigned int *item = ucontrol->value.enumerated.item;
sound/soc/codecs/rt711.c+11−17
@@ -360,12 +360,11 @@ io_error: · 359 unmodified lines
360360
361361 static void rt711_jack_init(struct rt711_priv *rt711)
362362 {
363− struct snd_soc_dapm_context *dapm =
364− snd_soc_component_get_dapm(rt711->component);
363+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt711->component);
365364
366365 mutex_lock(&rt711->calibrate_mutex);
367366 /* power on */
368− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
367+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
369368 regmap_write(rt711->regmap,
370369 RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0);
371370
@@ -448,7 +447,7 @@ static void rt711_jack_init(struct rt711_priv *rt711) · 76 unmodified lines
448447 }
449448
450449 /* power off */
451− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
450+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
452451 regmap_write(rt711->regmap,
453452 RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
454453 mutex_unlock(&rt711->calibrate_mutex);
@@ -504,8 +503,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 49 unmodified lines
504503 struct snd_ctl_elem_value *ucontrol)
505504 {
506505 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
507− struct snd_soc_dapm_context *dapm =
508− snd_soc_component_get_dapm(component);
506+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
509507 struct soc_mixer_control *mc =
510508 (struct soc_mixer_control *)kcontrol->private_value;
511509 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component);
@@ -543,7 +541,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 31 unmodified lines
543541 val_ll |= read_ll;
544542 }
545543
546− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
544+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
547545 regmap_write(rt711->regmap,
548546 RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0);
549547
@@ -597,7 +595,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 47 unmodified lines
597595 break;
598596 }
599597
600− if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
598+ if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
601599 regmap_write(rt711->regmap,
602600 RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
603601
@@ -682,8 +680,7 @@ static const struct snd_kcontrol_new rt711_snd_controls[] = { · 78 unmodified lines
682680 static int rt711_mux_get(struct snd_kcontrol *kcontrol,
683681 struct snd_ctl_elem_value *ucontrol)
684682 {
685− struct snd_soc_component *component =
686− snd_soc_dapm_kcontrol_component(kcontrol);
683+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
687684 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component);
688685 unsigned int reg, val = 0, nid;
689686 int ret;
@@ -712,10 +709,8 @@ static int rt711_mux_get(struct snd_kcontrol *kcontrol, · 22 unmodified lines
712709 static int rt711_mux_put(struct snd_kcontrol *kcontrol,
713710 struct snd_ctl_elem_value *ucontrol)
714711 {
715− struct snd_soc_component *component =
716− snd_soc_dapm_kcontrol_component(kcontrol);
717− struct snd_soc_dapm_context *dapm =
718− snd_soc_dapm_kcontrol_dapm(kcontrol);
712+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
713+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
719714 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component);
720715 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
721716 unsigned int *item = ucontrol->value.enumerated.item;
@@ -900,13 +895,12 @@ static const struct snd_soc_dapm_route rt711_audio_map[] = { · 178 unmodified lines
900895 static int rt711_set_bias_level(struct snd_soc_component *component,
901896 enum snd_soc_bias_level level)
902897 {
903− struct snd_soc_dapm_context *dapm =
904− snd_soc_component_get_dapm(component);
898+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
905899 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component);
906900
907901 switch (level) {
908902 case SND_SOC_BIAS_PREPARE:
909− if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
903+ if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
910904 regmap_write(rt711->regmap,
911905 RT711_SET_AUDIO_POWER_STATE,
912906 AC_PWRST_D0);
sound/soc/codecs/rt712-sdca-dmic.c+3−6
@@ -429,8 +429,7 @@ static const struct snd_kcontrol_new rt712_sdca_dmic_snd_controls[] = { · 428 unmodified lines
429429 static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol,
430430 struct snd_ctl_elem_value *ucontrol)
431431 {
432− struct snd_soc_component *component =
433− snd_soc_dapm_kcontrol_component(kcontrol);
432+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
434433 struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component);
435434 unsigned int val = 0, mask_sft;
436435
@@ -452,10 +451,8 @@ static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines
452451 static int rt712_sdca_dmic_mux_put(struct snd_kcontrol *kcontrol,
453452 struct snd_ctl_elem_value *ucontrol)
454453 {
455− struct snd_soc_component *component =
456− snd_soc_dapm_kcontrol_component(kcontrol);
457− struct snd_soc_dapm_context *dapm =
458− snd_soc_dapm_kcontrol_dapm(kcontrol);
454+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
455+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
459456 struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component);
460457 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
461458 unsigned int *item = ucontrol->value.enumerated.item;
sound/soc/codecs/rt712-sdca.c+7−13
@@ -743,8 +743,7 @@ static const struct snd_kcontrol_new rt712_sdca_spk_controls[] = { · 742 unmodified lines
743743 static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol,
744744 struct snd_ctl_elem_value *ucontrol)
745745 {
746− struct snd_soc_component *component =
747− snd_soc_dapm_kcontrol_component(kcontrol);
746+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
748747 struct rt712_sdca_priv *rt712 = snd_soc_component_get_drvdata(component);
749748 unsigned int val = 0, mask = 0x3300;
750749
@@ -768,10 +767,8 @@ static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol, · 17 unmodified lines
768767 static int rt712_sdca_mux_put(struct snd_kcontrol *kcontrol,

43 more lines aren’t shown here.

sound/soc/codecs/rt715-sdca.c+3−6

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

sound/soc/codecs/rt715.c+14−21

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

sound/soc/codecs/rt721-sdca.c+3−6

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

sound/soc/codecs/rt722-sdca-sdw.c+3−1

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

sound/soc/codecs/rt9123.c+3−3

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

sound/soc/codecs/sgtl5000.c+4−4

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

sound/soc/codecs/simple-mux.c+4−3

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

sound/soc/codecs/sma1303.c+11−20

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

sound/soc/codecs/sma1307.c+37−58

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

sound/soc/codecs/ssm2518.c+2−1

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

sound/soc/codecs/ssm2602.c+2−2

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

sound/soc/codecs/ssm4567.c+2−1

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

sound/soc/codecs/sta32x.c+6−4

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

sound/soc/codecs/sta350.c+6−4

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

sound/soc/codecs/sta529.c+2−1

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

sound/soc/codecs/tas2562.c+2−2

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

sound/soc/codecs/tas2781-comlib-i2c.c+1−1

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

sound/soc/codecs/tas2781-i2c.c+66−40

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

sound/soc/codecs/tas2783-sdw.c+2−2

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

sound/soc/codecs/tas5086.c+2−2

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

sound/soc/codecs/tas571x.c+4−3

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

sound/soc/codecs/tas5720.c+2−2

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

sound/soc/codecs/tas5805m.c+2−4

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

sound/soc/codecs/tas6424.c+3−1

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

sound/soc/codecs/tfa989x.c+1−1

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

sound/soc/codecs/tlv320adc3xxx.c+4−4

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

sound/soc/codecs/tlv320adcx140.c+2−4

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

sound/soc/codecs/tlv320aic23.c+2−2

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

sound/soc/codecs/tlv320aic31xx.c+8−6

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

sound/soc/codecs/tlv320aic32x4.c+2−1

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

sound/soc/codecs/tlv320aic3x.c+6−5

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

sound/soc/codecs/tlv320dac33.c+5−4

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

sound/soc/codecs/tscs42xx.c+2−4

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

sound/soc/codecs/tscs454.c+2−4

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

sound/soc/codecs/twl4030.c+8−6

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

sound/soc/codecs/twl6040.c+8−7

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

sound/soc/codecs/uda1334.c+2−2

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

sound/soc/codecs/uda1380.c+2−1

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

sound/soc/codecs/wcd9335.c+19−15

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

sound/soc/codecs/wcd934x.c+23−21

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

sound/soc/codecs/wcd937x.c+43−20

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

sound/soc/codecs/wcd938x.c+13−14

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

sound/soc/codecs/wcd939x-sdw.c+7−1

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

sound/soc/codecs/wcd939x.c+12−12

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

sound/soc/codecs/wm0010.c+3−2

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

sound/soc/codecs/wm2000.c+4−4

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

sound/soc/codecs/wm5100.c+2−2

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

sound/soc/codecs/wm5102.c+6−6

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

sound/soc/codecs/wm5110.c+8−8

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

sound/soc/codecs/wm8350.c+4−3

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

sound/soc/codecs/wm8400.c+8−6

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

sound/soc/codecs/wm8510.c+2−1

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

sound/soc/codecs/wm8523.c+2−1

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

sound/soc/codecs/wm8580.c+5−3

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

sound/soc/codecs/wm8711.c+2−1

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

sound/soc/codecs/wm8728.c+2−1

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

sound/soc/codecs/wm8731.c+5−4

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

sound/soc/codecs/wm8737.c+4−2

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

sound/soc/codecs/wm8750.c+2−1

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

sound/soc/codecs/wm8753.c+4−3

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

sound/soc/codecs/wm8770.c+2−1

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

sound/soc/codecs/wm8776.c+2−1

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

sound/soc/codecs/wm8804.c+2−2

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

sound/soc/codecs/wm8900.c+8−4

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

sound/soc/codecs/wm8903.c+6−4

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

sound/soc/codecs/wm8904.c+12−11

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

sound/soc/codecs/wm8940.c+4−2

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

sound/soc/codecs/wm8955.c+6−4

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

sound/soc/codecs/wm8958-dsp2.c+16−16

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

sound/soc/codecs/wm8960.c+9−7

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

sound/soc/codecs/wm8961.c+3−2

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

sound/soc/codecs/wm8962.c+17−13

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

sound/soc/codecs/wm8971.c+2−1

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

sound/soc/codecs/wm8974.c+2−1

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

sound/soc/codecs/wm8978.c+6−3

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

sound/soc/codecs/wm8983.c+4−3

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

sound/soc/codecs/wm8985.c+5−4

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

sound/soc/codecs/wm8988.c+2−1

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

sound/soc/codecs/wm8990.c+6−3

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

sound/soc/codecs/wm8991.c+3−2

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

sound/soc/codecs/wm8993.c+8−5

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

sound/soc/codecs/wm8994.c+24−22

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

sound/soc/codecs/wm8995.c+4−3

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

sound/soc/codecs/wm8996.c+7−6

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

sound/soc/codecs/wm8997.c+2−2

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

sound/soc/codecs/wm8998.c+4−4

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

sound/soc/codecs/wm9081.c+4−3

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

sound/soc/codecs/wm9090.c+3−2

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

sound/soc/codecs/wm9712.c+4−3

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

sound/soc/codecs/wm9713.c+4−3

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

sound/soc/codecs/wm_adsp.c+11−10

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

sound/soc/codecs/wm_hubs.c+5−5

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

sound/soc/codecs/wsa881x.c+4−5

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

sound/soc/codecs/wsa883x.c+8−11

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

sound/soc/codecs/wsa884x.c+4−4

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

sound/soc/fsl/fsl-asoc-card.c+2−2

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

sound/soc/fsl/fsl_aud2htx.h+2−1

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

sound/soc/fsl/fsl_micfil.c+111−25

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

sound/soc/fsl/fsl_spdif.c+8−8

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

sound/soc/fsl/fsl_xcvr.c+35−53

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

sound/soc/fsl/imx-rpmsg.c+1−1

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

sound/soc/generic/audio-graph-card.c+2−2

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

sound/soc/intel/atom/sst-atom-controls.c+7−8

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

sound/soc/intel/atom/sst/sst_acpi.c+2−1

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

sound/soc/intel/avs/boards/da7219.c+1−2

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

sound/soc/intel/avs/boards/es8336.c+3−2

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

sound/soc/intel/avs/boards/nau8825.c+1−2

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

sound/soc/intel/avs/boards/rt274.c+3−3

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

sound/soc/intel/avs/boards/rt5514.c+2−1

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

sound/soc/intel/avs/boards/rt5640.c+2−1

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

sound/soc/intel/avs/control.c+3−4

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

sound/soc/intel/avs/debugfs.c+3−6

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

sound/soc/intel/avs/path.c+9−4

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

sound/soc/intel/avs/pcm.c+1−1

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

sound/soc/intel/avs/topology.c+110−3

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

sound/soc/intel/avs/topology.h+8−0

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

sound/soc/intel/boards/bdw-rt5677.c+4−5

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

sound/soc/intel/boards/bytcht_cx2072x.c+2−1

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

sound/soc/intel/boards/bytcht_es8316.c+5−4

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

sound/soc/intel/boards/bytcr_rt5640.c+13−12

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

sound/soc/intel/boards/bytcr_rt5651.c+9−9

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

sound/soc/intel/boards/bytcr_wm5102.c+7−7

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

sound/soc/intel/boards/cht_bsw_max98090_ti.c+2−3

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

sound/soc/intel/boards/cht_bsw_rt5645.c+6−6

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

sound/soc/intel/boards/cht_bsw_rt5672.c+4−4

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

sound/soc/intel/boards/hda_dsp_common.c+12−3

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

sound/soc/intel/boards/sof_board_helpers.c+6−4

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

sound/soc/intel/boards/sof_cirrus_common.c+3−2

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

sound/soc/intel/boards/sof_da7219.c+2−3

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

sound/soc/intel/boards/sof_es8336.c+8−6

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

sound/soc/intel/boards/sof_maxim_common.c+12−10

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

sound/soc/intel/boards/sof_nau8825.c+1−1

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

sound/soc/intel/boards/sof_nuvoton_common.c+3−2

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

sound/soc/intel/boards/sof_pcm512x.c+3−2

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

sound/soc/intel/boards/sof_realtek_common.c+18−16

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

sound/soc/intel/boards/sof_rt5682.c+14−3

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

sound/soc/intel/boards/sof_sdw.c+68−12

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

sound/soc/intel/catpt/device.c+18−8

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

sound/soc/intel/catpt/loader.c+9−9

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

sound/soc/intel/catpt/pcm.c+14−17

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

sound/soc/intel/catpt/sysfs.c+1−1

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

sound/soc/intel/common/Makefile+1−0

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

sound/soc/intel/common/soc-acpi-intel-nvl-match.c+90−0

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

sound/soc/intel/common/soc-acpi-intel-ptl-match.c+79−0

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

sound/soc/intel/common/sof-function-topology-lib.c+6−2

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

sound/soc/mediatek/Kconfig+31−0

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

sound/soc/mediatek/Makefile+1−0

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

sound/soc/mediatek/common/mtk-afe-platform-driver.c+4−3

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

sound/soc/mediatek/common/mtk-btcvsd.c+12−12

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

sound/soc/mediatek/common/mtk-dsp-sof-common.c+3−2

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

sound/soc/mediatek/mt8183/mt8183-dai-adda.c+2−2

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

sound/soc/mediatek/mt8183/mt8183-dai-i2s.c+2−2

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

sound/soc/mediatek/mt8186/mt8186-afe-pcm.c+6−6

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

sound/soc/mediatek/mt8186/mt8186-dai-adda.c+2−2

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

sound/soc/mediatek/mt8186/mt8186-dai-i2s.c+2−2

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

sound/soc/mediatek/mt8186/mt8186-dai-tdm.c+2−2

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

sound/soc/mediatek/mt8186/mt8186-misc-control.c+6−6

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

sound/soc/mediatek/mt8186/mt8186-mt6366-common.c+1−1

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

sound/soc/mediatek/mt8186/mt8186-mt6366.c+10−9

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

sound/soc/mediatek/mt8188/mt8188-afe-pcm.c+4−6

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

sound/soc/mediatek/mt8188/mt8188-dai-adda.c+2−2

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

sound/soc/mediatek/mt8188/mt8188-dai-dmic.c+1−1

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

sound/soc/mediatek/mt8188/mt8188-dai-etdm.c+1−2

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

sound/soc/mediatek/mt8188/mt8188-mt6359.c+10−7

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

sound/soc/mediatek/mt8189/Makefile+18−0

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

sound/soc/mediatek/mt8189/mt8189-afe-clk.c+750−0

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

sound/soc/mediatek/mt8189/mt8189-afe-clk.h+76−0

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

sound/soc/mediatek/mt8189/mt8189-afe-common.h+240−0

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

sound/soc/mediatek/mt8189/mt8189-afe-pcm.c+2615−0

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

sound/soc/mediatek/mt8189/mt8189-dai-adda.c+1228−0

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

sound/soc/mediatek/mt8189/mt8189-dai-i2s.c+1463−0

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

sound/soc/mediatek/mt8189/mt8189-dai-pcm.c+332−0

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

sound/soc/mediatek/mt8189/mt8189-dai-tdm.c+672−0

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

sound/soc/mediatek/mt8189/mt8189-interconnection.h+97−0

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

sound/soc/mediatek/mt8189/mt8189-nau8825.c+1178−0

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

sound/soc/mediatek/mt8189/mt8189-reg.h+10773−0

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

sound/soc/mediatek/mt8192/mt8192-dai-adda.c+6−6

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

sound/soc/mediatek/mt8192/mt8192-dai-i2s.c+2−2

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

sound/soc/mediatek/mt8195/mt8195-afe-pcm.c+2−4

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

sound/soc/mediatek/mt8195/mt8195-dai-adda.c+4−4

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

sound/soc/mediatek/mt8195/mt8195-dai-etdm.c+1−2

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

sound/soc/mediatek/mt8195/mt8195-mt6359.c+13−8

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

sound/soc/mediatek/mt8365/mt8365-afe-pcm.c+1−2

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

sound/soc/meson/aiu-acodec-ctrl.c+2−4

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

sound/soc/meson/aiu-codec-ctrl.c+2−4

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

sound/soc/meson/axg-spdifout.c+2−2

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

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

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

sound/soc/meson/g12a-toacodec.c+2−4

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

sound/soc/meson/g12a-tohdmitx.c+4−8

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

sound/soc/meson/t9015.c+2−2

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

sound/soc/mxs/mxs-saif.c+90−33

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

sound/soc/pxa/spitz.c+6−3

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

sound/soc/qcom/qdsp6/audioreach.c+66−168

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

sound/soc/qcom/qdsp6/q6adm.c+80−99

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

sound/soc/qcom/qdsp6/q6afe.c+14−35

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

sound/soc/qcom/qdsp6/q6apm-dai.c+7−18

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

sound/soc/qcom/qdsp6/q6apm.c+17−40

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

sound/soc/qcom/qdsp6/q6asm-dai.c+48−39

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

sound/soc/qcom/qdsp6/q6asm.c+63−140

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

sound/soc/qcom/qdsp6/q6asm.h+1−0

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

sound/soc/qcom/qdsp6/q6prm.c+6−21

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

sound/soc/qcom/qdsp6/q6routing.c+2−4

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

sound/soc/qcom/qdsp6/q6usb.c+2−1

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

sound/soc/qcom/qdsp6/topology.c+6−6

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

sound/soc/qcom/sc7180.c+6−4

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

sound/soc/qcom/sc7280.c+3−64

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

sound/soc/qcom/sc8280xp.c+4−30

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

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

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

sound/soc/qcom/sdw.c+76−52

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

sound/soc/qcom/sdw.h+2−5

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

sound/soc/qcom/sm8250.c+4−30

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

sound/soc/qcom/x1e80100.c+3−30

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

sound/soc/renesas/fsi.c+4−4

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

sound/soc/renesas/rz-ssi.c+47−17

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

sound/soc/rockchip/rk3288_hdmi_analog.c+2−1

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

sound/soc/rockchip/rockchip_i2s_tdm.c+1−2

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

sound/soc/rockchip/rockchip_max98090.c+1−1

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

sound/soc/rockchip/rockchip_sai.c+4−4

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

sound/soc/samsung/aries_wm8994.c+3−3

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

sound/soc/samsung/bells.c+3−3

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

sound/soc/samsung/littlemill.c+4−4

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

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

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

sound/soc/samsung/midas_wm1811.c+4−4

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

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

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

sound/soc/samsung/speyside.c+13−11

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

sound/soc/samsung/tm2_wm5110.c+4−3

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

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

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

sound/soc/sdca/Kconfig+28−0

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

sound/soc/sdca/Makefile+9−1

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

sound/soc/sdca/sdca_asoc.c+16−73

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

sound/soc/sdca/sdca_class.c+304−0

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

sound/soc/sdca/sdca_class.h+37−0

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

sound/soc/sdca/sdca_class_function.c+460−0

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

sound/soc/sdca/sdca_device.c+20−0

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

sound/soc/sdca/sdca_fdl.c+504−0

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

sound/soc/sdca/sdca_function_device.c+117−0

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

sound/soc/sdca/sdca_function_device.h+15−0

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

sound/soc/sdca/sdca_functions.c+275−35

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

sound/soc/sdca/sdca_hid.c+50−9

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

sound/soc/sdca/sdca_interrupts.c+224−56

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

sound/soc/sdca/sdca_regmap.c+68−30

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

sound/soc/sdca/sdca_ump.c+262−0

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

sound/soc/sdw_utils/Makefile+1−0

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

sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c+3−2

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

sound/soc/sdw_utils/soc_sdw_cs42l42.c+2−1

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

sound/soc/sdw_utils/soc_sdw_cs42l43.c+6−3

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

sound/soc/sdw_utils/soc_sdw_cs42l45.c+80−0

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

sound/soc/sdw_utils/soc_sdw_cs_amp.c+2−1

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

sound/soc/sdw_utils/soc_sdw_dmic.c+3−2

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

sound/soc/sdw_utils/soc_sdw_maxim.c+4−4

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

sound/soc/sdw_utils/soc_sdw_rt5682.c+2−1

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

sound/soc/sdw_utils/soc_sdw_rt700.c+2−1

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

sound/soc/sdw_utils/soc_sdw_rt711.c+2−1

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

sound/soc/sdw_utils/soc_sdw_rt_amp.c+3−2

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

sound/soc/sdw_utils/soc_sdw_rt_mf_sdca.c+2−1

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

sound/soc/sdw_utils/soc_sdw_rt_sdca_jack_common.c+6−5

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

sound/soc/sdw_utils/soc_sdw_ti_amp.c+2−1

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

sound/soc/sdw_utils/soc_sdw_utils.c+136−22

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

sound/soc/soc-core.c+23−19

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

sound/soc/soc-dai.c+3−2

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

sound/soc/soc-dapm.c+116−80

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

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

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

sound/soc/soc-ops.c+51−11

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

sound/soc/soc-pcm.c+23−15

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

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

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

sound/soc/sof/fw-file-profile.c+12−1

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

sound/soc/sof/imx/Kconfig+1−0

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

sound/soc/sof/imx/imx9.c+8−28

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

sound/soc/sof/intel/Kconfig+18−0

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

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

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

sound/soc/sof/intel/apl.c+1−0

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

sound/soc/sof/intel/cnl.c+3−1

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

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

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

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

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

sound/soc/sof/intel/hda.c+211−2

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

sound/soc/sof/intel/hda.h+1−0

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

sound/soc/sof/intel/icl.c+1−0

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

sound/soc/sof/intel/lnl.c+1−0

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

sound/soc/sof/intel/mtl.c+2−0

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

sound/soc/sof/intel/nvl.c+55−0

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

sound/soc/sof/intel/nvl.h+14−0

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

sound/soc/sof/intel/pci-nvl.c+82−0

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

sound/soc/sof/intel/ptl.c+2−0

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

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

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

sound/soc/sof/intel/skl.c+1−0

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

sound/soc/sof/intel/tgl.c+4−0

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

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

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

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

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

sound/soc/sof/sof-client-probes.c+8−3

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

sound/soc/sof/topology.c+6−1

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

sound/soc/spacemit/Kconfig+15−0

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

sound/soc/spacemit/Makefile+5−0

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

sound/soc/spacemit/k1_i2s.c+461−0

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

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

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

sound/soc/stm/stm32_sai.c+4−10

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

sound/soc/stm/stm32_sai_sub.c+40−17

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

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

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

sound/soc/sunxi/sun4i-spdif.c+24−2

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

sound/soc/sunxi/sun50i-codec-analog.c+1−1

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

sound/soc/sunxi/sun8i-codec-analog.c+7−7

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

sound/soc/sunxi/sun8i-codec.c+2−2

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

sound/soc/tegra/Kconfig+1−1

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

sound/soc/tegra/tegra186_asrc.c+12−12

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

sound/soc/tegra/tegra186_dspk.c+12−12

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

sound/soc/tegra/tegra210_admaif.c+8−8

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

sound/soc/tegra/tegra210_adx.c+2−2

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

sound/soc/tegra/tegra210_ahub.c+3−3

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

sound/soc/tegra/tegra210_amx.c+2−2

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

sound/soc/tegra/tegra210_dmic.c+12−12

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

sound/soc/tegra/tegra210_i2s.c+16−16

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

sound/soc/tegra/tegra210_mbdrc.c+12−12

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

sound/soc/tegra/tegra210_mixer.c+2−2

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

sound/soc/tegra/tegra210_mvc.c+6−6

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

sound/soc/tegra/tegra210_ope.c+2−2

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

sound/soc/tegra/tegra210_peq.c+4−4

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

sound/soc/tegra/tegra210_sfc.c+8−8

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

sound/soc/tegra/tegra_asoc_machine.c+7−4

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

sound/soc/tegra/tegra_wm8903.c+2−1

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

sound/soc/ti/ams-delta.c+4−4

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

sound/soc/ti/davinci-evm.c+6−5

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

sound/soc/ti/j721e-evm.c+1−1

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

sound/soc/ti/n810.c+8−4

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

sound/soc/ti/omap-abe-twl6040.c+1−1

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

sound/soc/ti/omap-twl4030.c+1−1

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

sound/soc/ti/omap3pandora.c+19−17

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

sound/soc/ti/rx51.c+10−7

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

sound/soc/uniphier/aio-cpu.c+2−2

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

sound/soc/uniphier/evea.c+6−6

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

sound/soc/ux500/mop500_ab8500.c+1−1

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

sound/usb/line6/podhd.c+15−1

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

sound/usb/mixer_quirks.c+115−7

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

sound/usb/stream.c+2−4

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

tools/testing/selftests/alsa/conf.c+1−1

This diff is large: its 9 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