ARM: omap3: pandora: Modernize audio and backlight to Device Tree to finally remove pdata-quirks
Subsystems (13)
cover ARM: omap3: pandora: Modernize audio and backlight to Device Tree to finally remove pdata-quirks
PATCH V1 2026-07-11 08:02:02:
This series modernizes the OpenPandora handheld support by converting the sound subsystem and backlight control to proper platform drivers and Device Tree definitions.
The primary goal is the complete removal of omap3_pandora_legacy_init() and the elimination of the last remaining user of machine_is_omap3_pandora().
History and Context
===================
The necessity of this cleanup was highlighted in several recent discussions:
1. Tony Lindgren noted that machine_is_omap3_pandora() checks never succeed on Device Tree-booted machines, leaving the audio subsystem functionally broken since the DT conversion years ago:
https://marc.info/?l=alsa-devel&m=165632351319716&w=2
2. Ethan Nelson-Moore submitted a patch to replace the macro with DT compatibility checks (accepted as commit 45efb8fbdae3 in v7.2-rc1):
https://marc.info/?l=linux-omap&m=177841578110704&w=2
3. Sascha Hauer pointed out that the entire omap3pandora driver fundamentally depended on this broken machine ID check:
https://marc.info/?l=linux-omap&m=178048982272252&w=2
Design Choices and Implementation
=================================
Based on these discussions and a long-standing and working out-of-tree solution, we initially attempted a migration to generic frameworks like simple-audio-card or audio-graph-card. However, the hardware routing peculiarities of the OpenPandora introduced too many functional gaps. Replacing omap3pandora.c entirely with pure DT definitions proved unfeasible.
Therefore, we opted to base a new proposal on the out-of-tree rewrite of the old-style sound board file kernel driver (sound/soc/ti/omap3pandora.c) into a proper platform driver that cleanly fetches its resources from the Device Tree, while adding specific handling for the twl4030-regen output and adapting the pandora device tree files.
Series Structure
================
* Patches 01–06 (Preparation): Move highly specific legacy code to its proper infrastructure (TWL4030 regulator regeneration and codec handling).
* Patch 07-08 (New Driver): Introduce a dedicated platform driver for the PCM1773 audio DAC.
* Patches 09-14 (Audio Core): Rewrite the omap3pandora ASoC fabric driver and update the respective Device Tree nodes.
* Patches 14–15 (Backlight): Remove the custom, legacy Pandora backlight driver, convert it to generic Device Tree nodes
* Patch 16: (Cleanup) safely delete the obsolete omap3_pandora_legacy_init().
Notes & Testing
===============
* Testing: This series has been tested on real OpenPandora hardware.
Credits
=======
This work is a collaborative effort by multiple authors over several years:
* Grond <[email protected]>
* Stefan Leichter <[email protected]>
* H. Nikolaus Schaller <[email protected]>
Grond (8):
dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
regulator: twl: Expose the TWL4030's REGEN signal as a regulator
arm: dts: twl4030: add twl4030-regen child
arm: dts: omap3pandora: Populate DT data for the TWL4030's REGEN
regulator
arm: dts: omap3pandora: Don't use DMA channels for unused SPI masters
ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk()
interface
ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI
arm: dts: omap3pandora: Add device node for PCM1773 codec
H. Nikolaus Schaller (5):
ASoC: dt-bindings: add TI PCM1773
ASoC: dt-bindings: add OpenPandora Sound Card
arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and
pwm_bl
backlight: remove pandora_bl
arm: omap2: remove remaining pdata-quirks for pandora legacy devices
Stefan Leichter (3):
ASoC: omap3pandora: Rewrite sound card driver as a platform driver
with DT
ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2)
arm: dts: omap3pandora: create new DT node for the sound card
.../devicetree/bindings/mfd/ti,twl.yaml | 1 + .../sound/openpandora,omap3pandora-sound.yaml | 94 ++++ .../devicetree/bindings/sound/pcm1773.yaml | 32 ++ .../dts/ti/omap/omap3-pandora-common.dtsi | 84 ++++ arch/arm/boot/dts/ti/omap/twl4030.dtsi | 14 + arch/arm/mach-omap2/pdata-quirks.c | 23 - drivers/regulator/twl-regulator.c | 52 ++ drivers/video/backlight/Kconfig | 7 - drivers/video/backlight/Makefile | 1 - drivers/video/backlight/pandora_bl.c | 159 ------ include/linux/mfd/twl.h | 3 + include/linux/mfd/twl4030-audio.h | 3 + sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/pcm1773.c | 149 ++++++ sound/soc/codecs/twl4030.c | 140 ++++-- sound/soc/ti/omap3pandora.c | 454 ++++++++++++------ 16 files changed, 855 insertions(+), 366 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml create mode 100644 Documentation/devicetree/bindings/sound/pcm1773.yaml delete mode 100644 drivers/video/backlight/pandora_bl.c create mode 100644 sound/soc/codecs/pcm1773.c
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH 1/16 dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
From: Grond <[email protected]>
FIXME: not reflected in the bindings
+Reguired properties:
+For twl3040 REGEN signal:
+ - regulator-min-microvolt:
+ - Same meaning as in bindings/regulator/regulator.yaml, but must match
+ regulator-max-microvolt.
+ - regulator-max-microvolt:
+ - Same meaning as in bindings/regulator/regulator.yaml, but must match
+ regulator-min-microvolt.
+ - startup-delay-us:
+ - Same meaning as in bindings/regulator/fixed-regulator.yaml.
--- Documentation/devicetree/bindings/mfd/ti,twl.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1 -0
@@ -46,6 +46,7 @@ allOf: - ti,twl4030-vusb1v5 - ti,twl4030-vusb1v8 - ti,twl4030-vusb3v1 + - ti,twl4030-regen ti,retain-on-reset: false properties:
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti, twl4030-regen
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The binding schema fails to enforce the required properties for the `ti,twl4030-regen`…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The binding schema fails to enforce the required properties for the ti,twl4030-regen compatible string and rejects the startup-delay-us property.
- [Low] The commit message contains misspellings and an incorrect hardware model number.
--
--- Patch [1]: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen --- commit 47a2b827603c26c697c09f74aba57400724a478c
Author: Grond <[email protected]>
dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
This commit adds the ti,twl4030-regen compatible string to the bindings. It also updates the commit message to document its newly required regulator properties.
Quoted 2 lines
+Reguired properties:
+For twl3040 REGEN signal:
[Severity: Low]
This isn't a bug, but should "Reguired" be "Required" and "twl3040" be "twl4030"?
Documentation/devicetree/bindings/mfd/ti,twl.yaml allOf: · line 52
Quoted 12 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1
-0@@ -46,6 +46,7 @@ allOf: - ti,twl4030-vusb1v5 - ti,twl4030-vusb1v8 - ti,twl4030-vusb3v1 + - ti,twl4030-regen ti,retain-on-reset: false properties:
[Severity: Medium]
Will this schema allow validation to pass without the properties described in the commit message?
Since there is no corresponding if-then block added to enforce regulator-min-microvolt and regulator-max-microvolt, they won't be required for ti,twl4030-regen.
Also, does this cause validation to fail when startup-delay-us is used?
Because startup-delay-us is not defined in the base regulator schema and unevaluatedProperties is set to false for the regulator pattern block, any device tree attempting to use startup-delay-us as instructed will likely be rejected during dt_binding_check and dtbs_check.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
In reply to H. Nikolaus SchallerQuoted 4 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
FIXME: not reflected in the bindings
Review
Quoted 10 lines
(quoted diff) +10
-0+Reguired properties: +For twl3040 REGEN signal: + - regulator-min-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-max-microvolt. + - regulator-max-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-min-microvolt. + - startup-delay-us: + - Same meaning as in bindings/regulator/fixed-regulator.yaml.
I don't know what that means.
Quoted 2 lines
Signed-off-by Grond <[email protected]>
As explicitly written in submitting patches: we do not take anonymous contributions.
Best regards,
Krzysztof
Re: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
Hi Krzysztof,
Thank you for the feedback.
Quoted 21 lines
Am 13.07.2026 um 09:39 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
FIXME: not reflected in the bindings
Review
Quoted 10 lines
(quoted diff) +10
-0+Reguired properties: +For twl3040 REGEN signal: + - regulator-min-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-max-microvolt. + - regulator-max-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-min-microvolt. + - startup-delay-us: + - Same meaning as in bindings/regulator/fixed-regulator.yaml.I don't know what that means.
Quoted 1 line
Quoted 4 lines
Quoted 1 line
Signed-off-by Grond <[email protected]>As explicitly written in submitting patches: we do not take anonymous contributions.
Thanks for pointing this out. In more than 10 years of contributing, I actually have never run into this specific issue before.
To give some context: this is a contribution we received on our mailing list about 5 years ago. We do not know the author personally, but the code looks good and has been thoroughly tested by us. I kept their Signed-off-by because I didn't want to falsely claim authorship.
Unless he answers to this mail, what would be the best way to proceed?
Should I keep him as the Author: in the git metadata but remove the pseudo-anonymous Signed-off-by, and instead add my own Signed-off-by (and perhaps a Co-developed-by or From: note) to certify the Developer's Certificate of Origin (DCO) myself?
Anyways this will likely be reworked based on the sahiko-bot recommendations to make regen not a regulator but a gpio that can be controlled by a separate regulator-fixed. This will also clarify/remove the "same meaning" statements and ambiguities.
Thanks and BR,
Nikolaus
Re: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
Quoted 25 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
Quoted 21 lines
Am 13.07.2026 um 09:39 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
FIXME: not reflected in the bindings
Review
Quoted 10 lines
(quoted diff) +10
-0+Reguired properties: +For twl3040 REGEN signal: + - regulator-min-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-max-microvolt. + - regulator-max-microvolt: + - Same meaning as in bindings/regulator/regulator.yaml, but must match + regulator-min-microvolt. + - startup-delay-us: + - Same meaning as in bindings/regulator/fixed-regulator.yaml.I don't know what that means.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Grond <[email protected]>As explicitly written in submitting patches: we do not take anonymous contributions.
Thanks for pointing this out. In more than 10 years of contributing, I actually have never run into this specific issue before.
To give some context: this is a contribution we received on our mailing list about 5 years ago. We do not know the author personally, but the code looks good and has been thoroughly tested by us. I kept their Signed-off-by because I didn't want to falsely claim authorship.
Take the authorship. You are allowed to do that by both DCO and common sense (you are not doing something immoral, unless author shows interest/hints to fix it by themself).
Commit msg also needs fixing/rewriting.
Beside, one more nit since there will be a new version:
A nit, subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23
Also, please wrap your replies to mailing list wrapping style.
Best regards,
Krzysztof
Re: [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen
Quoted 21 lines
Am 13.07.2026 um 11:19 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 16 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
Quoted 11 lines
Am 13.07.2026 um 09:39 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 5 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
Signed-off-by Grond <[email protected]>As explicitly written in submitting patches: we do not take anonymous contributions.
Quoted 7 lines
Quoted 3 lines
Thanks for pointing this out. In more than 10 years of contributing, I actually have never run into this specific issue before.
To give some context: this is a contribution we received on our mailing list about 5 years ago. We do not know the author personally, but the code looks good and has been thoroughly tested by us. I kept their Signed-off-by because I didn't want to falsely claim authorship.
Take the authorship. You are allowed to do that by both DCO and common sense (you are not doing something immoral, unless author shows interest/hints to fix it by themself).
Ok, let's give him some days to respond. Thanks for the procedure to resolve a potential deadlock.
Quoted 7 lines
Commit msg also needs fixing/rewriting.
Beside, one more nit since there will be a new version:
A nit, subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings.
Ok.
Quoted 2 lines
Best regards,
Krzysztof
PATCH 2/16 regulator: twl: Expose the TWL4030's REGEN signal as a regulator
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
This is needed on some boards (for example, the Pandora), where REGEN is used to drive external regulators.
--- drivers/regulator/twl-regulator.c | 52 +++++++++++++++++++++++++++++++ include/linux/mfd/twl.h | 3 ++ 2 files changed, 55 insertions(+)
drivers/regulator/twl-regulator.c +52 -0
@@ -451,6 +451,16 @@ static const struct regulator_ops twl4030fixed_ops = { .get_status = twl4030reg_get_status, }; +static const struct regulator_ops twl4030signal_ops = { + .enable = twl4030reg_enable, + .disable = twl4030reg_disable, + .is_enabled = twl4030reg_is_enabled, + + .set_mode = twl4030reg_set_mode, + + .get_status = twl4030reg_get_status, +}; +/*----------------------------------------------------------------------*/ #define TWL4030_ADJUSTABLE_LDO (label, offset, num, turnon_delay, remap_conf) \
@@ -511,6 +521,24 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \ }, \ } +#define TWL4030_SIGNAL(label, offset, num, remap_conf) \ +static const struct twlreg_info TWLSIGNAL_INFO_##label = { \ + .base = offset, \ + .id = num, \ + .remap = remap_conf, \ + .desc = { \ + .name = #label, \ + .id = TWL4030_REG_##label, \ + .n_voltages = 1, \ + .fixed_uV = 0, /* filled in from DT later */ \ + .ops = &twl4030signal_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .enable_time = 0, /* also filled in from DT */ \ + .of_map_mode = twl4030reg_map_mode, \ + }, \ + } +/* * We list regulators here if systems need some level of * software control over them after boot.
@@ -536,6 +564,7 @@ TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08);TWL4030_FIXED_LDO (VUSB1V5 ,0x71 ,1500 ,17 ,100 ,0x08 );TWL4030_FIXED_LDO (VUSB1V8 ,0x74 ,1800 ,18 ,100 ,0x08 );TWL4030_FIXED_LDO (VUSB3V1 ,0x77 ,3100 ,19 ,150 ,0x08 ); +TWL4030_SIGNAL (REGEN ,0x7f ,21 ,0x08 );#define TWL_OF_MATCH (comp, family, label) \ { \
@@ -548,6 +577,7 @@ TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08);#define TWL6032_OF_MATCH (comp, label) TWL_OF_MATCH(comp, TWL6032, label)#define TWLFIXED_OF_MATCH (comp, label) TWL_OF_MATCH(comp, TWLFIXED, label)#define TWLSMPS_OF_MATCH (comp, label) TWL_OF_MATCH(comp, TWLSMPS, label) +#define TWLSIGNAL_OF_MATCH (comp, label) TWL_OF_MATCH(comp, TWLSIGNAL, label)static const struct of_device_id twl_of_match[] = {TWL4030_OF_MATCH ("ti,twl4030-vaux1" ,VAUX1 ),
@@ -570,6 +600,7 @@ static const struct of_device_id twl_of_match[] = {TWLFIXED_OF_MATCH ("ti,twl4030-vusb1v5" ,VUSB1V5 ),TWLFIXED_OF_MATCH ("ti,twl4030-vusb1v8" ,VUSB1V8 ),TWLFIXED_OF_MATCH ("ti,twl4030-vusb3v1" ,VUSB3V1 ), +TWLSIGNAL_OF_MATCH ("ti,twl4030-regen" ,REGEN ), {}, };MODULE_DEVICE_TABLE (of, twl_of_match);
@@ -583,6 +614,7 @@ static int twlreg_probe(struct platform_device *pdev)struct regulation_constraints *c;struct regulator_dev *rdev;struct regulator_config config = { }; +int ret; template =of_device_get_match_data (&pdev->dev);if (!template)
@@ -615,6 +647,26 @@ static int twlreg_probe(struct platform_device *pdev)case TWL4030_REG_VINTANA2 :case TWL4030_REG_VINTDIG : c->always_on = true; +break ; +case TWL4030_REG_REGEN : +if (c->min_uV ==0 || c->max_uV ==0 ) { +dev_err (&pdev->dev,"minimum or maximum regulator voltage zero in DT\n" ); +return -EINVAL ; + } + +if (c->min_uV != c->max_uV) { +dev_err (&pdev->dev,"minimum and maximum voltage are different in DT\n" ); +return -EINVAL ; + } + info->desc.fixed_uV = c->min_uV; + + ret =of_property_read_u32 (pdev->dev.of_node,"startup-delay-us" , + &info->desc.enable_time); +if (ret) { +dev_err (&pdev->dev,"no valid startup delay set in DT: %d\n" , ret); +return ret; + } +break ;default :break ;
include/linux/mfd/twl.h +3 -0
@@ -738,6 +738,9 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base);#define TWL4030_REG_VUSB1V8 18#define TWL4030_REG_VUSB3V1 19 +/* digital output signal for enabling external regulators */ +#define TWL4030_REG_REGEN 21 +/* TWL6030 SMPS/LDO's */ /* EXTERNAL dc-to-dc buck convertor controllable via SR */ #define TWL6030_REG_VDD1 30
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 02/16] regulator: twl: Expose the TWL4030's REGEN signal as a regulator
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Unnecessarily strict DT property enforcement causes probe failure. --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unnecessarily strict DT property enforcement causes probe failure. --
--- Patch [2]: [PATCH 02/16] regulator: twl: Expose the TWL4030's REGEN signal as a regulator --- commit d13717da4f5b51bb52a516562b40db8ac7694aad
Author: Grond <[email protected]>
regulator: twl: Expose the TWL4030's REGEN signal as a regulator
This commit exposes the TWL4030 REGEN signal as a regulator. This functionality is needed on some boards where REGEN is used to drive external regulators.
Quoted 4 lines
drivers/regulator/twl-regulator.c +0
-0
[ ... ]
Quoted 6 lines
drivers/regulator/twl-regulator.c +2
-0@@ -615,6 +647,26 @@ static int twlreg_probe(struct platform_device *pdev)case TWL4030_REG_VINTANA2 :case TWL4030_REG_VINTDIG : c->always_on = true; +break ; +case TWL4030_REG_REGEN :
[ ... ]
drivers/regulator/twl-regulator.c static int twlreg_probe(struct platform_device *pdev) · line 668
Quoted 8 lines
drivers/regulator/twl-regulator.c +8
-0+ info->desc.fixed_uV = c->min_uV; + + ret =of_property_read_u32 (pdev->dev.of_node,"startup-delay-us" , + &info->desc.enable_time); +if (ret) { +dev_err (&pdev->dev,"no valid startup delay set in DT: %d\n" , ret); +return ret; + }
[Severity: Low]
This isn't a bug, but does this code need to fail the probe if the startup-delay-us property is missing?
Since enable_time already defaults to 0 in the template structure, could this be treated as an optional property similar to standard fixed-regulator behavior, rather than strictly enforcing its presence and returning an error?
Quoted 5 lines
drivers/regulator/twl-regulator.c +2
-0+ +break ;default :break ; }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Mark Brown
maintainerRe: [PATCH 02/16] regulator: twl: Expose the TWL4030's REGEN signal as a regulator
In reply to H. Nikolaus SchallerQuoted 4 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
This is needed on some boards (for example, the Pandora), where REGEN is used to drive external regulators.
Is this a regulator or a GPIO? It sounds an awful lot like a GPIO.
PATCH 3/16 arm: dts: twl4030: add twl4030-regen child
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
This is needed on some boards (for example, the Pandora), where REGEN is used to drive external regulators.
--- arch/arm/boot/dts/ti/omap/twl4030.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/ti/omap/twl4030.dtsi +14 -0
@@ -112,6 +112,20 @@ vsim: regulator-vsim { regulator-max-microvolt = <3000000>; }; + regen: regulator-regen { + compatible = "ti,twl4030-regen"; + /* + * Since REGEN is technically just a signal that actuates an + * external regulator, we do not know what voltage it will + * eventually have, or what it's on/off timing should be. + * Therefore, disable it here; boards that use it can override + * the status to "okay" once they have set the + * regulator-{min,max}-microvolt and startup-delay-us + * attributes. + */ + status = "disabled"; + }; + twl_gpio: gpio { compatible = "ti,twl4030-gpio"; gpio-controller;
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 03/16] arm: dts: twl4030: add twl4030-regen child
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The YAML binding schema fails to allow 'startup-delay-us', causing a conflict between driver probe…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The YAML binding schema fails to allow 'startup-delay-us', causing a conflict between driver probe requirements and dtbs_check validation.
- [Medium] Architectural flaw in Device Tree design: conflating a PMIC digital control signal with an external voltage regulator. --
--- Patch [3]: [PATCH 03/16] arm: dts: twl4030: add twl4030-regen child --- commit a39086d961abe1def74820ce0f67a5656f16f99d
Author: Grond <[email protected]>
arm: dts: twl4030: add twl4030-regen child
This is needed on some boards (for example, the Pandora), where REGEN is used to drive external regulators.
arch/arm/boot/dts/ti/omap/twl4030.dtsi vsim: regulator-vsim { · line 119
Quoted 13 lines
arch/arm/boot/dts/ti/omap/twl4030.dtsi +5
-0@@ -112,6 +112,20 @@ vsim: regulator-vsim { regulator-max-microvolt = <3000000>; }; + regen: regulator-regen { + compatible = "ti,twl4030-regen"; + /* + * Since REGEN is technically just a signal that actuates an + * external regulator, we do not know what voltage it will
[Severity: Medium]
Is there an architectural mismatch in how this external regulator is modeled?
The comment acknowledges that REGEN is just a control signal, but the driver forces the PMIC's digital signal node to define the external component's voltage parameters:
drivers/regulator/twl-regulator.c:twlreg_probe() {
if (c->min_uV == 0 || c->max_uV == 0) {
dev_err(&pdev->dev, "minimum or maximum regulator voltage zero in DT\n");
return -EINVAL;
}
}Would it be more aligned with Device Tree principles to model the PMIC's REGEN pin as an enable-gpio or a voltage-less switch, and define a separate regulator-fixed node for the external regulator that uses REGEN to enable it?
arch/arm/boot/dts/ti/omap/twl4030.dtsi vsim: regulator-vsim { · line 125
Quoted 6 lines
arch/arm/boot/dts/ti/omap/twl4030.dtsi +6
-0+ * eventually have, or what it's on/off timing should be. + * Therefore, disable it here; boards that use it can override + * the status to "okay" once they have set the + * regulator-{min,max}-microvolt and startup-delay-us + * attributes. + */
[Severity: High]
Will this cause a conflict between driver probe requirements and the dtbs_check validation?
Looking at twlreg_probe() in drivers/regulator/twl-regulator.c, the driver explicitly requires the startup-delay-us property:
drivers/regulator/twl-regulator.c:twlreg_probe() {
ret = of_property_read_u32(pdev->dev.of_node, "startup-delay-us",
&info->desc.enable_time);
if (ret) {
dev_err(&pdev->dev, "no valid startup delay set in DT: %d\n", ret);
return ret;
}
}However, the ti,twl.yaml binding schema introduces ti,twl4030-regen but fails to add startup-delay-us to the allowed properties, leading to
unevaluatedProperties: false rejecting it during validation.
If board developers provide the property to satisfy the driver, they will fail schema validation, but if they omit it to pass validation, the driver will fail to probe at runtime. Can the schema be updated to allow this, or is there a different expected behavior?
Quoted 2 lines
arch/arm/boot/dts/ti/omap/twl4030.dtsi +2
-0+ status = "disabled"; + };
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
PATCH 4/16 arm: dts: omap3pandora: Populate DT data for the TWL4030's REGEN regulator
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
On the Pandora, REGEN is used to enable TPS61029DRC external regulator which runs a 5V power rail. The 5ms startup delay is taken from Pandora's 3.2 kernel, where it is labeled as a "guess". So it may be possible to activate the regulator faster.
On Pandora CC units, this regulator is used as the input to the LCD power supply. Therefore, problems are likely to arise if the regulator is ever disabled, so we add the regulator-always-on property to compensate.
--- arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +8 -0
@@ -486,6 +486,14 @@ &vsim { regulator-always-on; }; +®en { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + startup-delay-us = <5000>; + regulator-always-on; + status = "okay"; +}; + &i2c2 { clock-frequency = <100000>; /* no clients so we should disable clock */
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 04/16] arm: dts: omap3pandora: Populate DT data for the TWL4030's REGEN regulator
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines
From: Grond <[email protected]>
On the Pandora, REGEN is used to enable TPS61029DRC external regulator which runs a 5V power rail. The 5ms startup delay is taken from Pandora's 3.2 kernel, where it is labeled as a "guess". So it may be possible to activate the regulator faster.
Quoted 6 lines
On Pandora CC units, this regulator is used as the input to the LCD power supply. Therefore, problems are likely to arise if the regulator is ever disabled, so we add the regulator-always-on property to compensate.
Signed-off-by Grond <[email protected]>Signed-off-by H. Nikolaus Schaller <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH 5/16 arm: dts: omap3pandora: Don't use DMA channels for unused SPI masters
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
On the pandora, only McSPI1 (spi0) is actually used. Because the device tree defaults in arch/arm/boot/dts/omap3.dtsi leave all of the mcspi interfaces enabled, the DMA channels which the device tree assigns to them cannot be used for anything else. This is a problem because OMAP3's sDMA controller can only have 32 DMA channels configured at any one time.
So when we try to use (for example) the McBSP subsystem (which is required for sound) it doesn't work because we've already exhausted our available DMA channels.
Fix this by disabling mcspi[2-4] on the pandora device tree.
--- .../boot/dts/ti/omap/omap3-pandora-common.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +17 -0
@@ -693,6 +693,23 @@ lcd_in: endpoint { }; +/* + * Only mcspi1 is used on the pandora, the others do not surface on the board + * due to pinmux configuration. disable the unused ones so that they do not + * consume DMA channels + */ +&mcspi2 { + status = "disabled"; +}; + +&mcspi3 { + status = "disabled"; +}; + +&mcspi4 { + status = "disabled"; +}; + /* n/a - used as GPIOs */ &mcbsp1 { };
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 05/16] arm: dts: omap3pandora: Don't use DMA channels for unused SPI masters
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
From: Grond <[email protected]>
On the pandora, only McSPI1 (spi0) is actually used. Because the device tree defaults in
arch/arm/boot/dts/omap3.dtsileave all of the mcspi interfaces enabled, the DMA channels which the device tree assigns to them cannot be used for anything else. This is a problem because OMAP3's sDMA controller can only have 32 DMA channels configured at any one time.
Quoted 8 lines
So when we try to use (for example) the McBSP subsystem (which is required for sound) it doesn't work because we've already exhausted our available DMA channels.
Fix this by disabling mcspi[2-4] on the pandora device tree.
Signed-off-by Grond <[email protected]>Signed-off-by H. Nikolaus Schaller <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH 6/16 ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
On the Pandora, the APLL is actually what drives all of the audio clocks on the board. Since the TWL4030 is only used for capture, we need some way of setting the correct rate for playback streams, since they will not go through the TWL4030's .hw_params() code path (which is normally how APLL rate is set).
--- include/linux/mfd/twl4030-audio.h | 3 + sound/soc/codecs/twl4030.c | 140 +++++++++++++++++++++--------- 2 files changed, 101 insertions(+), 42 deletions(-)
include/linux/mfd/twl4030-audio.h +3 -0
@@ -244,6 +244,9 @@#define TWL4030_VIBRA_SEL 0x10#define TWL4030_VIBRA_DIR_SEL 0x20 +/* clock ID used for setting APLL rate */ +#define TWL4030_CLOCK_APLL 0xffff +/* TWL4030 codec resource IDs */ enum twl4030_audio_res {TWL4030_AUDIO_RES_POWER =0 ,
sound/soc/codecs/twl4030.c +98 -42
179 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Missing cleanup on write failure in `twl4030_perform_writes()` leaves the codec permanently…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing cleanup on write failure in twl4030_perform_writes() leaves the codec permanently disabled.
- [Medium] twl4030_hw_params() completely ignores the return value of batch register writes, masking hardware configuration failures. --
--- Patch [6]: [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface --- commit db9973d614eb8b37cb4d8a6cf9cada8e9b6d1cf8
Author: Grond <[email protected]>
Subject: ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
This patch allows setting the APLL rate through the .set_sysclk() interface for devices where the APLL drives audio clocks, but playback bypasses the standard .hw_params() path. It extracts the APLL rate calculation into a helper and introduces batch register write functions.
Quoted 15 lines
sound/soc/codecs/twl4030.c +7
-0@@ -198,6 +198,38 @@ static void twl4030_codec_enable(struct snd_soc_component *component, int enableudelay (10 ); } +static int twl4030_perform_writes (struct snd_soc_component *component, +const unsigned int *regs, +const unsigned int *vals, +unsigned int n) +{ +struct twl4030_priv *twl4030 =snd_soc_component_get_drvdata (component); +int reboot_codec = twl4030->codec_powered;
sound/soc/codecs/twl4030.c static void twl4030_codec_enable(struct snd_soc_component *component, int enable · line 217
Quoted 10 lines
sound/soc/codecs/twl4030.c +10
-0+unsigned int i; +int ret; + +if (reboot_codec) +twl4030_codec_enable (component,0 ); + +for (i =0 ; i < n; ++i) { + ret =twl4030_write (component, regs[i], vals[i]); +if (ret) +return ret;
[Severity: High]
If twl4030_write() fails and returns early, will it leave the codec permanently disabled because we skip the twl4030_codec_enable(component, 1) call? This seems to cause a hardware state mismatch where the ALSA core considers the codec powered on, but it remains physically powered off.
Quoted 7 lines
sound/soc/codecs/twl4030.c +7
-0+ } + +if (reboot_codec) +twl4030_codec_enable (component,1 ); + +return 0 ; +}
[ ... ]
Quoted 14 lines
sound/soc/codecs/twl4030.c +0
-10@@ -1775,20 +1824,12 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,return -EINVAL ; } -if (format != old_format || mode != old_mode) { -if (twl4030->codec_powered) { -/* -* If the codec is powered, than we need to toggle the -* codec power. -*/ -twl4030_codec_enable (component,0 ); -twl4030_write (component,TWL4030_REG_CODEC_MODE , mode); -twl4030_write (component,TWL4030_REG_AUDIO_IF , format); -twl4030_codec_enable (component,1 );
sound/soc/codecs/twl4030.c static int twl4030_hw_params(struct snd_pcm_substream *substream, · line 1832
Quoted 10 lines
sound/soc/codecs/twl4030.c +6
-4- }else { -twl4030_write (component,TWL4030_REG_CODEC_MODE , mode); -twl4030_write (component,TWL4030_REG_AUDIO_IF , format); - } +if (format != old_format || s) { + regs[0 ] =TWL4030_REG_CODEC_MODE ; + vals[0 ] = mode; + regs[1 ] =TWL4030_REG_AUDIO_IF ; + vals[1 ] = format; +twl4030_perform_writes (component, regs, vals,ARRAY_SIZE (regs));
[Severity: Medium]
Does this code ignore the return value of twl4030_perform_writes()? If the batch register writes fail, it seems the hardware remains unconfigured but the function will still return 0 (success) and falsely advance the stream state.
Quoted 3 lines
sound/soc/codecs/twl4030.c +0
-0}/* Store the important parameters for the DAI configuration and set
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Andreas Kemnade
maintainerRe: [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
In reply to H. Nikolaus SchallerQuoted 10 lines · On Sat, 11 Jul 2026 08:01:53 +0200 "H. Nikolaus Schaller" <[email protected]>…
From: Grond <[email protected]>
On the Pandora, the APLL is actually what drives all of the audio clocks on the board. Since the TWL4030 is only used for capture, we need some way of setting the correct rate for playback streams, since they will not go through the TWL4030's .hw_params() code path (which is normally how APLL rate is set).
Signed-off-by Grond <[email protected]>Signed-off-by H. Nikolaus Schaller <[email protected]>
As a general comment: might we model this as clock provider (and maybe that enables the usage of a generic audio-graph-card)?
Regards,
Andreas
PATCH 7/16 ASoC: dt-bindings: add TI PCM1773
In reply to H. Nikolaus SchallerPCM1771/3 is a simple audio codec that can be enabled through an enable-gpio.
--- .../devicetree/bindings/sound/pcm1773.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1773.yaml
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +32 -0
@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments pcm1773 audio codec + +maintainers: + - [email protected] + +description: |+ + PCM1771 is a simple audio codec that can be enabled + through a gpio. + +properties: + compatible: + const: ti,pcm1773 + +required: + - compatible + +additionalProperties: false + +examples: + - | + audio-codec { + compatible = "ti,pcm1773"; + enable-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; + }; + +...
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] Incorrect `$id` path with extra `bindings/` directory component. - [Low] Undocumented property…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Incorrect $id path with extra bindings/ directory component.
- [Low] Undocumented property enable-gpios is used in the example but missing from the properties block. --
--- Patch [7]: [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773 --- commit 743fe66d5b39db7483986e7887f8d34c7081d440
Author: H. Nikolaus Schaller <[email protected]>
ASoC: dt-bindings: add TI PCM1773
This commit adds a new device tree binding for the Texas Instruments PCM1771 and PCM1773 simple audio codecs. It documents the compatible string and shows basic usage.
Documentation/devicetree/bindings/sound/pcm1773.yaml line 4
Quoted 9 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +4
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml#
[Severity: Low]
Does this $id path match the exact file path relative to Documentation/devicetree/bindings/? It looks like there is an extra bindings/ directory component here which might cause schema cross-reference resolution to fail or dt_binding_check to skip validation.
[ ... ]
Quoted 4 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +4
-0+properties: + compatible: + const: ti,pcm1773 +
Documentation/devicetree/bindings/sound/pcm1773.yaml line 29
Quoted 10 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +10
-0+required: + - compatible + +additionalProperties: false + +examples: + - | + audio-codec { + compatible = "ti,pcm1773"; + enable-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
[Severity: Low]
Will this example fail dt_binding_check validation? The schema uses
additionalProperties: false, but enable-gpios is omitted from the properties block above, which will cause the strict schema validation to reject this example and any actual device tree nodes using the property.
Quoted 3 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +3
-0+ }; + +...
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Rob Herring (Arm)
maintainerRe: [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773
In reply to H. Nikolaus SchallerQuoted 9 lines · H. Nikolaus Schaller
PCM1771/3 is a simple audio codec that can be enabled through an enable-gpio.
Signed-off-by H. Nikolaus Schaller <[email protected]>--- .../devicetree/bindings/sound/pcm1773.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1773.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
doc reference errors (make refcheckdocs):
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773
In reply to H. Nikolaus SchallerQuoted 15 lines · H. Nikolaus Schaller
PCM1771/3 is a simple audio codec that can be enabled through an enable-gpio.
Signed-off-by H. Nikolaus Schaller <[email protected]>--- .../devicetree/bindings/sound/pcm1773.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1773.yamlDocumentation/devicetree/bindings/sound/pcm1773.yaml new file +0
-0
Documentation/devicetree/bindings/sound/pcm1773.yaml line 4
Quoted 4 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +4
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml#
You need to use latest existing bindings as starting point and test your code.
Best regards,
Krzysztof
Re: [Letux-kernel] [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773
Quoted 14 lines
Am 13.07.2026 um 09:38 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 9 lines · H. Nikolaus Schaller
PCM1771/3 is a simple audio codec that can be enabled through an enable-gpio.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
.../devicetree/bindings/sound/pcm1773.yaml| 32 +++++++++++++++++++1 file changed, 32 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/pcm1773.yaml
Quoted 13 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml line 4
Quoted 10 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +4
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml#You need to use latest existing bindings as starting point and test your code.
The bindings were forgotten since they do not influence code for testing and running code doing what is expected is the ultimate test.
Anyways, sorry.
BTW: the sashiko bot also reported a lot of things and a v2 is being worked on.
BR,
Nikolaus
Re: [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773
In reply to Krzysztof KozlowskiHi Krzysztof,
Thank you for the feedback.
Quoted 12 lines
Am 13.07.2026 um 09:38 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 9 lines · H. Nikolaus Schaller
PCM1771/3 is a simple audio codec that can be enabled through an enable-gpio.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
.../devicetree/bindings/sound/pcm1773.yaml| 32 +++++++++++++++++++1 file changed, 32 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/pcm1773.yaml
Quoted 13 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml line 4
Quoted 10 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +4
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml#You need to use latest existing bindings as starting point and test your code.
Resulting code from compiler was runtime tested.
Actually, we used the latest bindings of some other audio dac as a starting point. However, we introduced errors into the finally submitted file.
We will verify and test the schema next time.
Regarding the checks: both the rob herring bot and the sashiko bot also reported several issues directly to us, so we are already aware of some other remaining errors.
We are currently working on a v2 to clean everything up.
Thanks and BR,
Nikolaus
PATCH 8/16 ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
This chip is used in the OpenPandora.
--- sound/soc/codecs/Kconfig | 5 ++ sound/soc/codecs/pcm1773.c | 149 +++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 sound/soc/codecs/pcm1773.c
sound/soc/codecs/Kconfig +5 -0
@@ -182,6 +182,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_HDMI_CODEC imply SND_SOC_PCM1681 imply SND_SOC_PCM1754 + imply SND_SOC_PCM1773 imply SND_SOC_PCM1789_I2C imply SND_SOC_PCM179X_I2C imply SND_SOC_PCM179X_SPI
@@ -1541,6 +1542,10 @@ config SND_SOC_PCM1754 tristate "Texas Instruments PCM1754 CODEC" depends on GPIOLIB +config SND_SOC_PCM1773 + tristate "Texas Instruments PCM1773 CODEC" + select GPIOLIB + config SND_SOC_PCM1789 tristate
sound/soc/codecs/pcm1773.c new file +149 -0
149 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 08/16] ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] Device-managed allocations (devm_*) are incorrectly placed in the ASoC component probe, causing…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Device-managed allocations (devm_*) are incorrectly placed in the ASoC component probe, causing memory leaks and -EBUSY errors on card unbind/rebind.
- [High] The driver silently ignores errors from devm_regulator_get(), breaking deferred probing.
- [High] The codec driver defines a DAC widget but lacks physical output endpoints (SND_SOC_DAPM_OUTPUT).
- [Medium] The driver uses mdelay() inside a sleepable DAPM event handler, needlessly wasting CPU cycles.
- [Low] SND_SOC_PCM1773 uses select GPIOLIB instead of depends on GPIOLIB, violating cross-config consistency.
--
--- Patch [8]: [PATCH 08/16] ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI --- commit 834434a73863a6e3a112c74fe0cc88b2cf342a3d
Author: Grond <[email protected]>
ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI
This commit adds a new ASoC codec driver for the Texas Instruments PCM1773 chip, which is used in the OpenPandora.
Quoted 4 lines
sound/soc/codecs/Kconfig +0
-0
[ ... ]
sound/soc/codecs/Kconfig config SND_SOC_PCM1754 · line 1547
Quoted 7 lines
sound/soc/codecs/Kconfig +3
-0@@ -1541,6 +1542,10 @@ config SND_SOC_PCM1754 tristate "Texas Instruments PCM1754 CODEC" depends on GPIOLIB +config SND_SOC_PCM1773 + tristate "Texas Instruments PCM1773 CODEC" + select GPIOLIB
[Severity: Low]
Does this config violate cross-config consistency?
The adjacent SND_SOC_PCM1754 config uses depends on GPIOLIB, while this one uses select GPIOLIB.
Quoted 5 lines
sound/soc/codecs/pcm1773.c new file +0
-0
[ ... ]
Quoted 3 lines
sound/soc/codecs/pcm1773.c new file +3
-0+static int pcm1773_dac_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) +{
[ ... ]
sound/soc/codecs/pcm1773.c line 41
Quoted 8 lines
sound/soc/codecs/pcm1773.c new file +8
-0+if (SND_SOC_DAPM_EVENT_ON (event)) { +if (ctx->regulator) { + ret =regulator_enable (ctx->regulator); +if (ret) { +dev_err (dev,"Failed to power DAC: %d\n" , ret); +return ret; + } +mdelay (1 );
[Severity: Medium]
Since this DAPM event handler is called in process context where sleeping is allowed (as seen by the use of gpiod_set_value_cansleep below), should this use a sleeping delay instead of a busy-wait loop to avoid wasting CPU cycles?
sound/soc/codecs/pcm1773.c line 51
Quoted 10 lines
sound/soc/codecs/pcm1773.c new file +10
-0+ } + +if (ctx->enable_gpio) +gpiod_set_value_cansleep (ctx->enable_gpio,1 ); + }else { +if (ctx->enable_gpio) +gpiod_set_value_cansleep (ctx->enable_gpio,0 ); + +if (ctx->regulator) { +mdelay (1 );
[Severity: Medium]
Could this also be a sleeping delay instead of wasting CPU cycles?
sound/soc/codecs/pcm1773.c line 63
Quoted 12 lines
sound/soc/codecs/pcm1773.c new file +12
-0+regulator_disable (ctx->regulator); + } + } + +return 0 ; +} + +static const struct snd_soc_dapm_widget pcm1773_dapm_widgets[] = { +SND_SOC_DAPM_DAC_E ("PCM1773 DAC" ,"HiFi Playback" ,SND_SOC_NOPM , +0 ,0 , pcm1773_dac_event, +SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ), +};
[Severity: High]
Are physical output endpoints missing here?
The DAPM widgets define the DAC, but there are no corresponding physical sink endpoints (like SND_SOC_DAPM_OUTPUT) provided to terminate the playback path. Without a path to a sink endpoint, the DAPM graph remains incomplete and the DAC will not be powered on during playback.
[ ... ]
sound/soc/codecs/pcm1773.c line 90
Quoted 7 lines
sound/soc/codecs/pcm1773.c new file +7
-0+static int pcm1773_probe (struct snd_soc_component *component) +{ +struct pcm1773 *ctx =NULL ; +struct device *dev = component->dev; +int ret; + + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL );
[Severity: High]
Will placing device-managed allocations inside the ASoC component probe cause memory leaks and failures on rebind?
When a sound card unbinds and rebinds (such as during deferred probing of a machine driver), pcm1773_probe() is called multiple times. Because these allocations are tied to the underlying platform device dev rather than the component lifetime, the memory won't be freed until the platform device itself is removed.
sound/soc/codecs/pcm1773.c line 95
Quoted 5 lines
sound/soc/codecs/pcm1773.c new file +5
-0+if (!ctx) +return -ENOMEM ; +snd_soc_component_set_drvdata (component, ctx); + + ctx->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW );
[Severity: High]
Does requesting the GPIO here also fail on card rebind?
Since devm_gpiod_get_optional is tied to the platform device, an unbind and rebind of the sound card will attempt to request the same GPIO again before the platform device is removed, resulting in a permanent -EBUSY error.
Quoted 4 lines
sound/soc/codecs/pcm1773.c new file +4
-0+if (IS_ERR (ctx->enable_gpio)) { +return dev_err_probe (dev,PTR_ERR (ctx->enable_gpio), +"invalid GPIO specification for enable" ); + }
sound/soc/codecs/pcm1773.c line 109
Quoted 10 lines
sound/soc/codecs/pcm1773.c new file +10
-0+if (ctx->enable_gpio) +dev_dbg (dev,"got enable-gpio\n" ); +else +dev_warn (dev,"enable-gpio not specified\n" ); + + ctx->regulator =devm_regulator_get (dev,"vcc" ); +if (IS_ERR (ctx->regulator)) { +dev_warn (dev,"cannot get regulator 'vcc'" ); + ctx->regulator =NULL ; + }
[Severity: High]
Does this silently break deferred probing?
If devm_regulator_get returns -EPROBE_DEFER (because the regulator driver probes after this codec), the error is swallowed, ctx->regulator is set to NULL, and the function returns 0. The driver will successfully probe without its regulator, resulting in silent audio failures since the DAC won't be powered.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
Mark Brown
maintainerRe: [PATCH 08/16] ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI
In reply to H. Nikolaus Schallersound/soc/codecs/pcm1773.c line 6
Quoted 12 lines · H. Nikolaus Schaller
From: Grond <[email protected]>
This chip is used in the OpenPandora.
+++
b/sound/soc/codecs/pcm1773.csound/soc/codecs/pcm1773.c new file +6
-0@@ -0,0 +1,149 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* pcm1773.c -- codec for the simple PCM1773 output codec from TI +* +* Shamelessly cobbled together from sound/soc/ti/omap3pandora.c and a few +* other codec drivers in sound/soc/codecs/
Please make the entire comment a C++ one so things look more intentional.
sound/soc/codecs/pcm1773.c line 81
Quoted 10 lines
sound/soc/codecs/pcm1773.c new file +10
-0+ .playback = { + .stream_name = "PCM1773 IN", + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_48000, +// [TODO] these really should be BE, per the data sheet but for +// some reason the omap-mcbsp driver claims only to support LE. +// investigate + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, + },
The format described here is the in memory format, not the wire format.
sound/soc/codecs/pcm1773.c line 109
Quoted 5 lines
sound/soc/codecs/pcm1773.c new file +5
-0+ ctx->regulator =devm_regulator_get (dev,"vcc" ); +if (IS_ERR (ctx->regulator)) { +dev_warn (dev,"cannot get regulator 'vcc'" ); + ctx->regulator =NULL ; + }
This is obviously broken. The driver should handle the error as a normal error, not just ignore it.
PATCH 9/16 ASoC: dt-bindings: add OpenPandora Sound Card
In reply to H. Nikolaus SchallerThe OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
--- .../sound/openpandora,omap3pandora-sound.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +94 -0
@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.org + +title: OpenPandora OMAP3 Audio Complex + +maintainers: + - H. Nikolaus Schaller <[email protected]> + +description: + The OpenPandora audio subsystem describes the routing links between the + OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, + alongside amplifiers and power supplies. + +properties: + compatible: + const: openpandora,omap3pandora-sound + + status: true + + label: + $ref: /schemas/types.yaml#/definitions/string + description: User-visible name for this sound card. + + amp-gpios: + maxItems: 1 + description: GPIO pin controlling the amplifier power state. + + amp-supply: + description: Regulator supplying power to the amplifier. + + sound-dai: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 2 + maxItems: 2 + description: + Phandles to the audio CPU DAI (OMAP3 McBSP) and the codec DAI. + + routing: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. + + widgets: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + User-specified audio sound widgets. + Each entry is a pair of strings, the first being the widget type + (e.g., "Speaker", "Headphone", "Microphone", "Line") and the second being its name. + +required: + - compatible + - sound-dai + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + sound: sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <®en>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "PCM1773 DAC", "APLL Enable", + "Headphone Amplifier", "PCM1773 DAC", + "Line Out", "PCM1773 DAC", + "Headphone Jack", "Headphone Amplifier", + "AUXL", "Line In", + "AUXR", "Line In", + "MAINMIC", "Mic (internal)", + "Mic (internal)", "Mic Bias 1", + "SUBMIC", "Mic (external)", + "Mic (external)", "Mic Bias 2"; + + sound-dai = <&mcbsp2>, <&dac>; + };
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The `$id` and `$schema` fields in the YAML schema contain invalid URIs, breaking schema…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The $id and $schema fields in the YAML schema contain invalid URIs, breaking schema validation.
- [Low] The status property is explicitly and unnecessarily defined in the binding schema. --
--- Patch [9]: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card --- commit 94d05b63d0a0b038d3a5355e6b58cc3b78b60eeb
Author: H. Nikolaus Schaller <[email protected]>
ASoC: dt-bindings: add OpenPandora Sound Card
The OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 5
Quoted 11 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +5
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.org
[Severity: Medium]
Is the $id field missing the full path? As per the device tree binding guidelines, an incorrect $id field breaks the schema cross-reference system and causes dt_binding_check to silently skip validation. It typically needs to begin with http://devicetree.org/schemas/ and exactly match the file path.
Additionally, shouldn't $schema be set to the standard meta-schema
(http://devicetree.org/meta-schemas/core.yaml#) instead of the base URL?
Quoted 6 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +6
-0+ +title: OpenPandora OMAP3 Audio Complex + +maintainers: + - H. Nikolaus Schaller <[email protected]> +
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 21
Quoted 10 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +10
-0+description: + The OpenPandora audio subsystem describes the routing links between the + OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, + alongside amplifiers and power supplies. + +properties: + compatible: + const: openpandora,omap3pandora-sound + + status: true
[Severity: Low]
This isn't a bug, but is it necessary to explicitly define the status property here? Since status is a core standard device tree property, it is implicitly handled by the core dt-schema. Redefining it here without constraints is redundant.
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
Rob Herring (Arm)
maintainerRe: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
In reply to H. Nikolaus SchallerQuoted 10 lines · H. Nikolaus Schaller
The OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
Signed-off-by H. Nikolaus Schaller <[email protected]>--- .../sound/openpandora,omap3pandora-sound.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:./Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml:10:2: [warning] wrong indentation: expected 2 but found 1 (indentation) ./Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml:13:2: [warning] wrong indentation: expected 2 but found 1 (indentation) ./Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml:18:2: [warning] wrong indentation: expected 2 but found 1 (indentation) ./Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml:56:2: [warning] wrong indentation: expected 2 but found 1 (indentation) ./Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml:62:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
dtschema/dtc warnings/errors:
Traceback (most recent call last):
File "/usr/local/bin/dt-doc-validate", line 8, in <module>
sys.exit(main())
~~~~^^
File "/usr/local/lib/python3.13/dist-packages/dtschema/doc_validate.py", line 66, in main
ret |= check_doc(f)
~~~~~~~~~^^^
File "/usr/local/lib/python3.13/dist-packages/dtschema/doc_validate.py", line 29, in check_doc
for error in sorted(dtsch.iter_errors(), key=lambda e: e.linecol):
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/dist-packages/dtschema/schema.py", line 167, in iter_errors
self.validator = self.DtValidator(registry.contents(meta_schema_id), registry=registry)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/dist-packages/referencing/_core.py", line 488, in contents
return self[uri].contents
~~~~^^^^^ File "/usr/local/lib/python3.13/dist-packages/referencing/_core.py", line 338, in __getitem__
raise exceptions.NoSuchResource(ref=uri) from None
referencing.exceptions.NoSuchResource: 'http://devicetree.org'
Lexical error: Documentation/devicetree/bindings/sound/pcm1773.example.dts:20.37-52 Unexpected 'GPIO_ACTIVE_LOW' FATAL ERROR: Syntax error parsing input tree
make[2]: *** [scripts/Makefile.dtbs:140: Documentation/devicetree/bindings/sound/pcm1773.example.dtb] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1705: dt_binding_check] Error 2
make: *** [Makefile:248: __sub-make] Error 2
doc reference errors (make refcheckdocs):
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
In reply to H. Nikolaus SchallerQuoted 16 lines · H. Nikolaus Schaller
The OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
Signed-off-by H. Nikolaus Schaller <[email protected]>--- .../sound/openpandora,omap3pandora-sound.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yamlDocumentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +0
-0
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 5
Quoted 5 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +5
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.org
This wasn't ever tested. Why?
Best regards,
Krzysztof
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Hi Krzysztof,
Thank you for the feedback.
Quoted 13 lines
Am 13.07.2026 um 09:37 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 10 lines · H. Nikolaus Schaller
The OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
.../sound/openpandora,omap3pandora-sound.yaml| 94 +++++++++++++++++++1 file changed, 94 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml
Quoted 13 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 5
Quoted 11 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +5
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.orgThis wasn't ever tested. Why?
It does not emit any C compiler issues or runtime problems so it remained unnoticed.
It was notified by the sahiko-bot and will be fixed in v2.
Thanks and BR,
Nikolaus
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Quoted 31 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
Quoted 13 lines
Am 13.07.2026 um 09:37 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 10 lines · H. Nikolaus Schaller
The OpenPandora audio subsystem describes the routing links between the OMAP3 McBSP interface, the external PCM1773 DAC, and the TWL4030 audio codec, alongside amplifiers and power supplies.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
.../sound/openpandora,omap3pandora-sound.yaml| 94 +++++++++++++++++++1 file changed, 94 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yamlQuoted 13 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 5
Quoted 11 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +5
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.orgThis wasn't ever tested. Why?
Quoted 1 line
It does not emit any C compiler issues or runtime problems so it remained unnoticed.
I do not believe.
There is a clear warning from Rob's bot.
You just did not follow the process of building the code (compiler has nothing to do here). Read submitting patches in DT dir and then writing schema for further instructions. This is ABSOLUTE MINIMUM. We are not your build test service.
Quoted 2 lines
It was notified by the sahiko-bot and will be fixed in v2.
Sashiko has nothing to do with that.
You DID NOT BUILD the code.
Best regards,
Krzysztof
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Quoted 22 lines
Am 13.07.2026 um 11:21 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 6 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
It does not emit any C compiler issues or runtime problems so it remained unnoticed.
I do not believe.
There is a clear warning from Rob's bot.
You just did not follow the process of building the code (compiler has nothing to do here). Read submitting patches in DT dir and then writing schema for further instructions. This is ABSOLUTE MINIMUM. We are not your build test service.
Quoted 1 line
Quoted 5 lines
Quoted 1 line
It was notified by the sahiko-bot and will be fixed in v2.
Sashiko has nothing to do with that.
You DID NOT BUILD the code.
Hm. You are confusing me. I did "make" and did not get any errors... And the resulting code works as intended.
Best regards and thanks,
Nikolaus
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Quoted 22 lines · H. Nikolaus Schaller
Quoted 22 lines
Am 13.07.2026 um 11:21 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 6 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
It does not emit any C compiler issues or runtime problems so it remained unnoticed.
I do not believe.
There is a clear warning from Rob's bot.
You just did not follow the process of building the code (compiler has nothing to do here). Read submitting patches in DT dir and then writing schema for further instructions. This is ABSOLUTE MINIMUM. We are not your build test service.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
It was notified by the sahiko-bot and will be fixed in v2.
Sashiko has nothing to do with that.
You DID NOT BUILD the code.
Hm. You are confusing me. I did "make" and did not get any errors... And the resulting code works as intended.
'make' alone does not build that, just like other pieces of code they have own - well documented and always expected - build processes.
I don't know what is confusing in my message, since I pointed you to SPECIFIC guide telling you EXACTLY what to do (and which you did not do).
Best regards,
Krzysztof
Re: [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card
Quoted 33 lines
Am 13.07.2026 um 11:42 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 28 lines · H. Nikolaus Schaller
Quoted 27 lines
Am 13.07.2026 um 11:21 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 6 lines · H. Nikolaus Schaller
Hi Krzysztof,
Thank you for the feedback.
It does not emit any C compiler issues or runtime problems so it remained unnoticed.
I do not believe.
There is a clear warning from Rob's bot.
You just did not follow the process of building the code (compiler has nothing to do here). Read submitting patches in DT dir and then writing schema for further instructions. This is ABSOLUTE MINIMUM. We are not your build test service.
Quoted 2 lines
It was notified by the sahiko-bot and will be fixed in v2.
Sashiko has nothing to do with that.
You DID NOT BUILD the code.
Quoted 8 lines
Quoted 2 lines
Hm. You are confusing me. I did "make" and did not get any errors... And the resulting code works as intended.
'make' alone does not build that, just like other pieces of code they have own - well documented and always expected - build processes.
I don't know what is confusing in my message, since I pointed you to SPECIFIC guide telling you EXACTLY what to do (and which you did not do).
Confusing was the phrase "building the code". For my understanding "building the code" is the process of building ("translating the code") to get vmlinux or similar and a DTB and kernel modules.
As far as I understand the bindings they are used to check the DTS source files against. So here is no translation of bindings into a real DTB that finaly runs on a device. So I had assumed that schemas are "validated" (not "built") by dt_binding_check.
This made me confused.
Back to topic:
It finally turned out that our script to run the required checks automatically was no longer operational and silently ignored the validations. Therefore nobody noticed before the bots did. Good to have a second and independent check.
So sorry for the confusion we have introduced...
v2 will be checked as it previously was.
BR and thanks,
Nikolaus
PATCH 10/16 ASoC: omap3pandora: Rewrite sound card driver as a platform driver with DT
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
This change takes advantage of numerous prior changes and moves a significant amount of code into the new PCM1773 codec driver (and removes a hardcoded GPIO and regulator in the process). By using this new driver we can remove the prior fiction that playback audio goes through the TWL4030.
Previously, the sound card driver worked by checking (through various means) if it was running on the Pandora, and if so, it would create a new platform device from nothing to function as the sound card, and rely on some weirdness to get registered as an ASoC card driver. This has not been the way to do ASoC card drivers for a while now, so instead we register a platform driver which matches a device in the Pandora's DT and registers the appropriate ASoC card driver when found. This also means that the driver will only load when the DT says that we need it, and we can stop manually loading this thing.
Other significant changes:
- as a side-effect this patch retires the last call to machine_is_omap3_pandora()
- conversion to devm
- separate capture and playback ops
- conversion to dev_err
- use new code for twl4030 to set apll clock
- move widgets and routing to device tree definitions
--- sound/soc/ti/omap3pandora.c | 454 +++++++++++++++++++++++++----------- 1 file changed, 320 insertions(+), 134 deletions(-)
sound/soc/ti/omap3pandora.c +320 -134
@@ -6,138 +6,279 @@*/ #include <linux/clk.h> -#include <linux/platform_device.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> -#include <linux/regulator/consumer.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> +#include <asm/mach-types.h> +#include <linux/mfd/twl4030-audio.h> #include <linux/platform_data/asoc-ti-mcbsp.h> #include "omap-mcbsp.h" -#define PREFIX "ASoC omap3pandora: " +struct omap3pandora_sound { +struct gpio_desc *amp_gpio; +struct regulator *amp_regulator; + +struct snd_pcm_substream *playback_stream; +struct snd_pcm_substream *capture_stream; -static struct regulator *omap3pandora_dac_reg; -static struct gpio_desc *dac_power_gpio; -static struct gpio_desc *amp_power_gpio; +struct mutex sample_rate_lock;// protects all fields after +unsigned int sample_rate; +int sample_rate_users; +}; -static int omap3pandora_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) +static struct snd_soc_dai_link omap3pandora_dai[]; + +static int omap3pandora_common_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct snd_soc_dai *codec_dai =snd_soc_rtd_to_codec (rtd,0 );struct snd_soc_dai *cpu_dai =snd_soc_rtd_to_cpu (rtd,0 ); +struct device *dev = rtd->dev;int ret; -/* Set the codec system clock for DAC and ADC */ - ret =snd_soc_dai_set_sysclk (codec_dai,0 ,26000000 , -SND_SOC_CLOCK_IN ); -if (ret <0 ) { -pr_err (PREFIX "can't set codec system clock\n" ); -return ret; - } -/* Set McBSP clock to external */ ret =snd_soc_dai_set_sysclk (cpu_dai,OMAP_MCBSP_SYSCLK_CLKS_EXT ,256 *params_rate (params),SND_SOC_CLOCK_IN );if (ret <0 ) { -pr_err (PREFIX "can't set cpu system clock\n" ); +dev_err (dev,"cannot set McBSP clock to external: %d\n" , ret);return ret; } ret =snd_soc_dai_set_clkdiv (cpu_dai,OMAP_MCBSP_CLKGDV ,8 );if (ret <0 ) { -pr_err (PREFIX "can't set SRG clock divider\n" ); +dev_err (dev,"cannot set McBSP clock divider: %d\n" , ret);return ret; }return 0 ; } -static int omap3pandora_dac_event (struct snd_soc_dapm_widget *w, -struct snd_kcontrol *k,int event) +static inline int constrain_sample_rate (struct snd_pcm_substream *substream, +unsigned int sample_rate) { +return snd_pcm_hw_constraint_single (substream->runtime, +SNDRV_PCM_HW_PARAM_RATE , + sample_rate); +} + +static inline void relax_sample_rate (struct snd_pcm_substream *substream) +{ +const struct snd_interval default_sample_rate_range = { + .min = substream->runtime->hw.rate_min, + .max = substream->runtime->hw.rate_max, + .openmin =1 , + .openmax =1 , + }; + + *constrs_interval (&substream->runtime->hw_constraints, +SNDRV_PCM_HW_PARAM_RATE ) = + default_sample_rate_range; +} + +static void release_sample_rate (struct omap3pandora_sound *ctx, +struct snd_pcm_substream *substream) +{ +mutex_lock (&ctx->sample_rate_lock); + +if (ctx->sample_rate_users >0 ) + --ctx->sample_rate_users; +if (ctx->sample_rate_users ==0 ) + ctx->sample_rate =0 ; + +relax_sample_rate (substream); + +mutex_unlock (&ctx->sample_rate_lock); +} + +static int grab_sample_rate (struct omap3pandora_sound *ctx, +struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct device *dev = rtd->dev; +int ret; + + ret =mutex_lock_interruptible (&ctx->sample_rate_lock); +if (ret) +return ret; + +if (++ctx->sample_rate_users ==1 ) + ctx->sample_rate =params_rate (params); + +mutex_unlock (&ctx->sample_rate_lock); + + ret =constrain_sample_rate (substream, ctx->sample_rate); +if (ret <0 ) + goto err; + + ret =constrain_sample_rate (substream,params_rate (params)); +if (ret <0 ) { +dev_dbg (dev,"sample rate mismatch; playback/capture share same clock" ); + goto err; + } + +return 0 ; + +err: +release_sample_rate (ctx, substream); + +return ret; +} + +static int omap3pandora_playback_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct snd_soc_card *card = rtd->card; +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); +struct device *dev = rtd->dev; +struct snd_soc_pcm_runtime *tmp_rtd; +struct snd_soc_pcm_runtime *twl4030_rtd =NULL ;int ret;/* -* The PCM1773 DAC datasheet requires 1ms delay between switching -* VCC power on/off and /PD pin high/low +* We need to set the APLL clock rate on the TWL4030 because it feeds +* both the DAI of the PCM1773. So find the appropriate RTD and call +* the TWL's .set_sysclk callback through there. Ugly, but it must be +* done. */ -if (SND_SOC_DAPM_EVENT_ON (event)) { -struct device *dev =snd_soc_dapm_to_dev (w->dapm); - ret =regulator_enable (omap3pandora_dac_reg); -if (ret) { -dev_err (dev,"Failed to power DAC: %d\n" , ret); -return ret; +for_each_card_rtds (card, tmp_rtd) +if (tmp_rtd->dai_link == &omap3pandora_dai[1 ]) { + twl4030_rtd = tmp_rtd; +break ; } -mdelay (1 ); -gpiod_set_value (dac_power_gpio,1 ); - }else { -gpiod_set_value (dac_power_gpio,0 ); -mdelay (1 ); -regulator_disable (omap3pandora_dac_reg); +if (!twl4030_rtd) { +dev_err (dev,"cannot find TWL4030 runtime data to set APLL rate\n" ); +return -EINVAL ; } -return 0 ; + ret =snd_soc_dai_set_sysclk (snd_soc_rtd_to_codec (twl4030_rtd,0 ), +TWL4030_CLOCK_APLL ,params_rate (params), +SND_SOC_CLOCK_OUT ); +if (ret) { +dev_err (dev,"cannot set TWL4030 APLL rate via set_sysclk interface: %d\n" , + ret); +return ret; + } + +if (!ctx->playback_stream) { + ctx->playback_stream = substream; + ret =grab_sample_rate (ctx, substream, params); +if (ret) +return ret; + } + +return omap3pandora_common_hw_params (substream, params); } -static int omap3pandora_hp_event (struct snd_soc_dapm_widget *w, -struct snd_kcontrol *k,int event) +static int omap3pandora_capture_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct snd_soc_dai *codec_dai =snd_soc_rtd_to_codec (rtd,0 ); +struct device *dev = rtd->dev; +struct snd_soc_card *card = rtd->card; +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); +int ret; + +/* Set the codec system clock for DAC and ADC */ + ret =snd_soc_dai_set_sysclk (codec_dai,0 ,26000000 , +SND_SOC_CLOCK_IN ); +if (ret <0 ) { +dev_err (dev,"cannot set TWL4030 system clock: %d\n" , ret); +return ret; + } + +if (!ctx->capture_stream) { + ctx->capture_stream = substream; + ret =grab_sample_rate (ctx, substream, params); +if (ret) +return ret; + } + +return omap3pandora_common_hw_params (substream, params); +} + +static int omap3pandora_playback_hw_free (struct snd_pcm_substream *substream) { -if (SND_SOC_DAPM_EVENT_ON (event)) -gpiod_set_value (amp_power_gpio,1 ); -else -gpiod_set_value (amp_power_gpio,0 ); +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct snd_soc_card *card = rtd->card; +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); + +if (ctx->playback_stream) +release_sample_rate (ctx, substream); + ctx->playback_stream =NULL ;return 0 ; } -/* -* Audio paths on Pandora board: -* -* |O| ---> PCM DAC +-> AMP -> Headphone Jack -* |M| A +--------> Line Out -* |A| <~~clk~~+ -* |P| <--- TWL4030 <--------- Line In and MICs -*/ -static const struct snd_soc_dapm_widget omap3pandora_dapm_widgets[] = { -SND_SOC_DAPM_DAC_E ("PCM DAC" ,"HiFi Playback" ,SND_SOC_NOPM , -0 ,0 , omap3pandora_dac_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ), -SND_SOC_DAPM_PGA_E ("Headphone Amplifier" ,SND_SOC_NOPM , -0 ,0 ,NULL ,0 , omap3pandora_hp_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ), -SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ), -SND_SOC_DAPM_LINE ("Line Out" ,NULL ), +static int omap3pandora_common_startup (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct snd_soc_card *card = rtd->card; +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); +unsigned int sample_rate = ctx->sample_rate; -SND_SOC_DAPM_MIC ("Mic (internal)" ,NULL ), -SND_SOC_DAPM_MIC ("Mic (external)" ,NULL ), -SND_SOC_DAPM_LINE ("Line In" ,NULL ), -}; +if (!sample_rate) +return 0 ; -static const struct snd_soc_dapm_route omap3pandora_map[] = { - {"PCM DAC" ,NULL ,"APLL Enable" }, - {"Headphone Amplifier" ,NULL ,"PCM DAC" }, - {"Line Out" ,NULL ,"PCM DAC" }, - {"Headphone Jack" ,NULL ,"Headphone Amplifier" }, +return constrain_sample_rate (substream, sample_rate); +} - {"AUXL" ,NULL ,"Line In" }, - {"AUXR" ,NULL ,"Line In" }, +static int omap3pandora_capture_hw_free (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct snd_soc_card *card = rtd->card; +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); - {"MAINMIC" ,NULL ,"Mic (internal)" }, - {"Mic (internal)" ,NULL ,"Mic Bias 1" }, +if (ctx->capture_stream) +release_sample_rate (ctx, substream); + ctx->capture_stream =NULL ; - {"SUBMIC" ,NULL ,"Mic (external)" }, - {"Mic (external)" ,NULL ,"Mic Bias 2" }, -}; +return 0 ; +} + +static int omap3pandora_hp_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) +{ +struct snd_soc_card *card =snd_soc_dapm_to_card (w->dapm); +struct device *dev = card->dev; +struct omap3pandora_sound *ctx = +snd_soc_card_get_drvdata (card); +int ret; + +if (SND_SOC_DAPM_EVENT_ON (event)) { + ret =regulator_enable (ctx->amp_regulator); +if (ret) { +dev_err (dev,"error enabling amplifier regulator: %d\n" , ret); +return ret; + } + +gpiod_set_value (ctx->amp_gpio,1 ); + }else { +gpiod_set_value (ctx->amp_gpio,0 ); + + ret =regulator_disable (ctx->amp_regulator); +if (ret) { +dev_err (dev,"error disabling amplifier regulator: %d\n" , ret); +return ret; + } + } + +return 0 ; +}static int omap3pandora_out_init (struct snd_soc_pcm_runtime *rtd) {
@@ -171,20 +312,40 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)return 0 ; } -static const struct snd_soc_ops omap3pandora_ops = { - .hw_params = omap3pandora_hw_params, +static const struct snd_soc_ops omap3pandora_playback_ops = { + .startup = omap3pandora_common_startup, + .hw_params = omap3pandora_playback_hw_params, + .hw_free = omap3pandora_playback_hw_free, +}; + +static const struct snd_soc_ops omap3pandora_capture_ops = { + .startup = omap3pandora_common_startup, + .hw_params = omap3pandora_capture_hw_params, + .hw_free = omap3pandora_capture_hw_free, };/* Digital audio interface glue - connects codec <--> CPU */ +#if IS_BUILTIN (CONFIG_SND_SOC_OMAP3_PANDORA )SND_SOC_DAILINK_DEFS (out,DAILINK_COMP_ARRAY (COMP_CPU ("omap-mcbsp.2" )), -DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("pcm1773-codec" ,"pcm1773-hifi" )),DAILINK_COMP_ARRAY (COMP_PLATFORM ("omap-mcbsp.2" )));SND_SOC_DAILINK_DEFS (in,DAILINK_COMP_ARRAY (COMP_CPU ("omap-mcbsp.4" )),DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )),DAILINK_COMP_ARRAY (COMP_PLATFORM ("omap-mcbsp.4" ))); +#else /* IS_BUILTIN(CONFIG_SND_SOC_OMAP3_PANDORA) */ +SND_SOC_DAILINK_DEFS (out, +DAILINK_COMP_ARRAY (COMP_CPU ("49022000.mcbsp" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("pcm1773-codec" ,"pcm1773-hifi" )), +DAILINK_COMP_ARRAY (COMP_PLATFORM ("49022000.mcbsp" ))); + +SND_SOC_DAILINK_DEFS (in, +DAILINK_COMP_ARRAY (COMP_CPU ("49026000.mcbsp" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )), +DAILINK_COMP_ARRAY (COMP_PLATFORM ("49026000.mcbsp" ))); +#endif /* IS_BUILTIN(CONFIG_SND_SOC_OMAP3_PANDORA) */ static struct snd_soc_dai_link omap3pandora_dai[] = { {
@@ -192,100 +353,125 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { .stream_name = "HiFi Out", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC, - .ops = &omap3pandora_ops, + .ops = &omap3pandora_playback_ops, .init = omap3pandora_out_init, + .playback_only = 1, SND_SOC_DAILINK_REG(out), }, { .name = "TWL4030", .stream_name = "Line/Mic In", .dai_fmt =SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC, - .ops = &omap3pandora_ops, + .ops = &omap3pandora_capture_ops, .init = omap3pandora_in_init, + .capture_only =1 , SND_SOC_DAILINK_REG(in), } }; +static const struct snd_soc_dapm_widget omap3pandora_local_widgets[] = { +SND_SOC_DAPM_PGA_E ("Headphone Amplifier" ,SND_SOC_NOPM , +0 ,0 ,NULL ,0 , omap3pandora_hp_event, +SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ), +}; +/* SoC card */ static struct snd_soc_card snd_soc_card_omap3pandora = { - .name ="omap3pandora" , - .owner =THIS_MODULE , - .dai_link = omap3pandora_dai, - .num_links =ARRAY_SIZE (omap3pandora_dai), - - .dapm_widgets = omap3pandora_dapm_widgets, - .num_dapm_widgets =ARRAY_SIZE (omap3pandora_dapm_widgets), - .dapm_routes = omap3pandora_map, - .num_dapm_routes =ARRAY_SIZE (omap3pandora_map), + .name ="omap3pandora" , + .owner =THIS_MODULE , + .dai_link = omap3pandora_dai, + .num_links =ARRAY_SIZE (omap3pandora_dai), + .dapm_widgets = omap3pandora_local_widgets, + .num_dapm_widgets =ARRAY_SIZE (omap3pandora_local_widgets), }; -static struct platform_device *omap3pandora_snd_device; - -static int __init omap3pandora_soc_init (void ) +static int omap3pandora_probe (struct platform_device *pdev) {int ret; +struct device *dev = &pdev->dev; +struct snd_soc_card *card = &snd_soc_card_omap3pandora; +struct omap3pandora_sound *ctx; -if (!of_machine_is_compatible ("openpandora,omap3-pandora-600mhz" ) && - !of_machine_is_compatible ("openpandora,omap3-pandora-1ghz" )) -return -ENODEV ; - -pr_info ("OMAP3 Pandora SoC init\n" ); - - omap3pandora_snd_device =platform_device_alloc ("soc-audio" ,-1 ); -if (omap3pandora_snd_device ==NULL ) { -pr_err (PREFIX "Platform device allocation failed\n" ); + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); +if (!ctx)return -ENOMEM ; - } -platform_set_drvdata (omap3pandora_snd_device, &snd_soc_card_omap3pandora); +mutex_init (&ctx->sample_rate_lock); - ret =platform_device_add (omap3pandora_snd_device); -if (ret) { -pr_err (PREFIX "Unable to add platform device\n" ); - goto fail2; + ctx->amp_gpio =devm_gpiod_get (dev,"amp" ,GPIOD_OUT_LOW ); +if (IS_ERR (ctx->amp_gpio)) { +dev_err (dev,"cannot find amplifier gpio\n" ); +return PTR_ERR (ctx->amp_gpio); } - dac_power_gpio =devm_gpiod_get (&omap3pandora_snd_device->dev, -"dac" ,GPIOD_OUT_LOW ); -if (IS_ERR (dac_power_gpio)) { - ret =PTR_ERR (dac_power_gpio); - goto fail3; + ctx->amp_regulator =devm_regulator_get (dev,"amp" ); +if (IS_ERR (ctx->amp_regulator)) { + ret =PTR_ERR (ctx->amp_regulator); +dev_err (dev,"Failed to request regulator for amplifier power: %d\n" , ret); +return ret; } - amp_power_gpio =devm_gpiod_get (&omap3pandora_snd_device->dev, -"amp" ,GPIOD_OUT_LOW ); -if (IS_ERR (amp_power_gpio)) { - ret =PTR_ERR (amp_power_gpio); - goto fail3; + card->dev = dev; + +if (dev->of_node) { + ret =snd_soc_of_parse_card_name (card,"label" ); +if (ret) + card->name ="omap3pandora" ; + + ret =snd_soc_of_parse_audio_simple_widgets (card,"widgets" ); +if (ret) { +dev_err (dev,"Failed to parse DAPM widgets: %d\n" , ret); + goto err_mutex; + } + + ret =snd_soc_of_parse_audio_routing (card,"routing" ); +if (ret) { +dev_err (dev,"Failed to parse audio routing: %d\n" , ret); + goto err_mutex; + } } - omap3pandora_dac_reg =regulator_get (&omap3pandora_snd_device->dev,"vcc" ); -if (IS_ERR (omap3pandora_dac_reg)) { -pr_err (PREFIX "Failed to get DAC regulator from %s: %ld\n" , -dev_name (&omap3pandora_snd_device->dev), -PTR_ERR (omap3pandora_dac_reg)); - ret =PTR_ERR (omap3pandora_dac_reg); - goto fail3; +snd_soc_card_set_drvdata (card, ctx); + + ret =devm_snd_soc_register_card (dev, card); +if (ret) { +dev_err (dev,"Failed to register sound card: %d\n" , ret); + goto err_mutex; }return 0 ; -fail3: -platform_device_del (omap3pandora_snd_device); -fail2: -platform_device_put (omap3pandora_snd_device); - +err_mutex: +mutex_destroy (&ctx->sample_rate_lock);return ret; } -module_init (omap3pandora_soc_init); -static void __exit omap3pandora_soc_exit(void) +static void omap3pandora_remove (struct platform_device *pdev) { -regulator_put (omap3pandora_dac_reg); -platform_device_unregister (omap3pandora_snd_device); +struct snd_soc_card *card =platform_get_drvdata (pdev); +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); + +mutex_destroy (&ctx->sample_rate_lock); } -module_exit (omap3pandora_soc_exit); + +static const struct of_device_id omap3pandora_of_match[] = { + { .compatible ="openpandora,omap3pandora-sound" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, omap3pandora_of_match); + +static struct platform_driver omap3pandora_driver = { + .driver = { + .name ="omap3pandora-sound" , + .of_match_table = omap3pandora_of_match, + }, + .probe = omap3pandora_probe, + .remove = omap3pandora_remove, +}; + +module_platform_driver (omap3pandora_driver);MODULE_AUTHOR ("Grazvydas Ignotas <[email protected]>" );MODULE_DESCRIPTION ("ALSA SoC OMAP3 Pandora" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:omap3pandora-sound" );
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 10/16] ASoC: omap3pandora: Rewrite sound card driver as a platform driver with DT
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider: - [Critical] Device Tree ABI breakage due to removal of fallback machine-compatible matching and strict…
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [Critical] Device Tree ABI breakage due to removal of fallback machine-compatible matching and strict requirement for new DT nodes/properties.
- [High] Double-decrement of sample rate user count when grab_sample_rate() fails.
- [High] relax_sample_rate() incorrectly excludes hardware's minimum and maximum sample rates and permanently erases constraints applied by other components.
- [High] Static global snd_soc_card structure reuse causes list corruption on multiple probes and dangling pointer Use-After-Free.
- [High] Calling mutex_destroy() synchronously in .remove while using devm-based sound card registration creates a Use-After-Free vulnerability.
- [Medium] Missing mutex_destroy() on early probe error paths.
- [Low] Unused variable codec_dai in omap3pandora_common_hw_params.
--
--- Patch [10]: [PATCH 10/16] ASoC: omap3pandora: Rewrite sound card driver as a platform driver with DT --- commit 8781d4ef4d1eb0b2da4ee910133603e631f2f4a9
Author: Stefan Leichter <[email protected]>
ASoC: omap3pandora: Rewrite sound card driver as a platform driver with DT
This change converts the omap3pandora sound card driver to a standard platform driver matched via Device Tree. It also moves code into the PCM1773 codec driver and splits capture/playback operations.
Quoted 4 lines
sound/soc/ti/omap3pandora.c +0
-0
[ ... ]
sound/soc/ti/omap3pandora.c line 44
Quoted 7 lines
sound/soc/ti/omap3pandora.c +2
-2-static int omap3pandora_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) +static int omap3pandora_common_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct snd_soc_dai *codec_dai =snd_soc_rtd_to_codec (rtd,0 );
[Severity: Low]
Is codec_dai used anywhere in this function now? It looks like the usage was moved to omap3pandora_capture_hw_params(), leaving this variable unused and potentially causing build warnings.
[ ... ]
sound/soc/ti/omap3pandora.c line 87
Quoted 13 lines
sound/soc/ti/omap3pandora.c +13
-0+static inline void relax_sample_rate (struct snd_pcm_substream *substream) +{ +const struct snd_interval default_sample_rate_range = { + .min = substream->runtime->hw.rate_min, + .max = substream->runtime->hw.rate_max, + .openmin =1 , + .openmax =1 , + }; + + *constrs_interval (&substream->runtime->hw_constraints, +SNDRV_PCM_HW_PARAM_RATE ) = + default_sample_rate_range; +}
[Severity: High]
Does setting openmin and openmax to 1 permanently exclude the hardware's exact minimum and maximum supported rates? It seems this would block rates like exactly 8000 Hz or 96000 Hz from being selected, as these flags make the interval mathematically open.
Also, does overwriting the hw_constraints interval directly via pointer assignment permanently erase other constraints that might have been applied by the CPU DAI or Codec DAI?
[ ... ]
Quoted 3 lines
sound/soc/ti/omap3pandora.c +3
-0+static int omap3pandora_playback_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{
[ ... ]
sound/soc/ti/omap3pandora.c line 181
Quoted 6 lines
sound/soc/ti/omap3pandora.c +6
-0+if (!ctx->playback_stream) { + ctx->playback_stream = substream; + ret =grab_sample_rate (ctx, substream, params); +if (ret) +return ret; + }
[Severity: High]
Could this lead to a double-decrement of the sample rate user count?
If grab_sample_rate() fails due to a sample rate mismatch, it will call release_sample_rate() and decrement the count. However, since ctx->playback_stream is assigned before grab_sample_rate(), the ALSA core's subsequent call to omap3pandora_playback_hw_free() will see ctx->playback_stream as non-NULL and call release_sample_rate() a second time.
The same pattern appears in omap3pandora_capture_hw_params(). Should the stream pointer assignment happen after grab_sample_rate() succeeds, or should it be cleared in the error path?
[ ... ]
Quoted 37 lines
/* SoC card */
static structsnd_soc_cardsnd_soc_card_omap3pandora= {sound/soc/ti/omap3pandora.c +15
-12- .name = "omap3pandora", - .owner = THIS_MODULE, - .dai_link = omap3pandora_dai, - .num_links = ARRAY_SIZE(omap3pandora_dai), - - .dapm_widgets = omap3pandora_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(omap3pandora_dapm_widgets), - .dapm_routes = omap3pandora_map, - .num_dapm_routes = ARRAY_SIZE(omap3pandora_map), + .name = "omap3pandora", + .owner = THIS_MODULE, + .dai_link = omap3pandora_dai, + .num_links = ARRAY_SIZE(omap3pandora_dai), + .dapm_widgets = omap3pandora_local_widgets, + .num_dapm_widgets = ARRAY_SIZE(omap3pandora_local_widgets), }; -static struct platform_device *omap3pandora_snd_device; - -static int __init omap3pandora_soc_init (void ) +static int omap3pandora_probe (struct platform_device *pdev) {int ret; +struct device *dev = &pdev->dev; +struct snd_soc_card *card = &snd_soc_card_omap3pandora; +struct omap3pandora_sound *ctx; + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); +if (!ctx)return -ENOMEM ; +mutex_init (&ctx->sample_rate_lock); + ctx->amp_gpio =devm_gpiod_get (dev,"amp" ,GPIOD_OUT_LOW ); +if (IS_ERR (ctx->amp_gpio)) {
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = { · line 412
Quoted 10 lines
sound/soc/ti/omap3pandora.c +7
-0+dev_err (dev,"cannot find amplifier gpio\n" ); +return PTR_ERR (ctx->amp_gpio); } + ctx->amp_regulator =devm_regulator_get (dev,"amp" ); +if (IS_ERR (ctx->amp_regulator)) { + ret =PTR_ERR (ctx->amp_regulator); +dev_err (dev,"Failed to request regulator for amplifier power: %d\n" , ret); +return ret; }
[Severity: Medium]
Do these early error returns leak the lockdep tracking for the mutex?
Since mutex_init() is called before these checks, shouldn't they use goto err_mutex instead of returning directly?
[ ... ]
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = { · line 421
Quoted 6 lines
sound/soc/ti/omap3pandora.c +6
-0+if (dev->of_node) { + ret =snd_soc_of_parse_card_name (card,"label" ); +if (ret) + card->name ="omap3pandora" ; + + ret =snd_soc_of_parse_audio_simple_widgets (card,"widgets" );
[Severity: High]
Does modifying the static global snd_soc_card_omap3pandora structure in probe() create issues if the driver is unbound and rebound?
Functions like snd_soc_of_parse_audio_simple_widgets() allocate memory with devm_kcalloc() and assign it to the card structure. If unbound, devres frees the memory, leaving dangling pointers in the static structure. Furthermore, probing multiple times could corrupt the global linked list by calling list_add() on the same card->list node twice.
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = { · line 432
Quoted 11 lines
sound/soc/ti/omap3pandora.c +10
-0+if (ret) { +dev_err (dev,"Failed to parse DAPM widgets: %d\n" , ret); + goto err_mutex; + } + + ret =snd_soc_of_parse_audio_routing (card,"routing" ); +if (ret) { +dev_err (dev,"Failed to parse audio routing: %d\n" , ret); + goto err_mutex; + } }
[Severity: Critical]
Does this strict property check break compatibility with older Device Trees?
The previous driver automatically instantiated the sound card based on the root machine compatible string. By unconditionally requiring the new widgets and routing properties and failing if they are absent, will users booting a new kernel with an older DT lose audio functionality completely?
Quoted 17 lines
sound/soc/ti/omap3pandora.c +8
-1+snd_soc_card_set_drvdata (card, ctx); + + ret =devm_snd_soc_register_card (dev, card); +if (ret) { +dev_err (dev,"Failed to register sound card: %d\n" , ret); + goto err_mutex; }return 0 ; +err_mutex: +mutex_destroy (&ctx->sample_rate_lock);return ret; } -module_init (omap3pandora_soc_init);
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = {
Quoted 10 lines
sound/soc/ti/omap3pandora.c +5
-3-static void __exit omap3pandora_soc_exit(void) +static void omap3pandora_remove (struct platform_device *pdev) { -regulator_put (omap3pandora_dac_reg); -platform_device_unregister (omap3pandora_snd_device); +struct snd_soc_card *card =platform_get_drvdata (pdev); +struct omap3pandora_sound *ctx =snd_soc_card_get_drvdata (card); + +mutex_destroy (&ctx->sample_rate_lock); }
[Severity: High]
Can destroying the mutex here lead to a use-after-free or lockdep panic?
The sound card is registered using devm_snd_soc_register_card(), which defers unregistration to the devres cleanup phase. This runs after the omap3pandora_remove() function returns.
If we call mutex_destroy() synchronously in .remove, does this leave a window where the sound card is still fully active and exposed to userspace, but its internal lock has been destroyed?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
PATCH 11/16 ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2)
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
enable mcbsp2 and mcbsp4.
--- arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +2 -0
@@ -716,6 +716,7 @@ &mcbsp1 { /* audio DAC */ &mcbsp2 { + status = "okay"; }; /* bluetooth */
@@ -724,6 +725,7 @@ &mcbsp3 { /* to twl4030*/ &mcbsp4 { + status = "okay"; }; &venc {
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 11/16] ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2)
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Missing Sound Card devicetree node leaves audio broken. - [Medium] Missing Pin Multiplexing for…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing Sound Card devicetree node leaves audio broken.
- [Medium] Missing Pin Multiplexing for McBSP nodes.
--
--- Patch [11]: [PATCH 11/16] ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2) --- commit e4ecb9f743bc9100e161520f1482dafaecae52b7
Author: Stefan Leichter <[email protected]>
ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2)
This commit enables the mcbsp2 and mcbsp4 nodes in the omap3-pandora-common device tree to support audio.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi &mcbsp1 { · line 719
Quoted 9 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +1
-0@@ -716,6 +716,7 @@ &mcbsp1 { /* audio DAC */ &mcbsp2 { + status = "okay";
[Severity: High]
Is the audio hardware left non-functional because the sound card devicetree node is missing?
While this enables the McBSP nodes, the machine sound driver itself is never instantiated because its device node (matching openpandora,omap3pandora-sound) is missing.
[Severity: Medium]
Are the required pinctrl configurations missing for this node?
It is a standard devicetree requirement on OMAP3 to define pinctrl-names = "default"; and pinctrl-0 = <...>; properties for enabled peripherals so that the kernel explicitly claims and configures the pins independent of the bootloader state.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi &mcbsp3 { · line 728
Quoted 8 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +1
-0}; /* bluetooth */@@ -724,6 +725,7 @@ &mcbsp3 { /* to twl4030*/ &mcbsp4 { + status = "okay";
[Severity: Medium]
Should this node also include pinctrl configurations to ensure the kernel explicitly configures the pins independent of the bootloader state?
Quoted 1 line
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +0
-0};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH 12/16 arm: dts: omap3pandora: Add device node for PCM1773 codec
In reply to H. Nikolaus SchallerFrom: Grond <[email protected]>
This will ensure that the new PCM1773 driver gets loaded automatically.
--- arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +7 -0
@@ -42,6 +42,13 @@ tv_connector_in: endpoint { }; }; + dac: pcm1773-codec { + compatible = "ti,pcm1773"; + vcc-supply = <&vsim>; + enable-gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ + status = "okay"; + }; + gpio-leds { compatible = "gpio-leds";
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 12/16] arm: dts: omap3pandora: Add device node for PCM1773 codec
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] Incorrect lifecycle for `devm_*` resource allocations in the ASoC component probe causes memory…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Incorrect lifecycle for devm_* resource allocations in the ASoC component probe causes memory leaks and rebinding failures.
- [High] The driver swallows -EPROBE_DEFER from devm_regulator_get(), breaking deferred probing for the VCC supply.
- [Low] The commit uses the deprecated property name enable-gpio instead of enable-gpios.
- [Low] Missing property definitions in the PCM1773 YAML binding schema will cause dtbs_check failures.
- [Low] Busy-waiting with mdelay() is used in a sleepable context.
--
--- Patch [12]: [PATCH 12/16] arm: dts: omap3pandora: Add device node for PCM1773 codec --- commit 4dbdbb04f5f389f900287ce1a74c35a57890d4b3
Author: Grond <[email protected]>
arm: dts: omap3pandora: Add device node for PCM1773 codec
This commit adds a new device node for the PCM1773 codec to the OpenPandora device tree. This ensures the new PCM1773 driver gets loaded automatically.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi tv_connector_in: endpoint { · line 48
Quoted 11 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +4
-0@@ -42,6 +42,13 @@ tv_connector_in: endpoint { }; }; + dac: pcm1773-codec { + compatible = "ti,pcm1773"; + vcc-supply = <&vsim>; + enable-gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */
[Severity: Low]
Is it expected to use the deprecated property name enable-gpio instead of the mandated enable-gpios suffix?
The standard requires the plural form even for single GPIOs.
Quoted 8 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +3
-0+ status = "okay"; + }; + gpio-leds {Documentation/devicetree/bindings/sound/pcm1773.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/sound/pcm1773.yaml
Quoted 8 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +8
-0+properties: + compatible: + const: ti,pcm1773 + +required: + - compatible + +additionalProperties: false
[Severity: Low]
Will this schema cause dtbs_check validation errors?
The schema includes additionalProperties: false but fails to list enable-gpios and vcc-supply in the properties dictionary.
The provided device tree nodes specify these properties, which will lead to schema validation failures.
Quoted 6 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +2
-0+ +examples:sound/soc/codecs/pcm1773.c new file +0
-0
[ ... ]
Quoted 3 lines
sound/soc/codecs/pcm1773.c new file +3
-0+static int pcm1773_dac_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) +{
[ ... ]
sound/soc/codecs/pcm1773.c
Quoted 8 lines
sound/soc/codecs/pcm1773.c new file +8
-0+if (SND_SOC_DAPM_EVENT_ON (event)) { +if (ctx->regulator) { + ret =regulator_enable (ctx->regulator); +if (ret) { +dev_err (dev,"Failed to power DAC: %d\n" , ret); +return ret; + } +mdelay (1 );
[Severity: Low]
Should this use usleep_range() or msleep() instead of busy-waiting?
pcm1773_dac_event() is executed during DAPM widget power up/down events, which run in a sleepable context (as demonstrated by calls to gpiod_set_value_cansleep()). Using mdelay() here wastes CPU cycles.
Quoted 1 line
sound/soc/codecs/pcm1773.c new file +1
-0+ }
[ ... ]
sound/soc/codecs/pcm1773.c
Quoted 12 lines
sound/soc/codecs/pcm1773.c new file +12
-0+static int pcm1773_probe (struct snd_soc_component *component) +{ +struct pcm1773 *ctx =NULL ; +struct device *dev = component->dev; +int ret; + + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return -ENOMEM ; +snd_soc_component_set_drvdata (component, ctx); + + ctx->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW );
[Severity: High]
Can this incorrect lifecycle for devm_ allocations cause memory leaks and rebinding failures?
pcm1773_probe() executes during sound card binding, using devm_kzalloc() and devm_gpiod_get_optional() with the platform device (component->dev).
Since the platform device outlives the sound card lifecycle, these resources are not freed upon unbind, and a subsequent bind will hit -EBUSY when requesting the GPIO or regulator.
Quoted 1 line
sound/soc/codecs/pcm1773.c new file +1
-0+if (IS_ERR (ctx->enable_gpio)) {
[ ... ]
sound/soc/codecs/pcm1773.c
Quoted 5 lines
sound/soc/codecs/pcm1773.c new file +5
-0+ ctx->regulator =devm_regulator_get (dev,"vcc" ); +if (IS_ERR (ctx->regulator)) { +dev_warn (dev,"cannot get regulator 'vcc'" ); + ctx->regulator =NULL ; + }
[Severity: High]
Does this break deferred probing for the VCC supply by swallowing -EPROBE_DEFER?
When the VCC regulator driver is loaded after the sound driver, devm_regulator_get() returns -EPROBE_DEFER.
This code intercepts the error, sets the regulator to NULL, and continues instead of propagating the error. This will cause the DAC to silently fail to power up later.
Quoted 3 lines
sound/soc/codecs/pcm1773.c new file +3
-0+ +return 0 ; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
PATCH 13/16 arm: dts: omap3pandora: create new DT node for the sound card
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
This means that the sound card driver (snd-soc-omap3pandora) will get loaded by default.
To make this work, we also add dac pcm1773-codec and widgets and routing as needed.
--- .../dts/ti/omap/omap3-pandora-common.dtsi | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +42 -0
@@ -47,6 +47,45 @@ dac: pcm1773-codec { vcc-supply = <&vsim>; enable-gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ status = "okay"; + #sound-dai-cells = <0>; + }; + + twl_audio_clk: twl-audio-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <12288000>; + clock-output-names = "clk256fs"; + }; + + sound: sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <®en>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "PCM1773 DAC", "APLL Enable", + "Headphone Amplifier", "PCM1773 DAC", + "Line Out", "PCM1773 DAC", + "Headphone Jack", "Headphone Amplifier", + "AUXL", "Line In", + "AUXR", "Line In", + "MAINMIC", "Mic (internal)", + "Mic (internal)", "Mic Bias 1", + "SUBMIC", "Mic (external)", + "Mic (external)", "Mic Bias 2"; + + sound-dai = <&mcbsp2>, <&dac>; }; gpio-leds {
@@ -724,6 +763,9 @@ &mcbsp1 { /* audio DAC */ &mcbsp2 { status = "okay"; + #sound-dai-cells = <0>; + clocks = <&mcbsp2_fck>, <&mcbsp2_ick>; + clock-names = "fck", "ick"; }; /* bluetooth */
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 13/16] arm: dts: omap3pandora: create new DT node for the sound card
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] Double decrement of sample_rate_users on hw_params error path. - [High] Using `IS_BUILTIN()` to…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Double decrement of sample_rate_users on hw_params error path.
- [High] Using IS_BUILTIN() to change CPU and Platform component names breaks DAI linking for built-in driver initialization.
- [Medium] Incorrect $id and $schema fields in the newly added audio DT bindings.
- [Medium] The ti,pcm1773 binding schema does not document necessary properties and sets additionalProperties: false, causing DT validation failures. --
--- Patch [13]: [PATCH 13/16] arm: dts: omap3pandora: create new DT node for the sound card --- commit 9dab89ea3f463775080f6924b99e5cea84e88df3
Author: Stefan Leichter <[email protected]>
arm: dts: omap3pandora: create new DT node for the sound card
This means that the sound card driver (snd-soc-omap3pandora) will get loaded by default. To make this work, we also add dac pcm1773-codec and widgets and routing as needed.
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 5
Quoted 11 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +5
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org +$schema: http://devicetree.org
[Severity: Medium]
Are these $id and $schema paths correct? The $id field breaks the schema cross-reference system if it doesn't include the full path, and could cause dt_binding_check to report misleading errors or skip validation.
[ ... ]
Documentation/devicetree/bindings/sound/pcm1773.yaml line 5
Quoted 11 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +5
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/sound/pcm1773.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#
[Severity: Medium]
Should this $id field omit the extraneous bindings/ directory to match the standard path format?
[ ... ]
Documentation/devicetree/bindings/sound/pcm1773.yaml line 13
Quoted 8 lines
Documentation/devicetree/bindings/sound/pcm1773.yaml new file +8
-0+properties: + compatible: + const: ti,pcm1773 + +required: + - compatible + +additionalProperties: false
[Severity: Medium]
Since additionalProperties is set to false but only the compatible string is documented, won't valid device tree nodes that use properties like vcc-supply, enable-gpio, status, and #sound-dai-cells fail validation?
[ ... ]
Quoted 4 lines
sound/soc/ti/omap3pandora.c +0
-0
[ ... ]
Quoted 3 lines
sound/soc/ti/omap3pandora.c +3
-0+static int omap3pandora_playback_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{
[ ... ]
sound/soc/ti/omap3pandora.c
Quoted 6 lines
sound/soc/ti/omap3pandora.c +6
-0+if (!ctx->playback_stream) { + ctx->playback_stream = substream; + ret =grab_sample_rate (ctx, substream, params); +if (ret) +return ret; + }
[Severity: High]
If grab_sample_rate() returns an error, it drops sample_rate_users back down, but ctx->playback_stream remains set to this substream.
When this stream is subsequently closed, omap3pandora_playback_hw_free() will see ctx->playback_stream is set and call release_sample_rate() again.
Will this result in a double decrement of sample_rate_users that could prematurely unlock constraints for an active stream?
[ ... ]
Quoted 3 lines
sound/soc/ti/omap3pandora.c +3
-0+static int omap3pandora_capture_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{
[ ... ]
sound/soc/ti/omap3pandora.c
Quoted 6 lines
sound/soc/ti/omap3pandora.c +6
-0+if (!ctx->capture_stream) { + ctx->capture_stream = substream; + ret =grab_sample_rate (ctx, substream, params); +if (ret) +return ret; + }
[Severity: High]
Similarly, does this have the same double decrement issue if grab_sample_rate() fails, leaving ctx->capture_stream set for omap3pandora_capture_hw_free() to clean up later?
[ ... ]
Quoted 12 lines
sound/soc/ti/omap3pandora.c +3
-1+#if IS_BUILTIN (CONFIG_SND_SOC_OMAP3_PANDORA )SND_SOC_DAILINK_DEFS (out,DAILINK_COMP_ARRAY (COMP_CPU ("omap-mcbsp.2" )), -DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("pcm1773-codec" ,"pcm1773-hifi" )),DAILINK_COMP_ARRAY (COMP_PLATFORM ("omap-mcbsp.2" )));SND_SOC_DAILINK_DEFS (in,DAILINK_COMP_ARRAY (COMP_CPU ("omap-mcbsp.4" )),DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )),DAILINK_COMP_ARRAY (COMP_PLATFORM ("omap-mcbsp.4" ))); +#else /* IS_BUILTIN(CONFIG_SND_SOC_OMAP3_PANDORA) */
sound/soc/ti/omap3pandora.c
Quoted 10 lines
sound/soc/ti/omap3pandora.c +10
-0+SND_SOC_DAILINK_DEFS (out, +DAILINK_COMP_ARRAY (COMP_CPU ("49022000.mcbsp" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("pcm1773-codec" ,"pcm1773-hifi" )), +DAILINK_COMP_ARRAY (COMP_PLATFORM ("49022000.mcbsp" ))); + +SND_SOC_DAILINK_DEFS (in, +DAILINK_COMP_ARRAY (COMP_CPU ("49026000.mcbsp" )), +DAILINK_COMP_ARRAY (COMP_CODEC ("twl4030-codec" ,"twl4030-hifi" )), +DAILINK_COMP_ARRAY (COMP_PLATFORM ("49026000.mcbsp" ))); +#endif /* IS_BUILTIN(CONFIG_SND_SOC_OMAP3_PANDORA) */
[Severity: High]
Does this IS_BUILTIN() check break DAI linking when the driver is built into the kernel?
Since the McBSP devices are populated via the Device Tree and use unit addresses (like 49022000.mcbsp) regardless of the driver's compilation state, could ALSA fail to find omap-mcbsp.2 when probing the built-in driver?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
PATCH 14/16 arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and pwm_bl
In reply to H. Nikolaus SchallerThis allows to remove the pandora_bl driver and pdata-quirks.
--- arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +8 -0
@@ -31,6 +31,14 @@ hfclk_26m: oscillator { clock-frequency = <26000000>; }; + backlight { + compatible = "pwm-backlight"; + pwms = <&twl_pwm 0 1922710>; + + brightness-levels = <0 150 158 166 174 185 205 230 255>; + default-brightness-level = <6>; + }; + tv: connector { compatible = "connector-analog-tv"; label = "tv";
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 14/16] arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and pwm_bl
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Missing TPS61161 hardware initialization quirk causes backlight to fail. - [High] Concurrent…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Missing TPS61161 hardware initialization quirk causes backlight to fail.
- [High] Concurrent probing of legacy and generic backlight drivers causes I2C register corruption.
- [Medium] Hardware misconfiguration due to unsupported PWM period, leading to artificially restricted brightness range. --
--- Patch [14]: [PATCH 14/16] arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and pwm_bl --- commit 062b6b894a7997d211a245d15a6bd9071869adad
Author: H. Nikolaus Schaller <[email protected]>
arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and pwm_bl
This commit adds a generic pwm-backlight device tree node for the Pandora backlight. The commit message states this allows removing the pandora_bl driver and pdata-quirks.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi hfclk_26m: oscillator { · line 35
Quoted 10 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +2
-0@@ -31,6 +31,14 @@ hfclk_26m: oscillator { clock-frequency = <26000000>; }; + backlight { + compatible = "pwm-backlight";
[Severity: High]
Will this result in a hardware conflict if the legacy driver isn't actually removed in this patch?
The commit message mentions this allows removing the legacy pandora_bl driver and pdata-quirks.c registration, but this commit doesn't remove or conditionally disable the legacy platform device registration.
If CONFIG_BACKLIGHT_PANDORA is enabled, both the legacy pandora_bl driver and the new pwm-backlight driver will probe concurrently. Since pandora_bl writes directly to I2C registers and bypasses the PWM framework, this dual driver setup can cause race conditions, register corruption, and duplicate sysfs entries for the backlight.
[Severity: High]
Does switching to the generic driver cause the backlight to fail on startup?
The legacy pandora_bl driver included a TPS61161 hardware quirk that forced a 100% duty cycle for 2-10ms at startup. Without this continuous >2.5ms high pulse, the TPS61161 enters 1-wire detection mode and disables PWM control.
The generic pwm-backlight driver immediately applies the computed duty cycle on power-up, which lacks this required hardware initialization sequence.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi hfclk_26m: oscillator { · line 38
Quoted 3 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +3
-0+ pwms = <&twl_pwm 0 1922710>; + + brightness-levels = <0 150 158 166 174 185 205 230 255>;
[Severity: Medium]
Is this artificially restricted minimum brightness of 150/255 (59%) a workaround for an unsupported PWM period?
The device tree requests a period of 1922710ns (64-tick mode), but the pwm-twl driver unconditionally sets TWL_PWM0_ON to 1, forcing 128-tick mode (~3.9ms period).
To prevent the longer off-times of this slower frequency from exceeding the 2.5ms threshold that triggers the TPS61161 1-wire mode, it appears the minimum brightness was raised to 59%. This seems to be a significant functional regression from the original 14% minimum brightness.
Quoted 6 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +3
-0+ default-brightness-level = <6>; + }; + tv: connector { compatible = "connector-analog-tv"; label = "tv";
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
PATCH 15/16 backlight: remove pandora_bl
In reply to H. Nikolaus SchallerRetire the platform specific pandora backlight driver since it can now be replaced by twl_pm and device tree.
--- drivers/video/backlight/Kconfig | 7 -- drivers/video/backlight/Makefile | 1 - drivers/video/backlight/pandora_bl.c | 159 --------------------------- 3 files changed, 167 deletions(-) delete mode 100644 drivers/video/backlight/pandora_bl.c
drivers/video/backlight/Kconfig +0 -7
@@ -451,13 +451,6 @@ config BACKLIGHT_MP3309C To compile this driver as a module, choose M here: the module will be called mp3309c. -config BACKLIGHT_PANDORA - tristate "Backlight driver for Pandora console" - depends on TWL4030_CORE - help - If you have a Pandora console, say Y to enable the - backlight driver. - config BACKLIGHT_SKY81452 tristate "Backlight driver for SKY81452" depends on MFD_SKY81452
drivers/video/backlight/Makefile +0 -1
@@ -52,7 +52,6 @@ obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o -obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o obj-$(CONFIG_BACKLIGHT_QCOM_WLED) += qcom-wled.o obj-$(CONFIG_BACKLIGHT_RT4831) += rt4831-backlight.o
drivers/video/backlight/pandora_bl.c deleted +0 -159
159 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 15/16] backlight: remove pandora_bl
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Removal of the TPS61161 backlight controller PWM mode initialization sequence, potentially…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Removal of the TPS61161 backlight controller PWM mode initialization sequence, potentially breaking backlight control.
- [Low] The 'pandora-backlight' platform device is still registered in legacy pdata quirks despite the driver being removed, resulting in an unbound dead device.
- [Low] Stale Kconfig reference to CONFIG_BACKLIGHT_PANDORA remains in omap2plus_defconfig.
--
--- Patch [15]: [PATCH 15/16] backlight: remove pandora_bl --- commit 6eef80f63fc65c8cd1ed05d5c2e07cc3c726434e
Author: H. Nikolaus Schaller <[email protected]>
backlight: remove pandora_bl
Retire the platform specific pandora backlight driver since it can now be replaced by twl_pm and device tree.
[Severity: Low]
Does this commit leave an unbound dead device registered in the system?
The pandora-backlight platform driver is removed here, but it appears arch/arm/mach-omap2/pdata-quirks.c still statically defines and registers the device in omap3_pandora_legacy_init():
platform_device_register(&pandora_backlight);
Should this platform device registration be removed as well?
Quoted 5 lines
drivers/video/backlight/Kconfig +0
-0@@ -451,13 +451,6 @@ config BACKLIGHT_MP3309C
[ ... ]
drivers/video/backlight/Kconfig config BACKLIGHT_MP3309C · line 460
Quoted 7 lines
drivers/video/backlight/Kconfig +0
-7-config BACKLIGHT_PANDORA - tristate "Backlight driver for Pandora console" - depends on TWL4030_CORE - help - If you have a Pandora console, say Y to enable the - backlight driver. -
[Severity: Low]
Will this removal trigger a Kconfig warning during omap2plus_defconfig generation?
The defconfig file still explicitly enables CONFIG_BACKLIGHT_PANDORA=m. Should arch/arm/configs/omap2plus_defconfig be updated to remove this stale entry?
Quoted 6 lines
drivers/video/backlight/pandora_bl.c deleted +0
-0@@ -1,159 +0,0 @@
[ ... ]
Quoted 12 lines
drivers/video/backlight/pandora_bl.c deleted +0
-12-if (priv->old_state ==PANDORABL_WAS_OFF ) { -/* -* set PWM duty cycle to max. TPS61161 seems to use this -* to calibrate it's PWM sensitivity when it starts. -*/ -twl_i2c_write_u8 (TWL_MODULE_PWM ,MAX_VALUE ,TWL_PWM0_OFF ); - -/* first enable clock, then PWM0 out */ -twl_i2c_read_u8 (TWL4030_MODULE_INTBR , &r,TWL_INTBR_GPBR1 ); - r &= ~PWM0_ENABLE ; - r |=PWM0_CLK_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 );
drivers/video/backlight/pandora_bl.c line 90
Quoted 10 lines
drivers/video/backlight/pandora_bl.c deleted +0
-10- r |=PWM0_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 ); - -/* -* TI made it very easy to enable digital control, so easy that -* it often triggers unintentionally and disabes PWM control, -* so wait until 1 wire mode detection window ends. -*/ -usleep_range (2000 ,10000 ); - }
[Severity: High]
When switching to the generic pwm-backlight driver, how is the TPS61161 initialized into PWM mode?
Because the TPS61161 shares its EN pin for both 1-wire EasyScale digital control and PWM control, the removed pandora_bl driver included this hardware workaround to force a 100% PWM duty cycle and sleep for 2-10ms at startup.
Without this initialization pulse, could the TPS61161 misinterpret the initial PWM signal as a 1-wire EasyScale command and disable PWM control, preventing the backlight from turning on properly?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=15
Re: [PATCH 15/16] backlight: remove pandora_bl
In reply to H. Nikolaus SchallerQuoted 4 lines · H. Nikolaus Schaller
Retire the platform specific pandora backlight driver since it can now be replaced by
twl_pmand device tree.Signed-off-by H. Nikolaus Schaller <[email protected]>
Yay!
Daniel.
Re: [PATCH 15/16] backlight: remove pandora_bl
Hi Daniel,
Quoted 11 lines
Am 10.08.2026 um 12:35 schrieb Daniel Thompson <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
Retire the platform specific pandora backlight driver since it can now be replaced by
twl_pmand device tree.Signed-off-by H. Nikolaus Schaller <[email protected]>Yay!
Reviewed-by Daniel Thompson (RISCstar) <[email protected]>
Well, there were some good comments by Sahiko to the prerequisites of this patch, because it has one speciality the PWM BL driver does not handle (avoid interpretation of PWM signals as W1 protocol).
I haven't found time to work on this, so we can't remove this yet.
In the end it may either remain a pandora_bl driver (converted to DT) or become a patch for something else.
BR,
Nikolaus
Andreas Kemnade
maintainerRe: [PATCH 15/16] backlight: remove pandora_bl
Quoted 14 lines · On Mon, 10 Aug 2026 12:45:16 +0200 "H. Nikolaus Schaller" <[email protected]>…
Hi Daniel,
Quoted 11 lines
Am 10.08.2026 um 12:35 schrieb Daniel Thompson <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
Retire the platform specific pandora backlight driver since it can now be replaced by
twl_pmand device tree.Signed-off-by H. Nikolaus Schaller <[email protected]>Yay!
Reviewed-by Daniel Thompson (RISCstar) <[email protected]>
Quoted 9 lines
Well, there were some good comments by Sahiko to the prerequisites of this patch, because it has one speciality the PWM BL driver does not handle (avoid interpretation of PWM signals as W1 protocol).
I haven't found time to work on this, so we can't remove this yet.
In the end it may either remain a
pandora_bldriver (converted to DT) or become a patch for something else.
But then it is a TPS61161 on top of PWM, not a pandora driver. And then there might be just a quirk for that chip in the pwm_bl using triggered by a compatible. I guess the quirk is this:
if (priv->old_state == PANDORABL_WAS_OFF) {
- /*
- * set PWM duty cycle to max. TPS61161 seems to use this
- * to calibrate it's PWM sensitivity when it starts.
- */
- twl_i2c_write_u8(TWL_MODULE_PWM, MAX_VALUE, TWL_PWM0_OFF);
-
- /* first enable clock, then PWM0 out */
- twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1);
- r &= ~PWM0_ENABLE;
- r |= PWM0_CLK_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
- r |= PWM0_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
-
- /*
- * TI made it very easy to enable digital control, so easy that
- * it often triggers unintentionally and disabes PWM control,
- * so wait until 1 wire mode detection window ends.
- */
- usleep_range(2000, 10000);
- }
Regards,
Andreas
Re: [PATCH 15/16] backlight: remove pandora_bl
Quoted 48 lines
Am 10.08.2026 um 14:39 schrieb Andreas Kemnade <[email protected]>:
Quoted 14 lines · On Mon, 10 Aug 2026 12:45:16 +0200 "H. Nikolaus Schaller" <[email protected]>…
Hi Daniel,
Quoted 11 lines
Am 10.08.2026 um 12:35 schrieb Daniel Thompson <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
Retire the platform specific pandora backlight driver since it can now be replaced by
twl_pmand device tree.Signed-off-by H. Nikolaus Schaller <[email protected]>Yay!
Reviewed-by Daniel Thompson (RISCstar) <[email protected]>Quoted 9 lines
Well, there were some good comments by Sahiko to the prerequisites of this patch, because it has one speciality the PWM BL driver does not handle (avoid interpretation of PWM signals as W1 protocol).
I haven't found time to work on this, so we can't remove this yet.
In the end it may either remain a
pandora_bldriver (converted to DT) or become a patch for something else.But then it is a TPS61161 on top of PWM, not a pandora driver. And then there might be just a quirk for that chip in the
pwm_blusing triggered by a compatible. I guess the quirk is this:if (
priv->old_state==PANDORABL_WAS_OFF) {
- /*
- * set PWM duty cycle to max. TPS61161 seems to use this
- * to calibrate it's PWM sensitivity when it starts.
- */
-twl_i2c_write_u8(TWL_MODULE_PWM, MAX_VALUE, TWL_PWM0_OFF);drivers/video/backlight/pandora_bl.c deleted +0
-6- -/* first enable clock, then PWM0 out */ -twl_i2c_read_u8 (TWL4030_MODULE_INTBR , &r,TWL_INTBR_GPBR1 ); - r &= ~PWM0_ENABLE ; - r |=PWM0_CLK_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 );
drivers/video/backlight/pandora_bl.c line 90
Quoted 10 lines
drivers/video/backlight/pandora_bl.c deleted +0
-10- r |=PWM0_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 ); - -/* -* TI made it very easy to enable digital control, so easy that -* it often triggers unintentionally and disabes PWM control, -* so wait until 1 wire mode detection window ends. -*/ -usleep_range (2000 ,10000 ); - }
Yes that is what I mean. It needs to be ported somewhere. If it can be ported to some compatible = "pwm_bl_for_tps61161" or what fits best it will be fine. Or it could be in some compatible = "pandora_bl" driver.
Has to be worked out when the development machines are not blocked by 3 or 4 other projects already running in parallel :)
BR,
Nikolaus
Re: [PATCH 15/16] backlight: remove pandora_bl
Quoted 28 lines
Am 10.08.2026 um 15:23 schrieb H. Nikolaus Schaller <[email protected]>:
Quoted 22 lines
Am 10.08.2026 um 14:39 schrieb Andreas Kemnade <[email protected]>:
Quoted 17 lines · On Mon, 10 Aug 2026 12:45:16 +0200 "H. Nikolaus Schaller" <[email protected]>…
Hi Daniel,
Quoted 11 lines
Am 10.08.2026 um 12:35 schrieb Daniel Thompson <[email protected]>:
Quoted 4 lines · H. Nikolaus Schaller
Retire the platform specific pandora backlight driver since it can now be replaced by
twl_pmand device tree.Signed-off-by H. Nikolaus Schaller <[email protected]>Yay!
Reviewed-by Daniel Thompson (RISCstar) <[email protected]>Well, there were some good comments by Sahiko to the prerequisites of this patch, because it has one speciality the PWM BL driver does not handle (avoid interpretation of PWM signals as W1 protocol).
Here is the report: https://sashiko.dev/#/patchset/[email protected]?part=15
Quoted 26 lines
Quoted 26 lines
Quoted 6 lines
I haven't found time to work on this, so we can't remove this yet.
In the end it may either remain a
pandora_bldriver (converted to DT) or become a patch for something else.But then it is a TPS61161 on top of PWM, not a pandora driver. And then there might be just a quirk for that chip in the
pwm_blusing triggered by a compatible. I guess the quirk is this:if (
priv->old_state==PANDORABL_WAS_OFF) {
- /*
- * set PWM duty cycle to max. TPS61161 seems to use this
- * to calibrate it's PWM sensitivity when it starts.
- */
-twl_i2c_write_u8(TWL_MODULE_PWM, MAX_VALUE, TWL_PWM0_OFF);drivers/video/backlight/pandora_bl.c deleted +0
-9- -/* first enable clock, then PWM0 out */ -twl_i2c_read_u8 (TWL4030_MODULE_INTBR , &r,TWL_INTBR_GPBR1 ); - r &= ~PWM0_ENABLE ; - r |=PWM0_CLK_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 ); - r |=PWM0_ENABLE ; -twl_i2c_write_u8 (TWL4030_MODULE_INTBR , r,TWL_INTBR_GPBR1 ); -
Quoted 8 lines
Quoted 8 lines
- /*
- * TI made it very easy to enable digital control, so easy that
- * it often triggers unintentionally and disabes PWM control,
- * so wait until 1 wire mode detection window ends.
- */
-usleep_range(2000, 10000);
- }
Exactly. The Sashiko comment to this section was:
When switching to the generic pwm-backlight driver, how is the TPS61161 initialized into PWM mode? Because the TPS61161 shares its EN pin for both 1-wire EasyScale digital control and PWM control, the removed pandora_bl driver included this hardware workaround to force a 100% PWM duty cycle and sleep for 2-10ms at startup. Without this initialization pulse, could the TPS61161 misinterpret the initial PWM signal as a 1-wire EasyScale command and disable PWM control, preventing the backlight from turning on properly?
Well, I didn't see this but it would be on the safe side to have it.
Quoted 7 lines
Yes that is what I mean. It needs to be ported somewhere. If it can be ported to some compatible = "
pwm_bl_for_tps61161" or what fits best it will be fine. Or it could be in some compatible = "pandora_bl" driver.Has to be worked out when the development machines are not blocked by 3 or 4 other projects already running in parallel :)
Nevertheless I did a quick look into the pandora_bl driver structure.
Here are my findings:
- the code fragment is part of pandora_backlight_update_status()
- priv->old_state remembers if brighness was set to 0 or not
- so this code triggers on any change from bright = 0 to bright > 0
- the pandora_bl driver is the only one to use TWL_MODULE_PWM besides twl-pwm
So the most natural way of transplanting this appears to me:
- add this logic to the twl-pwm driver
- add a propery to escribe this special need (e.g. "disable-easyscale")
- use this to triger the extra code in case this flag is set
- and if the pwm duty cycle changes from permanently off to real PWM
- this should obviously go into twl_pwm_config() to detect through duty_ns
- alternativey it might be possible to handle everything in twl4030_pwm_enable
Suggestions welcome.
BR,
Nikolaus
Andreas Kemnade
maintainerRe: [PATCH 15/16] backlight: remove pandora_bl
Quoted 10 lines · On Mon, 10 Aug 2026 20:30:13 +0200 "H. Nikolaus Schaller" <[email protected]>…
Quoted 7 lines
Yes that is what I mean. It needs to be ported somewhere. If it can be ported to some compatible = "
pwm_bl_for_tps61161" or what fits best it will be fine. Or it could be in some compatible = "pandora_bl" driver.Has to be worked out when the development machines are not blocked by 3 or 4 other projects already running in parallel :)
Nevertheless I did a quick look into the
pandora_bldriver structure.
Quoted 8 lines
Here are my findings:
- the code fragment is part ofpandora_backlight_update_status()
-priv->old_stateremembers if brighness was set to 0 or not
- so this code triggers on any change from bright = 0 to bright > 0
- thepandora_bldriver is the only one to useTWL_MODULE_PWMbesides twl-pwmSo the most natural way of transplanting this appears to me:
- add this logic to the twl-pwm driver
That chip could be connected to any pwm driver, so it does not make sense to have that in a pwm driver.
So it belongs into a backlight driver. And since it shared so much code with the pwm_bl, it could be extended.
The compatible should have pwm in the name to be able to also add a w1 driver later.
Regards,
Andreas
Re: [Letux-kernel] [PATCH 15/16] backlight: remove pandora_bl
Quoted 23 lines
Am 10.08.2026 um 22:34 schrieb Andreas Kemnade <[email protected]>:
Quoted 16 lines · On Mon, 10 Aug 2026 20:30:13 +0200 "H. Nikolaus Schaller" <[email protected]>…
Quoted 7 lines
Yes that is what I mean. It needs to be ported somewhere. If it can be ported to some compatible = "
pwm_bl_for_tps61161" or what fits best it will be fine. Or it could be in some compatible = "pandora_bl" driver.Has to be worked out when the development machines are not blocked by 3 or 4 other projects already running in parallel :)
Nevertheless I did a quick look into the
pandora_bldriver structure.Here are my findings:
- the code fragment is part ofpandora_backlight_update_status()
-priv->old_stateremembers if brighness was set to 0 or not
- so this code triggers on any change from bright = 0 to bright > 0
- thepandora_bldriver is the only one to useTWL_MODULE_PWMbesides twl-pwm
Quoted 5 lines
Quoted 2 lines
So the most natural way of transplanting this appears to me:
- add this logic to the twl-pwm driverThat chip could be connected to any pwm driver, so it does not make sense to have that in a pwm driver.
Well, the chip does not need a driver, at all - at least in PWM case. The missing piece is just about doing proper startup into PWM mode.
Quoted 1 line
So it belongs into a backlight driver.
Interesting how contrary requirements can be judged :) Especially for such simple things that apparently even work without any driver.
Quoted 2 lines
And since it shared so much
code with thepwm_bl, it could be extended.
But how do you give the chip driver access to twl4030 registers? Or make it universal so that it works on any PWM generator? Any ideas?
Quoted 2 lines
The compatible should have pwm in the name to be able to also add a w1 driver later.
Ok, that is an argument to be considered.
But: for multi-protocol chips (think of SPI and I2C) there are usually two drivers (or glue code for a core driver) for each protocol. So we can have one driver when connected to PWM and another being an EasyScale (which is not the standard one-wire protocol) driver.
BTW: I am still not convinced that the chip needs an EasyScale client driver at all. The protocol is similar to an UART with fixed bit format. So this rather needs a generic host driver. Not a client driver. Something like baclkight levels -> easy-scale. Then you can connect any compatible chip.
But even in this case the hardware connection requires you to patch or piggy-back that into the twl4030 pwm driver because that is the connection given by the Pandora hardware.
So why not generating the simple startup sequence in the PWM driver? KISS...
BR,
Nikolaus
PATCH 16/16 arm: omap2: remove remaining pdata-quirks for pandora legacy devices
In reply to H. Nikolaus SchallerAfter updating the pandora-backligt setup and removing the omap3pandora sound system and defining related gpios by device tree, we can remove omap3_pandora_legacy_init() and the related legacy devices completely.
--- arch/arm/mach-omap2/pdata-quirks.c | 23 ----------------------- 1 file changed, 23 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -23
@@ -268,27 +268,6 @@ static void __init omap3_logicpd_torpedo_init(void) omap3_gpio126_127_129(); } -/* omap3pandora legacy devices */ - -static struct platform_device pandora_backlight = { - .name ="pandora-backlight" , - .id =-1 , -}; - -static struct gpiod_lookup_table pandora_soc_audio_gpios = { - .dev_id ="soc-audio" , - .table = { -GPIO_LOOKUP ("gpio-112-127" ,6 ,"dac" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("gpio-0-15" ,14 ,"amp" ,GPIO_ACTIVE_HIGH ), - { } - }, -}; - -static void __init omap3_pandora_legacy_init (void ) -{ -platform_device_register (&pandora_backlight); -gpiod_add_lookup_table (&pandora_soc_audio_gpios); -}#endif /* CONFIG_ARCH_OMAP3 */ #ifdef CONFIG_SOC_DRA7XX
@@ -514,8 +493,6 @@ static struct pdata_init pdata_quirks[] __initdata = { { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, { "ti,am3517-evm", am3517_evm_legacy_init, }, { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, }, - { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, }, - { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, }, #endif { /* sentinel */ }, };
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewRe: [PATCH 16/16] arm: omap2: remove remaining pdata-quirks for pandora legacy devices
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
After updating the pandora-backligt setup and removing the omap3pandora sound system and defining related gpios by device tree, we can remove
omap3_pandora_legacy_init()and the related legacy devices completely.Signed-off-by H. Nikolaus Schaller <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=16
Andreas Kemnade
maintainerRe: [PATCH 16/16] arm: omap2: remove remaining pdata-quirks for pandora legacy devices
In reply to H. Nikolaus SchallerQuoted 6 lines · On Sat, 11 Jul 2026 08:02:03 +0200 "H. Nikolaus Schaller" <[email protected]>…
After updating the pandora-backligt setup and removing the omap3pandora sound system and defining related gpios by device tree, we can remove
omap3_pandora_legacy_init()and the related legacy devices completely.Signed-off-by H. Nikolaus Schaller <[email protected]>
regarding bisectabily: Do we create mess, if the platform devices via quirks are disabled?
I am wondering how we handle this. If this patch goes together with the removal of the legacy drivers, then there might be a situation where neither the new one nor the old one is available? Split this all up?
If sound discussion takes longer, maybe do the backlight thing alone?
Regards,
Andreas
Quoted 48 lines
--- arch/arm/mach-omap2/pdata-quirks.c | 23 ----------------------- 1 file changed, 23 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-omap2/pdata-quirks.cindexb947bacf23a37..aca7097a692ed100644 ---a/arch/arm/mach-omap2/pdata-quirks.c+++b/arch/arm/mach-omap2/pdata-quirks.c@@ -268,27 +268,6 @@ static void__initomap3_logicpd_torpedo_init(void)omap3_gpio126_127_129();
}arch/arm/mach-omap2/pdata-quirks.c +0
-11-/* omap3pandora legacy devices */ - -static struct platform_device pandora_backlight = { - .name ="pandora-backlight" , - .id =-1 , -}; - -static struct gpiod_lookup_table pandora_soc_audio_gpios = { - .dev_id ="soc-audio" , - .table = { - GPIO_LOOKUP("gpio-112-127", 6, "dac",
GPIO_ACTIVE_HIGH),(quoted diff) +0
-1- GPIO_LOOKUP("gpio-0-15", 14, "amp",
GPIO_ACTIVE_HIGH),arch/arm/mach-omap2/pdata-quirks.c +0
-11- { } - }, -}; - -static void __init omap3_pandora_legacy_init (void ) -{ -platform_device_register (&pandora_backlight); -gpiod_add_lookup_table (&pandora_soc_audio_gpios); -}#endif /* CONFIG_ARCH_OMAP3 */ #ifdef CONFIG_SOC_DRA7XX @@ -514,8 +493,6 @@ static struct pdata_init pdata_quirks[] __initdata = { { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, { "ti,am3517-evm", am3517_evm_legacy_init, }, { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, }, - { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, }, - { "openpandora,omap3-pandora-1ghz",
omap3_pandora_legacy_init, }, #endif
{ /* sentinel */ },
};