* [PATCH v2 01/20] dt-bindings: gpio: twl4030: Document REGEN GPIO
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 02/20] gpio: twl4030: Support " H. Nikolaus Schaller
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml b/Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml
index 96d50d14c0710..25ba4328ac2d0 100644
--- a/Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/ti,twl4030-gpio.yaml
@@ -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:
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 02/20] gpio: twl4030: Support REGEN GPIO
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 01/20] dt-bindings: gpio: twl4030: Document REGEN GPIO H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 03/20] ASoC: twl4030: Allow APLL rate selection through set_sysclk() H. Nikolaus Schaller
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Allow 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 3e06ef9e22336..30ac6f7e0e56a 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -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) {
diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h
index 238d9dcefc358..9cceb4fe6c12e 100644
--- a/include/linux/mfd/twl.h
+++ b/include/linux/mfd/twl.h
@@ -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;
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 03/20] ASoC: twl4030: Allow APLL rate selection through set_sysclk()
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 01/20] dt-bindings: gpio: twl4030: Document REGEN GPIO H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 02/20] gpio: twl4030: Support " H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773 H. Nikolaus Schaller
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller, Grond
The 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.
Suggested-by: Grond <grond66@riseup.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/include/linux/mfd/twl4030-audio.h b/include/linux/mfd/twl4030-audio.h
index 1c28605dfda80..4378eef97b0fc 100644
--- a/include/linux/mfd/twl4030-audio.h
+++ b/include/linux/mfd/twl4030-audio.h
@@ -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,
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index e207721b99414..3c9ed38004783 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -198,6 +198,38 @@ static void twl4030_codec_enable(struct snd_soc_component *component, int enable
udelay(10);
}
+static int twl4030_perform_writes(struct snd_soc_component *component,
+ const unsigned int *regs,
+ const unsigned int *vals,
+ unsigned int n)
+{
+ struct twl4030_priv *twl4030 = snd_soc_component_get_drvdata(component);
+ bool reboot_codec = twl4030->codec_powered;
+ unsigned int i;
+ int ret = 0;
+
+ if (reboot_codec)
+ twl4030_codec_enable(component, 0);
+
+ for (i = 0; i < n; ++i) {
+ ret = twl4030_write(component, regs[i], vals[i]);
+ if (ret)
+ break;
+ }
+
+ if (reboot_codec)
+ twl4030_codec_enable(component, 1);
+
+ return ret;
+}
+
+static inline int
+twl4030_perform_single_write(struct snd_soc_component *component,
+ unsigned int reg, unsigned int val)
+{
+ return twl4030_perform_writes(component, ®, &val, 1);
+}
+
static void
twl4030_get_board_param_values(struct twl4030_board_params *board_params,
struct device_node *node)
@@ -1697,38 +1729,16 @@ static void twl4030_shutdown(struct snd_pcm_substream *substream,
twl4030_tdm_enable(component, substream->stream, 0);
}
-static int twl4030_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
+static int twl4030_get_codec_mode_for_apll_rate(struct snd_soc_component *component,
+ unsigned int rate, u8 *res)
{
- struct snd_soc_component *component = dai->component;
- struct twl4030_priv *twl4030 = snd_soc_component_get_drvdata(component);
- u8 mode, old_mode, format, old_format;
-
- /* If the substream has 4 channel, do the necessary setup */
- if (params_channels(params) == 4) {
- format = twl4030_read(component, TWL4030_REG_AUDIO_IF);
- mode = twl4030_read(component, TWL4030_REG_CODEC_MODE);
-
- /* Safety check: are we in the correct operating mode and
- * the interface is in TDM mode? */
- if ((mode & TWL4030_OPTION_1) &&
- ((format & TWL4030_AIF_FORMAT) == TWL4030_AIF_FORMAT_TDM))
- twl4030_tdm_enable(component, substream->stream, 1);
- else
- return -EINVAL;
- }
-
- if (twl4030->configured)
- /* Ignoring hw_params for already configured DAI */
- return 0;
+ u8 old_mode, mode;
- /* bit rate */
old_mode = twl4030_read(component,
TWL4030_REG_CODEC_MODE) & ~TWL4030_CODECPDZ;
mode = old_mode & ~TWL4030_APLL_RATE;
- switch (params_rate(params)) {
+ switch (rate) {
case 8000:
mode |= TWL4030_APLL_RATE_8000;
break;
@@ -1760,11 +1770,50 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
mode |= TWL4030_APLL_RATE_96000;
break;
default:
- dev_err(component->dev, "%s: unknown rate %d\n", __func__,
- params_rate(params));
+ dev_err(component->dev, "%s: unknown rate %u\n", __func__,
+ rate);
return -EINVAL;
}
+ *res = mode;
+
+ return mode != old_mode ? 1 : 0;
+}
+
+static int twl4030_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct twl4030_priv *twl4030 = snd_soc_component_get_drvdata(component);
+ u8 mode, format, old_format;
+ int s, ret;
+ unsigned int regs[2], vals[2];
+
+ /* If the substream has 4 channel, do the necessary setup */
+ if (params_channels(params) == 4) {
+ format = twl4030_read(component, TWL4030_REG_AUDIO_IF);
+ mode = twl4030_read(component, TWL4030_REG_CODEC_MODE);
+
+ /* Safety check: are we in the correct operating mode and
+ * the interface is in TDM mode?
+ */
+ if ((mode & TWL4030_OPTION_1) &&
+ ((format & TWL4030_AIF_FORMAT) == TWL4030_AIF_FORMAT_TDM))
+ twl4030_tdm_enable(component, substream->stream, 1);
+ else
+ return -EINVAL;
+ }
+
+ if (twl4030->configured)
+ /* Ignoring hw_params for already configured DAI */
+ return 0;
+
+ s = twl4030_get_codec_mode_for_apll_rate(component,
+ params_rate(params), &mode);
+ if (s < 0)
+ return s;
+
/* sample size */
old_format = twl4030_read(component, TWL4030_REG_AUDIO_IF);
format = old_format;
@@ -1782,20 +1831,14 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (format != old_format || mode != old_mode) {
- if (twl4030->codec_powered) {
- /*
- * If the codec is powered, than we need to toggle the
- * codec power.
- */
- twl4030_codec_enable(component, 0);
- twl4030_write(component, TWL4030_REG_CODEC_MODE, mode);
- twl4030_write(component, TWL4030_REG_AUDIO_IF, format);
- twl4030_codec_enable(component, 1);
- } else {
- twl4030_write(component, TWL4030_REG_CODEC_MODE, mode);
- twl4030_write(component, TWL4030_REG_AUDIO_IF, format);
- }
+ if (format != old_format || s) {
+ regs[0] = TWL4030_REG_CODEC_MODE;
+ vals[0] = mode;
+ regs[1] = TWL4030_REG_AUDIO_IF;
+ vals[1] = format;
+ ret = twl4030_perform_writes(component, regs, vals, ARRAY_SIZE(regs));
+ if (ret)
+ return ret;
}
/* Store the important parameters for the DAI configuration and set
@@ -1820,6 +1863,21 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
{
struct snd_soc_component *component = codec_dai->component;
struct twl4030_priv *twl4030 = snd_soc_component_get_drvdata(component);
+ int s;
+ u8 mode;
+
+ if (clk_id == TWL4030_CLOCK_APLL) {
+ s = twl4030_get_codec_mode_for_apll_rate(component,
+ freq, &mode);
+ if (s < 0)
+ return s;
+
+ if (s)
+ return twl4030_perform_single_write(component,
+ TWL4030_REG_CODEC_MODE, mode);
+
+ return 0;
+ }
switch (freq) {
case 19200000:
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (2 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 03/20] ASoC: twl4030: Allow APLL rate selection through set_sysclk() H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT H. Nikolaus Schaller
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Extend 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/Documentation/devicetree/bindings/sound/ti,pcm1754.yaml b/Documentation/devicetree/bindings/sound/ti,pcm1754.yaml
index a757f737690c1..ee2ebd819db00 100644
--- a/Documentation/devicetree/bindings/sound/ti,pcm1754.yaml
+++ b/Documentation/devicetree/bindings/sound/ti,pcm1754.yaml
@@ -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 <s.kerkmann@pengutronix.de>
@@ -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:
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (3 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773 H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM H. Nikolaus Schaller
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, Stefan Leichter, Grond,
H. Nikolaus Schaller
From: Stefan Leichter <sle85276@gmx.de>
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.
Signed-off-by: Stefan Leichter <sle85276@gmx.de>
Suggested-by: Grond <grond66@riseup.net>
Co-developed-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/sound/soc/ti/omap3pandora.c b/sound/soc/ti/omap3pandora.c
index 6c9c184cd9d6f..d747c0e6b48cb 100644
--- a/sound/soc/ti/omap3pandora.c
+++ b/sound/soc/ti/omap3pandora.c
@@ -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 <notasas@gmail.com>");
MODULE_DESCRIPTION("ALSA SoC OMAP3 Pandora");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:omap3pandora-sound");
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (4 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 09/20] pwm: twl: Support 64-cycle PWM frame H. Nikolaus Schaller
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, 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 <hns@goldelico.com>
---
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(+)
diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
index 9cc3e4721612e..f458f0d80f2cd 100644
--- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
+++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
@@ -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'
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 09/20] pwm: twl: Support 64-cycle PWM frame
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (5 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 10/20] dt-bindings: backlight: pwm: Document enable guard H. Nikolaus Schaller
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Implement 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/drivers/pwm/pwm-twl.c b/drivers/pwm/pwm-twl.c
index 99c1caf4f19c8..70567d5805f43 100644
--- a/drivers/pwm/pwm-twl.c
+++ b/drivers/pwm/pwm-twl.c
@@ -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);
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 10/20] dt-bindings: backlight: pwm: Document enable guard
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (6 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 09/20] pwm: twl: Support 64-cycle PWM frame H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 11/20] backlight: pwm: Support enable guard period H. Nikolaus Schaller
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
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 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml
index b71f6454a4ac2..9172f14bfb76f 100644
--- a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml
+++ b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml
@@ -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]
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 11/20] backlight: pwm: Support enable guard period
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (7 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 10/20] dt-bindings: backlight: pwm: Document enable guard H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 12/20] drm/panel: td043mtea1: Attach DT backlight H. Nikolaus Schaller
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Some 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.
Suggested-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://patchwork.kernel.org/project/linux-omap/patch/f897f695c0e1e128d7ebb41be8dfdce4d634f552.1783749722.git.hns@goldelico.com/#27124981
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 3ad71ee3657af..1d0a463710926 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -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;
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 0bf80e98d5b40..35cf19b1e9768 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -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);
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 12/20] drm/panel: td043mtea1: Attach DT backlight
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (8 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 11/20] backlight: pwm: Support enable guard period H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 13/20] ARM: dts: omap3pandora: Disable unused DMA channels H. Nikolaus Schaller
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Connect 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
index b18af526b54c5..cb2fa393591c8 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
@@ -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");
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 13/20] ARM: dts: omap3pandora: Disable unused DMA channels
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (9 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 12/20] drm/panel: td043mtea1: Attach DT backlight H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 14/20] ARM: dts: omap3-pandora: Model LCD power enable dependencies H. Nikolaus Schaller
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller, Grond
On 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.
Suggested-by: Grond <grond66@riseup.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index 06c5b23589991..2097ec15c6513 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -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 {
};
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 14/20] ARM: dts: omap3-pandora: Model LCD power enable dependencies
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (10 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 13/20] ARM: dts: omap3pandora: Disable unused DMA channels H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 15/20] ARM: dts: omap3pandora: Enable audio interfaces H. Nikolaus Schaller
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller, Grond
The 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.
Suggested-by: Grond <grond66@riseup.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(-)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index 2097ec15c6513..f25fc4f8ad042 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -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 {
};
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 15/20] ARM: dts: omap3pandora: Enable audio interfaces
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (11 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 14/20] ARM: dts: omap3-pandora: Model LCD power enable dependencies H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 16/20] ARM: dts: omap3pandora: Describe PCM1773 H. Nikolaus Schaller
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, Stefan Leichter,
H. Nikolaus Schaller
From: Stefan Leichter <sle85276@gmx.de>
Enable McBSP2 for the external playback DAC and McBSP4 for the
TWL4030 capture path on OpenPandora.
Signed-off-by: Stefan Leichter <sle85276@gmx.de>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index f25fc4f8ad042..2a5e8ba5714da 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -728,6 +728,7 @@ &mcbsp1 {
/* audio DAC */
&mcbsp2 {
+ status = "okay";
};
/* bluetooth */
@@ -740,6 +741,7 @@ &mcbsp3 {
/* to twl4030*/
&mcbsp4 {
+ status = "okay";
};
&venc {
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 16/20] ARM: dts: omap3pandora: Describe PCM1773
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (12 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 15/20] ARM: dts: omap3pandora: Enable audio interfaces H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 17/20] ARM: dts: omap3pandora: Describe sound card H. Nikolaus Schaller
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller, Grond
Describe 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.
Suggested-by: Grond <grond66@riseup.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index 2a5e8ba5714da..6e349f7ae6936 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -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";
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 17/20] ARM: dts: omap3pandora: Describe sound card
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (13 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 16/20] ARM: dts: omap3pandora: Describe PCM1773 H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 19/20] backlight: Remove legacy Pandora driver H. Nikolaus Schaller
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, Stefan Leichter,
H. Nikolaus Schaller
From: Stefan Leichter <sle85276@gmx.de>
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.
Signed-off-by: Stefan Leichter <sle85276@gmx.de>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index 6e349f7ae6936..a5633d93547a3 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -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 */
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (14 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 17/20] ARM: dts: omap3pandora: Describe sound card H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 19/20] backlight: Remove legacy Pandora driver H. Nikolaus Schaller
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Replace 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
index a5633d93547a3..6bdfbd80b9fcd 100644
--- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
@@ -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>;
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 19/20] backlight: Remove legacy Pandora driver
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
` (15 preceding siblings ...)
2026-11-24 7:25 ` [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM H. Nikolaus Schaller
@ 2026-11-24 7:25 ` H. Nikolaus Schaller
16 siblings, 0 replies; 18+ messages in thread
From: H. Nikolaus Schaller @ 2026-11-24 7:25 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Liam Girdwood, Mark Brown,
Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren, Russell King, Neil Armstrong, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Uwe Kleine-König, Helge Deller, Jaroslav Kysela,
Takashi Iwai, Peter Ujfalusi, Jarkko Nikula
Cc: Jessica Zhang, linux-gpio, devicetree, linux-kernel, dri-devel,
linux-leds, linux-sound, linux-omap, linux-arm-kernel, linux-pwm,
linux-fbdev, letux-kernel, kernel, H. Nikolaus Schaller
Remove 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.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
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
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 5791953b75fff..ef5e8d1bf9da1 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -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
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index dbf4ca23a9b6d..040e6cc7e5a29 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -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
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 34469711c6cd9..c62c920e64b96 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -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
diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c
deleted file mode 100644
index e6889e2ac55e1..0000000000000
--- a/drivers/video/backlight/pandora_bl.c
+++ /dev/null
@@ -1,159 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Backlight driver for Pandora handheld.
- * Pandora uses TWL4030 PWM0 -> TPS61161 combo for control backlight.
- * Based on pwm_bl.c
- *
- * Copyright 2009,2012 Gražvydas Ignotas <notasas@gmail.com>
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/backlight.h>
-#include <linux/mfd/twl.h>
-#include <linux/err.h>
-
-#define TWL_PWM0_ON 0x00
-#define TWL_PWM0_OFF 0x01
-
-#define TWL_INTBR_GPBR1 0x0c
-#define TWL_INTBR_PMBR1 0x0d
-
-#define TWL_PMBR1_PWM0_MUXMASK 0x0c
-#define TWL_PMBR1_PWM0 0x04
-#define PWM0_CLK_ENABLE BIT(0)
-#define PWM0_ENABLE BIT(2)
-
-/* range accepted by hardware */
-#define MIN_VALUE 9
-#define MAX_VALUE 63
-#define MAX_USER_VALUE (MAX_VALUE - MIN_VALUE)
-
-struct pandora_private {
- unsigned old_state;
-#define PANDORABL_WAS_OFF 1
-};
-
-static int pandora_backlight_update_status(struct backlight_device *bl)
-{
- int brightness = bl->props.brightness;
- struct pandora_private *priv = bl_get_data(bl);
- u8 r;
-
- if (bl->props.power != BACKLIGHT_POWER_ON)
- brightness = 0;
- if (bl->props.state & BL_CORE_FBBLANK)
- brightness = 0;
- if (bl->props.state & BL_CORE_SUSPENDED)
- brightness = 0;
-
- if ((unsigned int)brightness > MAX_USER_VALUE)
- brightness = MAX_USER_VALUE;
-
- if (brightness == 0) {
- if (priv->old_state == PANDORABL_WAS_OFF)
- goto done;
-
- /* first disable PWM0 output, then clock */
- twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1);
- r &= ~PWM0_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
- r &= ~PWM0_CLK_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
-
- goto done;
- }
-
- if (priv->old_state == PANDORABL_WAS_OFF) {
- /*
- * set PWM duty cycle to max. TPS61161 seems to use this
- * to calibrate it's PWM sensitivity when it starts.
- */
- twl_i2c_write_u8(TWL_MODULE_PWM, MAX_VALUE, TWL_PWM0_OFF);
-
- /* first enable clock, then PWM0 out */
- twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1);
- r &= ~PWM0_ENABLE;
- r |= PWM0_CLK_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
- r |= PWM0_ENABLE;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1);
-
- /*
- * TI made it very easy to enable digital control, so easy that
- * it often triggers unintentionally and disabes PWM control,
- * so wait until 1 wire mode detection window ends.
- */
- usleep_range(2000, 10000);
- }
-
- twl_i2c_write_u8(TWL_MODULE_PWM, MIN_VALUE + brightness, TWL_PWM0_OFF);
-
-done:
- if (brightness != 0)
- priv->old_state = 0;
- else
- priv->old_state = PANDORABL_WAS_OFF;
-
- return 0;
-}
-
-static const struct backlight_ops pandora_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = pandora_backlight_update_status,
-};
-
-static int pandora_backlight_probe(struct platform_device *pdev)
-{
- struct backlight_properties props;
- struct backlight_device *bl;
- struct pandora_private *priv;
- u8 r;
-
- priv = devm_kmalloc_obj(&pdev->dev, *priv);
- if (!priv)
- return -ENOMEM;
-
- memset(&props, 0, sizeof(props));
- props.max_brightness = MAX_USER_VALUE;
- props.type = BACKLIGHT_RAW;
- bl = devm_backlight_device_register(&pdev->dev, pdev->name, &pdev->dev,
- priv, &pandora_backlight_ops, &props);
- if (IS_ERR(bl)) {
- dev_err(&pdev->dev, "failed to register backlight\n");
- return PTR_ERR(bl);
- }
-
- platform_set_drvdata(pdev, bl);
-
- /* 64 cycle period, ON position 0 */
- twl_i2c_write_u8(TWL_MODULE_PWM, 0x80, TWL_PWM0_ON);
-
- priv->old_state = PANDORABL_WAS_OFF;
- bl->props.brightness = MAX_USER_VALUE;
- backlight_update_status(bl);
-
- /* enable PWM function in pin mux */
- twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_PMBR1);
- r &= ~TWL_PMBR1_PWM0_MUXMASK;
- r |= TWL_PMBR1_PWM0;
- twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_PMBR1);
-
- return 0;
-}
-
-static struct platform_driver pandora_backlight_driver = {
- .driver = {
- .name = "pandora-backlight",
- },
- .probe = pandora_backlight_probe,
-};
-
-module_platform_driver(pandora_backlight_driver);
-
-MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>");
-MODULE_DESCRIPTION("Pandora Backlight Driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:pandora-backlight");
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread