[PATCH v4 0/4] Add PM4125 audio codec driver

Alexey Klimov posted 4 patches 2 weeks, 2 days ago
.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |    6 +
.../bindings/sound/qcom,pm4125-codec.yaml          |  134 ++
.../devicetree/bindings/sound/qcom,pm4125-sdw.yaml |   79 +
MAINTAINERS                                        |    2 +
sound/soc/codecs/Kconfig                           |   18 +
sound/soc/codecs/Makefile                          |    8 +
sound/soc/codecs/pm4125-sdw.c                      |  545 ++++++
sound/soc/codecs/pm4125.c                          | 1780 ++++++++++++++++++++
sound/soc/codecs/pm4125.h                          |  307 ++++
9 files changed, 2879 insertions(+)
[PATCH v4 0/4] Add PM4125 audio codec driver
Posted by Alexey Klimov 2 weeks, 2 days ago
PMICs like PM4125 have in-built audio codec IC. The series here
adds support for this codec driver: DT bindings and codec driver
itself that consists mainly of two parts: soundwire devices and
codec part itself.

This audio codec can be found on platforms like QCM2290 and
on Qualcomm QRB2210 RB1 board.

We are working on this together with Srini
(srinivas.kandagatla@oss.qualcomm.com or srini@kernel.org).

