ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks
Subsystems (18)
v2 cover ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks
PATCH V2 2026-11-24 08:26:00:
Changes in V2:
The series has been reworked and expanded from 16 to 20 patches, addressing review feedback and issues identified during hardware testing.
Audio and power management:
===========================
* Replace the TWL4030 REGEN regulator implementation with an optional GPIO and a fixed regulator described in Device Tree.
* Extend the existing PCM1754 codec driver to support the PCM1773 instead of introducing a separate codec driver.
* Add power supply and power-down GPIO support to the codec driver.
* Improve error handling, resource management and power sequencing in the codec and sound card drivers.
* Update the sound card and codec bindings and Device Tree nodes.
PWM and backlight:
==================
* Add optional 64-cycle frame support to the TWL4030 PWM driver.
* Add an optional enable guard period to the generic pwm-backlight driver to prevent the TPS61161 from inadvertently entering EasyScale mode.
* Adjust the Pandora PWM backlight configuration accordingly.
* Remove the obsolete CONFIG_BACKLIGHT_PANDORA option from omap2plus_defconfig.
Device Tree and general cleanup:
================================
* Correct and validate the affected Device Tree bindings.
* Reorder the series so that bindings and supporting drivers precede their Device Tree users.
* Improve commit messages and fix coding style issues.
* Clarify the original authorship and take responsibility for contributions previously signed off under a pseudonym.
Review feedback addressed:
==========================
* Mark Brown suggested representing TWL4030 REGEN as a GPIO rather than a regulator and reviewed the original standalone PCM1773 driver, which has been replaced by extending the PCM1754 driver.
* Krzysztof Kozlowski requested corrections to the Device Tree bindings, proper schema validation, improved commit messages and clarification of the original contributor's authorship.
* Andreas Kemnade suggested handling the TPS61161 initialization in the backlight layer. V2 implements this through a generic pwm-backlight enable guard period. His comments on clock modeling and patch bisectability were also considered.
* Daniel Thompson provided Reviewed-by for the original removal of the Pandora backlight driver.
* Issues identified by Sashiko and Rob Herring's automated DT validation were reviewed and addressed as applicable.
Many thanks to everyone who reviewed V1.
Validation and testing:
=======================
* Based on Linux v7.4-rc4.
* All 20 patches checked with checkpatch.pl.
* Remaining checkpatch warnings and intentional deviations have been reviewed. In particular, ENOTSUPP must be retained in the GPIO set_config callback because gpiolib handles it differently from EOPNOTSUPP.
* dt_binding_check and dtbs_check passed for all five affected Device Tree bindings.
* The complete series has been successfully built and tested on real OpenPandora hardware.
* LCD operation, PWM backlight brightness control including brightness zero and power-down, and audio playback through the internal speakers and headset have been verified.
* Audio capture was not tested.
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]>
H. Nikolaus Schaller (17):
dt-bindings: gpio: twl4030: Document REGEN GPIO
gpio: twl4030: Support REGEN GPIO
ASoC: twl4030: Allow APLL rate selection through set_sysclk()
dt-bindings: sound: pcm1754: Describe PCM1773
ASoC: codecs: pcm1754: Add PCM1773 support
dt-bindings: sound: Document OpenPandora sound card
dt-bindings: mfd: twl4030: Document 64-cycle PWM
pwm: twl: Support 64-cycle PWM frame
dt-bindings: backlight: pwm: Document enable guard
backlight: pwm: Support enable guard period drm/panel: td043mtea1: Attach DT backlight
ARM: dts: omap3pandora: Disable unused DMA channels
ARM: dts: omap3-pandora: Model LCD power enable dependencies
ARM: dts: omap3pandora: Describe PCM1773
ARM: dts: omap3pandora: Switch backlight to PWM
backlight: Remove legacy Pandora driver
ARM: OMAP2+: Remove Pandora platform-data quirks
Stefan Leichter (3):
ASoC: ti: omap3pandora: Convert sound card to DT
ARM: dts: omap3pandora: Enable audio interfaces
ARM: dts: omap3pandora: Describe sound card
.../bindings/gpio/ti,twl4030-gpio.yaml | 4 + .../leds/backlight/pwm-backlight.yaml | 20 + .../devicetree/bindings/mfd/ti,twl.yaml | 9 + .../sound/openpandora,omap3pandora-sound.yaml | 95 ++++ .../devicetree/bindings/sound/ti,pcm1754.yaml | 10 +- .../dts/ti/omap/omap3-pandora-common.dtsi | 123 ++++- arch/arm/configs/omap2plus_defconfig | 1 - arch/arm/mach-omap2/pdata-quirks.c | 23 - drivers/gpio/gpio-twl4030.c | 185 ++++++- drivers/gpu/drm/panel/panel-tpo-td043mtea1.c | 4 + drivers/pwm/pwm-twl.c | 37 ++ drivers/video/backlight/Kconfig | 7 - drivers/video/backlight/Makefile | 1 - drivers/video/backlight/pandora_bl.c | 159 ------ drivers/video/backlight/pwm_bl.c | 37 +- include/linux/mfd/twl.h | 3 + include/linux/mfd/twl4030-audio.h | 3 + include/linux/pwm_backlight.h | 1 + sound/soc/codecs/pcm1754.c | 122 ++++- sound/soc/codecs/twl4030.c | 142 ++++-- sound/soc/ti/omap3pandora.c | 452 ++++++++++++------ 21 files changed, 1016 insertions(+), 422 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml delete mode 100644 drivers/video/backlight/pandora_bl.c
Signature · 1 line
2.56.0
PATCH v2 1/20 dt-bindings: gpio: twl4030: Document REGEN GPIO
Document the optional ti,use-regen property for the TWL4030 GPIO controller. It exposes the REGEN power-management output through the GPIO controller so that device tree consumers can control it using a GPIO specifier.
The property is opt-in to preserve the existing GPIO numbering for systems that do not use REGEN as a GPIO.
---
Notes:
Changes against V1:
- Replaces the former REGEN regulator binding following Mark Brown's recommendation to model the control signal as a GPIO and Krzysztof Kozlowski's binding review.
- Expand the binding commit message to explain why REGEN exposure is opt-in and how consumers use it.
- Commit-message review assisted by ChatGPT.
Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml +4 -0
@@ -47,6 +47,10 @@ properties: type: boolean description: Enables LEDA and LEDB outputs if set + ti,use-regen: + type: boolean + description: Enables the REGEN output as a GPIO if set + additionalProperties: false examples:
Signature · 1 line
2.56.0
PATCH v2 2/20 gpio: twl4030: Support REGEN GPIO
In reply to H. Nikolaus SchallerAllow the TWL4030 GPIO controller to expose REGEN as an additional, output-only GPIO when enabled by the ti,use-regen device tree property.
Unlike the ordinary GPIO lines, REGEN is controlled through the TWL4030 power-management registers. Keep it optional so that existing users of the GPIO controller retain their GPIO numbering and behaviour.
---
Notes:
Changes against V1:
- Follow Mark Brown's V1 review of the regulator implementation:
REGEN is a control signal, not a voltage regulator.
- Clarify that REGEN is controlled by power-management registers and does not require enabling the GPIO module.
- Use WARN_ON_ONCE(true) for the impossible GPIO offset and clarify that LED and REGEN outputs cannot be inputs.
- Expand the commit message to describe the opt-in output-only GPIO.
- Reject unavailable LED offsets when only REGEN extends ngpio; do not report a successful GPIO request for reserved lines.
- Address checkpatch style findings (braces, wrapping and alignment).
- Ignore the checkpatch recommendation to use EOPNOTSUPP instead of ENOTSUPP in the GPIO set_config callback. Gpiolib treats ENOTSUPP as an unsupported optional configuration; EOPNOTSUPP propagates as an error and prevents fixed-regulator GPIO setup on Pandora.
- Code and commit-message review assisted by ChatGPT.
drivers/gpio/gpio-twl4030.c | 185 ++++++++++++++++++++++++++++++++---- include/linux/mfd/twl.h | 3 + 2 files changed, 169 insertions(+), 19 deletions(-)
drivers/gpio/gpio-twl4030.c +166 -19
@@ -37,6 +37,20 @@* There are also two LED pins used sometimes as output-only GPIOs. */ +#define TWL4030_GPIO_LED_A TWL4030_GPIO_MAX +#define TWL4030_GPIO_LED_B (TWL4030_GPIO_MAX + 1) +#define TWL4030_GPIO_REGEN (TWL4030_GPIO_MAX + 2) + +/* PM_RECEIVER: REGEN_DEV_GRP */ +#define TWL4030_REGEN_DEV_GRP 0x7f +#define TWL4030_REGEN_DEV_GRP_P1 BIT(5) +#define TWL4030_REGEN_DEV_GRP_P2 BIT(6) +#define TWL4030_REGEN_DEV_GRP_P3 BIT(7) + +/* POWERPM_RECEIVER: DC/DC_GLOBAL_CFG */ +#define TWL4030_DC_DC_GLOBAL_CFG 0x06 +#define TWL4030_REGEN_PU_DISABLE BIT(5) +/* genirq interfaces are not available to modules */ #ifdef MODULE #define is_module () true
@@ -136,6 +150,79 @@ static int twl4030_led_set_value(int led, int value) TWL4030_LED_LEDEN_REG); } +static int twl4030_regen_get (void ) +{ +u8 value; +int ret; + + ret =twl_i2c_read_u8 (TWL_MODULE_PM_RECEIVER , &value, +TWL4030_REGEN_DEV_GRP ); +if (ret <0 ) +return ret; + +return !!(value &TWL4030_REGEN_DEV_GRP_P1 ); +} + +static int twl4030_regen_set (int value) +{ +u8 reg; +int ret; + + ret =twl_i2c_read_u8 (TWL_MODULE_PM_RECEIVER , ®, +TWL4030_REGEN_DEV_GRP ); +if (ret <0 ) +return ret; + +if (value) + reg |=TWL4030_REGEN_DEV_GRP_P1 ; +else + reg &= ~(TWL4030_REGEN_DEV_GRP_P1 | +TWL4030_REGEN_DEV_GRP_P2 | +TWL4030_REGEN_DEV_GRP_P3 ); + +return twl_i2c_write_u8 (TWL_MODULE_PM_RECEIVER , reg, +TWL4030_REGEN_DEV_GRP ); +} + +static int twl4030_regen_set_pullup (bool enable) +{ +u8 value; +int ret; + + ret =twl_i2c_read_u8 (TWL_MODULE_PM_RECEIVER , &value, +TWL4030_DC_DC_GLOBAL_CFG ); +if (ret <0 ) +return ret; + +if (enable) + value &= ~TWL4030_REGEN_PU_DISABLE ; +else + value |=TWL4030_REGEN_PU_DISABLE ; + +return twl_i2c_write_u8 (TWL_MODULE_PM_RECEIVER , value, +TWL4030_DC_DC_GLOBAL_CFG ); +} + +static int twl4030_set_config (struct gpio_chip *chip, +unsigned int offset,unsigned long config) +{ +unsigned int param; + +if (offset !=TWL4030_GPIO_REGEN ) +return -ENOTSUPP ; + + param =pinconf_to_config_param (config); + +switch (param) { +case PIN_CONFIG_BIAS_PULL_UP : +return twl4030_regen_set_pullup (true); +case PIN_CONFIG_BIAS_DISABLE : +return twl4030_regen_set_pullup (false); +default : +return -ENOTSUPP ; + } +} +static int twl4030_set_gpio_direction (int gpio,int is_input) {u8 d_bnk = gpio >>3 ;
@@ -144,6 +231,9 @@ static int twl4030_set_gpio_direction(int gpio, int is_input)u8 base =REG_GPIODATADIR1 + d_bnk;int ret =0 ; +if (gpio >=TWL4030_GPIO_MAX ) +return -EINVAL ; + ret =gpio_twl4030_read (base);if (ret >=0 ) {if (is_input)
@@ -211,8 +301,16 @@ static int twl_request(struct gpio_chip *chip, unsigned offset)mutex_lock (&priv->mutex); +/* +* REGEN is controlled through the power-management registers +* and does not require enabling the GPIO module. +*/ +if (offset ==TWL4030_GPIO_REGEN ) + goto done; +/* Support the two LED outputs as output-only GPIOs. */ -if (offset >=TWL4030_GPIO_MAX ) { +if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) {u8 ledclr_mask =LEDEN_LEDAON |LEDEN_LEDAEXT |LEDEN_LEDAPWM |LEDEN_PWM_LENGTHA ;u8 reg =TWL4030_PWMAON_REG ;
@@ -249,6 +347,15 @@ static int twl_request(struct gpio_chip *chip, unsigned offset) goto done; } +/* +* Offsets 18/19 are reserved for the optional LEDs. If the LEDs +* aren't enabled, they must not be treated as LED GPIOs. +*/ +if (offset >=TWL4030_GPIO_MAX ) { + status = -EINVAL ; + goto done; + } +/* on first use, turn GPIO module "on" */ if (!priv->usage_count) {struct twl4030_gpio_platform_data *pdata;
@@ -277,8 +384,18 @@ static void twl_free(struct gpio_chip *chip, unsigned offset)struct gpio_twl4030_priv *priv =gpiochip_get_data (chip);mutex_lock (&priv->mutex); +if (offset ==TWL4030_GPIO_REGEN ) + goto out; + +if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) { +WARN_ON_ONCE (twl4030_led_set_value (offset - +TWL4030_GPIO_LED_A ,1 )); + goto out; + } +if (offset >=TWL4030_GPIO_MAX ) { -WARN_ON_ONCE (twl4030_led_set_value (offset -TWL4030_GPIO_MAX ,1 )); +WARN_ON_ONCE (true); goto out; }
@@ -301,7 +418,7 @@ static int twl_direction_in(struct gpio_chip *chip, unsigned offset)if (offset <TWL4030_GPIO_MAX ) ret =twl4030_set_gpio_direction (offset,1 );else - ret = -EINVAL ;/* LED outputs can't be set as input */ + ret = -EINVAL ;/* LED and REGEN outputs cannot be inputs */ if (!ret) priv->direction &= ~BIT (offset);
@@ -323,10 +440,14 @@ static int twl_get(struct gpio_chip *chip, unsigned offset) goto out; } -if (priv->direction &BIT (offset)) +if (offset ==TWL4030_GPIO_REGEN ) + status =twl4030_regen_get (); +else if (priv->direction &BIT (offset)) status = priv->out_state &BIT (offset); -else +else if (offset <TWL4030_GPIO_MAX ) status =twl4030_get_gpio_datain (offset); +else + status = -EINVAL ; ret = (status <0 ) ? status : !!status; out:
@@ -342,13 +463,20 @@ static int twl_set(struct gpio_chip *chip, unsigned int offset, int value)mutex_lock (&priv->mutex);if (offset <TWL4030_GPIO_MAX ) ret =twl4030_set_gpio_dataout (offset, value); +else if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) + ret =twl4030_led_set_value (offset -TWL4030_GPIO_LED_A , value); +else if (offset ==TWL4030_GPIO_REGEN ) + ret =twl4030_regen_set (value);else - ret =twl4030_led_set_value (offset -TWL4030_GPIO_MAX , value); + ret = -EINVAL ; -if (value) - priv->out_state |=BIT (offset); -else - priv->out_state &= ~BIT (offset); +if (!ret) { +if (value) + priv->out_state |=BIT (offset); +else + priv->out_state &= ~BIT (offset); + }mutex_unlock (&priv->mutex);
@@ -361,21 +489,29 @@ static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)int ret =0 ;mutex_lock (&priv->mutex); +if (offset <TWL4030_GPIO_MAX ) { ret =twl4030_set_gpio_direction (offset,0 ); -if (ret) { -mutex_unlock (&priv->mutex); -return ret; - } +if (ret) + goto out; + }else if (offset ==TWL4030_GPIO_REGEN ) { +/* REGEN is an output-only signal. */ + }else if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) { +/* LED GPIOs are output-only. */ + }else { + ret = -EINVAL ; + goto out; } -/* -* LED gpios i.e. offset >= TWL4030_GPIO_MAX are always output -*/ - priv->direction |=BIT (offset); + +out:mutex_unlock (&priv->mutex); +if (ret) +return ret; +return twl_set (chip, offset, value); }
@@ -395,7 +531,14 @@ static int twl_get_direction(struct gpio_chip *chip, unsigned offset)mutex_unlock (&priv->mutex);return ret; } + }else if (offset ==TWL4030_GPIO_REGEN || + (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B )) { + ret =GPIO_LINE_DIRECTION_OUT ; + }else { + ret = -EINVAL ; } +mutex_unlock (&priv->mutex);return ret;
@@ -420,6 +563,7 @@ static const struct gpio_chip template_chip = { .get_direction = twl_get_direction, .get = twl_get, .set = twl_set, + .set_config = twl4030_set_config, .to_irq = twl_to_irq, .can_sleep = true, };
@@ -478,6 +622,7 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) omap_twl_info->use_leds =of_property_read_bool (dev->of_node,"ti,use-leds" ); + omap_twl_info->use_regen =of_property_read_bool (dev->of_node,"ti,use-regen" );of_property_read_u32 (dev->of_node,"ti,debounce" , &omap_twl_info->debounce);
@@ -567,7 +712,9 @@ static int gpio_twl4030_probe(struct platform_device *pdev)* is (still) clear if use_leds is set. */ if (pdata->use_leds) - priv->gpio_chip.ngpio +=2 ; + priv->gpio_chip.ngpio =TWL4030_GPIO_LED_B +1 ; +if (pdata->use_regen) + priv->gpio_chip.ngpio =TWL4030_GPIO_REGEN +1 ; ret =devm_gpiochip_add_data (&pdev->dev, &priv->gpio_chip, priv);if (ret <0 ) {
include/linux/mfd/twl.h +3 -0
@@ -560,6 +560,9 @@ struct twl4030_gpio_platform_data {/* package the two LED signals as output-only GPIOs? */ bool use_leds; +/* Expose the REGEN signal as an output-only GPIO. */ +bool use_regen; +/* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ u8 mmc_cd;
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 02/20] gpio: twl4030: Support REGEN GPIO
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] gpio: twl4030: REGEN usage_count corruption breaks REG_GPIO_CTRL power control - [Medium] gpio…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] gpio: twl4030: REGEN usage_count corruption breaks REG_GPIO_CTRL power control
- [Medium] gpio: twl4030: unchecked use_leds in twl_request() exposes disabled LED GPIOs
--
commit 21b2429c7b13ebb306ae7f98703ac0b013d40ac3
Author: H. Nikolaus Schaller <[email protected]>
gpio: twl4030: Support REGEN GPIO
This commit adds optional support for exposing the TWL4030 REGEN control signal as an output-only GPIO when the ti,use-regen device tree property is present.
Quoted 4 lines
drivers/gpio/gpio-twl4030.c +0
-0
[ ... ]
Quoted 20 lines
drivers/gpio/gpio-twl4030.c +9
-1@@ -211,8 +301,16 @@ static int twl_request(struct gpio_chip *chip, unsigned offset)mutex_lock (&priv->mutex); +/* +* REGEN is controlled through the power-management registers +* and does not require enabling the GPIO module. +*/ +if (offset ==TWL4030_GPIO_REGEN ) + goto done; +/* Support the two LED outputs as output-only GPIOs. */ -if (offset >=TWL4030_GPIO_MAX ) { +if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) {u8 ledclr_mask =LEDEN_LEDAON |LEDEN_LEDAEXT |LEDEN_LEDAPWM |LEDEN_PWM_LENGTHA ;u8 reg =TWL4030_PWMAON_REG ;@@ -249,6 +347,15 @@ static int twl_request(struct gpio_chip *chip, unsigned offset) goto done;
drivers/gpio/gpio-twl4030.c static int twl_request(struct gpio_chip *chip, unsigned offset) · line 357
Quoted 10 lines
drivers/gpio/gpio-twl4030.c +8
-0} +/* +* Offsets 18/19 are reserved for the optional LEDs. If the LEDs +* aren't enabled, they must not be treated as LED GPIOs. +*/ +if (offset >=TWL4030_GPIO_MAX ) { + status = -EINVAL ; + goto done; + }
[Severity: Medium]
Can this offset >= TWL4030_GPIO_MAX check ever be reached, or does twl_request() still treat offsets 18 and 19 as valid LED GPIOs when ti,use-regen is enabled without ti,use-leds?
In gpio_twl4030_probe(), pdata->use_regen extends ngpio to TWL4030_GPIO_REGEN + 1 without recording whether pdata->use_leds is set. Because TWL4030_GPIO_LED_A and TWL4030_GPIO_LED_B are unconditionally matched right above this check (and TWL4030_GPIO_REGEN is handled at the top), requesting or driving offset 18 or 19 succeeds and reprograms the TWL4030_MODULE_LED registers even when ti,use-leds is not enabled.
Quoted 14 lines
drivers/gpio/gpio-twl4030.c +7
-0+/* on first use, turn GPIO module "on" */ if (!priv->usage_count) {struct twl4030_gpio_platform_data *pdata;@@ -277,8 +384,18 @@ static void twl_free(struct gpio_chip *chip, unsigned offset)struct gpio_twl4030_priv *priv =gpiochip_get_data (chip);mutex_lock (&priv->mutex); +if (offset ==TWL4030_GPIO_REGEN ) + goto out; + +if (offset >=TWL4030_GPIO_LED_A && + offset <=TWL4030_GPIO_LED_B ) { + WARN_ON_ONCE(twl4030_led_set_value(offset -
drivers/gpio/gpio-twl4030.c static void twl_free(struct gpio_chip *chip, unsigned offset) · line 401
Quoted 10 lines
drivers/gpio/gpio-twl4030.c +5
-1+ TWL4030_GPIO_LED_A, 1)); + goto out; + } +if (offset >=TWL4030_GPIO_MAX ) { -WARN_ON_ONCE (twl4030_led_set_value (offset -TWL4030_GPIO_MAX ,1 )); +WARN_ON_ONCE (true); goto out; }
[Severity: High]
Does jumping to done in twl_request() and out in twl_free() for TWL4030_GPIO_REGEN break REG_GPIO_CTRL power management via priv->usage_count?
In twl_request(), if (offset == TWL4030_GPIO_REGEN) goto done; skips enabling REG_GPIO_CTRL on first use, but done: still sets BIT(TWL4030_GPIO_REGEN) in priv->usage_count. If REGEN is requested before any regular GPIO (0..17), !priv->usage_count is already false when the first regular GPIO is requested, so REG_GPIO_CTRL is never written and the GPIO module stays powered off.
In twl_free(), if (offset == TWL4030_GPIO_REGEN) goto out; jumps past priv->usage_count &= ~BIT(offset);, leaving BIT(TWL4030_GPIO_REGEN) set forever once REGEN has been requested. As a result, freeing all regular GPIOs can never power down REG_GPIO_CTRL, and twl_get() continues to treat REGEN as requested after it is freed.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v2 3/20 ASoC: twl4030: Allow APLL rate selection through set_sysclk()
In reply to H. Nikolaus SchallerThe TWL4030 APLL supplies the audio clocks used by the Pandora sound card, including playback through an external DAC. Playback does not necessarily execute the TWL4030 codec's hw_params() callback, which previously provided the APLL rate selection.
Allow the machine driver to select the APLL rate through set_sysclk() so that the clock can be configured for playback-only streams.
---
Notes:
Changes against V1:
- Andreas Kemnade suggested modeling the APLL as a clock provider to enable a generic audio card; V2 retains the ASoC set_sysclk() interface instead. This alternative was not implemented.
- Clarify in the commit message why playback-only streams require an explicit APLL clock-selection interface.
- Take over patch authorship because Grond cannot be reached to confirm a full name or Signed-off-by. Credit the historical contribution with Suggested-by rather than asserting code authorship or a DCO sign-off.
- Historical source: commit 5497d5a29f53 (Grond, 2021-12-15), "ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface". The present patch is derived from this implementation, with subsequent revisions.
- Code and commit-message review assisted by ChatGPT.
include/linux/mfd/twl4030-audio.h | 3 + sound/soc/codecs/twl4030.c | 142 +++++++++++++++++++++--------- 2 files changed, 103 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 +100 -42
181 lines not on this page · raw message
Signature · 1 line
2.56.0
PATCH v2 4/20 dt-bindings: sound: pcm1754: Describe PCM1773
In reply to H. Nikolaus SchallerExtend the PCM1754 device tree binding to describe the related PCM1773 stereo DAC.
Add the ti,pcm1773 compatible string and an optional enable-gpios property for the PCM1773 power-down input. The format-gpios property selects the hardware audio format.
---
Notes:
Changes against V1:
- The standalone PCM1773 binding from V1 was replaced by an extension of the existing PCM1754 binding. Address Krzysztof Kozlowski's request to use current bindings and validate the schema, as well as the DT validation failures reported by Rob Herring's bot.
- Add the rationale for the compatible and optional enable GPIO to the commit message.
- Commit-message review assisted by ChatGPT.
.../devicetree/bindings/sound/ti,pcm1754.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/ti,pcm1754.yaml +8 -2
@@ -4,10 +4,10 @@ $id: http://devicetree.org/schemas/sound/ti,pcm1754.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Texas Instruments PCM1754 Stereo DAC +title: Texas Instruments PCM1754/PCM1773 Stereo DAC description: - The PCM1754 is a simple stereo DAC that is controlled via hardware gpios. + The PCM1754 and PCM1773 are stereo DACs controlled through hardware pins. maintainers: - Stefan Kerkmann <[email protected]>
@@ -19,12 +19,18 @@ properties: compatible: enum: - ti,pcm1754 + - ti,pcm1773 vcc-supply: true '#sound-dai-cells': const: 0 + enable-gpios: + maxItems: 1 + description: + GPIO used to control the PCM1773 power-down input (/PD) + format-gpios: maxItems: 1 description:
Signature · 1 line
2.56.0
Mark Brown
maintainerRe: [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773
Quoted 2 lines · H. Nikolaus Schaller
Extend the PCM1754 device tree binding to describe the related PCM1773 stereo DAC.
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Re: [Letux-kernel] [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773
Hi Mark,
Quoted 11 lines
Am 24.11.2026 um 13:05 schrieb Mark Brown <[email protected]>:
Quoted 2 lines · H. Nikolaus Schaller
Extend the PCM1754 device tree binding to describe the related PCM1773 stereo DAC.
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Agreed. Should become
ASoC: dt-bindings: ti,pcm1754:
Unfortunately there is no tool to find this (neither checkpatch, Sashiko-Bot, nor ChatGPT did report it before submission and I didn't think of checking again).
BR and thanks,
Nikolaus
PATCH v2 5/20 ASoC: codecs: pcm1754: Add PCM1773 support
In reply to H. Nikolaus SchallerExtend the PCM1754 codec driver to support the related PCM1773 DAC. Select the DAI name, supported formats and sample rate limits per variant. Handle the different FMT pin polarity and an optional format GPIO, avoiding GPIO writes when the format pin is not controlled by the driver. Add an optional enable GPIO for the PCM1773 power-down input, controlled by a DAPM supply event to enable the DAC after power-up and disable it before power-down.
Keep the DAI operations instance-specific so that different variants cannot overwrite each other's selectable formats.
---
Notes:
Changes against V1:
- The standalone PCM1773 driver reviewed by Mark Brown in V1 was abandoned. His comments concerned error handling, comment style and the distinction between memory and wire sample formats. V2 extends the existing PCM1754 driver instead.
- Keep the per-instance DAI operations and variant-specific format handling described explicitly in the commit message.
- Original PCM1773 implementation: bdcb6cad6be3 (Grond, 2021-12-15, original commit timezone -0800). The present patch adapts that work to the existing upstream PCM1754 driver.
- Suggested-by acknowledges the historical contribution without asserting a new DCO sign-off from Grond.
- Code and commit-message review assisted by ChatGPT.
sound/soc/codecs/pcm1754.c | 122 +++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 25 deletions(-)
sound/soc/codecs/pcm1754.c +97 -25
@@ -6,6 +6,7 @@* Copyright (c) 2025 Stefan Kerkmann <[email protected]> */ +#include <linux/delay.h> #include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/regulator/consumer.h>
@@ -13,10 +14,35 @@#include <sound/pcm_params.h> #include <sound/soc.h> +struct pcm1754_variant { +const char *dai_name; +unsigned int rate_min; +unsigned int rate_max; +u64 selectable_formats; +}; +struct pcm1754_priv {unsigned int format;struct gpio_desc *gpiod_mute;struct gpio_desc *gpiod_format; +struct gpio_desc *gpiod_enable; +const struct pcm1754_variant *variant; +}; + +static const struct pcm1754_variant pcm1754_variant = { + .dai_name ="pcm1754" , + .rate_min =5000 , + .rate_max =200000 , + .selectable_formats =SND_SOC_POSSIBLE_DAIFMT_I2S | +SND_SOC_POSSIBLE_DAIFMT_RIGHT_J , +}; + +static const struct pcm1754_variant pcm1773_variant = { + .dai_name ="pcm1773" , + .rate_min =8000 , + .rate_max =48000 , + .selectable_formats =SND_SOC_POSSIBLE_DAIFMT_I2S | +SND_SOC_POSSIBLE_DAIFMT_LEFT_J , }; static int pcm1754_set_dai_fmt(struct snd_soc_dai *codec_dai,
@@ -40,31 +66,29 @@ static int pcm1754_hw_params(struct snd_pcm_substream *substream,switch (priv->format &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_RIGHT_J : -switch (params_width (params)) { -case 16 : - format =1 ; -break ; -default : +if (priv->variant != &pcm1754_variant || +params_width (params) !=16 )return -EINVAL ; - } + format =1 ; +break ; +case SND_SOC_DAIFMT_LEFT_J : +if (priv->variant != &pcm1773_variant || + (params_width (params) !=16 &¶ms_width (params) !=24 )) +return -EINVAL ; + format =0 ;break ;case SND_SOC_DAIFMT_I2S : -switch (params_width (params)) { -case 16 : - fallthrough; -case 24 : - format =0 ; -break ; -default : +if (params_width (params) !=16 &¶ms_width (params) !=24 )return -EINVAL ; - } + format = priv->variant == &pcm1773_variant ?1 :0 ;break ;default :dev_err (component->dev,"Invalid DAI format\n" );return -EINVAL ; } -gpiod_set_value_cansleep (priv->gpiod_format, format); +if (priv->gpiod_format) +gpiod_set_value_cansleep (priv->gpiod_format, format);return 0 ; }
@@ -73,23 +97,41 @@ static int pcm1754_mute_stream(struct snd_soc_dai *dai, int mute, int stream) {struct pcm1754_priv *priv =snd_soc_component_get_drvdata (dai->component); -gpiod_set_value_cansleep (priv->gpiod_mute, mute); +if (priv->gpiod_mute) +gpiod_set_value_cansleep (priv->gpiod_mute, mute);return 0 ; } -static const u64 pcm1754_selectable_formats = -SND_SOC_POSSIBLE_DAIFMT_I2S | -SND_SOC_POSSIBLE_DAIFMT_RIGHT_J ; -static const struct snd_soc_dai_ops pcm1754_dai_ops = { .set_fmt = pcm1754_set_dai_fmt, .hw_params = pcm1754_hw_params, .mute_stream = pcm1754_mute_stream, - .auto_selectable_formats = &pcm1754_selectable_formats, - .num_auto_selectable_formats =1 , }; +static int pcm1754_enable_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_component *component =snd_soc_dapm_to_component (w->dapm); +struct pcm1754_priv *priv =snd_soc_component_get_drvdata (component); + +if (!priv->gpiod_enable) +return 0 ; + +switch (event) { +case SND_SOC_DAPM_POST_PMU : +usleep_range (1000 ,2000 ); +gpiod_set_value_cansleep (priv->gpiod_enable,1 ); +break ; +case SND_SOC_DAPM_PRE_PMD : +gpiod_set_value_cansleep (priv->gpiod_enable,0 ); +usleep_range (1000 ,2000 ); +break ; + } + +return 0 ; +} +static const struct snd_soc_dai_driver pcm1754_dai = { .name ="pcm1754" , .playback = {
@@ -106,6 +148,9 @@ static const struct snd_soc_dai_driver pcm1754_dai = {static const struct snd_soc_dapm_widget pcm1754_dapm_widgets[] = {SND_SOC_DAPM_REGULATOR_SUPPLY ("VCC" ,0 ,0 ), +SND_SOC_DAPM_SUPPLY ("Enable" ,SND_SOC_NOPM ,0 ,0 , + pcm1754_enable_event, +SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ),SND_SOC_DAPM_DAC ("DAC1" ,"Channel 1 Playback" ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_DAC ("DAC2" ,"Channel 2 Playback" ,SND_SOC_NOPM ,0 ,0 ),
@@ -118,8 +163,9 @@ static const struct snd_soc_dapm_route pcm1754_dapm_routes[] = { { "DAC1", NULL, "Playback" }, { "DAC2", NULL, "Playback" }, - { "DAC1", NULL, "VCC" }, - { "DAC2", NULL, "VCC" }, + { "DAC1", NULL, "Enable" }, + { "DAC2", NULL, "Enable" }, + { "Enable", NULL, "VCC" }, { "VOUTL", NULL, "DAC1" }, { "VOUTR", NULL, "DAC2" },
@@ -137,8 +183,14 @@ static int pcm1754_probe(struct platform_device *pdev)struct pcm1754_priv *priv;struct device *dev = &pdev->dev;struct snd_soc_dai_driver *dai_drv; +struct snd_soc_dai_ops *dai_ops; +const struct pcm1754_variant *variant;int ret; + variant =device_get_match_data (dev); +if (!variant) +return -ENODEV ; + dai_drv =devm_kmemdup (dev, &pcm1754_dai,sizeof (*dai_drv),GFP_KERNEL );if (!dai_drv)return -ENOMEM ;
@@ -147,6 +199,8 @@ static int pcm1754_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; + priv->variant = variant; + priv->gpiod_mute =devm_gpiod_get_optional (dev,"mute" ,GPIOD_OUT_HIGH );if (IS_ERR (priv->gpiod_mute)) return dev_err_probe(dev, PTR_ERR(priv->gpiod_mute),
@@ -157,6 +211,23 @@ static int pcm1754_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (priv->gpiod_format),"failed to get format gpio" ); + priv->gpiod_enable =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW ); +if (IS_ERR (priv->gpiod_enable)) +return dev_err_probe (dev,PTR_ERR (priv->gpiod_enable), +"failed to get enable gpio" ); + + dai_ops =devm_kmemdup (dev, &pcm1754_dai_ops, +sizeof (*dai_ops),GFP_KERNEL ); +if (!dai_ops) +return -ENOMEM ; + + dai_ops->auto_selectable_formats = &variant->selectable_formats; + dai_ops->num_auto_selectable_formats =1 ; + dai_drv->ops = dai_ops; + dai_drv->name = variant->dai_name; + dai_drv->playback.rate_min = variant->rate_min; + dai_drv->playback.rate_max = variant->rate_max; +dev_set_drvdata (dev, priv); ret = devm_snd_soc_register_component(
@@ -169,7 +240,8 @@ static int pcm1754_probe(struct platform_device *pdev)#ifdef CONFIG_OF static const struct of_device_id pcm1754_of_match[] = { - { .compatible ="ti,pcm1754" }, + { .compatible ="ti,pcm1754" , .data = &pcm1754_variant }, + { .compatible ="ti,pcm1773" , .data = &pcm1773_variant }, { } };MODULE_DEVICE_TABLE (of, pcm1754_of_match);
Signature · 1 line
2.56.0
Mark Brown
maintainerRe: [PATCH v2 05/20] ASoC: codecs: pcm1754: Add PCM1773 support
Quoted 8 lines
Extend the PCM1754 codec driver to support the related PCM1773 DAC. Select the DAI name, supported formats and sample rate limits per variant. Handle the different FMT pin polarity and an optional format GPIO, avoiding GPIO writes when the format pin is not controlled by the driver. Add an optional enable GPIO for the PCM1773 power-down input, controlled by a DAPM supply event to enable the DAC after power-up and disable it before power-down.
sound/soc/codecs/pcm1754.c static int pcm1754_hw_params(struct snd_pcm_substream *substream, · line 79
Quoted 6 lines
sound/soc/codecs/pcm1754.c +5
-0+case SND_SOC_DAIFMT_LEFT_J : +if (priv->variant != &pcm1773_variant || + (params_width (params) !=16 &¶ms_width (params) !=24 )) +return -EINVAL ; + format =0 ;break ;
If you've got a struct describing the variant it is obviously not tasteful to open code a check based on the address of the variant struct rather than looking at something inside the description of the variant.
Signature · 1 line
Mark Brown <[email protected]>
PATCH v2 6/20 dt-bindings: sound: Document 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.
---
Notes:
Changes against V1:
- Address Krzysztof Kozlowski's V1 request to run the documented DT schema checks and fix the errors reported by Rob Herring's automated DT validation.
- Update the binding example and schema during DT consistency review.
- Binding and commit-message review assisted by ChatGPT.
.../sound/openpandora,omap3pandora-sound.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +95 -0
@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/openpandora,omap3pandora-sound.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +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 + + 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 { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable", + "DAC2", "APLL Enable", + "Headphone Amplifier", "VOUTL", + "Headphone Amplifier", "VOUTR", + "Line Out", "VOUTL", + "Line Out", "VOUTR", + "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.56.0
[email protected]
AI reviewRe: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] dt-bindings: sound: openpandora sound-dai omits mcbsp4 and twl4030 DAIs - [Low] dt-bindings…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] dt-bindings: sound: openpandora sound-dai omits mcbsp4 and twl4030 DAIs
- [Low] dt-bindings: sound: openpandora sound-dai lacks per-entry items list
- [Low] dt-bindings: sound: openpandora example has status property and wrong order
--
commit a7d9248344c1d8736a83ed4cfd8b21aad87db0cb
Author: H. Nikolaus Schaller <[email protected]>
dt-bindings: sound: Document OpenPandora sound card
This commit adds a Device Tree binding schema for the OpenPandora OMAP3 audio subsystem connecting OMAP3 McBSP, the PCM1773 DAC, and the TWL4030 codec.
Quoted 5 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 37
Quoted 6 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +6
-0+ 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.
[Severity: Low]
Should sound-dai define an items list with a per-entry description for each phandle instead of using minItems/maxItems with a free-form description?
[ ... ]
Quoted 9 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +9
-0+examples: + - | + #include <dt-bindings/gpio/gpio.h> + + sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora";
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 77
Quoted 10 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +10
-0+ + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)";
[Severity: Low]
DT binding examples normally omit status = "okay", and the property order in the example node (widgets, routing, sound-dai) does not match the order declared under properties: in the schema (sound-dai, routing, widgets).
Quoted 8 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +8
-0+ + routing = + "DAC1", "APLL Enable", + "DAC2", "APLL Enable", + "Headphone Amplifier", "VOUTL", + "Headphone Amplifier", "VOUTR", + "Line Out", "VOUTL", + "Line Out", "VOUTR",
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 95
Quoted 10 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +10
-0+ "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>; + };
[Severity: Medium]
Does constraining sound-dai to two phandles omit the second DAI link for OMAP3 McBSP4 and the TWL4030 codec?
The OpenPandora audio complex (sound/soc/ti/omap3pandora.c) uses two DAI
links: McBSP2 connected to the PCM1773 DAC for playback, and McBSP4 connected to the TWL4030 codec for capture and APLL clocking. The schema description and the example routing table both include the TWL4030 widgets (APLL Enable, AUXL, AUXR, MAINMIC, SUBMIC, Mic Bias 1, Mic Bias 2), but sound-dai only allows two entries and lists only <&mcbsp2> and <&dac>.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Rob Herring
maintainerRe: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
Quoted 34 lines · On Tue, Nov 24, 2026 at 07:40:31AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] dt-bindings: sound: openpandora sound-dai omits mcbsp4 and twl4030 DAIs
- [Low] dt-bindings: sound: openpandora sound-dai lacks per-entry items list
- [Low] dt-bindings: sound: openpandora example has status property and wrong order
--commit
a7d9248344c1d8736a83ed4cfd8b21aad87db0cb
Author: H. Nikolaus Schaller <[email protected]>dt-bindings: sound: Document OpenPandora sound card
This commit adds a Device Tree binding schema for the OpenPandora OMAP3 audio subsystem connecting OMAP3 McBSP, the PCM1773 DAC, and the TWL4030 codec.
Quoted 5 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +0
-0[ ... ]
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 37
Quoted 6 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +6
-0+ 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.
Quoted 4 lines
[Severity: Low]
Should sound-dai define an items list with a per-entry description for each phandle instead of using minItems/maxItems with a free-form description?
This would be why you broke everyone else. sound-dai already has a type.
Quoted 20 lines
[ ... ]
Quoted 17 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +17
-0+examples: + - | + #include <dt-bindings/gpio/gpio.h> + + sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack",
Quoted 8 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 77
Quoted 2 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +2
-0+ "Microphone", "Mic (internal)", + "Microphone", "Mic (external)";[Severity: Low]
DT binding examples normally omit status = "okay", and the property order in the example node (widgets, routing, sound-dai) does not match the order declared under properties: in the schema (sound-dai, routing, widgets).
Also correct comments.
Rob
Mark Brown
maintainerRe: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
In reply to H. Nikolaus SchallerQuoted 3 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.
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Rob Herring (Arm)
maintainerRe: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
In reply to H. Nikolaus SchallerQuoted 15 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]>---
Notes:
Changes against V1:
- Address Krzysztof Kozlowski's V1 request to run the documented DT schema checks and fix the errors reported by Rob Herring's automated DT validation.
- Update the binding example and schema during DT consistency review.
- Binding and commit-message review assisted by ChatGPT.
Quoted 4 lines
.../sound/openpandora,omap3pandora-sound.yaml | 95 +++++++++++++++++++ 1 file changed, 95 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:
dtschema/dtc warnings/errors:Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): primary-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): quaternary-dai-link:cpu:sound-dai: [[4294967295],[3]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): tertiary-dai-link:cpu:sound-dai: [[4294967295],[2]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,msm8916-qdsp6-sndcard): mm1-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,msm8916-qdsp6-sndcard): primary-dai-link:cpu:sound-dai: [[4294967295],[16]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/samsung,snow.example.dtb: sound (google,snow-audio-max98095): codec:sound-dai: [[4294967295],[0],[4294967295]] has more than 2 items
from schema $id: http://devicetree.org/schemas/sound/samsung,snow.yamlDocumentation/devicetree/bindings/sound/samsung,snow.example.dtb: sound (google,snow-audio-max98095): cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/samsung,snow.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@0:cpu:sound-dai: [[1],[16]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu:sound-dai: [[1],[17]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:cpu:sound-dai: [[1],[18]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/mediatek,mt8173-rt5650.example.dtb: sound (mediatek,mt8173-rt5650): codec-capture:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/mediatek,mt8173-rt5650.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu@0:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu@1:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@0:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:codec:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-0:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-1:sound-dai: [[4294967295],[2]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-2:sound-dai: [[4294967295],[3]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-3:sound-dai: [[4294967295],[4]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:codec:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:cpu:sound-dai: [[4294967295],[5]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): hdmi-dai-link:cpu:sound-dai: [[4294967295],[20]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm1-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm2-dai-link:cpu:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm3-dai-link:cpu:sound-dai: [[4294967295],[2]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): usb-dai-link:cpu:sound-dai: [[4294967295],[136]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): va-dai-link:cpu:sound-dai: [[4294967295],[110]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): wsa-dai-link:cpu:sound-dai: [[4294967295],[105]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@0:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@1:cpu:sound-dai: [[4294967295],[1]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@2:cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yaml
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 v2 06/20] dt-bindings: sound: Document OpenPandora sound card
Hi Rob,
Quoted 105 lines
Am 24.11.2026 um 14:35 schrieb Rob Herring (Arm) <[email protected]>:
Quoted 15 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]>---
Notes:
Changes against V1:
- Address Krzysztof Kozlowski's V1 request to run the documented DT schema checks and fix the errors reported by Rob Herring's automated DT validation.
- Update the binding example and schema during DT consistency review.
- Binding and commit-message review assisted by ChatGPT.Quoted 4 lines
.../sound/openpandora,omap3pandora-sound.yaml| 95 +++++++++++++++++++1 file changed, 95 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yamlMy bot found errors running 'make
dt_binding_check' on your patch:yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): primary-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): quaternary-dai-link:cpu:sound-dai: [[4294967295],[3]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,apq8016-sbc-sndcard): tertiary-dai-link:cpu:sound-dai: [[4294967295],[2]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,msm8916-qdsp6-sndcard): mm1-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.example.dtb: sound@7702000 (qcom,msm8916-qdsp6-sndcard): primary-dai-link:cpu:sound-dai: [[4294967295],[16]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,apq8016-sbc-sndcard.yamlDocumentation/devicetree/bindings/sound/samsung,snow.example.dtb: sound (google,snow-audio-max98095): codec:sound-dai: [[4294967295],[0],[4294967295]] has more than 2 items from schema $id: http://devicetree.org/schemas/sound/samsung,snow.yamlDocumentation/devicetree/bindings/sound/samsung,snow.example.dtb: sound (google,snow-audio-max98095): cpu:sound-dai: [[4294967295],[0]] has more than 1 item
from schema $id: http://devicetree.org/schemas/sound/samsung,snow.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@0:cpu:sound-dai: [[1],[16]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu:sound-dai: [[1],[17]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/fsl,qmc-audio.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:cpu:sound-dai: [[1],[18]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/mediatek,mt8173-rt5650.example.dtb: sound (mediatek,mt8173-rt5650): codec-capture:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/mediatek,mt8173-rt5650.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu@0:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,cpu@1:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@0:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:codec:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-0:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-1:sound-dai: [[4294967295],[2]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-2:sound-dai: [[4294967295],[3]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@1:cpu-3:sound-dai: [[4294967295],[4]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:codec:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/simple-card.example.dtb: sound (simple-audio-card): simple-audio-card,dai-link@2:cpu:sound-dai: [[4294967295],[5]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/simple-card.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): hdmi-dai-link:cpu:sound-dai: [[4294967295],[20]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm1-dai-link:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm2-dai-link:cpu:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): mm3-dai-link:cpu:sound-dai: [[4294967295],[2]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): usb-dai-link:cpu:sound-dai: [[4294967295],[136]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): va-dai-link:cpu:sound-dai: [[4294967295],[110]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/qcom,sm8250.example.dtb: sound (qcom,qrb5165-rb5-sndcard): wsa-dai-link:cpu:sound-dai: [[4294967295],[105]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/qcom,sm8250.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@0:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@1:cpu:sound-dai: [[4294967295],[1]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yamlDocumentation/devicetree/bindings/sound/google,sc7180-trogdor.example.dtb: sound (google,sc7180-trogdor): dai-link@2:cpu:sound-dai: [[4294967295],[0]] has more than 1 item from schema $id: http://devicetree.org/schemas/sound/google,sc7180-trogdor.yamldoc 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:
Quoted 5 lines
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that
DT_SCHEMA_FILEScan be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
To no unset the file list was the mistake and why I haven't seen these reports.
BR and thanks,
Nikolaus
Quoted 1 line
Re: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
In reply to H. Nikolaus SchallerDocumentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 19
Quoted 8 lines · H. Nikolaus Schaller
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +8
-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
openpandora,omap3-pandora-sound
(add hyphen) to match other style?
Quoted 27 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +27
-0+ + 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:
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +10
-0+ $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 +
allOf with $ref to sound-card-common.yaml and you can drop routing property.
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 65
Quoted 9 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +9
-0+additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay";
Drop
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 73
Quoted 8 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +8
-0+ + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out",
Join these two lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 80
Quoted 7 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +7
-0+ "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable",
As well
Best regards,
Krzysztof
Re: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
Hi Krzysztof,
Quoted 14 lines
Am 24.11.2026 um 15:45 schrieb Krzysztof Kozlowski <[email protected]>:
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 19
Quoted 8 lines · H. Nikolaus Schaller
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +8
-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-soundopenpandora,omap3-pandora-sound
Quoted 1 line
(add hyphen) to match other style?
Yes, that is a good idea.
Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +31
-0+ + 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
Quoted 8 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 56
Quoted 6 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +6
-0+ (e.g., "Speaker", "Headphone", "Microphone", "Line") and the second being its name. + +required: + - compatible + - sound-dai +allOf with $ref to
sound-card-common.yamland you can drop routing property.
Ok.
Quoted 12 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +9
-0+additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay";Drop
Ok.
Quoted 11 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 73
Quoted 9 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +8
-0+ + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out",Join these two lines
Ok, increases readability.
Quoted 9 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml line 80
Quoted 8 lines
Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +7
-0+ "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable",
Quoted 5 lines
As well
Best regards,
Krzysztof
BR and thanks,
Nikolaus
Andreas Kemnade
maintainerRe: [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card
In reply to H. Nikolaus SchallerQuoted 4 lines · On Tue, 24 Nov 2026 08:25:46 +0100 "H. Nikolaus Schaller" <[email protected]>…
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.
I think at least in some commit message should be commented why such an interface is needed and the generic sound cards are not sufficient, also as a starting point to recheck that later if these reasons are still valid.
Regards,
Andreas
Quoted 116 lines
Signed-off-by H. Nikolaus Schaller <[email protected]>---
Notes:
Changes against V1:
- Address Krzysztof Kozlowski's V1 request to run the documented DT schema checks and fix the errors reported by Rob Herring's automated DT validation.
- Update the binding example and schema during DT consistency review.
- Binding and commit-message review assisted by ChatGPT..../sound/openpandora,omap3pandora-sound.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yamlDocumentation/devicetree/bindings/sound/openpandora,omap3pandora-sound.yaml new file +95
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/openpandora,omap3pandora-sound.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +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 + + 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 { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable", + "DAC2", "APLL Enable", + "Headphone Amplifier", "VOUTL", + "Headphone Amplifier", "VOUTR", + "Line Out", "VOUTL", + "Line Out", "VOUTR", + "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>; + };
PATCH v2 7/20 ASoC: ti: omap3pandora: Convert sound card to DT
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
Convert the OpenPandora ASoC machine driver to bind through a Device Tree sound-card node instead of creating a platform device from board- specific setup code. Describe the CPU and codec DAIs and audio routes through DT, including the external PCM1773 playback DAC.
Move the audio paths from the machine driver's hard-coded DAPM routes to the Device Tree, and replace pr_info()/pr_err() diagnostics with device-scoped dev_info()/dev_err() messages.
Separate playback and capture handling and use the TWL4030 APLL clock selection interface for the audio clocks. Use device-managed resource allocation and card registration where possible.
This removes the machine-type-dependent sound-card registration and allows the card to probe only when described by the Device Tree.
---
Notes:
Changes against V1:
- Review Sashiko's V1 findings about stream rate accounting, sample-rate constraints, resource lifetime and DT DAI linking.
- Rewrite the commit message to describe the DT conversion and associated resource management without informal wording.
- Credit Grond's historical contribution as Suggested-by; no current code authorship or DCO sign-off is asserted on Grond's behalf.
- Original DT conversion: 1532a508d5ab (Stefan Leichter, 2020-06-29); Grond was credited as co-developer in that commit.
- Suggested-by preserves historical credit without asserting a renewed DCO sign-off from Grond.
- Preserve existing sample-rate ownership when a repeated hw_params() fails; release only reservations acquired by that invocation.
- Restore the missing int ret context line in the first diff hunk against Linux 7.4-rc3. This fixes git am applicability without changing the resulting source.
- Code and commit-message review assisted by ChatGPT.
sound/soc/ti/omap3pandora.c | 452 +++++++++++++++++++++++++----------- 1 file changed, 315 insertions(+), 137 deletions(-)
sound/soc/ti/omap3pandora.c +315 -137
@@ -6,138 +6,274 @@*/ #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; + +struct mutex sample_rate_lock;// protects all fields after +unsigned int sample_rate; +int sample_rate_users; +}; -static struct regulator *omap3pandora_dac_reg; -static struct gpio_desc *dac_power_gpio; -static struct gpio_desc *amp_power_gpio; +static struct snd_soc_dai_link omap3pandora_dai[]; -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 ); +__maybe_unused 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); +} + +/* The McBSP playback and capture interfaces share the TWL4030 APLL. */ +static int grab_sample_rate (struct omap3pandora_sound *ctx, +struct snd_pcm_substream **owner, +struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +bool *new_owner) +{ +unsigned int rate =params_rate (params); +int ret =0 ; + + *new_owner = false; +mutex_lock (&ctx->sample_rate_lock); +if (*owner == substream) { +if (ctx->sample_rate != rate) + ret = -EINVAL ; + }else if (*owner || (ctx->sample_rate_users && + ctx->sample_rate != rate)) { + ret = -EINVAL ; + }else { + ctx->sample_rate = rate; + ctx->sample_rate_users++; + *owner = substream; + *new_owner = true; + } +mutex_unlock (&ctx->sample_rate_lock); + +return ret; +} + +static void release_sample_rate (struct omap3pandora_sound *ctx, +struct snd_pcm_substream **owner, +struct snd_pcm_substream *substream) +{ +mutex_lock (&ctx->sample_rate_lock); +if (*owner == substream) { + *owner =NULL ; +if (WARN_ON_ONCE (!ctx->sample_rate_users)) + goto out; +if (!--ctx->sample_rate_users) + ctx->sample_rate =0 ; + } +out: +mutex_unlock (&ctx->sample_rate_lock); +} + +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 ; +bool new_owner;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 ; } + ret =grab_sample_rate (ctx, &ctx->playback_stream, substream, + params, &new_owner); +if (ret) +return ret; + + 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); + goto err_release; + } + + ret =omap3pandora_common_hw_params (substream, params); +if (ret) + goto err_release;return 0 ; + +err_release: +if (new_owner) +release_sample_rate (ctx, &ctx->playback_stream, substream); +return ret; } -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) { -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_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); +bool new_owner; +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; + } + + ret =grab_sample_rate (ctx, &ctx->capture_stream, substream, + params, &new_owner); +if (ret) +return ret; + + ret =omap3pandora_common_hw_params (substream, params); +if (ret) + goto err_release;return 0 ; + +err_release: +if (new_owner) +release_sample_rate (ctx, &ctx->capture_stream, substream); +return ret; } -/* -* 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_playback_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); -SND_SOC_DAPM_MIC ("Mic (internal)" ,NULL ), -SND_SOC_DAPM_MIC ("Mic (external)" ,NULL ), -SND_SOC_DAPM_LINE ("Line In" ,NULL ), -}; +release_sample_rate (ctx, &ctx->playback_stream, substream); -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 0 ; +} - {"AUXL" ,NULL ,"Line In" }, - {"AUXR" ,NULL ,"Line In" }, +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; - {"MAINMIC" ,NULL ,"Mic (internal)" }, - {"Mic (internal)" ,NULL ,"Mic Bias 1" }, +mutex_lock (&ctx->sample_rate_lock); + sample_rate = ctx->sample_rate; +mutex_unlock (&ctx->sample_rate_lock); - {"SUBMIC" ,NULL ,"Mic (external)" }, - {"Mic (external)" ,NULL ,"Mic Bias 2" }, -}; +if (!sample_rate) +return 0 ; + +return constrain_sample_rate (substream, sample_rate); +} + +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); + +release_sample_rate (ctx, &ctx->capture_stream, substream); + +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 +307,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" )),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" )), +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 +348,122 @@ 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 void omap3pandora_destroy_mutex (void *data) { -int ret; +struct omap3pandora_sound *ctx = data; -if (!of_machine_is_compatible ("openpandora,omap3-pandora-600mhz" ) && - !of_machine_is_compatible ("openpandora,omap3-pandora-1ghz" )) -return -ENODEV ; +mutex_destroy (&ctx->sample_rate_lock); +} -pr_info ("OMAP3 Pandora SoC init\n" ); +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; - 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 =devm_add_action_or_reset (dev, omap3pandora_destroy_mutex, ctx); +if (ret) +return ret; - 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; - 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; +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); +return ret; + } + + ret =snd_soc_of_parse_audio_routing (card,"routing" ); +if (ret) { +dev_err (dev,"Failed to parse audio routing: %d\n" , ret); +return ret; + } } -return 0 ; +snd_soc_card_set_drvdata (card, ctx); -fail3: -platform_device_del (omap3pandora_snd_device); -fail2: -platform_device_put (omap3pandora_snd_device); + ret =devm_snd_soc_register_card (dev, card); +if (ret) { +dev_err (dev,"Failed to register sound card: %d\n" , ret); +return ret; + } -return ret; +return 0 ; } -module_init (omap3pandora_soc_init); -static void __exit omap3pandora_soc_exit(void) -{ -regulator_put (omap3pandora_dac_reg); -platform_device_unregister (omap3pandora_snd_device); -} -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, +}; + +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.56.0
[email protected]
AI reviewRe: [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT
Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [High] ASoC: ti: omap3pandora: broken built-in McBSP names and missing DT DAI parsing - [High] ASoC: ti…
Thank you for your contribution! Sashiko AI review found 8 potential issues to consider:
- [High] ASoC: ti: omap3pandora: broken built-in McBSP names and missing DT DAI parsing
- [High] ASoC: ti: omap3pandora: missing SND_SOC_PCM1754 select in Kconfig
- [Medium] ASoC: ti: omap3pandora: grab_sample_rate() rejects single-stream rate change
- [Medium] ASoC: ti: omap3pandora: static open-time rate constraint in startup()
- [Medium] ASoC: ti: omap3pandora: missing snd_soc_pm_ops on omap3pandora_driver
- [Medium] ASoC: ti: omap3pandora: missing TWL4030_CLOCK_APLL setup in capture hw_params
- [Low] ASoC: ti: omap3pandora: omap3pandora_probe() requires optional DT properties
- [Low] ASoC: ti: omap3pandora: unused codec_dai variable and mach-types.h include
--
commit b90618564a61935165b508799b8ef7f6f6a36708
Author: Stefan Leichter <[email protected]>
ASoC: ti: omap3pandora: Convert sound card to DT
This commit converts the OpenPandora ASoC machine driver to probe via a Device Tree sound-card node, separates playback and capture handling with shared TWL4030 APLL rate accounting, and switches to device-managed resource registration.
Quoted 5 lines
sound/soc/ti/omap3pandora.c +0
-0@@ -6,138 +6,274 @@
[ ... ]
Quoted 22 lines
sound/soc/ti/omap3pandora.c +13
-4+#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; + +struct mutex sample_rate_lock;// protects all fields after +unsigned int sample_rate; +int sample_rate_users; +}; -static struct regulator *omap3pandora_dac_reg; -static struct gpio_desc *dac_power_gpio; -static struct gpio_desc *amp_power_gpio;
sound/soc/ti/omap3pandora.c line 44
Quoted 10 lines
sound/soc/ti/omap3pandora.c +4
-3+static struct snd_soc_dai_link omap3pandora_dai[]; -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 ); +__maybe_unused struct snd_soc_dai *codec_dai =snd_soc_rtd_to_codec (rtd,0 );
[Severity: Low]
This isn't a bug, but codec_dai in omap3pandora_common_hw_params() and the new <asm/mach-types.h> include are both unused and can be dropped.
[ ... ]
Quoted 18 lines
sound/soc/ti/omap3pandora.c +18
-0+/* The McBSP playback and capture interfaces share the TWL4030 APLL. */ +static int grab_sample_rate (struct omap3pandora_sound *ctx, +struct snd_pcm_substream **owner, +struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +bool *new_owner) +{ +unsigned int rate =params_rate (params); +int ret =0 ; + + *new_owner = false; +mutex_lock (&ctx->sample_rate_lock); +if (*owner == substream) { +if (ctx->sample_rate != rate) + ret = -EINVAL ; + }else if (*owner || (ctx->sample_rate_users && + ctx->sample_rate != rate)) { + ret = -EINVAL ;
sound/soc/ti/omap3pandora.c line 102
Quoted 10 lines
sound/soc/ti/omap3pandora.c +10
-0+ }else { + ctx->sample_rate = rate; + ctx->sample_rate_users++; + *owner = substream; + *new_owner = true; + } +mutex_unlock (&ctx->sample_rate_lock); + +return ret; +}
[Severity: Medium]
Does grab_sample_rate() reject sample-rate changes on a substream even when no other stream is active?
ALSA allows userspace to call SNDRV_PCM_IOCTL_HW_PARAMS more than once on an open substream without an intervening hw_free(). When *owner == substream and ctx->sample_rate_users == 1, returning -EINVAL on ctx->sample_rate != rate causes snd_pcm_hw_params() to fail and call hw_free(), dropping the reservation anyway. If ctx->sample_rate_users == 1, *owner == substream should be allowed to update ctx->sample_rate to the new rate.
[ ... ]
Quoted 18 lines
sound/soc/ti/omap3pandora.c +18
-0+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); +bool new_owner; +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; + }
sound/soc/ti/omap3pandora.c line 201
Quoted 10 lines
sound/soc/ti/omap3pandora.c +9
-0+ + ret =grab_sample_rate (ctx, &ctx->capture_stream, substream, + params, &new_owner); +if (ret) +return ret; + + ret =omap3pandora_common_hw_params (substream, params); +if (ret) + goto err_release;return 0 ;
[Severity: Medium]
Does omap3pandora_capture_hw_params() also need to program TWL4030_CLOCK_APLL via snd_soc_dai_set_sysclk()?
In sound/soc/codecs/twl4030.c, twl4030_hw_params() sets twl4030->configured = 1 on the first hw_params() call and returns early without updating TWL4030_REG_CODEC_MODE until twl4030_shutdown() clears twl4030->configured:
sound/soc/codecs/twl4030.c:twl4030_hw_params() {
...
/* If the substream has no subscribers, the Giacinto
* is already configured, so we can return */
if (twl4030->configured)
return 0;
...
}If an open capture substream runs hw_params(), hw_free() (which releases ctx->capture_stream), and then hw_params() at a new rate (or if playback changed the APLL rate in the meantime), McBSP4 is reconfigured to 256 * new_rate while the TWL4030 APLL stays at the old frequency.
[ ... ]
Quoted 6 lines
sound/soc/ti/omap3pandora.c +6
-0+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;
sound/soc/ti/omap3pandora.c line 262
Quoted 10 lines
sound/soc/ti/omap3pandora.c +10
-0+ +mutex_lock (&ctx->sample_rate_lock); + sample_rate = ctx->sample_rate; +mutex_unlock (&ctx->sample_rate_lock); + +if (!sample_rate) +return 0 ; + +return constrain_sample_rate (substream, sample_rate); +}
[Severity: Medium]
Can constraining the rate from a snapshot of ctx->sample_rate in startup() leave a substream either unconstrained or locked to a stale rate?
Because ctx->sample_rate is only set later in hw_params(), a full-duplex application that opens both playback and capture before configuring hw_params() sees ctx->sample_rate == 0 in both startup() calls and gets no rate constraint. Conversely, if stream B opens while stream A is running at rate R1, stream B is permanently constrained to R1 via snd_pcm_hw_constraint_single(); if stream A then closes and reopens at rate R2 != R1 before stream B runs hw_params(), stream B cannot succeed at any rate.
Quoted 1 line
sound/soc/ti/omap3pandora.c +0
-0@@ -171,20 +307,40 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
[ ... ]
Quoted 13 lines
/* Digital audio interface glue - connects codec <--> CPU */
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" )),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 static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) · line 343
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" )), +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 SND_SOC_OMAP3_PANDORA in sound/soc/ti/Kconfig need to select SND_SOC_PCM1754 now that the playback DAI link binds to the pcm1773 DAI?
Without select SND_SOC_PCM1754 in Kconfig, configs enabling CONFIG_SND_SOC_OMAP3_PANDORA (such as omap2plus_defconfig) do not build sound/soc/codecs/pcm1754.c, leaving the playback link unbound.
[Severity: High]
Why do the DAI links hardcode component names and branch on IS_BUILTIN(CONFIG_SND_SOC_OMAP3_PANDORA) instead of populating the DAI link of_node pointers from Device Tree?
On DT-based OMAP3 kernels, the McBSP devices are always named "49022000.mcbsp" and "49026000.mcbsp" regardless of whether this driver is built-in or a module, so CONFIG_SND_SOC_OMAP3_PANDORA=y searches for "omap-mcbsp.2" and "omap-mcbsp.4" and never binds. In addition, sound/soc/codecs/pcm1754.c leaves soc_component_dev_pcm1754.name NULL, so the codec component is named after the DT node (for example "dac" in the binding example) rather than "pcm1773-codec", and omap3pandora_probe() never parses the sound-dai phandles into cpus->of_node, platforms->of_node and codecs->of_node.
Quoted 1 line
sound/soc/ti/omap3pandora.c +0
-0@@ -192,100 +348,122 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
[ ... ]
Quoted 7 lines
sound/soc/ti/omap3pandora.c +7
-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" ); +if (ret) {
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = { · line 437
Quoted 10 lines
sound/soc/ti/omap3pandora.c +9
-0+dev_err (dev,"Failed to parse DAPM widgets: %d\n" , ret); +return ret; + } + + ret =snd_soc_of_parse_audio_routing (card,"routing" ); +if (ret) { +dev_err (dev,"Failed to parse audio routing: %d\n" , ret); +return ret; + } }
[Severity: Low]
Should omap3pandora_probe() check whether the "widgets" and "routing" properties exist before calling snd_soc_of_parse_audio_simple_widgets() and snd_soc_of_parse_audio_routing()?
Both helpers return -EINVAL when the property is absent, whereas the DT binding only lists compatible and sound-dai as required.
[ ... ]
sound/soc/ti/omap3pandora.c static struct snd_soc_dai_link omap3pandora_dai[] = { · line 462
Quoted 7 lines
sound/soc/ti/omap3pandora.c +7
-0+static struct platform_driver omap3pandora_driver = { + .driver = { + .name ="omap3pandora-sound" , + .of_match_table = omap3pandora_of_match, + }, + .probe = omap3pandora_probe, +};
[Severity: Medium]
Should omap3pandora_driver.driver set .pm = &snd_soc_pm_ops?
Previously, registering a "soc-audio" platform device bound the card to soc_driver in sound/soc/soc-core.c, which wires up snd_soc_pm_ops. Omitting .pm here disables ASoC card suspend, resume, and poweroff callbacks.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Mark Brown
maintainerRe: [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT
In reply to H. Nikolaus SchallerReview
Quoted 6 lines
Convert the OpenPandora ASoC machine driver to bind through a Device Tree sound-card node instead of creating a platform device from board- specific setup code. Describe the CPU and codec DAIs and audio routes through DT, including the external PCM1773 playback DAC.
(quoted diff) +1
-0+ DAILINK_COMP_ARRAY(COMP_CODEC("pcm1773-codec", "pcm1773")),
You've added the external CODEC but not updated the Kconfig dependencies for that.
Signature · 1 line
Mark Brown <[email protected]>
Re: [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT
Quoted 9 lines
Am 24.11.2026 um 15:48 schrieb Mark Brown <[email protected]>:
Quoted 4 lines
Convert the OpenPandora ASoC machine driver to bind through a Device Tree sound-card node instead of creating a platform device from board- specific setup code. Describe the CPU and codec DAIs and audio routes through DT, including the external PCM1773 playback DAC.
Quoted 4 lines
Quoted 1 line
+
DAILINK_COMP_ARRAY(COMP_CODEC("pcm1773-codec", "pcm1773")),You've added the external CODEC but not updated the
Kconfigdependencies for that.
Yes, I remember it was discussed but slipped through.
BR and thanks,
Nikolaus
PATCH v2 8/20 dt-bindings: mfd: twl4030: Document 64-cycle PWM
In reply to H. Nikolaus SchallerDocument the optional ti,twl4030-pwm-frame-64 property for the TWL4030 PWM controller. It selects the 64-clock-cycle frame instead of the default 128-cycle frame, doubling the output frequency and reducing duty-cycle resolution.
The selection is explicit because the driver does not know the PWM input clock rate and cannot derive the hardware frame length from a consumer-requested period. The shorter frame can reduce PWM LOW intervals during startup mode detection of LED drivers such as the TI TPS61160/61.
---
Notes:
Changes against V1:
- Revised commit message to focus on the binding and the reason for explicit 64-cycle frame selection.
- Commit-message review assisted by ChatGPT.
Documentation/devicetree/bindings/mfd/ti,twl.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/mfd/ti,twl.yaml +9 -0
@@ -396,6 +396,15 @@ properties: '#pwm-cells': const: 2 + ti,twl4030-pwm-frame-64: + type: boolean + description: + TWL4030 only; not supported by TWL6030 PWM. + Select the short 64-clock-cycle PWM frame instead of the + default 128-cycle frame, doubling the PWM frequency. Required + for dimming inputs requiring short PWM low intervals during + startup mode detection (e.g. TI TPS61160/61). + required: - compatible - '#pwm-cells'
Signature · 1 line
2.56.0
Re: [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM
Quoted 28 lines · H. Nikolaus Schaller
Document the optional ti,twl4030-pwm-frame-64 property for the TWL4030 PWM controller. It selects the 64-clock-cycle frame instead of the default 128-cycle frame, doubling the output frequency and reducing duty-cycle resolution.
The selection is explicit because the driver does not know the PWM input clock rate and cannot derive the hardware frame length from a consumer-requested period. The shorter frame can reduce PWM LOW intervals during startup mode detection of LED drivers such as the TI TPS61160/61.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
Notes:
Changes against V1:
- Revised commit message to focus on the binding and the reason for explicit 64-cycle frame selection.
- Commit-message review assisted by ChatGPT.Documentation/devicetree/bindings/mfd/ti,twl.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/mfd/ti,twl.yaml +0
-0
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 399
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1
-0@@ -396,6 +396,15 @@ properties: '#pwm-cells': const: 2 + ti,twl4030-pwm-frame-64:
Drop twl4030. Properties are not model specific, but should be re-usable among all of devices from that vendor (when applicable).
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 402
Quoted 3 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +3
-0+ type: boolean + description: + TWL4030 only; not supported by TWL6030 PWM.
Don't repeat constraints in free form text. Implement proper dt-schema for this.
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 406
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +4
-0+ Select the short 64-clock-cycle PWM frame instead of the + default 128-cycle frame, doubling the PWM frequency. Required + for dimming inputs requiring short PWM low intervals during + startup mode detection (e.g. TI TPS61160/61).
I don't get how TPS is related here, but if you mention other specific device then I wonder - why isn't this deducible from the compatible? Or you mean that PWM consumers might need it, depending on the consumer?
But isn't this then dynamic choice - depending on PWM frequency the consumer wants?
Best regards,
Krzysztof
Re: [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM
Hi Krzysztof,
Quoted 34 lines
Am 24.11.2026 um 15:40 schrieb Krzysztof Kozlowski <[email protected]>:
Quoted 31 lines · H. Nikolaus Schaller
Document the optional ti,twl4030-pwm-frame-64 property for the TWL4030 PWM controller. It selects the 64-clock-cycle frame instead of the default 128-cycle frame, doubling the output frequency and reducing duty-cycle resolution.
The selection is explicit because the driver does not know the PWM input clock rate and cannot derive the hardware frame length from a consumer-requested period. The shorter frame can reduce PWM LOW intervals during startup mode detection of LED drivers such as the TI TPS61160/61.
Signed-off-by H. Nikolaus Schaller <[email protected]>---
Notes:
Changes against V1:
- Revised commit message to focus on the binding and the reason for explicit 64-cycle frame selection.
- Commit-message review assisted by ChatGPT.
Documentation/devicetree/bindings/mfd/ti,twl.yaml| 9 +++++++++1 file changed, 9 insertions(+)Documentation/devicetree/bindings/mfd/ti,twl.yaml +0
-0@@ -396,6 +396,15 @@ properties: '#pwm-cells': const: 2
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 399
Quoted 1 line
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1
-0+ ti,twl4030-pwm-frame-64:Drop twl4030. Properties are not model specific, but should be re-usable among all of devices from that vendor (when applicable).
Ok.
Quoted 7 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 402
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +3
-0+ type: boolean + description: + TWL4030 only; not supported by TWL6030 PWM.Don't repeat constraints in free form text. Implement proper dt-schema for this.
Ok.
Quoted 9 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml properties: · line 406
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +4
-0+ Select the short 64-clock-cycle PWM frame instead of the + default 128-cycle frame, doubling the PWM frequency. Required + for dimming inputs requiring short PWM low intervals during + startup mode detection (e.g. TI TPS61160/61).I don't get how TPS is related here, but if you mention other specific device then I wonder - why isn't this deducible from the compatible? Or you mean that PWM consumers might need it, depending on the consumer?
The TPS61160 is an LED boost driver used for the panel backlight of the OpenPandora.
Besides being capable of PWM for the backlight intensity the TPS also can undestand some 1-wire data protocol. It switches to that mode if the common PWM/1-wire input follows a specific timing sequence.
Since we can't reprogram the PWM output connected in the OpenPandora to speak this protocol, we have to make sure that the TPS chip never enters this mode accidentially.
This feature is part of it.
And since the TPS is not described in the device tree and can not have its own driver (because there is PWM and not the protocol) there is no compatible to base this on.
Yes, I agree in combination with the comments from Mark that we should split the series and better describe this background.
Quoted 6 lines
But isn't this then dynamic choice - depending on PWM frequency the consumer wants?
Best regards,
Krzysztof
I'll collect feedbacks over some days and come up with multiple series as suggested by Mark.
BR and thanks,
Nikolaus
PATCH v2 9/20 pwm: twl: Support 64-cycle PWM frame
In reply to H. Nikolaus SchallerImplement the ti,twl4030-pwm-frame-64 device tree option in the TWL4030 PWM driver. When enabled, program bit 7 of PWMx_ON to select a 64-clock-cycle frame and clamp the OFF counter to 63.
The shorter frame doubles the output frequency at the expense of duty-cycle resolution. With ON = 1 and OFF = 63, a full-duty request is approximated rather than producing a constant HIGH level; the remaining LOW interval is short enough for the intended LED driver startup mode detection.
Keep the existing 128-cycle behaviour when the property is absent. As before, the driver does not implement arbitrary consumer-requested PWM periods.
---
Notes:
Changes against V1:
- Add optional selection of the TWL4030 64-cycle PWM frame through ti,twl4030-pwm-frame-64; retain the default 128-cycle mode.
- Set the frame-selection bit in PWMx_ON and limit the OFF counter to 63 in 64-cycle mode, including for full-duty requests.
- Retain the duty-cycle calculation and register encoding of the hardware-tested working series rather than the later review proposal using ON = OFF = 1 for full duty.
- Document that ON = 1, OFF = 63 does not produce constant HIGH; the resulting short LOW intervals are relevant for TPS61160/61.
- Revised commit message to distinguish driver implementation from the preceding binding documentation.
- PWM encoding and commit-message review assisted by ChatGPT.
drivers/pwm/pwm-twl.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/pwm/pwm-twl.c +37 -0
@@ -25,6 +25,9 @@#define TWL4030_GPBR1_REG 0x0c#define TWL4030_PMBR1_REG 0x0d +/* Bit 7 of the PWMx_ON register selects the short (64 cycles) frame */ +#define TWL4030_PWM_ON_FRAME_64 BIT(7) +/* GPBR1 register bits */ #define TWL4030_PWMXCLK_ENABLE (1 << 0)#define TWL4030_PWMX_ENABLE (1 << 2)
@@ -49,6 +52,7 @@ struct twl_pwm_chip {struct mutex mutex;u8 twl6030_toggle3;u8 twl4030_pwm_mux; +bool twl4030_frame_64; };static inline struct twl_pwm_chip *to_twl (struct pwm_chip *chip)
@@ -56,13 +60,35 @@ static inline struct twl_pwm_chip *to_twl(struct pwm_chip *chip)return pwmchip_get_drvdata (chip); } +/* +* Note: this hardware (and driver) does not honor arbitrary periods. +* Only the duty ratio is implemented; the frame length is either +* 128 clock cycles (default) or - if selected through device tree - +* 64 clock cycles. Consumers requiring an accurate period must verify +* the actually provided period. +*/ static int twl_pwm_config (struct pwm_chip *chip,struct pwm_device *pwm,u64 duty_ns,u64 period_ns) { +struct twl_pwm_chip *twl =to_twl (chip);int duty_cycle =DIV64_U64_ROUND_UP (duty_ns *TWL_PWM_MAX , period_ns) +1 ; +bool frame_64 =twl_class_is_4030 () && twl->twl4030_frame_64;u8 pwm_config[2 ] = {1 ,0 };int base, ret; +if (frame_64) + pwm_config[0 ] |=TWL4030_PWM_ON_FRAME_64 ; + +/* +* In the 64-cycle frame the OFF counter wraps at 64. A requested +* duty_cycle of 64 (full duty) would therefore wrap to a constant +* high output. Saturate to the largest value that still produces +* a low pulse (OFF = 63, approximately 62/64 high) instead. +* This also applies to full-duty requests from PWM consumers. +*/ +if (frame_64 && duty_cycle >TWL_PWM_MAX ) + duty_cycle =TWL_PWM_MAX ; +/* * To configure the duty period: * On-cycle is set to 1 (the minimum allowed value)
@@ -353,6 +379,17 @@ static int twl_pwm_probe(struct platform_device *pdev)else chip->ops = &twl6030_pwm_ops; +/* +* Optional short PWM frame (64 instead of 128 clock cycles). +* Doubles the output frequency; useful for LED dimming +* inputs requiring short low intervals during startup +* mode detection (e.g. TI TPS61160/61). +*/ + twl->twl4030_frame_64 = +twl_class_is_4030 () && +device_property_read_bool (&pdev->dev, +"ti,twl4030-pwm-frame-64" ); +mutex_init (&twl->mutex);return devm_pwmchip_add (&pdev->dev, chip);
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 09/20] pwm: twl: Support 64-cycle PWM frame
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] pwm: twl: 64-cycle mode in twl_pwm_config() scales and clamps to 127 not 63 --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] pwm: twl: 64-cycle mode in twl_pwm_config() scales and clamps to 127 not 63
--
commit 9c38629d98d044b0860bfc5ea8bf71a8a5b8a626
Author: H. Nikolaus Schaller <[email protected]>
pwm: twl: Support 64-cycle PWM frame
This commit adds support for the ti,twl4030-pwm-frame-64 device tree property to select a 64-clock-cycle PWM frame on TWL4030.
Quoted 4 lines
drivers/pwm/pwm-twl.c +0
-0
[ ... ]
Quoted 22 lines
drivers/pwm/pwm-twl.c +11
-0@@ -56,13 +60,35 @@ static inline struct twl_pwm_chip *to_twl(struct pwm_chip *chip)return pwmchip_get_drvdata (chip); } +/* +* Note: this hardware (and driver) does not honor arbitrary periods. +* Only the duty ratio is implemented; the frame length is either +* 128 clock cycles (default) or - if selected through device tree - +* 64 clock cycles. Consumers requiring an accurate period must verify +* the actually provided period. +*/ static int twl_pwm_config (struct pwm_chip *chip,struct pwm_device *pwm,u64 duty_ns,u64 period_ns) { +struct twl_pwm_chip *twl =to_twl (chip);int duty_cycle =DIV64_U64_ROUND_UP (duty_ns *TWL_PWM_MAX , period_ns) +1 ; +bool frame_64 =twl_class_is_4030 () && twl->twl4030_frame_64;u8 pwm_config[2 ] = {1 ,0 };int base, ret; +if (frame_64) + pwm_config[0 ] |=TWL4030_PWM_ON_FRAME_64 ;
drivers/pwm/pwm-twl.c static inline struct twl_pwm_chip *to_twl(struct pwm_chip *chip) · line 90
Quoted 10 lines
drivers/pwm/pwm-twl.c +10
-0+ +/* +* In the 64-cycle frame the OFF counter wraps at 64. A requested +* duty_cycle of 64 (full duty) would therefore wrap to a constant +* high output. Saturate to the largest value that still produces +* a low pulse (OFF = 63, approximately 62/64 high) instead. +* This also applies to full-duty requests from PWM consumers. +*/ +if (frame_64 && duty_cycle >TWL_PWM_MAX ) + duty_cycle =TWL_PWM_MAX ;
[Severity: High]
Does twl_pwm_config() scale and clamp duty_cycle against 127 instead of 63 when frame_64 is enabled?
TWL_PWM_MAX is defined as 0x7f (127), which is the counter limit for the 128-cycle frame. In 64-cycle mode, scaling duty_ns by TWL_PWM_MAX and clamping to TWL_PWM_MAX produces pwm_config[1] values up to 127 rather than 63. As a result, the 6-bit OFF counter wraps around at roughly 50% requested duty cycle (reaching OFF = 64 -> 0 and OFF = 65 -> 1, which matches ON = 1 for constant high output) and repeats the duty ramp a second time across the upper half of the range.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
PATCH v2 10/20 dt-bindings: backlight: pwm: Document enable guard
In reply to H. Nikolaus SchallerAdd support for a new device tree property "pwm-enable-guard-period-us". If set, the driver applies a full duty cycle (duty_cycle == period) for the given duration whenever the PWM was disabled or had zero duty cycle (e.g. power-up, resume, brightness 0). This covers the
requirements of such devices generically, without introducing a chip specific backlight driver.
---
Notes:
Changes against V1:
- Describe the guard trigger using the PWM state actually tested by the implementation (disabled or zero duty cycle).
- Remove the requirement that a disabled provider report zero duty-cycle.
- Remove the redundant uint32 $ref for the standard -us suffix after dt_binding_check reported a schema error.
- Binding semantics and code-consistency review assisted by ChatGPT; clarify that full duty is requested, not guaranteed at the output.
.../leds/backlight/pwm-backlight.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml +20 -0
@@ -49,6 +49,26 @@ properties: having to list out every possible value in the brightness-level array. $ref: /schemas/types.yaml#/definitions/uint32 + pwm-enable-guard-period-us: + description: > + Duration in microseconds for which the PWM consumer requests + full duty (duty_cycle == period) before applying the requested + brightness. The guard is issued if the previous PWM state was + disabled or had zero duty cycle, e.g. after power-up or resume. + + This can allow LED drivers with startup mode detection to settle + before normal PWM dimming begins. For example, TI TPS61160/61 + distinguish PWM dimming from EasyScale by the duration of low + intervals on CTRL during an initial detection window. The guard + duration must cover that window according to the LED driver + datasheet. + + The PWM provider may approximate full duty if the hardware + cannot represent it exactly. The board must ensure that the + resulting waveform meets the LED driver startup requirements + and that the input has a defined inactive state while off. + default: 0 + dependencies: default-brightness-level: [brightness-levels] num-interpolated-steps: [brightness-levels]
Signature · 1 line
2.56.0
PATCH v2 11/20 backlight: pwm: Support enable guard period
In reply to H. Nikolaus SchallerSome LED drivers distinguish PWM dimming from a one-wire control mode during a startup detection window. For example, TI TPS61160/61 use the duration of low intervals on CTRL to detect EasyScale. An initial guard interval can keep the waveform suitable for PWM mode detection before normal dimming begins.
Add support for a new device tree property "pwm-enable-guard-period-us". If set, the driver applies a full duty cycle (duty_cycle == period) for the given duration whenever the previous PWM state was disabled or had zero duty cycle. This covers the
requirements of such devices generically, without introducing a chip specific backlight driver.
The requested full duty need not produce an exact constant-high output on hardware with limited duty-cycle resolution. The board must ensure the resulting waveform meets the LED driver timing.
---
Notes:
Changes against V1:
- Andreas Kemnade proposed placing the TPS61161 PWM-mode initialization in backlight support rather than in the PWM controller. The enable guard is the generic V2 implementation.
- Add pwm-enable-guard-period-us support to pwm-backlight.
- Request full duty during the startup guard when the previously cached PWM state was disabled or had zero duty cycle.
- Check the return value of the guard PWM update, while leaving the normal pwm_apply_might_sleep() handling as in upstream.
- Retain the hardware-tested guard implementation from the working series; do not incorporate the later review changes to power-on ordering, guard triggering, duty limiting or rollback handling.
- Clarify that requesting full duty does not guarantee constant HIGH on every PWM provider; actual waveform depends on hardware.
- Keep the existing Suggested-by attribution.
- Code and commit-message review assisted by ChatGPT.
drivers/video/backlight/pwm_bl.c | 37 +++++++++++++++++++++++++++++++- include/linux/pwm_backlight.h | 1 + 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +36 -1
@@ -7,6 +7,7 @@#include <linux/delay.h> #include <linux/gpio/consumer.h> +#include <linux/minmax.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -18,6 +19,9 @@#include <linux/regulator/consumer.h> #include <linux/slab.h> +/* extra time added above enable_guard_period_us for usleep_range() */ +#define PWM_BL_GUARD_SLACK_US 2000 +struct pwm_bl_data {struct pwm_device *pwm;struct device *dev;
@@ -26,6 +30,7 @@ struct pwm_bl_data {bool enabled;struct regulator *power_supply;struct gpio_desc *enable_gpio; +unsigned int enable_guard_period_us;unsigned int scale;unsigned int post_pwm_on_delay;unsigned int pwm_off_delay;
@@ -93,11 +98,39 @@ static int pwm_backlight_update_status(struct backlight_device *bl)struct pwm_bl_data *pb =bl_get_data (bl);int brightness =backlight_get_brightness (bl);struct pwm_state state; +int ret;if (pb->notify) brightness = pb->notify (pb->dev, brightness);if (brightness >0 ) { +pwm_get_state (pb->pwm, &state); + +/* +* Some LED drivers detect a one-wire control mode during +* a startup window (e.g. TI TPS61160/TPS61161, using +* the duration of low intervals on CTRL). Request full +* duty for the guard interval before normal dimming. +* The PWM provider may approximate full duty. +* +* Apply the guard if the previous PWM state was disabled +* or had zero duty cycle. +*/ +if (pb->enable_guard_period_us && + (!state.enabled || !state.duty_cycle)) { +struct pwm_state guard = state; + + guard.duty_cycle = guard.period; + guard.enabled = true; + ret =pwm_apply_might_sleep (pb->pwm, &guard); +if (ret) +return ret; + +usleep_range (pb->enable_guard_period_us, + pb->enable_guard_period_us + +PWM_BL_GUARD_SLACK_US ); + } +pwm_get_state (pb->pwm, &state); state.duty_cycle =compute_duty_cycle (pb, brightness, &state); state.enabled = true;
@@ -239,7 +272,8 @@ static int pwm_backlight_parse_dt(struct device *dev,of_property_read_u32 (node,"post-pwm-on-delay-ms" , &data->post_pwm_on_delay);of_property_read_u32 (node,"pwm-off-delay-ms" , &data->pwm_off_delay); - +of_property_read_u32 (node,"pwm-enable-guard-period-us" , + &data->enable_guard_period_us);/* * Determine the number of brightness levels, if this property is not * set a default table of brightness levels will be used.
@@ -467,6 +501,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) goto err_alloc; } + pb->enable_guard_period_us = data->enable_guard_period_us; pb->notify = data->notify; pb->notify_after = data->notify_after; pb->exit = data->exit;
include/linux/pwm_backlight.h +1 -0
@@ -13,6 +13,7 @@ struct platform_pwm_backlight_data {unsigned int lth_brightness;unsigned int pwm_period_ns;unsigned int *levels; +unsigned int enable_guard_period_us;unsigned int post_pwm_on_delay;unsigned int pwm_off_delay;int (*init)(struct device *dev);
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 11/20] backlight: pwm: Support enable guard period
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] backlight: pwm_bl: guard period runs before pwm_backlight_power_on() - [Medium] backlight: pwm_bl…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [Medium] backlight: pwm_bl: guard period runs before pwm_backlight_power_on()
- [Medium] backlight: pwm_bl: guard pulse triggers before compute_duty_cycle()
- [Medium] backlight: pwm_bl: unchecked post-guard pwm_apply_might_sleep()
- [Low] backlight: pwm_bl: unused linux/minmax.h include added --
commit e05803a769b6dbbf7722b07888a63c3cd2737641
Author: H. Nikolaus Schaller <[email protected]>
backlight: pwm: Support enable guard period
This commit adds support for a pwm-enable-guard-period-us device tree property to apply a full duty cycle for a guard interval when enabling the PWM from a disabled or zero-duty state.
drivers/video/backlight/pwm_bl.c line 10
Quoted 9 lines
drivers/video/backlight/pwm_bl.c +1
-0@@ -7,6 +7,7 @@#include <linux/delay.h> #include <linux/gpio/consumer.h> +#include <linux/minmax.h>
[Severity: Low]
This isn't a bug, but linux/minmax.h does not appear to be used by anything in this change.
[ ... ]
Quoted 26 lines
drivers/video/backlight/pwm_bl.c +17
-0@@ -93,11 +98,39 @@ static int pwm_backlight_update_status(struct backlight_device *bl)struct pwm_bl_data *pb =bl_get_data (bl);int brightness =backlight_get_brightness (bl);struct pwm_state state; +int ret;if (pb->notify) brightness = pb->notify (pb->dev, brightness);if (brightness >0 ) { +pwm_get_state (pb->pwm, &state); + +/* +* Some LED drivers detect a one-wire control mode during +* a startup window (e.g. TI TPS61160/TPS61161, using +* the duration of low intervals on CTRL). Request full +* duty for the guard interval before normal dimming. +* The PWM provider may approximate full duty. +* +* Apply the guard if the previous PWM state was disabled +* or had zero duty cycle. +*/ +if (pb->enable_guard_period_us && + (!state.enabled || !state.duty_cycle)) { +struct pwm_state guard = state; +
drivers/video/backlight/pwm_bl.c static int pwm_backlight_update_status(struct backlight_device *bl) · line 132
Quoted 10 lines
drivers/video/backlight/pwm_bl.c +10
-0+ guard.duty_cycle = guard.period; + guard.enabled = true; + ret =pwm_apply_might_sleep (pb->pwm, &guard); +if (ret) +return ret; + +usleep_range (pb->enable_guard_period_us, + pb->enable_guard_period_us + +PWM_BL_GUARD_SLACK_US ); + }
[Severity: Medium]
Does checking brightness > 0 before calling compute_duty_cycle() cause a full-brightness flash when a non-zero brightness level maps to a duty cycle of 0?
When pb->lth_brightness is 0 and a low non-zero brightness index maps to 0 in pb->levels[] (or truncates to 0 in compute_duty_cycle()), the guard block drives the PWM at 100% duty cycle for pb->enable_guard_period_us before programming state.duty_cycle = 0. Because state.duty_cycle remains 0, subsequent updates at low brightness repeat the full-duty flash and delay. In addition, if the target duty cycle is already equal to state.period, the guard block sleeps and then applies the same full duty cycle a second time.
drivers/video/backlight/pwm_bl.c static int pwm_backlight_update_status(struct backlight_device *bl) · line 136
Quoted 4 lines
drivers/video/backlight/pwm_bl.c +1
-0+pwm_get_state (pb->pwm, &state); state.duty_cycle =compute_duty_cycle (pb, brightness, &state); state.enabled = true;
[Severity: Medium]
Does running the guard interval before pwm_backlight_power_on(pb) leave the LED driver unpowered or disabled while the guard pulse is on the line?
drivers/video/backlight/pwm_bl.c:pwm_backlight_update_status() {
...
pwm_get_state(pb->pwm, &state);
state.duty_cycle = compute_duty_cycle(pb, brightness, &state);
state.enabled = true;
pwm_apply_might_sleep(pb->pwm, &state);
pwm_backlight_power_on(pb);
...
}When a board also uses power-supply or enable-gpios, the full-duty guard waveform and its usleep_range() delay finish and the PWM is already switched to the dimmed duty cycle before pwm_backlight_power_on() enables pb->power_supply or asserts pb->enable_gpio. The LED driver IC powers up only after normal PWM dimming has begun, bypassing the startup guard window.
[Severity: Medium]
What happens if the guard pwm_apply_might_sleep() succeeds, but the post-guard pwm_apply_might_sleep() that sets the dimmed duty cycle fails?
Because the second call's return value is ignored, a transient failure on that update leaves the PWM hardware running at 100% duty cycle from the guard step while pwm_backlight_power_on() turns the backlight on and pwm_backlight_update_status() returns 0.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH v2 12/20 drm/panel: td043mtea1: Attach DT backlight
In reply to H. Nikolaus SchallerConnect the TPO TD043MTEA1 DRM panel to its backlight described in Device Tree by calling drm_panel_of_backlight() during probe. Without this association, the panel does not control the DT backlight.
---
Notes:
Changes against V1:
- Explain the DT backlight lookup performed by drm_panel_of_backlight(). Commit-message review assisted by ChatGPT; code unchanged.
drivers/gpu/drm/panel/panel-tpo-td043mtea1.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/panel/panel-tpo-td043mtea1.c +4 -0
@@ -450,6 +450,10 @@ static int td043mtea1_probe(struct spi_device *spi)return ret; } + ret =drm_panel_of_backlight (&lcd->panel); +if (ret) +return ret; + ret =sysfs_create_group (&spi->dev.kobj, &td043mtea1_attr_group);if (ret <0 ) {dev_err (&spi->dev,"failed to create sysfs files\n" );
Signature · 1 line
2.56.0
PATCH v2 13/20 ARM: dts: omap3pandora: Disable unused DMA channels
In reply to H. Nikolaus SchallerOn the OpenPandora, 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.
This can exhaust available sDMA channels and prevent McBSP audio transfers from being allocated.
Disable unused McSPI2, McSPI3 and McSPI4 in the Pandora device tree.
---
Notes:
Changes against V1:
- Historical origin: 24727d33755e (Grond, 2021-12-08).
The original contributor is credited with Suggested-by rather than an unverified current DCO sign-off.
Commit-message and provenance review assisted by ChatGPT; code unchanged.
.../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
@@ -685,6 +685,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.56.0
PATCH v2 14/20 ARM: dts: omap3-pandora: Model LCD power enable dependencies
In reply to H. Nikolaus SchallerThe OpenPandora LCD power supply differs between mainboard revisions.
On revision 5a, LCD_5V is derived from the shared 5V supply and switched by circuitry controlled through VAUX1. Both VAUX1 and the REGEN-controlled 5V supply must therefore be enabled for the LCD. On revision 6d, LCD_5V is generated independently from the battery supply, with its enable input controlled through VAUX1.
Both revisions must use the same device tree. There is no software-readable board revision identifier that allows the bootloader or kernel to distinguish them. Nor is manual selection of a board- specific DTB practical: the revision is not externally visible, and users would have to open their devices and inspect the mainboard to find out which revision they own. The original Pandora platform code also supported both revisions without such a configuration choice. Preserve that property in the device tree conversion.
Model the enable dependencies as a fixed-regulator chain:
LCD -> lcd_5v -> aux_5v -> vaux1
This enables both required controls on revision 5a, while also working on revision 6d. It does not describe the physical supply topology:
VAUX1 is not the electrical input of the shared 5V regulator, so other aux_5v consumers, including audio and USB, also enable VAUX1.
A fixed regulator can express only one vin-supply dependency, whereas the LCD requires two independent power controls. No suitable existing DT representation was found that expresses both dependencies without this artificial relationship. Use the chain as a pragmatic solution with the existing regulator framework and a common DTB.
Unlike the old platform configuration, the shared 5V rail and USB host VBUS are no longer forced always on; the regulator consumers manage their enable state. Keep USB host VBUS enabled at boot.
The sound card node is introduced in patch 17, which must reference aux_5v for its amp-supply property.
The 5 ms startup delay originates from the older Pandora kernel and was originally an estimate.
---
Notes:
Changes against V1:
- Historical origin: 55b8da9ea16f (Grond, 2021-12-30),
which described REGEN and the original 5 ms startup estimate. The revised DT models logical power-enable dependencies for both Pandora board revisions; it does not describe physical supply topology. The original contributor is credited with Suggested-by rather than an unverified current DCO sign-off.
Code and commit-message review assisted by ChatGPT.
.../dts/ti/omap/omap3-pandora-common.dtsi | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +29 -5
@@ -31,6 +31,28 @@ hfclk_26m: oscillator { clock-frequency = <26000000>; }; + /* Shared 5V rail for headphone amplifier, early LCD and USB */ + aux_5v: fixed-regulator-5v { + compatible = "regulator-fixed"; /* TPS61029DRC */ + regulator-name = "aux_5v"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + startup-delay-us = <5000>; + enable-active-high; + gpio = <&twl_gpio 20 GPIO_ACTIVE_HIGH>; /* REGEN */ + vin-supply = <&vaux1>; /* logical enable dependency */ + }; + + /* LCD_5V: switched shared 5V on rev 5a, separate supply on rev 6d */ + lcd_5v: fixed-regulator-lcd-5v { + compatible = "regulator-fixed"; + regulator-name = "lcd_5v"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + startup-delay-us = <5000>; + vin-supply = <&aux_5v>; /* logical enable dependency */ + }; + tv: connector { compatible = "connector-analog-tv"; label = "tv";
@@ -212,15 +234,13 @@ hsusb2_phy: hsusb2-phy-pins { #phy-cells = <0>; }; - /* HS USB Host VBUS supply - * disabling this regulator causes current leakage, and LCD flicker - * on earlier (CC) board revisions, so keep it always on */ + /* HS USB Host VBUS supply */ usb_host_5v: fixed-regulator-usb_host_5v { + vin-supply = <&aux_5v>; compatible = "regulator-fixed"; regulator-name = "usb_host_5v"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - regulator-always-on; regulator-boot-on; enable-active-high; gpio = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* GPIO_164 */
@@ -673,7 +693,7 @@ lcd: lcd@1 { label = "lcd"; reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>; /* GPIO_157 */ - vcc-supply = <&vaux1>; + vcc-supply = <&lcd_5v>; port { lcd_in: endpoint {
@@ -711,6 +731,10 @@ &mcbsp2 { }; /* bluetooth */ +&twl_gpio { + ti,use-regen; +}; + &mcbsp3 { };
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 14/20] ARM: dts: omap3-pandora: Model LCD power enable dependencies
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] ARM: dts: omap3-pandora: usb_host_5v disabled after boot due to no consumer - [Low] ARM: dts…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] ARM: dts: omap3-pandora: usb_host_5v disabled after boot due to no consumer
- [Low] ARM: dts: omap3-pandora: deprecated fixed-regulator-* node names on new nodes
- [Low] ARM: dts: omap3-pandora: twl_gpio inserted between bluetooth comment and mcbsp3
- [Low] ARM: dts: omap3-pandora: dead startup-delay-us on GPIO-less lcd_5v regulator
--
commit f12a2f12a91cab92b448c35782704537aa5d9f32
Author: H. Nikolaus Schaller <[email protected]>
ARM: dts: omap3-pandora: Model LCD power enable dependencies
This commit adds fixed-regulator nodes aux_5v and lcd_5v to model the LCD and USB host 5V power supply enable dependencies across OpenPandora board revisions, and enables ti,use-regen on twl_gpio.
Quoted 12 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +4
-0@@ -31,6 +31,28 @@ hfclk_26m: oscillator { clock-frequency = <26000000>; }; + /* Shared 5V rail for headphone amplifier, early LCD and USB */ + aux_5v: fixed-regulator-5v { + compatible = "regulator-fixed"; /* TPS61029DRC */ + regulator-name = "aux_5v";
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi hfclk_26m: oscillator { · line 47
Quoted 10 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +10
-0+ regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + startup-delay-us = <5000>; + enable-active-high; + gpio = <&twl_gpio 20 GPIO_ACTIVE_HIGH>; /* REGEN */ + vin-supply = <&vaux1>; /* logical enable dependency */ + }; + + /* LCD_5V: switched shared 5V on rev 5a, separate supply on rev 6d */ + lcd_5v: fixed-regulator-lcd-5v {
[Severity: Low] Documentation/devicetree/bindings/regulator/fixed-regulator.yaml marks node names not matching ^regulator(-[0-9]+v[0-9]+|-[0-9a-z-]+)?$ as deprecated. Should these new nodes be named regulator-5v (or regulator-aux-5v) and regulator-lcd-5v so they do not add dtbs_check warnings?
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi hfclk_26m: oscillator { · line 54
Quoted 7 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +7
-0+ compatible = "regulator-fixed"; + regulator-name = "lcd_5v"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + startup-delay-us = <5000>; + vin-supply = <&aux_5v>; /* logical enable dependency */ + };
[Severity: Low]
Does startup-delay-us on lcd_5v have any effect when the node has no enable GPIO?
In reg_fixed_voltage_probe(), a regulator-fixed node without a gpio property registers with fixed_voltage_ops (which has no .is_enabled callback) and rdev->ena_pin set to NULL. _regulator_is_enabled() therefore always returns 1, causing _regulator_enable() to skip _regulator_do_enable() where desc.enable_time (startup-delay-us) is applied. Since lcd_5v controls no hardware resource of its own, lcd could reference aux_5v directly in vcc-supply, or startup-delay-us could be dropped from lcd_5v.
Also, the commit message mentions "patch 17", which will lose its meaning in git history once committed.
[ ... ]
Quoted 8 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +1
-3@@ -212,15 +234,13 @@ hsusb2_phy: hsusb2-phy-pins { #phy-cells = <0>; }; - /* HS USB Host VBUS supply - * disabling this regulator causes current leakage, and LCD flicker - * on earlier (CC) board revisions, so keep it always on */ + /* HS USB Host VBUS supply */
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi hsusb2_phy: hsusb2-phy-pins { · line 246
Quoted 10 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +1
-1usb_host_5v: fixed-regulator-usb_host_5v { + vin-supply = <&aux_5v>; compatible = "regulator-fixed"; regulator-name = "usb_host_5v"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - regulator-always-on; regulator-boot-on; enable-active-high; gpio = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* GPIO_164 */
[Severity: High]
Won't removing regulator-always-on from usb_host_5v cause regulator_late_cleanup() to disable USB Host VBUS 30 seconds after boot?
Nothing in the device tree references &usb_host_5v (hsusb2_phy only has vcc-supply = <&vaux2>), so rdev->use_count stays at 0. When regulator_late_cleanup() runs, it sees !c->always_on and rdev->use_count == 0 and calls _regulator_do_disable(rdev), turning off GPIO 164 with no consumer to re-enable it and reintroducing the current leakage and LCD flicker on CC boards noted in the removed comment.
In addition, set_machine_constraints() enables rdev->supply (aux_5v, and transitively vaux1) at boot when boot_on is set, but regulator_late_cleanup() calls _regulator_do_disable() directly without disabling rdev->supply, permanently leaking that enable reference on aux_5v and vaux1.
[ ... ]
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi &mcbsp2 { · line 739
Quoted 10 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +4
-0@@ -711,6 +731,10 @@ &mcbsp2 { }; /* bluetooth */ +&twl_gpio { + ti,use-regen; +}; + &mcbsp3 { };
[Severity: Low]
This isn't a bug, but inserting &twl_gpio here separates the /* bluetooth */ comment from the &mcbsp3 node it describes.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
PATCH v2 15/20 ARM: dts: omap3pandora: Enable audio interfaces
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
Enable McBSP2 for the external playback DAC and McBSP4 for the TWL4030 capture path on OpenPandora.
---
Notes:
Changes against V1:
- Historical origin: d0494afbcf2e (Stefan Leichter, 2020-06-29). Commit-message review assisted by ChatGPT; code unchanged.
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
@@ -728,6 +728,7 @@ &mcbsp1 { /* audio DAC */ &mcbsp2 { + status = "okay"; }; /* bluetooth */
@@ -740,6 +741,7 @@ &mcbsp3 { /* to twl4030*/ &mcbsp4 { + status = "okay"; }; &venc {
Signature · 1 line
2.56.0
PATCH v2 16/20 ARM: dts: omap3pandora: Describe PCM1773
In reply to H. Nikolaus SchallerDescribe the PCM1773 playback DAC in the common OpenPandora device tree. The DAC is supplied by VSIM and enabled through GPIO118. This allows the PCM1773 codec driver to bind without platform-data registration.
---
Notes:
Changes against V1:
- Historical origin: 13b32c8cd102 (Grond, 2021-12-15).
- The current DTS node has been reviewed for the PCM1773 binding and GPIO/supply properties.
- Code and commit-message review assisted by ChatGPT.
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
@@ -64,6 +64,13 @@ tv_connector_in: endpoint { }; }; + dac: pcm1773-codec { + compatible = "ti,pcm1773"; + vcc-supply = <&vsim>; + enable-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ + status = "okay"; + }; + gpio-leds { compatible = "gpio-leds";
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 16/20] ARM: dts: omap3pandora: Describe PCM1773
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] ARM: dts: omap3pandora: non-generic pcm1773-codec node name used as ABI --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] ARM: dts: omap3pandora: non-generic pcm1773-codec node name used as ABI
--
commit c8d3624565f86aa716a8f19bdd1dc4e2ff56499b
Author: H. Nikolaus Schaller <[email protected]>
ARM: dts: omap3pandora: Describe PCM1773
This commit adds a devicetree node for the PCM1773 playback DAC to the common OpenPandora devicetree.
Quoted 5 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +0
-0
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi tv_connector_in: endpoint { · line 72
Quoted 9 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +6
-0@@ -64,6 +64,13 @@ tv_connector_in: endpoint { }; }; + dac: pcm1773-codec { + compatible = "ti,pcm1773"; + vcc-supply = <&vsim>; + enable-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ + status = "okay"; + };
[Severity: Low]
Should this node use a generic name such as audio-codec rather than the chip-specific pcm1773-codec?
Because this root-level node has no reg property, of_device_make_bus_id() names the platform device directly after the node name, and sound/soc/ti/omap3pandora.c relies on that exact name as an ABI:
sound/soc/ti/omap3pandora.c:
SND_SOC_DAILINK_DEFS(out,
DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.2")),
DAILINK_COMP_ARRAY(COMP_CODEC("pcm1773-codec", "pcm1773")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.2")));Matching the codec via a DT phandle in the machine driver would allow a generic node name here without breaking codec binding. Also, status = "okay" is the default and can be dropped.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=16
PATCH v2 17/20 ARM: dts: omap3pandora: Describe sound card
In reply to H. Nikolaus SchallerFrom: Stefan Leichter <[email protected]>
Describe the OpenPandora sound card and its connections to the external PCM1773 playback DAC and TWL4030 capture codec in the device tree.
Provide the amplifier GPIO and power supply, the DAPM widgets and routing, and the McBSP audio links needed by the DT-based sound card driver.
---
Notes:
Changes against V1:
- Historical origin: 570cb6f3073f (Stefan Leichter, 2020-06-29).
- The original history also contains a Signed-off-by from Grond; this has not been carried forward without renewed confirmation.
- The sound-card routing, codec phandles and amplifier supply have been reviewed in the V2 series.
- Code and commit-message review assisted by ChatGPT.
.../dts/ti/omap/omap3-pandora-common.dtsi | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +38 -0
@@ -69,6 +69,41 @@ dac: pcm1773-codec { vcc-supply = <&vsim>; enable-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ status = "okay"; + #sound-dai-cells = <0>; + }; + + sound: sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable", + "DAC2", "APLL Enable", + "Headphone Amplifier", "VOUTL", + "Headphone Amplifier", "VOUTR", + "Line Out", "VOUTL", + "Line Out", "VOUTR", + "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 {
@@ -736,6 +771,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.56.0
[email protected]
AI reviewRe: [PATCH v2 17/20] ARM: dts: omap3pandora: Describe sound card
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] ARM: dts: omap3pandora: incomplete and unused sound-dai property on sound node - [Medium] ASoC…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] ARM: dts: omap3pandora: incomplete and unused sound-dai property on sound node
- [Medium] ASoC: ti: omap3pandora: built-in driver fails to bind DT McBSP DAIs
- [Low] ARM: dts: omap3pandora: redundant clocks properties on mcbsp2 --
commit 51a8d5eee5be53980684a82cdf4795c967918b82
Author: Stefan Leichter <[email protected]>
ARM: dts: omap3pandora: Describe sound card
This commit adds the OpenPandora sound card node and McBSP2 DAI properties to omap3-pandora-common.dtsi.
Quoted 33 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +25
-0@@ -69,6 +69,41 @@ dac: pcm1773-codec { vcc-supply = <&vsim>; enable-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; /* GPIO 118 */ status = "okay"; + #sound-dai-cells = <0>; + }; + + sound: sound { + compatible = "openpandora,omap3pandora-sound"; + status = "okay"; + + label = "OpenPandora"; + + amp-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + amp-supply = <&aux_5v>; + + widgets = + "Line", "Line Out", + "Line", "Line In", + "Headphone", "Headphone Jack", + "Microphone", "Mic (internal)", + "Microphone", "Mic (external)"; + + routing = + "DAC1", "APLL Enable", + "DAC2", "APLL Enable", + "Headphone Amplifier", "VOUTL", + "Headphone Amplifier", "VOUTR", + "Line Out", "VOUTL",
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi dac: pcm1773-codec { · line 106
Quoted 10 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +10
-0+ "Line Out", "VOUTR", + "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>;
[Severity: Medium]
Is sound-dai here both incomplete for the capture link and unused by omap3pandora_probe()?
The sound card has both a playback link (McBSP2 to PCM1773) and a capture link (McBSP4 to TWL4030), but sound-dai and #sound-dai-cells only cover &mcbsp2 and &dac, omitting &mcbsp4 and the TWL4030 codec. In addition, omap3pandora_probe() in sound/soc/ti/omap3pandora.c only parses label, widgets and routing, and never reads sound-dai to populate the CPU, platform or codec of_node pointers in omap3pandora_dai[]. As a result, component matching still relies on hardcoded device names in omap3pandora_dai[], including the non-generic pcm1773-codec DT node name.
[Severity: Medium]
Can this sound card probe when CONFIG_SND_SOC_OMAP3_PANDORA=y?
Because omap3pandora_probe() does not populate dai_link->cpus->of_node or dai_link->platforms->of_node from sound-dai, ASoC matches the McBSP DAIs using the hardcoded names in omap3pandora_dai[] from commit "ASoC: ti:
omap3pandora: Convert sound card to DT":
sound/soc/ti/omap3pandora.c:
#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("pcm1773-codec", "pcm1773")),
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) */
On a Device Tree boot, the McBSP devices are always registered as 49022000.mcbsp and 49026000.mcbsp regardless of whether the sound driver is built-in or modular, so a built-in driver will never find omap-mcbsp.2 or omap-mcbsp.4 and card registration will defer indefinitely.
[ ... ]
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi &mcbsp1 { · line 777
Quoted 8 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +3
-0@@ -736,6 +771,9 @@ &mcbsp1 { /* audio DAC */ &mcbsp2 { status = "okay"; + #sound-dai-cells = <0>; + clocks = <&mcbsp2_fck>, <&mcbsp2_ick>; + clock-names = "fck", "ick"; };
[Severity: Low]
This isn't a bug, but clocks and clock-names on &mcbsp2 duplicate the
exact same properties already defined in the base mcbsp2 node inarch/arm/boot/dts/ti/omap/omap3.dtsi.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=17
PATCH v2 18/20 ARM: dts: omap3pandora: Switch backlight to PWM
In reply to H. Nikolaus SchallerReplace the legacy Pandora backlight platform device with a pwm-backlight device-tree node using TWL4030 PWM0.
Use the 64-cycle PWM frame and retain the experimentally determined brightness table. Request full duty for a 10 ms startup guard before normal PWM dimming begins. The TWL4030 64-cycle encoding limits the actual duty to approximately 62/64, retaining short low intervals during the TPS61161 mode-detection window.
---
Notes:
Changes against V1:
- Describe the 10 ms full-duty request and the actual TWL4030 output.
- Brightness levels remain unchanged; duty is capped by the TWL4030 PWM provider in 64-cycle mode (patch 09), not by patch 11.
- Code and commit-message review assisted by ChatGPT.
.../dts/ti/omap/omap3-pandora-common.dtsi | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +25 -0
@@ -53,6 +53,25 @@ lcd_5v: fixed-regulator-lcd-5v { vin-supply = <&aux_5v>; /* logical enable dependency */ }; + backlight: pwm-backlight { + compatible = "pwm-backlight"; + pwms = <&twl_pwm 0 1922710>; + /* + * TPS61161 analog dimming window: duty must stay above + * ~20-25 % (below that the regulator drops out, LED off) + * and the startup waveform must avoid long low intervals + * that could trigger EasyScale detection. The enable guard + * requests full duty; TWL4030 limits it to about 62/64. + * These levels were determined experimentally. + */ + brightness-levels = < + 0 24 30 36 42 49 58 68 80 94 110 129 255 + >; + default-brightness-level = <11>; + /* TPS61161: cover startup mode-detection window (10 ms) */ + pwm-enable-guard-period-us = <10000>; + }; + tv: connector { compatible = "connector-analog-tv"; label = "tv";
@@ -505,6 +524,10 @@ MATRIX_KEY(7, 4, KEY_LEFTBRACE ) >; }; +&twl_pwm { + ti,twl4030-pwm-frame-64; +}; + /* backup battery charger */ &charger { ti,bb-uvolt = <3200000>;
@@ -737,6 +760,8 @@ lcd: lcd@1 { reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>; /* GPIO_157 */ vcc-supply = <&lcd_5v>; + backlight = <&backlight>; + port { lcd_in: endpoint { remote-endpoint = <&dpi_out>;
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] ARM: dts: omap3pandora: default brightness 11 overflows 64-cycle TWL4030 PWM - [Medium] ARM: dts…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] ARM: dts: omap3pandora: default brightness 11 overflows 64-cycle TWL4030 PWM
- [Medium] ARM: dts: omap3pandora: PWM0 stays enabled and pulsing when brightness is 0
- [Low] ARM: dts: omap3pandora: non-generic node name pwm-backlight used for backlight
--
commit f1da995614fb9b1711442126ec6e32081ef0bd39
Author: H. Nikolaus Schaller <[email protected]>
ARM: dts: omap3pandora: Switch backlight to PWM
This commit adds a pwm-backlight devicetree node using TWL4030 PWM0 in 64-cycle mode and attaches it to the Pandora LCD node.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi lcd_5v: fixed-regulator-lcd-5v { · line 56
Quoted 9 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +1
-0@@ -53,6 +53,25 @@ lcd_5v: fixed-regulator-lcd-5v { vin-supply = <&aux_5v>; /* logical enable dependency */ }; + backlight: pwm-backlight {
[Severity: Low]
This isn't a bug, but the Devicetree Specification and pwm-backlight binding expect the generic node name "backlight" rather than "pwm-backlight".
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi lcd_5v: fixed-regulator-lcd-5v { · line 58
Quoted 2 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +2
-0+ compatible = "pwm-backlight"; + pwms = <&twl_pwm 0 1922710>;
[Severity: Medium]
Does this leave TWL4030 PWM0 enabled and pulsing when brightness is set to 0?
Because this node defines neither power-supply nor enable-gpios, pwm_backlight_update_status() sets state.enabled = true even at brightness 0:
drivers/video/backlight/pwm_bl.c:pwm_backlight_update_status() {
...
pwm_get_state(pb->pwm, &state);
state.duty_cycle = 0;
state.enabled = !pb->power_supply && !pb->enable_gpio;
pwm_apply_might_sleep(pb->pwm, &state);
...
}In twl_pwm_config(), duty_ns = 0 maps duty_cycle = 1 to 2 (ON = 1, OFF = 2), so twl4030_pwm_apply() keeps PWM0 and its clock enabled and drives a continuous 1/64 pulse train on the TPS61161 CTRL pin instead of disabling PWM0 to hold CTRL low as the legacy pandora_bl driver did.
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi lcd_5v: fixed-regulator-lcd-5v { · line 70
Quoted 12 lines
arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi +12
-0+ /* + * TPS61161 analog dimming window: duty must stay above + * ~20-25 % (below that the regulator drops out, LED off) + * and the startup waveform must avoid long low intervals + * that could trigger EasyScale detection. The enable guard + * requests full duty; TWL4030 limits it to about 62/64. + * These levels were determined experimentally. + */ + brightness-levels = < + 0 24 30 36 42 49 58 68 80 94 110 129 255 + >; + default-brightness-level = <11>;
[Severity: High]
Does default-brightness-level = <11> overflow the 64-cycle TWL4030 PWM counter and turn the backlight off after the 10 ms startup guard?
The table maximum is 255, so index 11 (level 129) requests duty_ns = (129 * 1922710) / 255 = 972665 ns (~50.6% of period_ns). However, twl_pwm_config() scales duty_ns by TWL_PWM_MAX (127) and clamps against TWL_PWM_MAX even when frame_64 is enabled:
drivers/pwm/pwm-twl.c:twl_pwm_config() {
int duty_cycle = DIV64_U64_ROUND_UP(duty_ns * TWL_PWM_MAX, period_ns) + 1;
...
if (frame_64 && duty_cycle > TWL_PWM_MAX)
duty_cycle = TWL_PWM_MAX;
}For duty_ns = 972665 ns, duty_cycle is 65 + 1 = 66 (0x42), which is not clamped and writes 66 to PWM0_OFF. In 64-cycle mode the 6-bit counter wraps 66 to OFF = 2 (with ON = 1), producing a 1/64 (1.56%) duty cycle that falls below the TPS61161 ~20-25% dropout threshold. In addition, because levels 1..11 (24..129) sit on a 0..255 scale to compensate for the 127 multiplier in twl_pwm_config(), levels 1..4 request 9.4%..16.5% duty cycles from pwm-backlight (below the ~20-25% TPS61161 threshold noted in the comment), and both levels 11 (129) and 12 (255) exceed the 64-cycle counter limit.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=18
PATCH v2 19/20 backlight: Remove legacy Pandora driver
In reply to H. Nikolaus SchallerRemove the Pandora-specific backlight platform driver after its functionality has been replaced by the TWL4030 PWM provider and the generic pwm-backlight driver described in the device tree.
Remove its Kconfig and Makefile entries and the obsolete omap2plus_defconfig selection.
---
Notes:
Changes against V1:
- Daniel Thompson gave Reviewed-by for the V1 removal of
pandora_bl. V2 additionally removes the stale defconfig option;
the old Reviewed-by is documented here, not carried as a tag.
- Explain replacement by generic pwm-backlight and removal of the defconfig selection.
- Commit-message review assisted by ChatGPT.
arch/arm/configs/omap2plus_defconfig | 1 - drivers/video/backlight/Kconfig | 7 -- drivers/video/backlight/Makefile | 1 - drivers/video/backlight/pandora_bl.c | 159 --------------------------- 4 files changed, 168 deletions(-) delete mode 100644 drivers/video/backlight/pandora_bl.c
arch/arm/configs/omap2plus_defconfig +0 -1
@@ -517,7 +517,6 @@ CONFIG_LCD_CLASS_DEVICE=y CONFIG_LCD_PLATFORM=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_PWM=m -CONFIG_BACKLIGHT_PANDORA=m CONFIG_BACKLIGHT_GPIO=m CONFIG_BACKLIGHT_LED=m CONFIG_FRAMEBUFFER_CONSOLE=y
drivers/video/backlight/Kconfig +0 -7
@@ -459,13 +459,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.56.0
PATCH v2 20/20 ARM: OMAP2+: Remove Pandora platform-data quirks
In reply to H. Nikolaus SchallerThe Pandora backlight is now described in the device tree and driven by pwm-backlight. The sound card also uses device-tree descriptions for its codec and amplifier GPIOs instead of legacy GPIO lookup tables.
Remove omap3_pandora_legacy_init(), its backlight platform device and audio GPIO lookup table, and the associated board compatibility entries. These platform-data quirks are no longer needed.
---
Notes:
Changes against V1:
- Andreas Kemnade raised bisectability and intermediate driver
availability concerns for the V1 pdata-quirks removal.
- Correct the legacy backlight name and explain removal of both backlight platform data and audio GPIO lookup tables.
- Commit-message review assisted by ChatGPT.
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.56.0
Andreas Kemnade
maintainerRe: [PATCH v2 20/20] ARM: OMAP2+: Remove Pandora platform-data quirks
Quoted 37 lines · On Tue, 24 Nov 2026 08:26:00 +0100 "H. Nikolaus Schaller" <[email protected]>…
The Pandora backlight is now described in the device tree and driven by pwm-backlight. The sound card also uses device-tree descriptions for its codec and amplifier GPIOs instead of legacy GPIO lookup tables.
Remove
omap3_pandora_legacy_init(), its backlight platform device and audio GPIO lookup table, and the associated board compatibility entries. These platform-data quirks are no longer needed.Signed-off-by H. Nikolaus Schaller <[email protected]>---
Notes:
Changes against V1:
- Andreas Kemnade raised bisectability and intermediate driver
availability concerns for the V1 pdata-quirks removal.
- Correct the legacy backlight name and explain removal of both backlight platform data and audio GPIO lookup tables.
- Commit-message review assisted by ChatGPT.arch/arm/mach-omap2/pdata-quirks.c | 23 ----------------------- 1 file changed, 23 deletions(-)arch/arm/mach-omap2/pdata-quirks.c +0
-8@@ -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 = {
arch/arm/mach-omap2/pdata-quirks.c static void __init omap3_logicpd_torpedo_init(void) · line 288
Quoted 10 lines
arch/arm/mach-omap2/pdata-quirks.c +0
-10- .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 ) -{
maybe ask here for pwm-backlight node? Then this all can be untangled a bit. so something like if (of_find_compatible_node(NULL, NULL,"pwm-backlight"))
if that node is available do not register that device.
Such a change can go in as soon as we have consensous that pwm-backlight is the way to go.
After all is in, in a final cleanup step, remove the pandora_bl and the quirk.
Quoted 7 lines
arch/arm/mach-omap2/pdata-quirks.c +0
-3-platform_device_register (&pandora_backlight); - gpiod_add_lookup_table(&pandora_soc_audio_gpios); -}#endif /* CONFIG_ARCH_OMAP3 */ #ifdef CONFIG_SOC_DRA7XX
arch/arm/mach-omap2/pdata-quirks.c static struct pdata_init pdata_quirks[] __initdata = { · line 498
Quoted 8 lines
arch/arm/mach-omap2/pdata-quirks.c +0
-2@@ -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 */ }, };
Regards,
Andreas
[email protected]
AI reviewSashiko has finished reviewing this 20-patch series:
Sashiko has finished reviewing this 20-patch series:
- Patches 1, 3-5, 8, 10, 12, 13, 15, 19, and 20: no issues found.
- Patch 2 ("gpio: twl4030: Support REGEN GPIO"): 2 potential issues (1 High, 1 Medium)
- Patch 6 ("dt-bindings: sound: Document OpenPandora sound card"): 3 potential issues (1 Medium, 2 Low)
- Patch 7 ("ASoC: ti: omap3pandora: Convert sound card to DT"): 8 potential issues (2 High, 4 Medium, 2 Low)
- Patch 9 ("pwm: twl: Support 64-cycle PWM frame"): 1 potential issue (1 High)
- Patch 11 ("backlight: pwm: Support enable guard period"): 4 potential issues (3 Medium, 1 Low)
- Patch 14 ("ARM: dts: omap3-pandora: Model LCD power enable depe..."):
4 potential issues (1 High, 3 Low)
- Patch 16 ("ARM: dts: omap3pandora: Describe PCM1773"): 1 potential issue (1 Low)
- Patch 17 ("ARM: dts: omap3pandora: Describe sound card"): 3 potential issues (2 Medium, 1 Low)
- Patch 18 ("ARM: dts: omap3pandora: Switch backlight to PWM"): 3 potential issues (1 High, 1 Medium, 1 Low)
Detailed reviews have been sent as separate replies to patches 2, 6, 7, 9, 11, 14, and 16-18.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]
Mark Brown
maintainerQuoted 5 lines · H. Nikolaus Schaller
PATCH V2 2026-11-24 08:26:00:
Changes in V2:
The series has been reworked and expanded from 16 to 20 patches, addressing review feedback and issues identified during hardware testing.
Quoted 8 lines
Audio and power management:
===========================PWM and backlight:
==================Device Tree and general cleanup:
================================
This is dealing with several tangentially related topics over multiple subsystems in a single series, this makes it a lot less digestable and results in a huge series with an extremely large CC list and murky merge strategy. Please split things out into separate serieses, even within the various subsystems there are batches of independent work which really do not need to be in the same series.
Hi Mark,
Quoted 17 lines
Am 24.11.2026 um 14:38 schrieb Mark Brown <[email protected]>:
Quoted 5 lines · H. Nikolaus Schaller
PATCH V2 2026-11-24 08:26:00:
Changes in V2:
The series has been reworked and expanded from 16 to 20 patches, addressing review feedback and issues identified during hardware testing.Quoted 8 lines
Audio and power management:
===========================PWM and backlight:
==================Device Tree and general cleanup:
================================
Quoted 6 lines
This is dealing with several tangentially related topics over multiple subsystems in a single series, this makes it a lot less digestable and results in a huge series with an extremely large CC list and murky merge strategy. Please split things out into separate serieses, even within the various subsystems there are batches of independent work which really do not need to be in the same series.
Well, they touch exactly one device, the OpenPandora which is the common factor.
They are connected through partially common power management and the total goal is to finally get rid of the ugly and old style pdata-quirks which has been requested for many years but never achieved.
Another goal is to keep bisectability. Therefore a sequence that can be merged independently is quite tricky and may reqire to stretch over several merge windows but seems to be possible (at least ChatGPT pretends to have an idea).
I'll wait for more feedbacks and then prepare multiple series (may become 5 or 6) referring to this one.
BR and thanks,
Nikolaus
Rob Herring
maintainerQuoted 153 lines · H. Nikolaus Schaller
PATCH V2 2026-11-24 08:26:00:
Changes in V2:
The series has been reworked and expanded from 16 to 20 patches, addressing review feedback and issues identified during hardware testing.Audio and power management:
===========================
* Replace the TWL4030 REGEN regulator implementation with an optional GPIO and a fixed regulator described in Device Tree.
* Extend the existing PCM1754 codec driver to support the PCM1773 instead of introducing a separate codec driver.
* Add power supply and power-down GPIO support to the codec driver.
* Improve error handling, resource management and power sequencing in the codec and sound card drivers.
* Update the sound card and codec bindings and Device Tree nodes.PWM and backlight:
==================
* Add optional 64-cycle frame support to the TWL4030 PWM driver.
* Add an optional enable guard period to the generic pwm-backlight driver to prevent the TPS61161 from inadvertently entering EasyScale mode.
* Adjust the Pandora PWM backlight configuration accordingly.
* Remove the obsoleteCONFIG_BACKLIGHT_PANDORAoption fromomap2plus_defconfig.Device Tree and general cleanup:
================================
* Correct and validate the affected Device Tree bindings.
* Reorder the series so that bindings and supporting drivers precede their Device Tree users.
* Improve commit messages and fix coding style issues.
* Clarify the original authorship and take responsibility for contributions previously signed off under a pseudonym.Review feedback addressed:
==========================
* Mark Brown suggested representing TWL4030 REGEN as a GPIO rather than a regulator and reviewed the original standalone PCM1773 driver, which has been replaced by extending the PCM1754 driver.
* Krzysztof Kozlowski requested corrections to the Device Tree bindings, proper schema validation, improved commit messages and clarification of the original contributor's authorship.
* Andreas Kemnade suggested handling the TPS61161 initialization in the backlight layer. V2 implements this through a generic pwm-backlight enable guard period. His comments on clock modeling and patch bisectability were also considered.
* Daniel Thompson provided Reviewed-by for the original removal of the Pandora backlight driver.
* Issues identified by Sashiko and Rob Herring's automated DT validation were reviewed and addressed as applicable.Many thanks to everyone who reviewed V1.
Validation and testing:
=======================
* Based on Linux v7.4-rc4.
* All 20 patches checked with checkpatch.pl.
* Remaining checkpatch warnings and intentional deviations have been reviewed. In particular, ENOTSUPP must be retained in the GPIOset_configcallback because gpiolib handles it differently from EOPNOTSUPP.
*dt_binding_checkanddtbs_checkpassed for all five affected Device Tree bindings.
* The complete series has been successfully built and tested on real OpenPandora hardware.
* LCD operation, PWM backlight brightness control including brightness zero and power-down, and audio playback through the internal speakers and headset have been verified.
* Audio capture was not tested.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 ofmachine_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=22. Ethan Nelson-Moore submitted a patch to replace the macro with DT compatibility checks (accepted as commit
45efb8fbdae3in v7.2-rc1):https://marc.info/?l=linux-omap&m=177841578110704&w=23. 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=2Design 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. Replacingomap3pandora.centirely 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 obsoleteomap3_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]>H. Nikolaus Schaller (17):
dt-bindings: gpio: twl4030: Document REGEN GPIO
gpio: twl4030: Support REGEN GPIO
ASoC: twl4030: Allow APLL rate selection throughset_sysclk()
dt-bindings: sound: pcm1754: Describe PCM1773
ASoC: codecs: pcm1754: Add PCM1773 support
dt-bindings: sound: Document OpenPandora sound card
dt-bindings: mfd: twl4030: Document 64-cycle PWM
pwm: twl: Support 64-cycle PWM frame
dt-bindings: backlight: pwm: Document enable guard
backlight: pwm: Support enable guard period drm/panel: td043mtea1: Attach DT backlight
ARM: dts: omap3pandora: Disable unused DMA channels
ARM: dts: omap3-pandora: Model LCD power enable dependencies
ARM: dts: omap3pandora: Describe PCM1773
ARM: dts: omap3pandora: Switch backlight to PWM
backlight: Remove legacy Pandora driver
ARM: OMAP2+: Remove Pandora platform-data quirks
Quoted 4 lines
Stefan Leichter (3):
ASoC: ti: omap3pandora: Convert sound card to DT
ARM: dts: omap3pandora: Enable audio interfaces
ARM: dts: omap3pandora: Describe sound card
Which of the 7 maintainers do you expect to take this series? Surely this can be broken up into smaller series?
Rob
Quoted 158 lines
Am 24.11.2026 um 16:13 schrieb Rob Herring <[email protected]>:
Quoted 153 lines · H. Nikolaus Schaller
PATCH V2 2026-11-24 08:26:00:
Changes in V2:
The series has been reworked and expanded from 16 to 20 patches, addressing review feedback and issues identified during hardware testing.Audio and power management:
===========================
* Replace the TWL4030 REGEN regulator implementation with an optional GPIO and a fixed regulator described in Device Tree.
* Extend the existing PCM1754 codec driver to support the PCM1773 instead of introducing a separate codec driver.
* Add power supply and power-down GPIO support to the codec driver.
* Improve error handling, resource management and power sequencing in the codec and sound card drivers.
* Update the sound card and codec bindings and Device Tree nodes.PWM and backlight:
==================
* Add optional 64-cycle frame support to the TWL4030 PWM driver.
* Add an optional enable guard period to the generic pwm-backlight driver to prevent the TPS61161 from inadvertently entering EasyScale mode.
* Adjust the Pandora PWM backlight configuration accordingly.
* Remove the obsoleteCONFIG_BACKLIGHT_PANDORAoption fromomap2plus_defconfig.Device Tree and general cleanup:
================================
* Correct and validate the affected Device Tree bindings.
* Reorder the series so that bindings and supporting drivers precede their Device Tree users.
* Improve commit messages and fix coding style issues.
* Clarify the original authorship and take responsibility for contributions previously signed off under a pseudonym.Review feedback addressed:
==========================
* Mark Brown suggested representing TWL4030 REGEN as a GPIO rather than a regulator and reviewed the original standalone PCM1773 driver, which has been replaced by extending the PCM1754 driver.
* Krzysztof Kozlowski requested corrections to the Device Tree bindings, proper schema validation, improved commit messages and clarification of the original contributor's authorship.
* Andreas Kemnade suggested handling the TPS61161 initialization in the backlight layer. V2 implements this through a generic pwm-backlight enable guard period. His comments on clock modeling and patch bisectability were also considered.
* Daniel Thompson provided Reviewed-by for the original removal of the Pandora backlight driver.
* Issues identified by Sashiko and Rob Herring's automated DT validation were reviewed and addressed as applicable.Many thanks to everyone who reviewed V1.
Validation and testing:
=======================
* Based on Linux v7.4-rc4.
* All 20 patches checked with checkpatch.pl.
* Remaining checkpatch warnings and intentional deviations have been reviewed. In particular, ENOTSUPP must be retained in the GPIOset_configcallback because gpiolib handles it differently from EOPNOTSUPP.
*dt_binding_checkanddtbs_checkpassed for all five affected Device Tree bindings.
* The complete series has been successfully built and tested on real OpenPandora hardware.
* LCD operation, PWM backlight brightness control including brightness zero and power-down, and audio playback through the internal speakers and headset have been verified.
* Audio capture was not tested.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 ofmachine_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=22. Ethan Nelson-Moore submitted a patch to replace the macro with DT compatibility checks (accepted as commit
45efb8fbdae3in v7.2-rc1):
https://marc.info/?l=linux-omap&m=177841578110704&w=23. 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=2Design 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. Replacingomap3pandora.centirely 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 obsoleteomap3_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]>H. Nikolaus Schaller (17):
dt-bindings: gpio: twl4030: Document REGEN GPIO
gpio: twl4030: Support REGEN GPIO
ASoC: twl4030: Allow APLL rate selection throughset_sysclk()
dt-bindings: sound: pcm1754: Describe PCM1773
ASoC: codecs: pcm1754: Add PCM1773 support
dt-bindings: sound: Document OpenPandora sound card
dt-bindings: mfd: twl4030: Document 64-cycle PWM
pwm: twl: Support 64-cycle PWM frame
dt-bindings: backlight: pwm: Document enable guard
backlight: pwm: Support enable guard period drm/panel: td043mtea1: Attach DT backlight
ARM: dts: omap3pandora: Disable unused DMA channels
ARM: dts: omap3-pandora: Model LCD power enable dependencies
ARM: dts: omap3pandora: Describe PCM1773
ARM: dts: omap3pandora: Switch backlight to PWM
backlight: Remove legacy Pandora driver
ARM: OMAP2+: Remove Pandora platform-data quirks
Quoted 6 lines
Quoted 4 lines
Stefan Leichter (3):
ASoC: ti: omap3pandora: Convert sound card to DT
ARM: dts: omap3pandora: Enable audio interfaces
ARM: dts: omap3pandora: Describe sound cardWhich of the 7 maintainers do you expect to take this series?
Well, as a contributor for a specific device one is not regularily thinking in maintainers work split but about a series to get a device fixed. Which is obviously orthogonal.
I didn't even recognize that this involves 7 maintainers.
Maybe an extension of checkpatch (which already looks into the MAINTAINER list) could help here?
Quoted 2 lines
Surely
this can be broken up into smaller series?
Yes it (we?) can. It is just a question how to do it and properly describe the dependencies to avoid bisectability problems and avoid that the final goal is lost.
I'll wait a little if there are other comments on individual patches and then start working on the split.
BR and thanks,
Nikolaus
Mark Brown
maintainerQuoted 10 lines · H. Nikolaus Schaller
Quoted 1 line
Which of the 7 maintainers do you expect to take this series?
Well, as a contributor for a specific device one is not regularily thinking in maintainers work split but about a series to get a device fixed. Which is obviously orthogonal.
I didn't even recognize that this involves 7 maintainers.
Maybe an extension of checkpatch (which already looks into the MAINTAINER list) could help here?
The very large CC list you've got here really ought to have been a warning sign here, and all the bits in submitting-patches.rst about splitting patches apply to serieses as much as to individual patches. Note that sometimes extensive cross subsystem interactions are the right thing to do since there are actually overlaps in what's being done, a blanket rule will never cover everything.
Quoted 6 lines
Quoted 2 lines
Surely
this can be broken up into smaller series?Yes it (we?) can. It is just a question how to do it and properly describe the dependencies to avoid bisectability problems and avoid that the final goal is lost.
If your multiple serieses can't be applied without each other then hold off on the dependencies until the earlier things have been applied. It is not managable to track a large stack of interdependencies.
Andreas Kemnade
maintainerQuoted 7 lines · On Tue, 24 Nov 2026 16:27:16 +0100 "H. Nikolaus Schaller" <[email protected]>…
Quoted 2 lines
Surely
this can be broken up into smaller series?Yes it (we?) can. It is just a question how to do it and properly describe the dependencies to avoid bisectability problems and avoid that the final goal is lost.
I think it is indeed tricky, and probably induces delays.
You can point to the pandora_bl driver resp the pandora sound card to show the final goal.
If I understand it correctly, you have
1. preparations/extensions for using the standard pwm backlight.
2. REGEN stuff to wire up the power supply.
3. dts changes to wire up backlight and its power supply.
4. sound: quirks in twl4030 codec
5. sound: dt conversion of the sound card.
6. dts changes to wire up sound card and its power supply
7. machine quirk cleanup
So what brings it all together: the power supply requirments, so both backlight and sound depend on 2.
Maybe it is an idea to split this into a set of
One patchset for
7a. machine quirk conditionally depending on available compatible 2.
1.
3.
Each can go into their individual trees.
3. might to in the next release cycle after 7a, 2. 1.
A second patchset sent after 3 is in -next, containg 4.
5.
6.
A third:
7b: remove quirk + pandora_bl
Regards,
Andreas