This driver also has a bit limited support for concurrent playback,
since line out path is connected to left input channel.

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
Changes in v4:
- clean SDW ports/channels as suggested by Srini;
- Srini implemented refcounting for global mbias (we didn't manage to make it proper DAPM widget);
- patch for qcom,spmi-pmic.yaml moved to separate commit
and "contains" is removed there;
- rx_clk_cnt removed;
- HPH{R,L}_COMP kcontrols fixed;
- removed unneeded kcontrols (LO Switch, DMIC Switches, MBHC Switch);
- removed "RDAC3", NULL, "RX1";
- pass dev pointer to pm4125_get_micb_vout_ctl_val();
- Link to v3: https://lore.kernel.org/r/20250814-pm4125_audio_codec_v1-v3-0-31a6ea0b368b@linaro.org

Changes in v3:
-- added qcom,pm4125-codec compatible to qcom,spmi-pmic.yaml
   as suggested by Krzysztof;
-- added braces around if-else branch in pm4125_probe, removed coma in
   pm4125_slave_id[] as suggested by Christophe Jaillet;
-- slightly re-ordered header files in pm4125.c;
-- reworked how driver deals with regulators after Christophe Jaillet
   noted that it is broken, devm_regulator_bulk_get_enable() is used,
   it looks like there is no need for regulator_bulk_{disable,free};
-- PDM watchdog irqs are moved to separate (new) widgets
   as suggested by Srini, therefore audio routing and events for
   HPH{L,R},LO and ERA PGAs are changed;
-- extended pr_err() msg in pm4125_get_micb_vout_ctl_val();
-- small styling code adjustment in pm4125_get_compander();
-- added/reworked pm4125_bind() to add error paths
   as suggested by Christophe Jaillet;
-- removed of_node_put() in pm4125_add_slave_components() after Krzysztof
   pointed out that of_node_put() is out of place, it looks like
   of_parse_phandle() gets the node and component_release_of() will
   do of_node_put() on dev release so no need for of_node_put();
-- Link to v2: https://lore.kernel.org/r/20250711-pm4125_audio_codec_v1-v2-0-13e6f835677a@linaro.org

Changes in v2:

-- added rxclk dapm widget, fixed/changed RX1/RX2 widgets;
-- added comment for pm4125_wd_handle_irq();
-- registers access permission routines have been reworked;
-- changed pm4125_sdw_* functions to static inline;
-- cleaned a bit pm4125_{rx,tx}_sdw_channels;
-- got rid of most of hardcoded magic numbers (for the remaining regs+values I don't have documentation);
-- updated commit messages;
-- pm4125_tx_sdw_ports has been updated;
-- removed of_match_ptr() and OF ifdef;
-- removed couple of pm_runtime_mark_last_busy() calls;
-- removed swap_gnd_mic;
-- removed __pm4125_codec_enable_micbias_pullup();
-- reordered sequence of calls in pm4125_probe() to make it a bit more logical;
-- removed excessive regulator_bulk_free() and in error path in _probe();
-- re-aligned for 100-chars length;
-- removed of_node_get(), replaced with of_node_put();
-- corrected some dev_err() messages;
-- corrected some comments;
-- removed legacy "WCD" from stream_name, replaced with "PM4125";
-- removed null callbacks from struct wcd_mbhc_cb;
-- removed "HPH Type" and "HPH{L,R} Impedance";
-- pm4125_codec_enable_micbias() has been updated;
-- pm4125_micbias_control() and pm4125_codec_enable_adc have been implemented;
-- pm4125_codec_enable_dmic() has been updated;
-- cleaned struct pm4125_priv;
-- some rework to pm4125_handle_post_irq() and pm4125_regmap_irq_chip;
-- updated Kconfig+Makefile (to make things be in sorting order);
-- new patch: adding new files to MAINTAINERS file;

For dt bindings:
-- I think all requested comments from Krzysztof were implemented;
-- squashed qcom,spmi-pmic change into previous patch to avoid warnings on dtbs check;

Not done:
-- Mark suggested to look at reimplementing this as a child mfd device from
MFD PMIC without device tree description.

- Link to v1: https://lore.kernel.org/r/20250626-pm4125_audio_codec_v1-v1-0-e52933c429a0@linaro.org

---
Alexey Klimov (4):
      dt-bindings: sound: add bindings for pm4125 audio codec
      dt-bindings: mfd: qcom,spmi-pmic: add qcom,pm4125-codec compatible
      ASoC: codecs: add new pm4125 audio codec driver
      MAINTAINERS: add Qualcomm PM4125 audio codec to drivers list

 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |    6 +
 .../bindings/sound/qcom,pm4125-codec.yaml          |  134 ++
 .../devicetree/bindings/sound/qcom,pm4125-sdw.yaml |   79 +
 MAINTAINERS                                        |    2 +
 sound/soc/codecs/Kconfig                           |   18 +
 sound/soc/codecs/Makefile                          |    8 +
 sound/soc/codecs/pm4125-sdw.c                      |  545 ++++++
 sound/soc/codecs/pm4125.c                          | 1780 ++++++++++++++++++++
 sound/soc/codecs/pm4125.h                          |  307 ++++
 9 files changed, 2879 insertions(+)
---
base-commit: 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1
change-id: 20250626-pm4125_audio_codec_v1-02ca7a300ddc

Best regards,
-- 
Alexey Klimov <alexey.klimov@linaro.org>
Re: [PATCH v4 0/4] Add PM4125 audio codec driver
Posted by Srinivas Kandagatla 2 weeks, 1 day ago

On 9/15/25 5:27 PM, Alexey Klimov wrote:
> PMICs like PM4125 have in-built audio codec IC. The series here
> adds support for this codec driver: DT bindings and codec driver
> itself that consists mainly of two parts: soundwire devices and
> codec part itself.
> 
> This audio codec can be found on platforms like QCM2290 and
> on Qualcomm QRB2210 RB1 board.
> 
> We are working on this together with Srini
> (srinivas.kandagatla@oss.qualcomm.com or srini@kernel.org).
> 
> This driver also has a bit limited support for concurrent playback,
> since line out path is connected to left input channel.
> 
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> 
Thanks Alexey for these patches,

I have now tested this series for headset playback, record and lineout.


Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>


--srini

---
> Changes in v4:
> - clean SDW ports/channels as suggested by Srini;
> - Srini implemented refcounting for global mbias (we didn't manage to make it proper DAPM widget);
> - patch for qcom,spmi-pmic.yaml moved to separate commit
> and "contains" is removed there;
> - rx_clk_cnt removed;
> - HPH{R,L}_COMP kcontrols fixed;
> - removed unneeded kcontrols (LO Switch, DMIC Switches, MBHC Switch);
> - removed "RDAC3", NULL, "RX1";
> - pass dev pointer to pm4125_get_micb_vout_ctl_val();
> - Link to v3: https://lore.kernel.org/r/20250814-pm4125_audio_codec_v1-v3-0-31a6ea0b368b@linaro.org
> 
> Changes in v3:
> -- added qcom,pm4125-codec compatible to qcom,spmi-pmic.yaml
>    as suggested by Krzysztof;
> -- added braces around if-else branch in pm4125_probe, removed coma in
>    pm4125_slave_id[] as suggested by Christophe Jaillet;
> -- slightly re-ordered header files in pm4125.c;
> -- reworked how driver deals with regulators after Christophe Jaillet
>    noted that it is broken, devm_regulator_bulk_get_enable() is used,
>    it looks like there is no need for regulator_bulk_{disable,free};
> -- PDM watchdog irqs are moved to separate (new) widgets
>    as suggested by Srini, therefore audio routing and events for
>    HPH{L,R},LO and ERA PGAs are changed;
> -- extended pr_err() msg in pm4125_get_micb_vout_ctl_val();
> -- small styling code adjustment in pm4125_get_compander();
> -- added/reworked pm4125_bind() to add error paths
>    as suggested by Christophe Jaillet;
> -- removed of_node_put() in pm4125_add_slave_components() after Krzysztof
>    pointed out that of_node_put() is out of place, it looks like
>    of_parse_phandle() gets the node and component_release_of() will
>    do of_node_put() on dev release so no need for of_node_put();
> -- Link to v2: https://lore.kernel.org/r/20250711-pm4125_audio_codec_v1-v2-0-13e6f835677a@linaro.org
> 
> Changes in v2:
> 
> -- added rxclk dapm widget, fixed/changed RX1/RX2 widgets;
> -- added comment for pm4125_wd_handle_irq();
> -- registers access permission routines have been reworked;
> -- changed pm4125_sdw_* functions to static inline;
> -- cleaned a bit pm4125_{rx,tx}_sdw_channels;
> -- got rid of most of hardcoded magic numbers (for the remaining regs+values I don't have documentation);
> -- updated commit messages;
> -- pm4125_tx_sdw_ports has been updated;
> -- removed of_match_ptr() and OF ifdef;
> -- removed couple of pm_runtime_mark_last_busy() calls;
> -- removed swap_gnd_mic;
> -- removed __pm4125_codec_enable_micbias_pullup();
> -- reordered sequence of calls in pm4125_probe() to make it a bit more logical;
> -- removed excessive regulator_bulk_free() and in error path in _probe();
> -- re-aligned for 100-chars length;
> -- removed of_node_get(), replaced with of_node_put();
> -- corrected some dev_err() messages;
> -- corrected some comments;
> -- removed legacy "WCD" from stream_name, replaced with "PM4125";
> -- removed null callbacks from struct wcd_mbhc_cb;
> -- removed "HPH Type" and "HPH{L,R} Impedance";
> -- pm4125_codec_enable_micbias() has been updated;
> -- pm4125_micbias_control() and pm4125_codec_enable_adc have been implemented;
> -- pm4125_codec_enable_dmic() has been updated;
> -- cleaned struct pm4125_priv;
> -- some rework to pm4125_handle_post_irq() and pm4125_regmap_irq_chip;
> -- updated Kconfig+Makefile (to make things be in sorting order);
> -- new patch: adding new files to MAINTAINERS file;
> 
> For dt bindings:
> -- I think all requested comments from Krzysztof were implemented;
> -- squashed qcom,spmi-pmic change into previous patch to avoid warnings on dtbs check;
> 
> Not done:
> -- Mark suggested to look at reimplementing this as a child mfd device from
> MFD PMIC without device tree description.
> 
> - Link to v1: https://lore.kernel.org/r/20250626-pm4125_audio_codec_v1-v1-0-e52933c429a0@linaro.org
> 
> ---
> Alexey Klimov (4):
>       dt-bindings: sound: add bindings for pm4125 audio codec
>       dt-bindings: mfd: qcom,spmi-pmic: add qcom,pm4125-codec compatible
>       ASoC: codecs: add new pm4125 audio codec driver
>       MAINTAINERS: add Qualcomm PM4125 audio codec to drivers list
> 
>  .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |    6 +
>  .../bindings/sound/qcom,pm4125-codec.yaml          |  134 ++
>  .../devicetree/bindings/sound/qcom,pm4125-sdw.yaml |   79 +
>  MAINTAINERS                                        |    2 +
>  sound/soc/codecs/Kconfig                           |   18 +
>  sound/soc/codecs/Makefile                          |    8 +
>  sound/soc/codecs/pm4125-sdw.c                      |  545 ++++++
>  sound/soc/codecs/pm4125.c                          | 1780 ++++++++++++++++++++
>  sound/soc/codecs/pm4125.h                          |  307 ++++
>  9 files changed, 2879 insertions(+)
> ---
> base-commit: 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1
> change-id: 20250626-pm4125_audio_codec_v1-02ca7a300ddc
> 
> Best regards,
Re: [PATCH v4 0/4] Add PM4125 audio codec driver
Posted by Krzysztof Kozlowski 2 weeks ago
On Mon, Sep 15, 2025 at 05:27:47PM +0100, Alexey Klimov wrote:
>  .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |    6 +
>  .../bindings/sound/qcom,pm4125-codec.yaml          |  134 ++
>  .../devicetree/bindings/sound/qcom,pm4125-sdw.yaml |   79 +
>  MAINTAINERS                                        |    2 +
>  sound/soc/codecs/Kconfig                           |   18 +
>  sound/soc/codecs/Makefile                          |    8 +
>  sound/soc/codecs/pm4125-sdw.c                      |  545 ++++++
>  sound/soc/codecs/pm4125.c                          | 1780 ++++++++++++++++++++
>  sound/soc/codecs/pm4125.h                          |  307 ++++
>  9 files changed, 2879 insertions(+)
> ---
> base-commit: 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1

git co 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1
fatal: unable to read tree (590b221ed4256fd6c34d3dea77aa5bd6e741bbc1)

On latest next:

b4 diff 20250915-pm4125_audio_codec_v1-v4-1-b247b64eec52@linaro.org
Checking for older revisions
Grabbing search results from lore.kernel.org
  Added from v3: 4 patches
---
Analyzing 50 messages in the thread
Preparing fake-am for v3: dt-bindings: sound: add bindings for pm4125 audio codec
  range: 6f3a32745b2c..b40852dc84c3
Preparing fake-am for v4: dt-bindings: sound: add bindings for pm4125 audio codec
ERROR: Could not write fake-am tree
---
Could not create fake-am range for upper series v4

I tried latest master - the same. I tried also next 20250901 - same.

You need to fix somehow the base you are using.

Best regards,
Krzysztof
Re: [PATCH v4 0/4] Add PM4125 audio codec driver
Posted by Dmitry Baryshkov 2 weeks ago
On Thu, Sep 18, 2025 at 11:02:30AM +0900, Krzysztof Kozlowski wrote:
> On Mon, Sep 15, 2025 at 05:27:47PM +0100, Alexey Klimov wrote:
> >  .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |    6 +
> >  .../bindings/sound/qcom,pm4125-codec.yaml          |  134 ++
> >  .../devicetree/bindings/sound/qcom,pm4125-sdw.yaml |   79 +
> >  MAINTAINERS                                        |    2 +
> >  sound/soc/codecs/Kconfig                           |   18 +
> >  sound/soc/codecs/Makefile                          |    8 +
> >  sound/soc/codecs/pm4125-sdw.c                      |  545 ++++++
> >  sound/soc/codecs/pm4125.c                          | 1780 ++++++++++++++++++++
> >  sound/soc/codecs/pm4125.h                          |  307 ++++
> >  9 files changed, 2879 insertions(+)
> > ---
> > base-commit: 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1
> 
> git co 590b221ed4256fd6c34d3dea77aa5bd6e741bbc1
> fatal: unable to read tree (590b221ed4256fd6c34d3dea77aa5bd6e741bbc1)

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20250912

> 
> On latest next:
> 
> b4 diff 20250915-pm4125_audio_codec_v1-v4-1-b247b64eec52@linaro.org
> Checking for older revisions
> Grabbing search results from lore.kernel.org
>   Added from v3: 4 patches
> ---
> Analyzing 50 messages in the thread
> Preparing fake-am for v3: dt-bindings: sound: add bindings for pm4125 audio codec
>   range: 6f3a32745b2c..b40852dc84c3
> Preparing fake-am for v4: dt-bindings: sound: add bindings for pm4125 audio codec
> ERROR: Could not write fake-am tree
> ---
> Could not create fake-am range for upper series v4
> 
> I tried latest master - the same. I tried also next 20250901 - same.
> 
> You need to fix somehow the base you are using.
> 
> Best regards,
> Krzysztof
> 

-- 
With best wishes
Dmitry
Re: (subset) [PATCH v4 0/4] Add PM4125 audio codec driver
Posted by Mark Brown 2 weeks, 1 day ago
On Mon, 15 Sep 2025 17:27:47 +0100, Alexey Klimov wrote:
> PMICs like PM4125 have in-built audio codec IC. The series here
> adds support for this codec driver: DT bindings and codec driver
> itself that consists mainly of two parts: soundwire devices and
> codec part itself.
> 
> This audio codec can be found on platforms like QCM2290 and
> on Qualcomm QRB2210 RB1 board.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] dt-bindings: sound: add bindings for pm4125 audio codec
      commit: 88d0d17192c5a850dc07bb38035b69c4cefde270
[3/4] ASoC: codecs: add new pm4125 audio codec driver
      commit: 8ad5294849379543782e290e8e670b69e4580a24
[4/4] MAINTAINERS: add Qualcomm PM4125 audio codec to drivers list
      commit: b9cb410d48b00a759f0947f2491785f4d0486c68

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark