* Re: [PATCH v1 1/6] dt-bindings: leds: Document TI LM3533 LED controller
From: Jonathan Cameron @ 2026-05-17 13:44 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko, Helge Deller, dri-devel, linux-leds, devicetree,
linux-kernel, linux-iio, linux-fbdev
In-Reply-To: <20260517074306.30937-2-clamor95@gmail.com>
On Sun, 17 May 2026 10:43:01 +0300
Svyatoslav Ryhel <clamor95@gmail.com> wrote:
> Document the LM3533 - a complete power source for backlight, keypad and
> indicator LEDs in smartphone handsets. The high-voltage inductive boost
> converter provides the power for two series LED strings display backlight
> and keypad functions.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Hi Svyatoslav,
I focused on the ALS part.. A few comments.
> +# see ti,lm3533.yaml for an example
> diff --git a/Documentation/devicetree/bindings/leds/ti,lm3533.yaml b/Documentation/devicetree/bindings/leds/ti,lm3533.yaml
> new file mode 100644
> index 000000000000..2e200f172400
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/ti,lm3533.yaml
> @@ -0,0 +1,190 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/ti,lm3533.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TI LM3533 Complete Lighting Power Solution
> +
> +description: >
> + The LM3533 is a complete power source for backlight, keypad, and indicator LEDs
> + in smartphone handsets. The high-voltage inductive boost converter provides the
> + power for two high voltage series LED strings for display backlight and four low
> + voltage control banks for individual LEDs. Additionally, LM3533 features an ALS
> + sensor support.
Mention it is an interface for an external ALS.
> + light-sensor:
> + type: object
> + additionalProperties: false
> +
> + properties:
> + compatible:
> + const: ti,lm3533-als
> +
> + interrupts:
> + maxItems: 1
> +
> + ti,resistor-ohm:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + Internal configuration resister value when ALS is in Analog Sensor
> + mode and PWM mode is disabled.
Good to note why this is a firmware thing rather than a userspace controlled
thing. I looked it up, it's because expectation is the input is a current from
the external analog ALS and these are used to convert it to a voltage with target
range.
> + minimum: 1575
> + maximum: 200000
> +
> + ti,pwm-mode:
> + type: boolean
> + description:
> + Switch for mode in which ALS is running. If this property is set
> + then ALS is running in PWM mode, internal resistor value is set to
> + high-impedance (0) and ti,resistor-ohm property is ignored.
I'd mention the ALS is an external device - so this is saying what interface thing
thing connected is using.
> +
> + required:
> + - compatible
> +
> + anyOf:
> + - required:
> + - ti,resistor-ohm
> + - required:
> + - ti,pwm-mode
> +
> +patternProperties:
> + "^backlight@[01]$":
> + $ref: /schemas/leds/backlight/ti,lm3533-backlight.yaml#
> +
> + "^led@[2-5]$":
> + $ref: /schemas/leds/ti,lm3533-leds.yaml#
> +
> +required:
> + - compatible
> + - reg
> + - light-sensor
> + - backlight@0
> + - backlight@1
Similar for the led nodes.
> + - led@2
> + - led@3
> + - led@4
> + - led@5
Curious - why are all the led nodes required? What if some aren't wired to anything?
> +
> +additionalProperties: false
^ permalink raw reply
* [PATCH] staging: sm750: rename CamelCase variable Bpp to bpp
From: Rupesh Majhi @ 2026-05-17 13:19 UTC (permalink / raw)
To: gregkh
Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
linux-kernel, Rupesh Majhi
Rename the CamelCase variable 'Bpp' to 'bpp' in both the header
and implementation files to comply with Linux kernel coding style.
Issue found by checkpatch.
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
---
drivers/staging/sm750fb/sm750_accel.c | 22 +++++++++++-----------
drivers/staging/sm750fb/sm750_accel.h | 6 +++---
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index ec2f0a6aa57d..59449a84728a 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -85,7 +85,7 @@ void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt)
}
int sm750_hw_fillrect(struct lynx_accel *accel,
- u32 base, u32 pitch, u32 Bpp,
+ u32 base, u32 pitch, u32 bpp,
u32 x, u32 y, u32 width, u32 height,
u32 color, u32 rop)
{
@@ -103,14 +103,14 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
write_dpr(accel, DE_PITCH,
- ((pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
+ ((pitch / bpp << DE_PITCH_DESTINATION_SHIFT) &
DE_PITCH_DESTINATION_MASK) |
- (pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
+ (pitch / bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
write_dpr(accel, DE_WINDOW_WIDTH,
- ((pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
+ ((pitch / bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
DE_WINDOW_WIDTH_DST_MASK) |
- (pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr44 */
+ (pitch / bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr44 */
write_dpr(accel, DE_FOREGROUND, color); /* DPR14 */
@@ -139,7 +139,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
* @sy: Starting y coordinate of source surface
* @dest_base: Address of destination: offset in frame buffer
* @dest_pitch: Pitch value of destination surface in BYTE
- * @Bpp: Color depth of destination surface
+ * @bpp: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
* @dy: Starting y coordinate of destination surface
* @width: width of rectangle in pixel value
@@ -150,7 +150,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
unsigned int source_base, unsigned int source_pitch,
unsigned int sx, unsigned int sy,
unsigned int dest_base, unsigned int dest_pitch,
- unsigned int Bpp, unsigned int dx, unsigned int dy,
+ unsigned int bpp, unsigned int dx, unsigned int dy,
unsigned int width, unsigned int height,
unsigned int rop2)
{
@@ -251,9 +251,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* pixel values. Need Byte to pixel conversion.
*/
write_dpr(accel, DE_PITCH,
- ((dest_pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
+ ((dest_pitch / bpp << DE_PITCH_DESTINATION_SHIFT) &
DE_PITCH_DESTINATION_MASK) |
- (source_pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
+ (source_pitch / bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
/*
* Screen Window width in Pixels.
@@ -261,9 +261,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* for a given point.
*/
write_dpr(accel, DE_WINDOW_WIDTH,
- ((dest_pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
+ ((dest_pitch / bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
DE_WINDOW_WIDTH_DST_MASK) |
- (source_pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
+ (source_pitch / bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
ret = accel->de_wait();
if (ret)
diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h
index 2c79cb730a0a..d15a40cacb84 100644
--- a/drivers/staging/sm750fb/sm750_accel.h
+++ b/drivers/staging/sm750fb/sm750_accel.h
@@ -190,7 +190,7 @@ void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt);
void sm750_hw_de_init(struct lynx_accel *accel);
int sm750_hw_fillrect(struct lynx_accel *accel,
- u32 base, u32 pitch, u32 Bpp,
+ u32 base, u32 pitch, u32 bpp,
u32 x, u32 y, u32 width, u32 height,
u32 color, u32 rop);
@@ -202,7 +202,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
* @sy: Starting y coordinate of source surface
* @dBase: Address of destination: offset in frame buffer
* @dPitch: Pitch value of destination surface in BYTE
- * @Bpp: Color depth of destination surface
+ * @bpp: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
* @dy: Starting y coordinate of destination surface
* @width: width of rectangle in pixel value
@@ -213,7 +213,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
unsigned int sBase, unsigned int sPitch,
unsigned int sx, unsigned int sy,
unsigned int dBase, unsigned int dPitch,
- unsigned int Bpp, unsigned int dx, unsigned int dy,
+ unsigned int bpp, unsigned int dx, unsigned int dy,
unsigned int width, unsigned int height,
unsigned int rop2);
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v1 2/6] mfd: lm3533: Convert to use OF bindings
From: Svyatoslav Ryhel @ 2026-05-17 11:10 UTC (permalink / raw)
To: Lee Jones
Cc: Daniel Thompson, Jingoo Han, Rob Herring, Pavel Machek,
Krzysztof Kozlowski, Conor Dooley, David Lechner,
Jonathan Cameron, Nuno Sá, Helge Deller, dri-devel,
linux-leds, devicetree, linux-kernel, linux-iio, linux-fbdev,
Svyatoslav Ryhel, Andy Shevchenko
In-Reply-To: <20260517074306.30937-3-clamor95@gmail.com>
нд, 17 трав. 2026 р. о 10:43 Svyatoslav Ryhel <clamor95@gmail.com> пише:
>
> Since there are no users of this driver via platform data, remove the
> platform data support and switch to using Device Tree bindings.
> Additionally, optimize functions used only by platform data.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
> drivers/iio/light/lm3533-als.c | 123 +++++--------
> drivers/leds/leds-lm3533.c | 60 ++++---
> drivers/mfd/lm3533-core.c | 257 +++++++++-------------------
> drivers/video/backlight/lm3533_bl.c | 52 ++++--
> include/linux/mfd/lm3533.h | 51 +-----
> 5 files changed, 202 insertions(+), 341 deletions(-)
>
> diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> index 99f0b903018c..853abb96e13f 100644
> --- a/drivers/iio/light/lm3533-als.c
> +++ b/drivers/iio/light/lm3533-als.c
> @@ -16,15 +16,18 @@
> #include <linux/module.h>
> #include <linux/mutex.h>
> #include <linux/mfd/core.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/slab.h>
> #include <linux/uaccess.h>
> +#include <linux/units.h>
>
> #include <linux/mfd/lm3533.h>
>
>
> -#define LM3533_ALS_RESISTOR_MIN 1
> -#define LM3533_ALS_RESISTOR_MAX 127
> +#define LM3533_ALS_RESISTOR_MIN 1575
> +#define LM3533_ALS_RESISTOR_MAX 200000
> #define LM3533_ALS_CHANNEL_CURRENT_MAX 2
> #define LM3533_ALS_THRESH_MAX 3
> #define LM3533_ALS_ZONE_MAX 4
> @@ -56,6 +59,9 @@ struct lm3533_als {
>
> atomic_t zone;
> struct mutex thresh_mutex;
> +
> + bool pwm_mode;
> + u32 r_select;
> };
>
>
> @@ -714,64 +720,6 @@ static const struct attribute_group lm3533_als_attribute_group = {
> .attrs = lm3533_als_attributes
> };
>
> -static int lm3533_als_set_input_mode(struct lm3533_als *als, bool pwm_mode)
> -{
> - u8 mask = LM3533_ALS_INPUT_MODE_MASK;
> - u8 val;
> - int ret;
> -
> - if (pwm_mode)
> - val = mask; /* pwm input */
> - else
> - val = 0; /* analog input */
> -
> - ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, val, mask);
> - if (ret) {
> - dev_err(&als->pdev->dev, "failed to set input mode %d\n",
> - pwm_mode);
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> -static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
> -{
> - int ret;
> -
> - if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) {
> - dev_err(&als->pdev->dev, "invalid resistor value\n");
> - return -EINVAL;
> - }
> -
> - ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val);
> - if (ret) {
> - dev_err(&als->pdev->dev, "failed to set resistor\n");
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> -static int lm3533_als_setup(struct lm3533_als *als,
> - const struct lm3533_als_platform_data *pdata)
> -{
> - int ret;
> -
> - ret = lm3533_als_set_input_mode(als, pdata->pwm_mode);
> - if (ret)
> - return ret;
> -
> - /* ALS input is always high impedance in PWM-mode. */
> - if (!pdata->pwm_mode) {
> - ret = lm3533_als_set_resistor(als, pdata->r_select);
> - if (ret)
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
> {
> u8 mask = LM3533_ALS_INT_ENABLE_MASK;
> @@ -784,7 +732,8 @@ static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
> return ret;
> }
>
> - ret = request_threaded_irq(als->irq, NULL, lm3533_als_isr,
> + ret = devm_request_threaded_irq(&als->pdev->dev, als->irq, NULL,
> + lm3533_als_isr,
> IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> dev_name(&als->pdev->dev), dev);
> if (ret) {
> @@ -828,7 +777,6 @@ static const struct iio_info lm3533_als_info = {
>
> static int lm3533_als_probe(struct platform_device *pdev)
> {
> - const struct lm3533_als_platform_data *pdata;
> struct lm3533 *lm3533;
> struct lm3533_als *als;
> struct iio_dev *indio_dev;
> @@ -838,12 +786,6 @@ static int lm3533_als_probe(struct platform_device *pdev)
> if (!lm3533)
> return -EINVAL;
>
> - pdata = dev_get_platdata(&pdev->dev);
> - if (!pdata) {
> - dev_err(&pdev->dev, "no platform data\n");
> - return -EINVAL;
> - }
> -
> indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*als));
> if (!indio_dev)
> return -ENOMEM;
> @@ -852,31 +794,52 @@ static int lm3533_als_probe(struct platform_device *pdev)
> indio_dev->channels = lm3533_als_channels;
> indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
> indio_dev->name = dev_name(&pdev->dev);
> - iio_device_set_parent(indio_dev, pdev->dev.parent);
> indio_dev->modes = INDIO_DIRECT_MODE;
>
> als = iio_priv(indio_dev);
> als->lm3533 = lm3533;
> als->pdev = pdev;
> - als->irq = lm3533->irq;
> + als->irq = platform_get_irq_optional(pdev, 0);
> atomic_set(&als->zone, 0);
> mutex_init(&als->thresh_mutex);
>
> platform_set_drvdata(pdev, indio_dev);
>
> - if (als->irq) {
> + if (als->irq > 0) {
> ret = lm3533_als_setup_irq(als, indio_dev);
> if (ret)
> return ret;
> }
>
> - ret = lm3533_als_setup(als, pdata);
> + device_property_read_u32(&pdev->dev, "ti,resistor-value-ohm",
> + &als->r_select);
> +
> + als->r_select = clamp(als->r_select, LM3533_ALS_RESISTOR_MIN,
> + LM3533_ALS_RESISTOR_MAX);
> + als->r_select = DIV_ROUND_UP(2 * MICRO, 10 * als->r_select);
> +
> + als->pwm_mode = device_property_read_bool(&pdev->dev, "ti,pwm-mode");
> +
> + ret = lm3533_update(lm3533, LM3533_REG_ALS_CONF, als->pwm_mode ?
> + LM3533_ALS_INPUT_MODE_MASK : 0,
> + LM3533_ALS_INPUT_MODE_MASK);
> if (ret)
> - goto err_free_irq;
> + return dev_err_probe(&pdev->dev, ret,
> + "failed to set input mode %d\n",
> + als->pwm_mode);
> +
> + /* ALS input is always high impedance in PWM-mode. */
> + if (!als->pwm_mode) {
> + ret = lm3533_write(lm3533, LM3533_REG_ALS_RESISTOR_SELECT,
> + (u8)als->r_select);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret,
> + "failed to set resistor\n");
> + }
>
> ret = lm3533_als_enable(als);
> if (ret)
> - goto err_free_irq;
> + return ret;
>
> ret = iio_device_register(indio_dev);
> if (ret) {
> @@ -888,9 +851,6 @@ static int lm3533_als_probe(struct platform_device *pdev)
>
> err_disable:
> lm3533_als_disable(als);
> -err_free_irq:
> - if (als->irq)
> - free_irq(als->irq, indio_dev);
>
> return ret;
> }
> @@ -903,13 +863,18 @@ static void lm3533_als_remove(struct platform_device *pdev)
> lm3533_als_set_int_mode(indio_dev, false);
> iio_device_unregister(indio_dev);
> lm3533_als_disable(als);
> - if (als->irq)
> - free_irq(als->irq, indio_dev);
> }
>
> +static const struct of_device_id lm3533_als_match_table[] = {
> + { .compatible = "ti,lm3533-als" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, lm3533_als_match_table);
> +
> static struct platform_driver lm3533_als_driver = {
> .driver = {
> .name = "lm3533-als",
> + .of_match_table = lm3533_als_match_table,
> },
> .probe = lm3533_als_probe,
> .remove = lm3533_als_remove,
> diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
> index 45795f2a1042..f6345bc1f443 100644
> --- a/drivers/leds/leds-lm3533.c
> +++ b/drivers/leds/leds-lm3533.c
> @@ -10,8 +10,10 @@
> #include <linux/module.h>
> #include <linux/leds.h>
> #include <linux/mfd/core.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/mutex.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/slab.h>
>
> #include <linux/mfd/lm3533.h>
> @@ -48,6 +50,9 @@ struct lm3533_led {
>
> struct mutex mutex;
> unsigned long flags;
> +
> + u32 max_current;
> + u32 pwm;
> };
>
>
> @@ -632,22 +637,20 @@ static const struct attribute_group *lm3533_led_attribute_groups[] = {
> NULL
> };
>
> -static int lm3533_led_setup(struct lm3533_led *led,
> - struct lm3533_led_platform_data *pdata)
> +static int lm3533_led_setup(struct lm3533_led *led)
> {
> int ret;
>
> - ret = lm3533_ctrlbank_set_max_current(&led->cb, pdata->max_current);
> + ret = lm3533_ctrlbank_set_max_current(&led->cb, led->max_current);
> if (ret)
> return ret;
>
> - return lm3533_ctrlbank_set_pwm(&led->cb, pdata->pwm);
> + return lm3533_ctrlbank_set_pwm(&led->cb, led->pwm);
> }
>
> static int lm3533_led_probe(struct platform_device *pdev)
> {
> struct lm3533 *lm3533;
> - struct lm3533_led_platform_data *pdata;
> struct lm3533_led *led;
> int ret;
>
> @@ -657,30 +660,30 @@ static int lm3533_led_probe(struct platform_device *pdev)
> if (!lm3533)
> return -EINVAL;
>
> - pdata = dev_get_platdata(&pdev->dev);
> - if (!pdata) {
> - dev_err(&pdev->dev, "no platform data\n");
> - return -EINVAL;
> - }
> -
> - if (pdev->id < 0 || pdev->id >= LM3533_LVCTRLBANK_COUNT) {
> - dev_err(&pdev->dev, "illegal LED id %d\n", pdev->id);
> - return -EINVAL;
> - }
> + if (pdev->id < LM3533_LVCTRLBANK_MIN || pdev->id > LM3533_LVCTRLBANK_MAX)
> + return dev_err_probe(&pdev->dev, -EINVAL,
> + "illegal LED id %d\n", pdev->id);
>
> led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
> if (!led)
> return -ENOMEM;
>
> led->lm3533 = lm3533;
> - led->cdev.name = pdata->name;
> - led->cdev.default_trigger = pdata->default_trigger;
> led->cdev.brightness_set_blocking = lm3533_led_set;
> led->cdev.brightness_get = lm3533_led_get;
> led->cdev.blink_set = lm3533_led_blink_set;
> led->cdev.brightness = LED_OFF;
> led->cdev.groups = lm3533_led_attribute_groups;
> - led->id = pdev->id;
> + led->id = pdev->id - LM3533_LVCTRLBANK_MIN;
> +
> + led->cdev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-%d",
> + pdev->name, led->id);
> + if (!led->cdev.name)
> + return -ENOMEM;
> +
> + led->cdev.default_trigger = "none";
> + device_property_read_string(&pdev->dev, "linux,default-trigger",
> + &led->cdev.default_trigger);
>
> mutex_init(&led->mutex);
>
> @@ -694,15 +697,23 @@ static int lm3533_led_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, led);
>
> - ret = led_classdev_register(pdev->dev.parent, &led->cdev);
> + ret = led_classdev_register(&pdev->dev, &led->cdev);
> if (ret) {
> - dev_err(&pdev->dev, "failed to register LED %d\n", pdev->id);
> + dev_err(&pdev->dev, "failed to register LED %d\n", led->id);
> return ret;
> }
>
> led->cb.dev = led->cdev.dev;
>
> - ret = lm3533_led_setup(led, pdata);
> + device_property_read_u32(&pdev->dev, "led-max-microamp",
> + &led->max_current);
> + led->max_current = clamp(led->max_current, LM3533_LED_MAX_CURRENT_MIN,
> + LM3533_LED_MAX_CURRENT_MAX);
> +
> + led->pwm = 0;
> + device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &led->pwm);
> +
> + ret = lm3533_led_setup(led);
> if (ret)
> goto err_deregister;
>
> @@ -739,9 +750,16 @@ static void lm3533_led_shutdown(struct platform_device *pdev)
> lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */
> }
>
> +static const struct of_device_id lm3533_led_match_table[] = {
> + { .compatible = "ti,lm3533-leds" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, lm3533_led_match_table);
> +
> static struct platform_driver lm3533_led_driver = {
> .driver = {
> .name = "lm3533-leds",
> + .of_match_table = lm3533_led_match_table,
> },
> .probe = lm3533_led_probe,
> .remove = lm3533_led_remove,
> diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
> index 0a2409d00b2e..83ebd780f39d 100644
> --- a/drivers/mfd/lm3533-core.c
> +++ b/drivers/mfd/lm3533-core.c
> @@ -14,19 +14,26 @@
> #include <linux/gpio/consumer.h>
> #include <linux/i2c.h>
> #include <linux/mfd/core.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/seq_file.h>
> #include <linux/slab.h>
> #include <linux/uaccess.h>
> +#include <linux/units.h>
>
> #include <linux/mfd/lm3533.h>
>
>
> #define LM3533_BOOST_OVP_MASK 0x06
> #define LM3533_BOOST_OVP_SHIFT 1
> +#define LM3533_BOOST_OVP_MIN 16000000
> +#define LM3533_BOOST_OVP_MAX 40000000
>
> #define LM3533_BOOST_FREQ_MASK 0x01
> #define LM3533_BOOST_FREQ_SHIFT 0
> +#define LM3533_BOOST_FREQ_MIN 500000
> +#define LM3533_BOOST_FREQ_MAX 1000000
>
> #define LM3533_BL_ID_MASK 1
> #define LM3533_LED_ID_MASK 3
> @@ -42,42 +49,14 @@
>
> #define LM3533_REG_MAX 0xb2
>
> -
> -static struct mfd_cell lm3533_als_devs[] = {
> - {
> - .name = "lm3533-als",
> - .id = -1,
> - },
> -};
> -
> -static struct mfd_cell lm3533_bl_devs[] = {
> - {
> - .name = "lm3533-backlight",
> - .id = 0,
> - },
> - {
> - .name = "lm3533-backlight",
> - .id = 1,
> - },
> -};
> -
> -static struct mfd_cell lm3533_led_devs[] = {
> - {
> - .name = "lm3533-leds",
> - .id = 0,
> - },
> - {
> - .name = "lm3533-leds",
> - .id = 1,
> - },
> - {
> - .name = "lm3533-leds",
> - .id = 2,
> - },
> - {
> - .name = "lm3533-leds",
> - .id = 3,
> - },
> +static struct mfd_cell lm3533_child_devices[] = {
> + MFD_CELL_OF("lm3533-als", NULL, NULL, 0, 0, "ti,lm3533-als"),
> + MFD_CELL_OF_REG("lm3533-backlight", NULL, NULL, 0, 0, "ti,lm3533-backlight", 0),
> + MFD_CELL_OF_REG("lm3533-backlight", NULL, NULL, 0, 1, "ti,lm3533-backlight", 1),
> + MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 0, "ti,lm3533-leds", 2),
> + MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 1, "ti,lm3533-leds", 3),
> + MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 2, "ti,lm3533-leds", 4),
> + MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 3, "ti,lm3533-leds", 5),
> };
>
> int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val)
> @@ -132,35 +111,6 @@ int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask)
> }
> EXPORT_SYMBOL_GPL(lm3533_update);
>
> -static int lm3533_set_boost_freq(struct lm3533 *lm3533,
> - enum lm3533_boost_freq freq)
> -{
> - int ret;
> -
> - ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
> - freq << LM3533_BOOST_FREQ_SHIFT,
> - LM3533_BOOST_FREQ_MASK);
> - if (ret)
> - dev_err(lm3533->dev, "failed to set boost frequency\n");
> -
> - return ret;
> -}
> -
> -
> -static int lm3533_set_boost_ovp(struct lm3533 *lm3533,
> - enum lm3533_boost_ovp ovp)
> -{
> - int ret;
> -
> - ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
> - ovp << LM3533_BOOST_OVP_SHIFT,
> - LM3533_BOOST_OVP_MASK);
> - if (ret)
> - dev_err(lm3533->dev, "failed to set boost ovp\n");
> -
> - return ret;
> -}
> -
> /*
> * HVLED output config -- output hvled controlled by backlight bl
> */
> @@ -376,136 +326,45 @@ static struct attribute_group lm3533_attribute_group = {
> .attrs = lm3533_attributes
> };
>
> -static int lm3533_device_als_init(struct lm3533 *lm3533)
> +static int lm3533_device_init(struct lm3533 *lm3533)
> {
> - struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
> + struct device *dev = lm3533->dev;
> int ret;
>
> - if (!pdata->als)
> - return 0;
> -
> - lm3533_als_devs[0].platform_data = pdata->als;
> - lm3533_als_devs[0].pdata_size = sizeof(*pdata->als);
> + lm3533_enable(lm3533);
>
> - ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL,
> - 0, NULL);
> + ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
> + lm3533->boost_freq << LM3533_BOOST_FREQ_SHIFT,
> + LM3533_BOOST_FREQ_MASK);
> if (ret) {
> - dev_err(lm3533->dev, "failed to add ALS device\n");
> - return ret;
> - }
> -
> - lm3533->have_als = 1;
> -
> - return 0;
> -}
> -
> -static int lm3533_device_bl_init(struct lm3533 *lm3533)
> -{
> - struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
> - int i;
> - int ret;
> -
> - if (!pdata->backlights || pdata->num_backlights == 0)
> - return 0;
> -
> - if (pdata->num_backlights > ARRAY_SIZE(lm3533_bl_devs))
> - pdata->num_backlights = ARRAY_SIZE(lm3533_bl_devs);
> -
> - for (i = 0; i < pdata->num_backlights; ++i) {
> - lm3533_bl_devs[i].platform_data = &pdata->backlights[i];
> - lm3533_bl_devs[i].pdata_size = sizeof(pdata->backlights[i]);
> + dev_err(dev, "failed to set boost frequency\n");
> + goto err_disable;
> }
>
> - ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs,
> - pdata->num_backlights, NULL, 0, NULL);
> + ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
> + lm3533->boost_ovp << LM3533_BOOST_OVP_SHIFT,
> + LM3533_BOOST_OVP_MASK);
> if (ret) {
> - dev_err(lm3533->dev, "failed to add backlight devices\n");
> - return ret;
> - }
> -
> - lm3533->have_backlights = 1;
> -
> - return 0;
> -}
> -
> -static int lm3533_device_led_init(struct lm3533 *lm3533)
> -{
> - struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
> - int i;
> - int ret;
> -
> - if (!pdata->leds || pdata->num_leds == 0)
> - return 0;
> -
> - if (pdata->num_leds > ARRAY_SIZE(lm3533_led_devs))
> - pdata->num_leds = ARRAY_SIZE(lm3533_led_devs);
> -
> - for (i = 0; i < pdata->num_leds; ++i) {
> - lm3533_led_devs[i].platform_data = &pdata->leds[i];
> - lm3533_led_devs[i].pdata_size = sizeof(pdata->leds[i]);
> + dev_err(dev, "failed to set boost ovp\n");
> + goto err_disable;
> }
>
> - ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs,
> - pdata->num_leds, NULL, 0, NULL);
> + ret = devm_mfd_add_devices(dev, 0, lm3533_child_devices,
> + ARRAY_SIZE(lm3533_child_devices),
> + NULL, 0, NULL);
Question to Lee Jones. Would you find acceptable if the driver will
build cell list dynamically based on the nodes in the device tree?
This is LED controller after all, not all leds can be populated and
same LED control bank can be linked to all LVLEDs for example.
If you are ok, would this implementation satisfy you?
struct mfd_cell lm3533_cells[LM3533_CELLS_MAX];
u32 count = 0, reg;
int ret;
device_for_each_child_node_scoped(lm3533->dev, child) {
if (!fwnode_device_is_available(child))
continue;
if (count >= LM3533_CELLS_MAX)
break;
if (fwnode_device_is_compatible(child, "ti,lm3533-als")) {
lm3533_cells[count].name = "lm3533-als";
lm3533_cells[count].id = PLATFORM_DEVID_NONE;
lm3533_cells[count].of_compatible = "ti,lm3533-als";
lm3533->have_als = true;
}
if (fwnode_device_is_compatible(child, "ti,lm3533-backlight")) {
ret = fwnode_property_read_u32(child, "reg", ®);
if (ret || reg > LM3533_HVLED_ID_MAX) {
dev_err(dev, "invalid backlight reg %d\n", reg);
continue;
}
lm3533_cells[count].name = "lm3533-backlight";
lm3533_cells[count].id = reg;
lm3533_cells[count].of_compatible =
"ti,lm3533-backlight";
lm3533->have_backlights = true;
}
if (fwnode_device_is_compatible(child, "ti,lm3533-leds")) {
ret = fwnode_property_read_u32(child, "reg", ®);
if (ret || reg < LM3533_HVLED_ID_MAX ||
reg > LM3533_LVLED_ID_MAX) {
dev_err(dev, "invalid LED reg %d\n", reg);
continue;
}
lm3533_cells[count].name = "lm3533-leds";
lm3533_cells[count].id = reg - LM3533_HVLED_ID_MAX;
lm3533_cells[count].of_compatible = "ti,lm3533-leds";
lm3533->have_leds = true;
}
count++;
}
> if (ret) {
> - dev_err(lm3533->dev, "failed to add LED devices\n");
> - return ret;
> - }
> -
> - lm3533->have_leds = 1;
> -
> - return 0;
> -}
> -
> -static int lm3533_device_setup(struct lm3533 *lm3533,
> - struct lm3533_platform_data *pdata)
> -{
> - int ret;
> -
> - ret = lm3533_set_boost_freq(lm3533, pdata->boost_freq);
> - if (ret)
> - return ret;
> -
> - return lm3533_set_boost_ovp(lm3533, pdata->boost_ovp);
> -}
> -
> -static int lm3533_device_init(struct lm3533 *lm3533)
> -{
> - struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
> - int ret;
> -
> - dev_dbg(lm3533->dev, "%s\n", __func__);
> -
> - if (!pdata) {
> - dev_err(lm3533->dev, "no platform data\n");
> - return -EINVAL;
> + dev_err(dev, "failed to add MFD devices: %d\n", ret);
> + goto err_disable;
> }
>
> - lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW);
> - if (IS_ERR(lm3533->hwen))
> - return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n");
> - gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen");
> -
> - lm3533_enable(lm3533);
> -
> - ret = lm3533_device_setup(lm3533, pdata);
> - if (ret)
> + ret = sysfs_create_group(&dev->kobj, &lm3533_attribute_group);
> + if (ret) {
> + dev_err(dev, "failed to create sysfs attributes\n");
> goto err_disable;
> -
> - lm3533_device_als_init(lm3533);
> - lm3533_device_bl_init(lm3533);
> - lm3533_device_led_init(lm3533);
> -
> - ret = sysfs_create_group(&lm3533->dev->kobj, &lm3533_attribute_group);
> - if (ret < 0) {
> - dev_err(lm3533->dev, "failed to create sysfs attributes\n");
> - goto err_unregister;
> }
>
> return 0;
>
> -err_unregister:
> - mfd_remove_devices(lm3533->dev);
> err_disable:
> lm3533_disable(lm3533);
>
> @@ -517,8 +376,6 @@ static void lm3533_device_exit(struct lm3533 *lm3533)
> dev_dbg(lm3533->dev, "%s\n", __func__);
>
> sysfs_remove_group(&lm3533->dev->kobj, &lm3533_attribute_group);
> -
> - mfd_remove_devices(lm3533->dev);
> lm3533_disable(lm3533);
> }
>
> @@ -589,7 +446,40 @@ static int lm3533_i2c_probe(struct i2c_client *i2c)
> return PTR_ERR(lm3533->regmap);
>
> lm3533->dev = &i2c->dev;
> - lm3533->irq = i2c->irq;
> +
> + lm3533->hwen = devm_gpiod_get_optional(lm3533->dev, "enable",
> + GPIOD_OUT_LOW);
> + if (IS_ERR(lm3533->hwen))
> + return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen),
> + "failed to get HWEN GPIO\n");
> +
> + device_property_read_u32(lm3533->dev, "ti,boost-ovp-microvolt",
> + &lm3533->boost_ovp);
> +
> + lm3533->boost_ovp = clamp(lm3533->boost_ovp, LM3533_BOOST_OVP_MIN,
> + LM3533_BOOST_OVP_MAX);
> + lm3533->boost_ovp = lm3533->boost_ovp / (8 * MICRO) - 2;
> +
> + device_property_read_u32(lm3533->dev, "ti,boost-freq-hz",
> + &lm3533->boost_freq);
> +
> + lm3533->boost_freq = clamp(lm3533->boost_freq, LM3533_BOOST_FREQ_MIN,
> + LM3533_BOOST_FREQ_MAX);
> + lm3533->boost_freq = lm3533->boost_freq / (500 * KILO) - 1;
> +
> + device_for_each_child_node_scoped(lm3533->dev, child) {
> + if (!fwnode_device_is_available(child))
> + continue;
> +
> + if (fwnode_device_is_compatible(child, "ti,lm3533-als"))
> + lm3533->have_als = true;
> +
> + if (fwnode_device_is_compatible(child, "ti,lm3533-backlight"))
> + lm3533->have_backlights = true;
> +
> + if (fwnode_device_is_compatible(child, "ti,lm3533-leds"))
> + lm3533->have_leds = true;
> + }
>
> return lm3533_device_init(lm3533);
> }
> @@ -603,6 +493,12 @@ static void lm3533_i2c_remove(struct i2c_client *i2c)
> lm3533_device_exit(lm3533);
> }
>
> +static const struct of_device_id lm3533_match_table[] = {
> + { .compatible = "ti,lm3533" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, lm3533_match_table);
> +
> static const struct i2c_device_id lm3533_i2c_ids[] = {
> { "lm3533" },
> { }
> @@ -612,6 +508,7 @@ MODULE_DEVICE_TABLE(i2c, lm3533_i2c_ids);
> static struct i2c_driver lm3533_i2c_driver = {
> .driver = {
> .name = "lm3533",
> + .of_match_table = lm3533_match_table,
> },
> .id_table = lm3533_i2c_ids,
> .probe = lm3533_i2c_probe,
> diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
> index babfd3ceec86..42da652df58d 100644
> --- a/drivers/video/backlight/lm3533_bl.c
> +++ b/drivers/video/backlight/lm3533_bl.c
> @@ -9,7 +9,9 @@
>
> #include <linux/module.h>
> #include <linux/init.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/backlight.h>
> #include <linux/slab.h>
>
> @@ -27,6 +29,9 @@ struct lm3533_bl {
> struct lm3533_ctrlbank cb;
> struct backlight_device *bd;
> int id;
> +
> + u32 max_current;
> + u32 pwm;
> };
>
>
> @@ -246,25 +251,24 @@ static struct attribute_group lm3533_bl_attribute_group = {
> .attrs = lm3533_bl_attributes
> };
>
> -static int lm3533_bl_setup(struct lm3533_bl *bl,
> - struct lm3533_bl_platform_data *pdata)
> +static int lm3533_bl_setup(struct lm3533_bl *bl)
> {
> int ret;
>
> - ret = lm3533_ctrlbank_set_max_current(&bl->cb, pdata->max_current);
> + ret = lm3533_ctrlbank_set_max_current(&bl->cb, bl->max_current);
> if (ret)
> return ret;
>
> - return lm3533_ctrlbank_set_pwm(&bl->cb, pdata->pwm);
> + return lm3533_ctrlbank_set_pwm(&bl->cb, bl->pwm);
> }
>
> static int lm3533_bl_probe(struct platform_device *pdev)
> {
> struct lm3533 *lm3533;
> - struct lm3533_bl_platform_data *pdata;
> struct lm3533_bl *bl;
> struct backlight_device *bd;
> struct backlight_properties props;
> + char *name = NULL;
> int ret;
>
> dev_dbg(&pdev->dev, "%s\n", __func__);
> @@ -273,12 +277,6 @@ static int lm3533_bl_probe(struct platform_device *pdev)
> if (!lm3533)
> return -EINVAL;
>
> - pdata = dev_get_platdata(&pdev->dev);
> - if (!pdata) {
> - dev_err(&pdev->dev, "no platform data\n");
> - return -EINVAL;
> - }
> -
> if (pdev->id < 0 || pdev->id >= LM3533_HVCTRLBANK_COUNT) {
> dev_err(&pdev->dev, "illegal backlight id %d\n", pdev->id);
> return -EINVAL;
> @@ -295,13 +293,20 @@ static int lm3533_bl_probe(struct platform_device *pdev)
> bl->cb.id = lm3533_bl_get_ctrlbank_id(bl);
> bl->cb.dev = NULL; /* until registered */
>
> + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-%d",
> + pdev->name, pdev->id);
> + if (!name)
> + return -ENOMEM;
> +
> memset(&props, 0, sizeof(props));
> props.type = BACKLIGHT_RAW;
> props.max_brightness = LM3533_BL_MAX_BRIGHTNESS;
> - props.brightness = pdata->default_brightness;
> - bd = devm_backlight_device_register(&pdev->dev, pdata->name,
> - pdev->dev.parent, bl, &lm3533_bl_ops,
> - &props);
> + props.brightness = LM3533_BL_MAX_BRIGHTNESS;
> + device_property_read_u32(&pdev->dev, "default-brightness",
> + &props.brightness);
> +
> + bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev,
> + bl, &lm3533_bl_ops, &props);
> if (IS_ERR(bd)) {
> dev_err(&pdev->dev, "failed to register backlight device\n");
> return PTR_ERR(bd);
> @@ -320,7 +325,15 @@ static int lm3533_bl_probe(struct platform_device *pdev)
>
> backlight_update_status(bd);
>
> - ret = lm3533_bl_setup(bl, pdata);
> + device_property_read_u32(&pdev->dev, "led-max-microamp",
> + &bl->max_current);
> + bl->max_current = clamp(bl->max_current, LM3533_LED_MAX_CURRENT_MIN,
> + LM3533_LED_MAX_CURRENT_MAX);
> +
> + bl->pwm = 0;
> + device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &bl->pwm);
> +
> + ret = lm3533_bl_setup(bl);
> if (ret)
> goto err_sysfs_remove;
>
> @@ -381,10 +394,17 @@ static void lm3533_bl_shutdown(struct platform_device *pdev)
> lm3533_ctrlbank_disable(&bl->cb);
> }
>
> +static const struct of_device_id lm3533_bl_match_table[] = {
> + { .compatible = "ti,lm3533-backlight" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, lm3533_bl_match_table);
> +
> static struct platform_driver lm3533_bl_driver = {
> .driver = {
> .name = "lm3533-backlight",
> .pm = &lm3533_bl_pm_ops,
> + .of_match_table = lm3533_bl_match_table,
> },
> .probe = lm3533_bl_probe,
> .remove = lm3533_bl_remove,
> diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
> index 69059a7a2ce5..3aa962d4c747 100644
> --- a/include/linux/mfd/lm3533.h
> +++ b/include/linux/mfd/lm3533.h
> @@ -15,6 +15,9 @@
> #define LM3533_ATTR_RW(_name) \
> DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
>
> +#define LM3533_LED_MAX_CURRENT_MIN 5000
> +#define LM3533_LED_MAX_CURRENT_MAX 29800
> +
> struct device;
> struct gpio_desc;
> struct regmap;
> @@ -25,7 +28,9 @@ struct lm3533 {
> struct regmap *regmap;
>
> struct gpio_desc *hwen;
> - int irq;
> +
> + u32 boost_ovp;
> + u32 boost_freq;
>
> unsigned have_als:1;
> unsigned have_backlights:1;
> @@ -38,50 +43,6 @@ struct lm3533_ctrlbank {
> int id;
> };
>
> -struct lm3533_als_platform_data {
> - unsigned pwm_mode:1; /* PWM input mode (default analog) */
> - u8 r_select; /* 1 - 127 (ignored in PWM-mode) */
> -};
> -
> -struct lm3533_bl_platform_data {
> - char *name;
> - u16 max_current; /* 5000 - 29800 uA (800 uA step) */
> - u8 default_brightness; /* 0 - 255 */
> - u8 pwm; /* 0 - 0x3f */
> -};
> -
> -struct lm3533_led_platform_data {
> - char *name;
> - const char *default_trigger;
> - u16 max_current; /* 5000 - 29800 uA (800 uA step) */
> - u8 pwm; /* 0 - 0x3f */
> -};
> -
> -enum lm3533_boost_freq {
> - LM3533_BOOST_FREQ_500KHZ,
> - LM3533_BOOST_FREQ_1000KHZ,
> -};
> -
> -enum lm3533_boost_ovp {
> - LM3533_BOOST_OVP_16V,
> - LM3533_BOOST_OVP_24V,
> - LM3533_BOOST_OVP_32V,
> - LM3533_BOOST_OVP_40V,
> -};
> -
> -struct lm3533_platform_data {
> - enum lm3533_boost_ovp boost_ovp;
> - enum lm3533_boost_freq boost_freq;
> -
> - struct lm3533_als_platform_data *als;
> -
> - struct lm3533_bl_platform_data *backlights;
> - int num_backlights;
> -
> - struct lm3533_led_platform_data *leds;
> - int num_leds;
> -};
> -
> extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb);
> extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb);
>
> --
> 2.51.0
>
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Svyatoslav Ryhel @ 2026-05-17 10:44 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev, johan
In-Reply-To: <agmbFQHezUl5Nydn@ashevche-desk.local>
нд, 17 трав. 2026 р. о 13:40 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
>
> On Sun, May 17, 2026 at 01:34:32PM +0300, Svyatoslav Ryhel wrote:
> > нд, 17 трав. 2026 р. о 13:20 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > > On Sun, May 17, 2026 at 01:13:22PM +0300, Svyatoslav Ryhel wrote:
> > > > нд, 17 трав. 2026 р. о 10:59 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > > > > On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> > > > > > Convert LM3533 to OF bindings, add missing VIN supply, add support for
> > > > > > setting mapping mode and LED sources based on device tree.
> > > > >
> > > > > How is this being different to
> > > > > https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
> > > > > ?
> > > >
> > > > I have decided to have a fresh look, this is continuation.
> > >
> > > Then it should be something like v4?
> >
> > That was more than a year ago, lets start fresh. Those patches are
> > gone, though I did add many of suggestions from there.
> >
> > > > > What about this comment
> > > > > https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
> > > > > ? Have you talked to Bjorn A and Johan?
> > > >
> > > > No, but since grep -r "lm3533_platform_data" * gives 0 results there
> > > > are no platform_data users of lm3533.
> > >
> > > Johan was against driver removal (while it sounds logical due to above) and
> > > referred to some other patches from somebody else. I think you need to
> > > synchronise with the people to have a clear roadmap that all stakeholders
> > > are agree with. With that, the split and other technical issues can be solved
> > > during the normal process.
> >
> > And this discussion was 2 years ago, and
> >
> > "This device is used in a bunch of Sony phones and Bjorn A posted a
> > series adding devicetree bindings a few years ago"
> >
> > They have had more than enough time, don't you think? You would
> > definitely know if there were any activity since you are IIO reviewer
> > and would be included, were there any activity?
>
> At least it's polite to Cc them your version.
>
I assume yes, I have added Johan but there is no email for Bjorn A.
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Andy Shevchenko @ 2026-05-17 10:40 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <CAPVz0n3Kn5VVxWxCgq2EcRiOaLWnB85hD+-S2Eou=H1PyycJCQ@mail.gmail.com>
On Sun, May 17, 2026 at 01:34:32PM +0300, Svyatoslav Ryhel wrote:
> нд, 17 трав. 2026 р. о 13:20 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > On Sun, May 17, 2026 at 01:13:22PM +0300, Svyatoslav Ryhel wrote:
> > > нд, 17 трав. 2026 р. о 10:59 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > > > On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> > > > > Convert LM3533 to OF bindings, add missing VIN supply, add support for
> > > > > setting mapping mode and LED sources based on device tree.
> > > >
> > > > How is this being different to
> > > > https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
> > > > ?
> > >
> > > I have decided to have a fresh look, this is continuation.
> >
> > Then it should be something like v4?
>
> That was more than a year ago, lets start fresh. Those patches are
> gone, though I did add many of suggestions from there.
>
> > > > What about this comment
> > > > https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
> > > > ? Have you talked to Bjorn A and Johan?
> > >
> > > No, but since grep -r "lm3533_platform_data" * gives 0 results there
> > > are no platform_data users of lm3533.
> >
> > Johan was against driver removal (while it sounds logical due to above) and
> > referred to some other patches from somebody else. I think you need to
> > synchronise with the people to have a clear roadmap that all stakeholders
> > are agree with. With that, the split and other technical issues can be solved
> > during the normal process.
>
> And this discussion was 2 years ago, and
>
> "This device is used in a bunch of Sony phones and Bjorn A posted a
> series adding devicetree bindings a few years ago"
>
> They have had more than enough time, don't you think? You would
> definitely know if there were any activity since you are IIO reviewer
> and would be included, were there any activity?
At least it's polite to Cc them your version.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Svyatoslav Ryhel @ 2026-05-17 10:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <agmWVdi3TkBb2cxV@ashevche-desk.local>
нд, 17 трав. 2026 р. о 13:20 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
>
> On Sun, May 17, 2026 at 01:13:22PM +0300, Svyatoslav Ryhel wrote:
> > нд, 17 трав. 2026 р. о 10:59 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > > On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> > > > Convert LM3533 to OF bindings, add missing VIN supply, add support for
> > > > setting mapping mode and LED sources based on device tree.
> > >
> > > How is this being different to
> > > https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
> > > ?
> >
> > I have decided to have a fresh look, this is continuation.
>
> Then it should be something like v4?
>
That was more than a year ago, lets start fresh. Those patches are
gone, though I did add many of suggestions from there.
> > > What about this comment
> > > https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
> > > ? Have you talked to Bjorn A and Johan?
> >
> > No, but since grep -r "lm3533_platform_data" * gives 0 results there
> > are no platform_data users of lm3533.
>
> Johan was against driver removal (while it sounds logical due to above) and
> referred to some other patches from somebody else. I think you need to
> synchronise with the people to have a clear roadmap that all stakeholders
> are agree with. With that, the split and other technical issues can be solved
> during the normal process.
>
And this discussion was 2 years ago, and
"This device is used in a bunch of Sony phones and Bjorn A posted a
series adding devicetree bindings a few years ago"
They have had more than enough time, don't you think? You would
definitely know if there were any activity since you are IIO reviewer
and would be included, were there any activity?
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Andy Shevchenko @ 2026-05-17 10:20 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <CAPVz0n0tfbwa1AbgO4eKrmNunHvmTFLDqXDFd1=VfLayuafH8w@mail.gmail.com>
On Sun, May 17, 2026 at 01:13:22PM +0300, Svyatoslav Ryhel wrote:
> нд, 17 трав. 2026 р. о 10:59 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
> > On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> > > Convert LM3533 to OF bindings, add missing VIN supply, add support for
> > > setting mapping mode and LED sources based on device tree.
> >
> > How is this being different to
> > https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
> > ?
>
> I have decided to have a fresh look, this is continuation.
Then it should be something like v4?
> > What about this comment
> > https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
> > ? Have you talked to Bjorn A and Johan?
>
> No, but since grep -r "lm3533_platform_data" * gives 0 results there
> are no platform_data users of lm3533.
Johan was against driver removal (while it sounds logical due to above) and
referred to some other patches from somebody else. I think you need to
synchronise with the people to have a clear roadmap that all stakeholders
are agree with. With that, the split and other technical issues can be solved
during the normal process.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Svyatoslav Ryhel @ 2026-05-17 10:13 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <agl1T8O6kwP7SFZ1@ashevche-desk.local>
нд, 17 трав. 2026 р. о 10:59 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
>
> On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> > Convert LM3533 to OF bindings, add missing VIN supply, add support for
> > setting mapping mode and LED sources based on device tree.
>
> How is this being different to
> https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
> ?
>
I have decided to have a fresh look, this is continuation.
> What about this comment
> https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
> ? Have you talked to Bjorn A and Johan?
>
No, but since grep -r "lm3533_platform_data" * gives 0 results there
are no platform_data users of lm3533.
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply
* Re: [PATCH v1 2/6] mfd: lm3533: Convert to use OF bindings
From: Svyatoslav Ryhel @ 2026-05-17 10:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <agl0Z_EGzX8X4No4@ashevche-desk.local>
нд, 17 трав. 2026 р. о 10:55 Andy Shevchenko <andriy.shevchenko@intel.com> пише:
>
> On Sun, May 17, 2026 at 10:43:02AM +0300, Svyatoslav Ryhel wrote:
> > Since there are no users of this driver via platform data, remove the
> > platform data support and switch to using Device Tree bindings.
> > Additionally, optimize functions used only by platform data.
>
> This is a mixture of at least (!) three patches:
Maybe you can make a list of how to split it then. I have tried to
make it complete and remain readable. I am open to your suggestions.
> - devm conversion
This will be dropped.
> - the change of some constants
If you mean LM3533_ALS_RESISTOR_MIN and LM3533_ALS_RESISTOR_MAX they
are used explicitly in r_select value. Previously it was passed via
pdata as register value and now it is obtained from the device tree as
resistance in Ohms and register value is actually calculated.
Naturally ALS_RESISTOR boundaries changed.
> - the rest
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply
* Re: [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Andy Shevchenko @ 2026-05-17 7:59 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
On Sun, May 17, 2026 at 10:43:00AM +0300, Svyatoslav Ryhel wrote:
> Convert LM3533 to OF bindings, add missing VIN supply, add support for
> setting mapping mode and LED sources based on device tree.
How is this being different to
https://lore.kernel.org/lkml/20250218132702.114669-1-clamor95@gmail.com/
?
What about this comment
https://lore.kernel.org/lkml/ZmBcvtLCzllQDWVX@hovoldconsulting.com/
? Have you talked to Bjorn A and Johan?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 2/6] mfd: lm3533: Convert to use OF bindings
From: Andy Shevchenko @ 2026-05-17 7:55 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-3-clamor95@gmail.com>
On Sun, May 17, 2026 at 10:43:02AM +0300, Svyatoslav Ryhel wrote:
> Since there are no users of this driver via platform data, remove the
> platform data support and switch to using Device Tree bindings.
> Additionally, optimize functions used only by platform data.
This is a mixture of at least (!) three patches:
- devm conversion
- the change of some constants
- the rest
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* [PATCH v1 6/6] video: leds: backlight: lm3533: Support getting LED sources from DT
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Add Control Bank to HVLED/LVLED muxing support based on the led-sources
defined in the device tree.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/leds/leds-lm3533.c | 55 +++++++++++++++++++++++++++--
drivers/video/backlight/lm3533_bl.c | 39 +++++++++++++++++++-
2 files changed, 91 insertions(+), 3 deletions(-)
diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
index f6345bc1f443..c4eaf30880a1 100644
--- a/drivers/leds/leds-lm3533.c
+++ b/drivers/leds/leds-lm3533.c
@@ -7,6 +7,7 @@
* Author: Johan Hovold <jhovold@gmail.com>
*/
+#include <linux/bits.h>
#include <linux/module.h>
#include <linux/leds.h>
#include <linux/mfd/core.h>
@@ -26,6 +27,12 @@
#define LM3533_ALS_CHANNEL_LV_MIN 1
#define LM3533_ALS_CHANNEL_LV_MAX 2
+#define LM3533_REG_OUTPUT_CONF1 0x10
+#define OUTPUT_CONF1_MASK GENMASK(7, 2)
+#define OUTPUT_CONF1_SHIFT 2
+#define LM3533_REG_OUTPUT_CONF2 0x11
+#define OUTPUT_CONF2_MASK GENMASK(3, 0)
+#define OUTPUT_CONF2_SHIFT 6
#define LM3533_REG_CTRLBANK_BCONF_BASE 0x1b
#define LM3533_REG_PATTERN_ENABLE 0x28
#define LM3533_REG_PATTERN_LOW_TIME_BASE 0x71
@@ -40,7 +47,7 @@
#define LM3533_REG_CTRLBANK_BCONF_ALS_CHANNEL_MASK 0x01
#define LM3533_LED_FLAG_PATTERN_ENABLE 1
-
+#define LM3533_MAX_LEDS 5
struct lm3533_led {
struct lm3533 *lm3533;
@@ -53,6 +60,9 @@ struct lm3533_led {
u32 max_current;
u32 pwm;
+
+ u32 num_leds;
+ u32 leds[LM3533_MAX_LEDS];
};
@@ -639,7 +649,30 @@ static const struct attribute_group *lm3533_led_attribute_groups[] = {
static int lm3533_led_setup(struct lm3533_led *led)
{
- int ret;
+ u32 output_cfg_shift = 0;
+ u32 output_cfg_val = 0;
+ int ret, i;
+
+ if (led->num_leds) {
+ for (i = 0; i < led->num_leds; i++) {
+ output_cfg_shift = led->leds[i] * 2;
+ output_cfg_val |= led->id << output_cfg_shift;
+ }
+
+ /* LVLED1, LVLED2 and LVLED3 */
+ ret = lm3533_update(led->lm3533, LM3533_REG_OUTPUT_CONF1,
+ output_cfg_val << OUTPUT_CONF1_SHIFT,
+ OUTPUT_CONF1_MASK);
+ if (ret)
+ return ret;
+
+ /* LVLED4 and LVLED5 */
+ ret = lm3533_update(led->lm3533, LM3533_REG_OUTPUT_CONF1,
+ output_cfg_val >> OUTPUT_CONF2_SHIFT,
+ OUTPUT_CONF2_MASK);
+ if (ret)
+ return ret;
+ }
ret = lm3533_ctrlbank_set_max_current(&led->cb, led->max_current);
if (ret)
@@ -713,6 +746,24 @@ static int lm3533_led_probe(struct platform_device *pdev)
led->pwm = 0;
device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &led->pwm);
+ led->num_leds = device_property_count_u32(&pdev->dev, "led-sources");
+
+ /*
+ * If led-sources property is not set then either this Control Bank uses
+ * its default LVLED or is not linked to any LVLED at all.
+ */
+ if (led->num_leds <= 0 || led->num_leds > LM3533_MAX_LEDS)
+ led->num_leds = 0;
+
+ if (led->num_leds > 0 && led->num_leds < LM3533_MAX_LEDS) {
+ ret = device_property_read_u32_array(&pdev->dev, "led-sources",
+ led->leds, led->num_leds);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get led-sources\n");
+ goto err_deregister;
+ }
+ }
+
ret = lm3533_led_setup(led);
if (ret)
goto err_deregister;
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index be9114b7e0ad..2898cb229643 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -7,6 +7,7 @@
* Author: Johan Hovold <jhovold@gmail.com>
*/
+#include <linux/bits.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
@@ -21,9 +22,12 @@
#define LM3533_HVCTRLBANK_COUNT 2
#define LM3533_BL_MAX_BRIGHTNESS 255
+#define LM3533_REG_OUTPUT_CONF1 0x10
+#define OUTPUT_CONF1_MASK GENMASK(1, 0)
#define LM3533_REG_CTRLBANK_AB_BCONF 0x1a
#define CTRLBANK_AB_BCONF_MODE(n) BIT(2 * (n) + 1)
+#define LM3533_MAX_LED_STRINGS 2
struct lm3533_bl {
struct lm3533 *lm3533;
@@ -34,6 +38,9 @@ struct lm3533_bl {
u32 max_current;
u32 pwm;
bool linear;
+
+ u32 num_leds;
+ u32 led_strings[LM3533_MAX_LED_STRINGS];
};
@@ -248,7 +255,8 @@ static struct attribute_group lm3533_bl_attribute_group = {
static int lm3533_bl_setup(struct lm3533_bl *bl)
{
int id = lm3533_bl_get_ctrlbank_id(bl);
- int ret;
+ u32 output_cfg_val = 0;
+ int ret, i;
ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF,
bl->linear ? CTRLBANK_AB_BCONF_MODE(id) : 0,
@@ -256,6 +264,16 @@ static int lm3533_bl_setup(struct lm3533_bl *bl)
if (ret)
return ret;
+ if (bl->num_leds) {
+ for (i = 0; i < bl->num_leds; i++)
+ output_cfg_val |= id << bl->led_strings[i];
+
+ ret = lm3533_update(bl->lm3533, LM3533_REG_OUTPUT_CONF1,
+ output_cfg_val, OUTPUT_CONF1_MASK);
+ if (ret)
+ return ret;
+ }
+
ret = lm3533_ctrlbank_set_max_current(&bl->cb, bl->max_current);
if (ret)
return ret;
@@ -337,6 +355,25 @@ static int lm3533_bl_probe(struct platform_device *pdev)
bl->linear = device_property_read_bool(&pdev->dev,
"ti,linear-mapping-mode");
+ bl->num_leds = device_property_count_u32(&pdev->dev, "led-sources");
+
+ /*
+ * If led-sources property is not set then either this Control Bank uses
+ * its default HVLED or is not linked to any HVLED at all.
+ */
+ if (bl->num_leds <= 0 || bl->num_leds > LM3533_MAX_LED_STRINGS)
+ bl->num_leds = 0;
+
+ if (bl->num_leds > 0 && bl->num_leds < LM3533_MAX_LED_STRINGS) {
+ ret = device_property_read_u32_array(&pdev->dev, "led-sources",
+ bl->led_strings,
+ bl->num_leds);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get led-sources\n");
+ goto err_sysfs_remove;
+ }
+ }
+
ret = lm3533_bl_setup(bl);
if (ret)
goto err_sysfs_remove;
--
2.51.0
^ permalink raw reply related
* [PATCH v1 5/6] video: backlight: lm3533_bl: Set initial mapping mode from DT
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Add support to obtain the initial mapping mode from DT instead of leaving
it unconfigured. Additionally, update the linear sysfs code, which uses a
similar coding pattern.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/video/backlight/lm3533_bl.c | 32 ++++++++++++++++-------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index 42da652df58d..be9114b7e0ad 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -22,6 +22,7 @@
#define LM3533_BL_MAX_BRIGHTNESS 255
#define LM3533_REG_CTRLBANK_AB_BCONF 0x1a
+#define CTRLBANK_AB_BCONF_MODE(n) BIT(2 * (n) + 1)
struct lm3533_bl {
@@ -32,6 +33,7 @@ struct lm3533_bl {
u32 max_current;
u32 pwm;
+ bool linear;
};
@@ -135,8 +137,9 @@ static ssize_t show_linear(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
+ int id = lm3533_bl_get_ctrlbank_id(bl);
+ u8 mask = CTRLBANK_AB_BCONF_MODE(id);
u8 val;
- u8 mask;
int linear;
int ret;
@@ -144,8 +147,6 @@ static ssize_t show_linear(struct device *dev,
if (ret)
return ret;
- mask = 1 << (2 * lm3533_bl_get_ctrlbank_id(bl) + 1);
-
if (val & mask)
linear = 1;
else
@@ -159,23 +160,16 @@ static ssize_t store_linear(struct device *dev,
const char *buf, size_t len)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
+ int id = lm3533_bl_get_ctrlbank_id(bl);
unsigned long linear;
- u8 mask;
- u8 val;
int ret;
if (kstrtoul(buf, 0, &linear))
return -EINVAL;
- mask = 1 << (2 * lm3533_bl_get_ctrlbank_id(bl) + 1);
-
- if (linear)
- val = mask;
- else
- val = 0;
-
- ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, val,
- mask);
+ ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF,
+ linear ? CTRLBANK_AB_BCONF_MODE(id) : 0,
+ CTRLBANK_AB_BCONF_MODE(id));
if (ret)
return ret;
@@ -253,8 +247,15 @@ static struct attribute_group lm3533_bl_attribute_group = {
static int lm3533_bl_setup(struct lm3533_bl *bl)
{
+ int id = lm3533_bl_get_ctrlbank_id(bl);
int ret;
+ ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF,
+ bl->linear ? CTRLBANK_AB_BCONF_MODE(id) : 0,
+ CTRLBANK_AB_BCONF_MODE(id));
+ if (ret)
+ return ret;
+
ret = lm3533_ctrlbank_set_max_current(&bl->cb, bl->max_current);
if (ret)
return ret;
@@ -333,6 +334,9 @@ static int lm3533_bl_probe(struct platform_device *pdev)
bl->pwm = 0;
device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &bl->pwm);
+ bl->linear = device_property_read_bool(&pdev->dev,
+ "ti,linear-mapping-mode");
+
ret = lm3533_bl_setup(bl);
if (ret)
goto err_sysfs_remove;
--
2.51.0
^ permalink raw reply related
* [PATCH v1 4/6] mfd: lm3533: set DMA mask
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Missing coherent_dma_mask assigning triggers the following warning in
dmesg:
[ 3.287872] platform lm3533-backlight.0: DMA mask not set
Since this warning might be elevated to an error in the future, set
coherent_dma_mask to zero because both the core and cells do not utilize
DMA.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/mfd/lm3533-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 131eb1a1c8eb..c7914afd564c 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -499,6 +499,10 @@ static int lm3533_i2c_probe(struct i2c_client *i2c)
lm3533->have_leds = true;
}
+ /* Parent I2C controller uses DMA, LM3533 and child devices do not */
+ i2c->dev.coherent_dma_mask = 0;
+ i2c->dev.dma_mask = &i2c->dev.coherent_dma_mask;
+
return lm3533_device_init(lm3533);
}
--
2.51.0
^ permalink raw reply related
* [PATCH v1 3/6] mfd: lm3533: Add support for VIN power supply
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Add support for 2.7V-5.5V VIN power supply.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/mfd/lm3533-core.c | 22 ++++++++++++++++++++--
include/linux/mfd/lm3533.h | 1 +
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 83ebd780f39d..131eb1a1c8eb 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -173,14 +173,25 @@ static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led)
return ret;
}
-static void lm3533_enable(struct lm3533 *lm3533)
+static int lm3533_enable(struct lm3533 *lm3533)
{
+ int ret;
+
+ ret = regulator_enable(lm3533->vin_supply);
+ if (ret) {
+ dev_err(lm3533->dev, "failed to enable vin power supply\n");
+ return ret;
+ }
+
gpiod_set_value(lm3533->hwen, 1);
+
+ return 0;
}
static void lm3533_disable(struct lm3533 *lm3533)
{
gpiod_set_value(lm3533->hwen, 0);
+ regulator_disable(lm3533->vin_supply);
}
enum lm3533_attribute_type {
@@ -331,7 +342,9 @@ static int lm3533_device_init(struct lm3533 *lm3533)
struct device *dev = lm3533->dev;
int ret;
- lm3533_enable(lm3533);
+ ret = lm3533_enable(lm3533);
+ if (ret)
+ return ret;
ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
lm3533->boost_freq << LM3533_BOOST_FREQ_SHIFT,
@@ -453,6 +466,11 @@ static int lm3533_i2c_probe(struct i2c_client *i2c)
return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen),
"failed to get HWEN GPIO\n");
+ lm3533->vin_supply = devm_regulator_get(lm3533->dev, "vin");
+ if (IS_ERR(lm3533->vin_supply))
+ return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->vin_supply),
+ "failed to get vin-supply\n");
+
device_property_read_u32(lm3533->dev, "ti,boost-ovp-microvolt",
&lm3533->boost_ovp);
diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
index 3aa962d4c747..e355a3ac982e 100644
--- a/include/linux/mfd/lm3533.h
+++ b/include/linux/mfd/lm3533.h
@@ -28,6 +28,7 @@ struct lm3533 {
struct regmap *regmap;
struct gpio_desc *hwen;
+ struct regulator *vin_supply;
u32 boost_ovp;
u32 boost_freq;
--
2.51.0
^ permalink raw reply related
* [PATCH v1 2/6] mfd: lm3533: Convert to use OF bindings
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Since there are no users of this driver via platform data, remove the
platform data support and switch to using Device Tree bindings.
Additionally, optimize functions used only by platform data.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/iio/light/lm3533-als.c | 123 +++++--------
drivers/leds/leds-lm3533.c | 60 ++++---
drivers/mfd/lm3533-core.c | 257 +++++++++-------------------
drivers/video/backlight/lm3533_bl.c | 52 ++++--
include/linux/mfd/lm3533.h | 51 +-----
5 files changed, 202 insertions(+), 341 deletions(-)
diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index 99f0b903018c..853abb96e13f 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -16,15 +16,18 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/units.h>
#include <linux/mfd/lm3533.h>
-#define LM3533_ALS_RESISTOR_MIN 1
-#define LM3533_ALS_RESISTOR_MAX 127
+#define LM3533_ALS_RESISTOR_MIN 1575
+#define LM3533_ALS_RESISTOR_MAX 200000
#define LM3533_ALS_CHANNEL_CURRENT_MAX 2
#define LM3533_ALS_THRESH_MAX 3
#define LM3533_ALS_ZONE_MAX 4
@@ -56,6 +59,9 @@ struct lm3533_als {
atomic_t zone;
struct mutex thresh_mutex;
+
+ bool pwm_mode;
+ u32 r_select;
};
@@ -714,64 +720,6 @@ static const struct attribute_group lm3533_als_attribute_group = {
.attrs = lm3533_als_attributes
};
-static int lm3533_als_set_input_mode(struct lm3533_als *als, bool pwm_mode)
-{
- u8 mask = LM3533_ALS_INPUT_MODE_MASK;
- u8 val;
- int ret;
-
- if (pwm_mode)
- val = mask; /* pwm input */
- else
- val = 0; /* analog input */
-
- ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, val, mask);
- if (ret) {
- dev_err(&als->pdev->dev, "failed to set input mode %d\n",
- pwm_mode);
- return ret;
- }
-
- return 0;
-}
-
-static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
-{
- int ret;
-
- if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) {
- dev_err(&als->pdev->dev, "invalid resistor value\n");
- return -EINVAL;
- }
-
- ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val);
- if (ret) {
- dev_err(&als->pdev->dev, "failed to set resistor\n");
- return ret;
- }
-
- return 0;
-}
-
-static int lm3533_als_setup(struct lm3533_als *als,
- const struct lm3533_als_platform_data *pdata)
-{
- int ret;
-
- ret = lm3533_als_set_input_mode(als, pdata->pwm_mode);
- if (ret)
- return ret;
-
- /* ALS input is always high impedance in PWM-mode. */
- if (!pdata->pwm_mode) {
- ret = lm3533_als_set_resistor(als, pdata->r_select);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
{
u8 mask = LM3533_ALS_INT_ENABLE_MASK;
@@ -784,7 +732,8 @@ static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
return ret;
}
- ret = request_threaded_irq(als->irq, NULL, lm3533_als_isr,
+ ret = devm_request_threaded_irq(&als->pdev->dev, als->irq, NULL,
+ lm3533_als_isr,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
dev_name(&als->pdev->dev), dev);
if (ret) {
@@ -828,7 +777,6 @@ static const struct iio_info lm3533_als_info = {
static int lm3533_als_probe(struct platform_device *pdev)
{
- const struct lm3533_als_platform_data *pdata;
struct lm3533 *lm3533;
struct lm3533_als *als;
struct iio_dev *indio_dev;
@@ -838,12 +786,6 @@ static int lm3533_als_probe(struct platform_device *pdev)
if (!lm3533)
return -EINVAL;
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "no platform data\n");
- return -EINVAL;
- }
-
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*als));
if (!indio_dev)
return -ENOMEM;
@@ -852,31 +794,52 @@ static int lm3533_als_probe(struct platform_device *pdev)
indio_dev->channels = lm3533_als_channels;
indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
indio_dev->name = dev_name(&pdev->dev);
- iio_device_set_parent(indio_dev, pdev->dev.parent);
indio_dev->modes = INDIO_DIRECT_MODE;
als = iio_priv(indio_dev);
als->lm3533 = lm3533;
als->pdev = pdev;
- als->irq = lm3533->irq;
+ als->irq = platform_get_irq_optional(pdev, 0);
atomic_set(&als->zone, 0);
mutex_init(&als->thresh_mutex);
platform_set_drvdata(pdev, indio_dev);
- if (als->irq) {
+ if (als->irq > 0) {
ret = lm3533_als_setup_irq(als, indio_dev);
if (ret)
return ret;
}
- ret = lm3533_als_setup(als, pdata);
+ device_property_read_u32(&pdev->dev, "ti,resistor-value-ohm",
+ &als->r_select);
+
+ als->r_select = clamp(als->r_select, LM3533_ALS_RESISTOR_MIN,
+ LM3533_ALS_RESISTOR_MAX);
+ als->r_select = DIV_ROUND_UP(2 * MICRO, 10 * als->r_select);
+
+ als->pwm_mode = device_property_read_bool(&pdev->dev, "ti,pwm-mode");
+
+ ret = lm3533_update(lm3533, LM3533_REG_ALS_CONF, als->pwm_mode ?
+ LM3533_ALS_INPUT_MODE_MASK : 0,
+ LM3533_ALS_INPUT_MODE_MASK);
if (ret)
- goto err_free_irq;
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to set input mode %d\n",
+ als->pwm_mode);
+
+ /* ALS input is always high impedance in PWM-mode. */
+ if (!als->pwm_mode) {
+ ret = lm3533_write(lm3533, LM3533_REG_ALS_RESISTOR_SELECT,
+ (u8)als->r_select);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to set resistor\n");
+ }
ret = lm3533_als_enable(als);
if (ret)
- goto err_free_irq;
+ return ret;
ret = iio_device_register(indio_dev);
if (ret) {
@@ -888,9 +851,6 @@ static int lm3533_als_probe(struct platform_device *pdev)
err_disable:
lm3533_als_disable(als);
-err_free_irq:
- if (als->irq)
- free_irq(als->irq, indio_dev);
return ret;
}
@@ -903,13 +863,18 @@ static void lm3533_als_remove(struct platform_device *pdev)
lm3533_als_set_int_mode(indio_dev, false);
iio_device_unregister(indio_dev);
lm3533_als_disable(als);
- if (als->irq)
- free_irq(als->irq, indio_dev);
}
+static const struct of_device_id lm3533_als_match_table[] = {
+ { .compatible = "ti,lm3533-als" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, lm3533_als_match_table);
+
static struct platform_driver lm3533_als_driver = {
.driver = {
.name = "lm3533-als",
+ .of_match_table = lm3533_als_match_table,
},
.probe = lm3533_als_probe,
.remove = lm3533_als_remove,
diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
index 45795f2a1042..f6345bc1f443 100644
--- a/drivers/leds/leds-lm3533.c
+++ b/drivers/leds/leds-lm3533.c
@@ -10,8 +10,10 @@
#include <linux/module.h>
#include <linux/leds.h>
#include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/mfd/lm3533.h>
@@ -48,6 +50,9 @@ struct lm3533_led {
struct mutex mutex;
unsigned long flags;
+
+ u32 max_current;
+ u32 pwm;
};
@@ -632,22 +637,20 @@ static const struct attribute_group *lm3533_led_attribute_groups[] = {
NULL
};
-static int lm3533_led_setup(struct lm3533_led *led,
- struct lm3533_led_platform_data *pdata)
+static int lm3533_led_setup(struct lm3533_led *led)
{
int ret;
- ret = lm3533_ctrlbank_set_max_current(&led->cb, pdata->max_current);
+ ret = lm3533_ctrlbank_set_max_current(&led->cb, led->max_current);
if (ret)
return ret;
- return lm3533_ctrlbank_set_pwm(&led->cb, pdata->pwm);
+ return lm3533_ctrlbank_set_pwm(&led->cb, led->pwm);
}
static int lm3533_led_probe(struct platform_device *pdev)
{
struct lm3533 *lm3533;
- struct lm3533_led_platform_data *pdata;
struct lm3533_led *led;
int ret;
@@ -657,30 +660,30 @@ static int lm3533_led_probe(struct platform_device *pdev)
if (!lm3533)
return -EINVAL;
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "no platform data\n");
- return -EINVAL;
- }
-
- if (pdev->id < 0 || pdev->id >= LM3533_LVCTRLBANK_COUNT) {
- dev_err(&pdev->dev, "illegal LED id %d\n", pdev->id);
- return -EINVAL;
- }
+ if (pdev->id < LM3533_LVCTRLBANK_MIN || pdev->id > LM3533_LVCTRLBANK_MAX)
+ return dev_err_probe(&pdev->dev, -EINVAL,
+ "illegal LED id %d\n", pdev->id);
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
if (!led)
return -ENOMEM;
led->lm3533 = lm3533;
- led->cdev.name = pdata->name;
- led->cdev.default_trigger = pdata->default_trigger;
led->cdev.brightness_set_blocking = lm3533_led_set;
led->cdev.brightness_get = lm3533_led_get;
led->cdev.blink_set = lm3533_led_blink_set;
led->cdev.brightness = LED_OFF;
led->cdev.groups = lm3533_led_attribute_groups;
- led->id = pdev->id;
+ led->id = pdev->id - LM3533_LVCTRLBANK_MIN;
+
+ led->cdev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-%d",
+ pdev->name, led->id);
+ if (!led->cdev.name)
+ return -ENOMEM;
+
+ led->cdev.default_trigger = "none";
+ device_property_read_string(&pdev->dev, "linux,default-trigger",
+ &led->cdev.default_trigger);
mutex_init(&led->mutex);
@@ -694,15 +697,23 @@ static int lm3533_led_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, led);
- ret = led_classdev_register(pdev->dev.parent, &led->cdev);
+ ret = led_classdev_register(&pdev->dev, &led->cdev);
if (ret) {
- dev_err(&pdev->dev, "failed to register LED %d\n", pdev->id);
+ dev_err(&pdev->dev, "failed to register LED %d\n", led->id);
return ret;
}
led->cb.dev = led->cdev.dev;
- ret = lm3533_led_setup(led, pdata);
+ device_property_read_u32(&pdev->dev, "led-max-microamp",
+ &led->max_current);
+ led->max_current = clamp(led->max_current, LM3533_LED_MAX_CURRENT_MIN,
+ LM3533_LED_MAX_CURRENT_MAX);
+
+ led->pwm = 0;
+ device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &led->pwm);
+
+ ret = lm3533_led_setup(led);
if (ret)
goto err_deregister;
@@ -739,9 +750,16 @@ static void lm3533_led_shutdown(struct platform_device *pdev)
lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */
}
+static const struct of_device_id lm3533_led_match_table[] = {
+ { .compatible = "ti,lm3533-leds" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, lm3533_led_match_table);
+
static struct platform_driver lm3533_led_driver = {
.driver = {
.name = "lm3533-leds",
+ .of_match_table = lm3533_led_match_table,
},
.probe = lm3533_led_probe,
.remove = lm3533_led_remove,
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 0a2409d00b2e..83ebd780f39d 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -14,19 +14,26 @@
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/units.h>
#include <linux/mfd/lm3533.h>
#define LM3533_BOOST_OVP_MASK 0x06
#define LM3533_BOOST_OVP_SHIFT 1
+#define LM3533_BOOST_OVP_MIN 16000000
+#define LM3533_BOOST_OVP_MAX 40000000
#define LM3533_BOOST_FREQ_MASK 0x01
#define LM3533_BOOST_FREQ_SHIFT 0
+#define LM3533_BOOST_FREQ_MIN 500000
+#define LM3533_BOOST_FREQ_MAX 1000000
#define LM3533_BL_ID_MASK 1
#define LM3533_LED_ID_MASK 3
@@ -42,42 +49,14 @@
#define LM3533_REG_MAX 0xb2
-
-static struct mfd_cell lm3533_als_devs[] = {
- {
- .name = "lm3533-als",
- .id = -1,
- },
-};
-
-static struct mfd_cell lm3533_bl_devs[] = {
- {
- .name = "lm3533-backlight",
- .id = 0,
- },
- {
- .name = "lm3533-backlight",
- .id = 1,
- },
-};
-
-static struct mfd_cell lm3533_led_devs[] = {
- {
- .name = "lm3533-leds",
- .id = 0,
- },
- {
- .name = "lm3533-leds",
- .id = 1,
- },
- {
- .name = "lm3533-leds",
- .id = 2,
- },
- {
- .name = "lm3533-leds",
- .id = 3,
- },
+static struct mfd_cell lm3533_child_devices[] = {
+ MFD_CELL_OF("lm3533-als", NULL, NULL, 0, 0, "ti,lm3533-als"),
+ MFD_CELL_OF_REG("lm3533-backlight", NULL, NULL, 0, 0, "ti,lm3533-backlight", 0),
+ MFD_CELL_OF_REG("lm3533-backlight", NULL, NULL, 0, 1, "ti,lm3533-backlight", 1),
+ MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 0, "ti,lm3533-leds", 2),
+ MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 1, "ti,lm3533-leds", 3),
+ MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 2, "ti,lm3533-leds", 4),
+ MFD_CELL_OF_REG("lm3533-leds", NULL, NULL, 0, 3, "ti,lm3533-leds", 5),
};
int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val)
@@ -132,35 +111,6 @@ int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask)
}
EXPORT_SYMBOL_GPL(lm3533_update);
-static int lm3533_set_boost_freq(struct lm3533 *lm3533,
- enum lm3533_boost_freq freq)
-{
- int ret;
-
- ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
- freq << LM3533_BOOST_FREQ_SHIFT,
- LM3533_BOOST_FREQ_MASK);
- if (ret)
- dev_err(lm3533->dev, "failed to set boost frequency\n");
-
- return ret;
-}
-
-
-static int lm3533_set_boost_ovp(struct lm3533 *lm3533,
- enum lm3533_boost_ovp ovp)
-{
- int ret;
-
- ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
- ovp << LM3533_BOOST_OVP_SHIFT,
- LM3533_BOOST_OVP_MASK);
- if (ret)
- dev_err(lm3533->dev, "failed to set boost ovp\n");
-
- return ret;
-}
-
/*
* HVLED output config -- output hvled controlled by backlight bl
*/
@@ -376,136 +326,45 @@ static struct attribute_group lm3533_attribute_group = {
.attrs = lm3533_attributes
};
-static int lm3533_device_als_init(struct lm3533 *lm3533)
+static int lm3533_device_init(struct lm3533 *lm3533)
{
- struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
+ struct device *dev = lm3533->dev;
int ret;
- if (!pdata->als)
- return 0;
-
- lm3533_als_devs[0].platform_data = pdata->als;
- lm3533_als_devs[0].pdata_size = sizeof(*pdata->als);
+ lm3533_enable(lm3533);
- ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL,
- 0, NULL);
+ ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
+ lm3533->boost_freq << LM3533_BOOST_FREQ_SHIFT,
+ LM3533_BOOST_FREQ_MASK);
if (ret) {
- dev_err(lm3533->dev, "failed to add ALS device\n");
- return ret;
- }
-
- lm3533->have_als = 1;
-
- return 0;
-}
-
-static int lm3533_device_bl_init(struct lm3533 *lm3533)
-{
- struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
- int i;
- int ret;
-
- if (!pdata->backlights || pdata->num_backlights == 0)
- return 0;
-
- if (pdata->num_backlights > ARRAY_SIZE(lm3533_bl_devs))
- pdata->num_backlights = ARRAY_SIZE(lm3533_bl_devs);
-
- for (i = 0; i < pdata->num_backlights; ++i) {
- lm3533_bl_devs[i].platform_data = &pdata->backlights[i];
- lm3533_bl_devs[i].pdata_size = sizeof(pdata->backlights[i]);
+ dev_err(dev, "failed to set boost frequency\n");
+ goto err_disable;
}
- ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs,
- pdata->num_backlights, NULL, 0, NULL);
+ ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM,
+ lm3533->boost_ovp << LM3533_BOOST_OVP_SHIFT,
+ LM3533_BOOST_OVP_MASK);
if (ret) {
- dev_err(lm3533->dev, "failed to add backlight devices\n");
- return ret;
- }
-
- lm3533->have_backlights = 1;
-
- return 0;
-}
-
-static int lm3533_device_led_init(struct lm3533 *lm3533)
-{
- struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
- int i;
- int ret;
-
- if (!pdata->leds || pdata->num_leds == 0)
- return 0;
-
- if (pdata->num_leds > ARRAY_SIZE(lm3533_led_devs))
- pdata->num_leds = ARRAY_SIZE(lm3533_led_devs);
-
- for (i = 0; i < pdata->num_leds; ++i) {
- lm3533_led_devs[i].platform_data = &pdata->leds[i];
- lm3533_led_devs[i].pdata_size = sizeof(pdata->leds[i]);
+ dev_err(dev, "failed to set boost ovp\n");
+ goto err_disable;
}
- ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs,
- pdata->num_leds, NULL, 0, NULL);
+ ret = devm_mfd_add_devices(dev, 0, lm3533_child_devices,
+ ARRAY_SIZE(lm3533_child_devices),
+ NULL, 0, NULL);
if (ret) {
- dev_err(lm3533->dev, "failed to add LED devices\n");
- return ret;
- }
-
- lm3533->have_leds = 1;
-
- return 0;
-}
-
-static int lm3533_device_setup(struct lm3533 *lm3533,
- struct lm3533_platform_data *pdata)
-{
- int ret;
-
- ret = lm3533_set_boost_freq(lm3533, pdata->boost_freq);
- if (ret)
- return ret;
-
- return lm3533_set_boost_ovp(lm3533, pdata->boost_ovp);
-}
-
-static int lm3533_device_init(struct lm3533 *lm3533)
-{
- struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
- int ret;
-
- dev_dbg(lm3533->dev, "%s\n", __func__);
-
- if (!pdata) {
- dev_err(lm3533->dev, "no platform data\n");
- return -EINVAL;
+ dev_err(dev, "failed to add MFD devices: %d\n", ret);
+ goto err_disable;
}
- lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW);
- if (IS_ERR(lm3533->hwen))
- return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n");
- gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen");
-
- lm3533_enable(lm3533);
-
- ret = lm3533_device_setup(lm3533, pdata);
- if (ret)
+ ret = sysfs_create_group(&dev->kobj, &lm3533_attribute_group);
+ if (ret) {
+ dev_err(dev, "failed to create sysfs attributes\n");
goto err_disable;
-
- lm3533_device_als_init(lm3533);
- lm3533_device_bl_init(lm3533);
- lm3533_device_led_init(lm3533);
-
- ret = sysfs_create_group(&lm3533->dev->kobj, &lm3533_attribute_group);
- if (ret < 0) {
- dev_err(lm3533->dev, "failed to create sysfs attributes\n");
- goto err_unregister;
}
return 0;
-err_unregister:
- mfd_remove_devices(lm3533->dev);
err_disable:
lm3533_disable(lm3533);
@@ -517,8 +376,6 @@ static void lm3533_device_exit(struct lm3533 *lm3533)
dev_dbg(lm3533->dev, "%s\n", __func__);
sysfs_remove_group(&lm3533->dev->kobj, &lm3533_attribute_group);
-
- mfd_remove_devices(lm3533->dev);
lm3533_disable(lm3533);
}
@@ -589,7 +446,40 @@ static int lm3533_i2c_probe(struct i2c_client *i2c)
return PTR_ERR(lm3533->regmap);
lm3533->dev = &i2c->dev;
- lm3533->irq = i2c->irq;
+
+ lm3533->hwen = devm_gpiod_get_optional(lm3533->dev, "enable",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(lm3533->hwen))
+ return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen),
+ "failed to get HWEN GPIO\n");
+
+ device_property_read_u32(lm3533->dev, "ti,boost-ovp-microvolt",
+ &lm3533->boost_ovp);
+
+ lm3533->boost_ovp = clamp(lm3533->boost_ovp, LM3533_BOOST_OVP_MIN,
+ LM3533_BOOST_OVP_MAX);
+ lm3533->boost_ovp = lm3533->boost_ovp / (8 * MICRO) - 2;
+
+ device_property_read_u32(lm3533->dev, "ti,boost-freq-hz",
+ &lm3533->boost_freq);
+
+ lm3533->boost_freq = clamp(lm3533->boost_freq, LM3533_BOOST_FREQ_MIN,
+ LM3533_BOOST_FREQ_MAX);
+ lm3533->boost_freq = lm3533->boost_freq / (500 * KILO) - 1;
+
+ device_for_each_child_node_scoped(lm3533->dev, child) {
+ if (!fwnode_device_is_available(child))
+ continue;
+
+ if (fwnode_device_is_compatible(child, "ti,lm3533-als"))
+ lm3533->have_als = true;
+
+ if (fwnode_device_is_compatible(child, "ti,lm3533-backlight"))
+ lm3533->have_backlights = true;
+
+ if (fwnode_device_is_compatible(child, "ti,lm3533-leds"))
+ lm3533->have_leds = true;
+ }
return lm3533_device_init(lm3533);
}
@@ -603,6 +493,12 @@ static void lm3533_i2c_remove(struct i2c_client *i2c)
lm3533_device_exit(lm3533);
}
+static const struct of_device_id lm3533_match_table[] = {
+ { .compatible = "ti,lm3533" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, lm3533_match_table);
+
static const struct i2c_device_id lm3533_i2c_ids[] = {
{ "lm3533" },
{ }
@@ -612,6 +508,7 @@ MODULE_DEVICE_TABLE(i2c, lm3533_i2c_ids);
static struct i2c_driver lm3533_i2c_driver = {
.driver = {
.name = "lm3533",
+ .of_match_table = lm3533_match_table,
},
.id_table = lm3533_i2c_ids,
.probe = lm3533_i2c_probe,
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index babfd3ceec86..42da652df58d 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -9,7 +9,9 @@
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/backlight.h>
#include <linux/slab.h>
@@ -27,6 +29,9 @@ struct lm3533_bl {
struct lm3533_ctrlbank cb;
struct backlight_device *bd;
int id;
+
+ u32 max_current;
+ u32 pwm;
};
@@ -246,25 +251,24 @@ static struct attribute_group lm3533_bl_attribute_group = {
.attrs = lm3533_bl_attributes
};
-static int lm3533_bl_setup(struct lm3533_bl *bl,
- struct lm3533_bl_platform_data *pdata)
+static int lm3533_bl_setup(struct lm3533_bl *bl)
{
int ret;
- ret = lm3533_ctrlbank_set_max_current(&bl->cb, pdata->max_current);
+ ret = lm3533_ctrlbank_set_max_current(&bl->cb, bl->max_current);
if (ret)
return ret;
- return lm3533_ctrlbank_set_pwm(&bl->cb, pdata->pwm);
+ return lm3533_ctrlbank_set_pwm(&bl->cb, bl->pwm);
}
static int lm3533_bl_probe(struct platform_device *pdev)
{
struct lm3533 *lm3533;
- struct lm3533_bl_platform_data *pdata;
struct lm3533_bl *bl;
struct backlight_device *bd;
struct backlight_properties props;
+ char *name = NULL;
int ret;
dev_dbg(&pdev->dev, "%s\n", __func__);
@@ -273,12 +277,6 @@ static int lm3533_bl_probe(struct platform_device *pdev)
if (!lm3533)
return -EINVAL;
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "no platform data\n");
- return -EINVAL;
- }
-
if (pdev->id < 0 || pdev->id >= LM3533_HVCTRLBANK_COUNT) {
dev_err(&pdev->dev, "illegal backlight id %d\n", pdev->id);
return -EINVAL;
@@ -295,13 +293,20 @@ static int lm3533_bl_probe(struct platform_device *pdev)
bl->cb.id = lm3533_bl_get_ctrlbank_id(bl);
bl->cb.dev = NULL; /* until registered */
+ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-%d",
+ pdev->name, pdev->id);
+ if (!name)
+ return -ENOMEM;
+
memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_RAW;
props.max_brightness = LM3533_BL_MAX_BRIGHTNESS;
- props.brightness = pdata->default_brightness;
- bd = devm_backlight_device_register(&pdev->dev, pdata->name,
- pdev->dev.parent, bl, &lm3533_bl_ops,
- &props);
+ props.brightness = LM3533_BL_MAX_BRIGHTNESS;
+ device_property_read_u32(&pdev->dev, "default-brightness",
+ &props.brightness);
+
+ bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev,
+ bl, &lm3533_bl_ops, &props);
if (IS_ERR(bd)) {
dev_err(&pdev->dev, "failed to register backlight device\n");
return PTR_ERR(bd);
@@ -320,7 +325,15 @@ static int lm3533_bl_probe(struct platform_device *pdev)
backlight_update_status(bd);
- ret = lm3533_bl_setup(bl, pdata);
+ device_property_read_u32(&pdev->dev, "led-max-microamp",
+ &bl->max_current);
+ bl->max_current = clamp(bl->max_current, LM3533_LED_MAX_CURRENT_MIN,
+ LM3533_LED_MAX_CURRENT_MAX);
+
+ bl->pwm = 0;
+ device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &bl->pwm);
+
+ ret = lm3533_bl_setup(bl);
if (ret)
goto err_sysfs_remove;
@@ -381,10 +394,17 @@ static void lm3533_bl_shutdown(struct platform_device *pdev)
lm3533_ctrlbank_disable(&bl->cb);
}
+static const struct of_device_id lm3533_bl_match_table[] = {
+ { .compatible = "ti,lm3533-backlight" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, lm3533_bl_match_table);
+
static struct platform_driver lm3533_bl_driver = {
.driver = {
.name = "lm3533-backlight",
.pm = &lm3533_bl_pm_ops,
+ .of_match_table = lm3533_bl_match_table,
},
.probe = lm3533_bl_probe,
.remove = lm3533_bl_remove,
diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
index 69059a7a2ce5..3aa962d4c747 100644
--- a/include/linux/mfd/lm3533.h
+++ b/include/linux/mfd/lm3533.h
@@ -15,6 +15,9 @@
#define LM3533_ATTR_RW(_name) \
DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
+#define LM3533_LED_MAX_CURRENT_MIN 5000
+#define LM3533_LED_MAX_CURRENT_MAX 29800
+
struct device;
struct gpio_desc;
struct regmap;
@@ -25,7 +28,9 @@ struct lm3533 {
struct regmap *regmap;
struct gpio_desc *hwen;
- int irq;
+
+ u32 boost_ovp;
+ u32 boost_freq;
unsigned have_als:1;
unsigned have_backlights:1;
@@ -38,50 +43,6 @@ struct lm3533_ctrlbank {
int id;
};
-struct lm3533_als_platform_data {
- unsigned pwm_mode:1; /* PWM input mode (default analog) */
- u8 r_select; /* 1 - 127 (ignored in PWM-mode) */
-};
-
-struct lm3533_bl_platform_data {
- char *name;
- u16 max_current; /* 5000 - 29800 uA (800 uA step) */
- u8 default_brightness; /* 0 - 255 */
- u8 pwm; /* 0 - 0x3f */
-};
-
-struct lm3533_led_platform_data {
- char *name;
- const char *default_trigger;
- u16 max_current; /* 5000 - 29800 uA (800 uA step) */
- u8 pwm; /* 0 - 0x3f */
-};
-
-enum lm3533_boost_freq {
- LM3533_BOOST_FREQ_500KHZ,
- LM3533_BOOST_FREQ_1000KHZ,
-};
-
-enum lm3533_boost_ovp {
- LM3533_BOOST_OVP_16V,
- LM3533_BOOST_OVP_24V,
- LM3533_BOOST_OVP_32V,
- LM3533_BOOST_OVP_40V,
-};
-
-struct lm3533_platform_data {
- enum lm3533_boost_ovp boost_ovp;
- enum lm3533_boost_freq boost_freq;
-
- struct lm3533_als_platform_data *als;
-
- struct lm3533_bl_platform_data *backlights;
- int num_backlights;
-
- struct lm3533_led_platform_data *leds;
- int num_leds;
-};
-
extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb);
extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb);
--
2.51.0
^ permalink raw reply related
* [PATCH v1 1/6] dt-bindings: leds: Document TI LM3533 LED controller
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
In-Reply-To: <20260517074306.30937-1-clamor95@gmail.com>
Document the LM3533 - a complete power source for backlight, keypad and
indicator LEDs in smartphone handsets. The high-voltage inductive boost
converter provides the power for two series LED strings display backlight
and keypad functions.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../leds/backlight/ti,lm3533-backlight.yaml | 68 +++++++
.../bindings/leds/ti,lm3533-leds.yaml | 66 ++++++
.../devicetree/bindings/leds/ti,lm3533.yaml | 190 ++++++++++++++++++
3 files changed, 324 insertions(+)
create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3533-backlight.yaml
create mode 100644 Documentation/devicetree/bindings/leds/ti,lm3533-leds.yaml
create mode 100644 Documentation/devicetree/bindings/leds/ti,lm3533.yaml
diff --git a/Documentation/devicetree/bindings/leds/backlight/ti,lm3533-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/ti,lm3533-backlight.yaml
new file mode 100644
index 000000000000..866b0fb8ed04
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/ti,lm3533-backlight.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/ti,lm3533-backlight.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI LM3533 high voltage series LED strings
+
+description:
+ This is part of the TI LM3533 MFD device. It represents two high voltage series
+ LED strings for display backlight controlled by the TI LM3533.
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+allOf:
+ - $ref: /schemas/leds/backlight/common.yaml#
+
+properties:
+ compatible:
+ const: ti,lm3533-backlight
+
+ reg:
+ description: Control bank selection (0 = bank A, 1 = bank B).
+ maximum: 1
+
+ led-max-microamp:
+ description: maximum current in uA with a 800 uA step.
+ minimum: 5000
+ maximum: 29800
+ default: 5000
+
+ led-sources:
+ description: |
+ HVLED strings associated with this control bank:
+ 0 - HVLED1
+ 1 - HVLED2
+ minItems: 1
+ maxItems: 2
+ items:
+ maximum: 1
+
+ ti,pwm-config-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Control Bank PWM Configuration Register mask that allows to configure
+ PWM input in Zones 0-4
+ BIT(0) - PWM Input is enabled
+ BIT(1) - PWM Input is enabled in Zone 0
+ BIT(2) - PWM Input is enabled in Zone 1
+ BIT(3) - PWM Input is enabled in Zone 2
+ BIT(4) - PWM Input is enabled in Zone 3
+ BIT(5) - PWM Input is enabled in Zone 4
+
+ ti,linear-mapping-mode:
+ description:
+ Enable linear mapping mode. If disabled, then it will use exponential
+ mapping mode in which the ramp up/down appears to have a more uniform
+ transition to the human eye.
+ type: boolean
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+# see ti,lm3533.yaml for an example
diff --git a/Documentation/devicetree/bindings/leds/ti,lm3533-leds.yaml b/Documentation/devicetree/bindings/leds/ti,lm3533-leds.yaml
new file mode 100644
index 000000000000..a582d7d2f955
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/ti,lm3533-leds.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/ti,lm3533-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI LM3533 low voltage control banks for individual LEDs
+
+description:
+ This is part of the TI LM3533 MFD device. It represents four low voltage
+ control banks for individual LEDs provided by the TI LM3533.
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+allOf:
+ - $ref: /schemas/leds/common.yaml#
+
+properties:
+ compatible:
+ const: ti,lm3533-leds
+
+ reg:
+ description:
+ Control bank selection (2 = bank C, 3 = bank D, 4 = bank E, 5 = bank F).
+ minimum: 2
+ maximum: 5
+
+ led-max-microamp:
+ description: maximum current in uA with a 800 uA step.
+ minimum: 5000
+ maximum: 29800
+ default: 5000
+
+ led-sources:
+ description: |
+ LVLED associated with this control bank. May be more than 1 source per bank.
+ 0 - LVLED1
+ 1 - LVLED2
+ 2 - LVLED3
+ 3 - LVLED4
+ 4 - LVLED5
+ minItems: 1
+ maxItems: 5
+ items:
+ maximum: 5
+
+ ti,pwm-config-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Control Bank PWM Configuration Register mask that allows to configure
+ PWM input in Zones 0-4
+ BIT(0) - PWM Input is enabled
+ BIT(1) - PWM Input is enabled in Zone 0
+ BIT(2) - PWM Input is enabled in Zone 1
+ BIT(3) - PWM Input is enabled in Zone 2
+ BIT(4) - PWM Input is enabled in Zone 3
+ BIT(5) - PWM Input is enabled in Zone 4
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+# see ti,lm3533.yaml for an example
diff --git a/Documentation/devicetree/bindings/leds/ti,lm3533.yaml b/Documentation/devicetree/bindings/leds/ti,lm3533.yaml
new file mode 100644
index 000000000000..2e200f172400
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/ti,lm3533.yaml
@@ -0,0 +1,190 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/ti,lm3533.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI LM3533 Complete Lighting Power Solution
+
+description: >
+ The LM3533 is a complete power source for backlight, keypad, and indicator LEDs
+ in smartphone handsets. The high-voltage inductive boost converter provides the
+ power for two high voltage series LED strings for display backlight and four low
+ voltage control banks for individual LEDs. Additionally, LM3533 features an ALS
+ sensor support.
+
+ https://www.ti.com/product/LM3533
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+properties:
+ compatible:
+ const: ti,lm3533
+
+ reg:
+ maxItems: 1
+
+ enable-gpios:
+ description: GPIO connected to the HWEN pin.
+ maxItems: 1
+
+ vin-supply:
+ description: Supply connected to the IN line (2.7 V to 5.5 V).
+
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ ti,boost-ovp-microvolt:
+ description: boost OVP select (16V, 24V, 32V, 40V)
+ enum: [ 16000000, 24000000, 32000000, 40000000 ]
+ default: 16000000
+
+ ti,boost-freq-hz:
+ description: boost frequency select (500KHz or 1MHz)
+ enum: [ 500000, 1000000 ]
+ default: 500000
+
+ light-sensor:
+ type: object
+ additionalProperties: false
+
+ properties:
+ compatible:
+ const: ti,lm3533-als
+
+ interrupts:
+ maxItems: 1
+
+ ti,resistor-ohm:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Internal configuration resister value when ALS is in Analog Sensor
+ mode and PWM mode is disabled.
+ minimum: 1575
+ maximum: 200000
+
+ ti,pwm-mode:
+ type: boolean
+ description:
+ Switch for mode in which ALS is running. If this property is set
+ then ALS is running in PWM mode, internal resistor value is set to
+ high-impedance (0) and ti,resistor-ohm property is ignored.
+
+ required:
+ - compatible
+
+ anyOf:
+ - required:
+ - ti,resistor-ohm
+ - required:
+ - ti,pwm-mode
+
+patternProperties:
+ "^backlight@[01]$":
+ $ref: /schemas/leds/backlight/ti,lm3533-backlight.yaml#
+
+ "^led@[2-5]$":
+ $ref: /schemas/leds/ti,lm3533-leds.yaml#
+
+required:
+ - compatible
+ - reg
+ - light-sensor
+ - backlight@0
+ - backlight@1
+ - led@2
+ - led@3
+ - led@4
+ - led@5
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ led-controller@36 {
+ compatible = "ti,lm3533";
+ reg = <0x36>;
+
+ enable-gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
+ vin-supply = <&vdd_3v3_bat>;
+
+ ti,boost-ovp-microvolt = <24000000>;
+ ti,boost-freq-hz = <500000>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ backlight@0 {
+ compatible = "ti,lm3533-backlight";
+ reg = <0>;
+
+ default-brightness = <113>;
+
+ led-max-microamp = <23400>;
+ led-sources = <0>;
+ };
+
+ backlight@1 {
+ compatible = "ti,lm3533-backlight";
+ reg = <1>;
+
+ default-brightness = <113>;
+
+ led-max-microamp = <23400>;
+ led-sources = <1>;
+ };
+
+ led@2 {
+ compatible = "ti,lm3533-leds";
+ reg = <2>;
+
+ led-max-microamp = <23400>;
+ led-sources = <0>;
+ };
+
+ led@3 {
+ compatible = "ti,lm3533-leds";
+ reg = <3>;
+
+ led-max-microamp = <23400>;
+ led-sources = <1>;
+ };
+
+ led@4 {
+ compatible = "ti,lm3533-leds";
+ reg = <4>;
+
+ led-max-microamp = <23400>;
+ led-sources = <2>;
+ };
+
+ led@5 {
+ compatible = "ti,lm3533-leds";
+ reg = <5>;
+
+ led-max-microamp = <23400>;
+ led-sources = <3 4>;
+ };
+
+ light-sensor {
+ compatible = "ti,lm3533-als";
+
+ interrupt-parent = <&gpio>;
+ interrupts = <80 IRQ_TYPE_LEVEL_LOW>;
+
+ ti,pwm-mode;
+ };
+ };
+ };
+...
--
2.51.0
^ permalink raw reply related
* [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support
From: Svyatoslav Ryhel @ 2026-05-17 7:43 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Helge Deller,
Svyatoslav Ryhel
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-iio,
linux-fbdev
Convert LM3533 to OF bindings, add missing VIN supply, add support for
setting mapping mode and LED sources based on device tree.
Svyatoslav Ryhel (6):
dt-bindings: leds: Document TI LM3533 LED controller
mfd: lm3533: Convert to use OF bindings
mfd: lm3533: Add support for VIN power supply
mfd: lm3533: set DMA mask
video: backlight: lm3533_bl: Set initial mapping mode from DT
video: leds: backlight: lm3533: Support getting LED sources from DT
.../leds/backlight/ti,lm3533-backlight.yaml | 68 +++++
.../bindings/leds/ti,lm3533-leds.yaml | 66 ++++
.../devicetree/bindings/leds/ti,lm3533.yaml | 190 ++++++++++++
drivers/iio/light/lm3533-als.c | 123 +++-----
drivers/leds/leds-lm3533.c | 117 ++++++--
drivers/mfd/lm3533-core.c | 281 +++++++-----------
drivers/video/backlight/lm3533_bl.c | 123 ++++++--
include/linux/mfd/lm3533.h | 52 +---
8 files changed, 660 insertions(+), 360 deletions(-)
create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3533-backlight.yaml
create mode 100644 Documentation/devicetree/bindings/leds/ti,lm3533-leds.yaml
create mode 100644 Documentation/devicetree/bindings/leds/ti,lm3533.yaml
--
2.51.0
^ permalink raw reply
* Re: [PATCH] staging: sm750fb: fix CamelCase variables name in sm750
From: kernel test robot @ 2026-05-17 4:00 UTC (permalink / raw)
To: Emmanuel Arias, sudipm.mukherjee, teddy.wang, gregkh
Cc: llvm, oe-kbuild-all, linux-fbdev, linux-staging, linux-kernel,
Emmanuel Arias
In-Reply-To: <20260516222613.1178800-1-eamanu@riseup.net>
Hi Emmanuel,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Emmanuel-Arias/staging-sm750fb-fix-CamelCase-variables-name-in-sm750/20260517-062807
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260516222613.1178800-1-eamanu%40riseup.net
patch subject: [PATCH] staging: sm750fb: fix CamelCase variables name in sm750
config: riscv-randconfig-001-20260517 (https://download.01.org/0day-ci/archive/20260517/202605171120.K414qtus-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260517/202605171120.K414qtus-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605171120.K414qtus-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/staging/sm750fb/sm750_hw.c:43:13: error: no member named 'pvReg' in 'struct sm750_dev'
43 | sm750_dev->pvReg =
| ~~~~~~~~~ ^
drivers/staging/sm750fb/sm750_hw.c:45:18: error: no member named 'pvReg' in 'struct sm750_dev'
45 | if (!sm750_dev->pvReg) {
| ~~~~~~~~~ ^
drivers/staging/sm750fb/sm750_hw.c:51:41: error: no member named 'pvReg' in 'struct sm750_dev'
51 | sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
| ~~~~~~~~~ ^
drivers/staging/sm750fb/sm750_hw.c:52:45: error: no member named 'pvReg' in 'struct sm750_dev'
52 | sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
| ~~~~~~~~~ ^
drivers/staging/sm750fb/sm750_hw.c:54:23: error: no member named 'pvReg' in 'struct sm750_dev'
54 | mmio750 = sm750_dev->pvReg;
| ~~~~~~~~~ ^
drivers/staging/sm750fb/sm750_hw.c:78:21: error: no member named 'pvReg' in 'struct sm750_dev'
78 | iounmap(sm750_dev->pvReg);
| ~~~~~~~~~ ^
6 errors generated.
vim +43 drivers/staging/sm750fb/sm750_hw.c
efe9bc08bf479b Elise Lennion 2016-10-11 27
700591a9adc8b1 Mike Rapoport 2015-10-26 28 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
81dee67e215b23 Sudip Mukherjee 2015-03-03 29 {
81dee67e215b23 Sudip Mukherjee 2015-03-03 30 int ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 31
e359b6a863e19f Mike Rapoport 2015-10-26 32 sm750_dev->vidreg_start = pci_resource_start(pdev, 1);
e359b6a863e19f Mike Rapoport 2015-10-26 33 sm750_dev->vidreg_size = SZ_2M;
81dee67e215b23 Sudip Mukherjee 2015-03-03 34
8225489ddb9006 Artem Lytkin 2026-02-16 35 /* reserve the vidreg space of smi adaptor */
9a52ae2dd8c24a Anatoly Stepanov 2015-06-29 36 ret = pci_request_region(pdev, 1, "sm750fb");
9a52ae2dd8c24a Anatoly Stepanov 2015-06-29 37 if (ret) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 38 dev_err(&pdev->dev, "Can not request PCI regions.\n");
8225489ddb9006 Artem Lytkin 2026-02-16 39 return ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 40 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 41
81dee67e215b23 Sudip Mukherjee 2015-03-03 42 /* now map mmio and vidmem */
fdc234d85210d9 Benjamin Philip 2021-07-28 @43 sm750_dev->pvReg =
fdc234d85210d9 Benjamin Philip 2021-07-28 44 ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
e359b6a863e19f Mike Rapoport 2015-10-26 45 if (!sm750_dev->pvReg) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 46 dev_err(&pdev->dev, "mmio failed\n");
81dee67e215b23 Sudip Mukherjee 2015-03-03 47 ret = -EFAULT;
8225489ddb9006 Artem Lytkin 2026-02-16 48 goto err_release_region;
81dee67e215b23 Sudip Mukherjee 2015-03-03 49 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 50
5865a858dbc9cb Yiming Qian 2025-09-09 51 sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
5865a858dbc9cb Yiming Qian 2025-09-09 52 sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
81dee67e215b23 Sudip Mukherjee 2015-03-03 53
efe9bc08bf479b Elise Lennion 2016-10-11 54 mmio750 = sm750_dev->pvReg;
efe9bc08bf479b Elise Lennion 2016-10-11 55 sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
81dee67e215b23 Sudip Mukherjee 2015-03-03 56
e359b6a863e19f Mike Rapoport 2015-10-26 57 sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
f5016082f63d42 Eric S. Stone 2016-10-22 58 /*
f5016082f63d42 Eric S. Stone 2016-10-22 59 * don't use pdev_resource[x].end - resource[x].start to
878336c3362d09 Stefan Wolz 2016-06-23 60 * calculate the resource size, it's only the maximum available
878336c3362d09 Stefan Wolz 2016-06-23 61 * size but not the actual size, using
3fcb465f1e74ef Elise Lennion 2016-10-13 62 * @ddk750_get_vm_size function can be safe.
878336c3362d09 Stefan Wolz 2016-06-23 63 */
3fcb465f1e74ef Elise Lennion 2016-10-13 64 sm750_dev->vidmem_size = ddk750_get_vm_size();
81dee67e215b23 Sudip Mukherjee 2015-03-03 65
81dee67e215b23 Sudip Mukherjee 2015-03-03 66 /* reserve the vidmem space of smi adaptor */
f50b4602fea62f Jennifer Guo 2026-05-09 67 sm750_dev->vmem =
fdc234d85210d9 Benjamin Philip 2021-07-28 68 ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size);
f50b4602fea62f Jennifer Guo 2026-05-09 69 if (!sm750_dev->vmem) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 70 dev_err(&pdev->dev, "Map video memory failed\n");
81dee67e215b23 Sudip Mukherjee 2015-03-03 71 ret = -EFAULT;
8225489ddb9006 Artem Lytkin 2026-02-16 72 goto err_unmap_reg;
81dee67e215b23 Sudip Mukherjee 2015-03-03 73 }
8225489ddb9006 Artem Lytkin 2026-02-16 74
8225489ddb9006 Artem Lytkin 2026-02-16 75 return 0;
8225489ddb9006 Artem Lytkin 2026-02-16 76
8225489ddb9006 Artem Lytkin 2026-02-16 77 err_unmap_reg:
8225489ddb9006 Artem Lytkin 2026-02-16 78 iounmap(sm750_dev->pvReg);
8225489ddb9006 Artem Lytkin 2026-02-16 79 err_release_region:
8225489ddb9006 Artem Lytkin 2026-02-16 80 pci_release_region(pdev, 1);
81dee67e215b23 Sudip Mukherjee 2015-03-03 81 return ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 82 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 83
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH] staging: sm750fb: fix CamelCase variables name in sm750
From: kernel test robot @ 2026-05-17 2:57 UTC (permalink / raw)
To: Emmanuel Arias, sudipm.mukherjee, teddy.wang, gregkh
Cc: oe-kbuild-all, linux-fbdev, linux-staging, linux-kernel,
Emmanuel Arias
In-Reply-To: <20260516222613.1178800-1-eamanu@riseup.net>
Hi Emmanuel,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Emmanuel-Arias/staging-sm750fb-fix-CamelCase-variables-name-in-sm750/20260517-062807
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260516222613.1178800-1-eamanu%40riseup.net
patch subject: [PATCH] staging: sm750fb: fix CamelCase variables name in sm750
config: parisc-randconfig-002-20260517 (https://download.01.org/0day-ci/archive/20260517/202605171049.KbaBnrJV-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260517/202605171049.KbaBnrJV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605171049.KbaBnrJV-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/staging/sm750fb/sm750_hw.c: In function 'hw_sm750_map':
>> drivers/staging/sm750fb/sm750_hw.c:43:13: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
sm750_dev->pvReg =
^~~~~
pv_reg
drivers/staging/sm750fb/sm750_hw.c:45:18: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
if (!sm750_dev->pvReg) {
^~~~~
pv_reg
drivers/staging/sm750fb/sm750_hw.c:51:41: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
^~~~~
pv_reg
drivers/staging/sm750fb/sm750_hw.c:52:45: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
^~~~~
pv_reg
drivers/staging/sm750fb/sm750_hw.c:54:23: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
mmio750 = sm750_dev->pvReg;
^~~~~
pv_reg
drivers/staging/sm750fb/sm750_hw.c:78:21: error: 'struct sm750_dev' has no member named 'pvReg'; did you mean 'pv_reg'?
iounmap(sm750_dev->pvReg);
^~~~~
pv_reg
vim +43 drivers/staging/sm750fb/sm750_hw.c
efe9bc08bf479b Elise Lennion 2016-10-11 27
700591a9adc8b1 Mike Rapoport 2015-10-26 28 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
81dee67e215b23 Sudip Mukherjee 2015-03-03 29 {
81dee67e215b23 Sudip Mukherjee 2015-03-03 30 int ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 31
e359b6a863e19f Mike Rapoport 2015-10-26 32 sm750_dev->vidreg_start = pci_resource_start(pdev, 1);
e359b6a863e19f Mike Rapoport 2015-10-26 33 sm750_dev->vidreg_size = SZ_2M;
81dee67e215b23 Sudip Mukherjee 2015-03-03 34
8225489ddb9006 Artem Lytkin 2026-02-16 35 /* reserve the vidreg space of smi adaptor */
9a52ae2dd8c24a Anatoly Stepanov 2015-06-29 36 ret = pci_request_region(pdev, 1, "sm750fb");
9a52ae2dd8c24a Anatoly Stepanov 2015-06-29 37 if (ret) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 38 dev_err(&pdev->dev, "Can not request PCI regions.\n");
8225489ddb9006 Artem Lytkin 2026-02-16 39 return ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 40 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 41
81dee67e215b23 Sudip Mukherjee 2015-03-03 42 /* now map mmio and vidmem */
fdc234d85210d9 Benjamin Philip 2021-07-28 @43 sm750_dev->pvReg =
fdc234d85210d9 Benjamin Philip 2021-07-28 44 ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
e359b6a863e19f Mike Rapoport 2015-10-26 45 if (!sm750_dev->pvReg) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 46 dev_err(&pdev->dev, "mmio failed\n");
81dee67e215b23 Sudip Mukherjee 2015-03-03 47 ret = -EFAULT;
8225489ddb9006 Artem Lytkin 2026-02-16 48 goto err_release_region;
81dee67e215b23 Sudip Mukherjee 2015-03-03 49 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 50
5865a858dbc9cb Yiming Qian 2025-09-09 51 sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
5865a858dbc9cb Yiming Qian 2025-09-09 52 sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
81dee67e215b23 Sudip Mukherjee 2015-03-03 53
efe9bc08bf479b Elise Lennion 2016-10-11 54 mmio750 = sm750_dev->pvReg;
efe9bc08bf479b Elise Lennion 2016-10-11 55 sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
81dee67e215b23 Sudip Mukherjee 2015-03-03 56
e359b6a863e19f Mike Rapoport 2015-10-26 57 sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
f5016082f63d42 Eric S. Stone 2016-10-22 58 /*
f5016082f63d42 Eric S. Stone 2016-10-22 59 * don't use pdev_resource[x].end - resource[x].start to
878336c3362d09 Stefan Wolz 2016-06-23 60 * calculate the resource size, it's only the maximum available
878336c3362d09 Stefan Wolz 2016-06-23 61 * size but not the actual size, using
3fcb465f1e74ef Elise Lennion 2016-10-13 62 * @ddk750_get_vm_size function can be safe.
878336c3362d09 Stefan Wolz 2016-06-23 63 */
3fcb465f1e74ef Elise Lennion 2016-10-13 64 sm750_dev->vidmem_size = ddk750_get_vm_size();
81dee67e215b23 Sudip Mukherjee 2015-03-03 65
81dee67e215b23 Sudip Mukherjee 2015-03-03 66 /* reserve the vidmem space of smi adaptor */
f50b4602fea62f Jennifer Guo 2026-05-09 67 sm750_dev->vmem =
fdc234d85210d9 Benjamin Philip 2021-07-28 68 ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size);
f50b4602fea62f Jennifer Guo 2026-05-09 69 if (!sm750_dev->vmem) {
e5448f8d2ec5b4 Artem Lytkin 2026-02-23 70 dev_err(&pdev->dev, "Map video memory failed\n");
81dee67e215b23 Sudip Mukherjee 2015-03-03 71 ret = -EFAULT;
8225489ddb9006 Artem Lytkin 2026-02-16 72 goto err_unmap_reg;
81dee67e215b23 Sudip Mukherjee 2015-03-03 73 }
8225489ddb9006 Artem Lytkin 2026-02-16 74
8225489ddb9006 Artem Lytkin 2026-02-16 75 return 0;
8225489ddb9006 Artem Lytkin 2026-02-16 76
8225489ddb9006 Artem Lytkin 2026-02-16 77 err_unmap_reg:
8225489ddb9006 Artem Lytkin 2026-02-16 78 iounmap(sm750_dev->pvReg);
8225489ddb9006 Artem Lytkin 2026-02-16 79 err_release_region:
8225489ddb9006 Artem Lytkin 2026-02-16 80 pci_release_region(pdev, 1);
81dee67e215b23 Sudip Mukherjee 2015-03-03 81 return ret;
81dee67e215b23 Sudip Mukherjee 2015-03-03 82 }
81dee67e215b23 Sudip Mukherjee 2015-03-03 83
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH] staging: sm750fb: fix CamelCase variables name in sm750
From: Emmanuel Arias @ 2026-05-16 22:26 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, Emmanuel Arias
Replace CamelCase variable name with snake_case:
- pvReg -> pv_reg
- setAllEngOff -> set_all_eng_off
Signed-off-by: Emmanuel Arias <eamanu@riseup.net>
---
drivers/staging/sm750fb/sm750.c | 6 +++---
drivers/staging/sm750fb/sm750.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 996a586a3727..9b30627a19d0 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -755,7 +755,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
* must be set after crtc member initialized
*/
crtc->cursor.offset = crtc->o_screen + crtc->vidmem_size - 1024;
- crtc->cursor.mmio = sm750_dev->pvReg +
+ crtc->cursor.mmio = sm750_dev->pv_reg +
0x800f0 + (int)crtc->channel * 0x140;
crtc->cursor.max_h = 64;
@@ -860,7 +860,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
sm750_dev->init_parm.mem_clk = 0;
sm750_dev->init_parm.master_clk = 0;
sm750_dev->init_parm.power_mode = 0;
- sm750_dev->init_parm.setAllEngOff = 0;
+ sm750_dev->init_parm.set_all_eng_off = 0;
sm750_dev->init_parm.reset_memory = 1;
/* defaultly turn g_hwcursor on for both view */
@@ -1059,7 +1059,7 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)
sm750fb_framebuffer_release(sm750_dev);
arch_phys_wc_del(sm750_dev->mtrr.vram);
- iounmap(sm750_dev->pvReg);
+ iounmap(sm750_dev->pv_reg);
iounmap(sm750_dev->vmem);
pci_release_region(pdev, 1);
kfree(g_settings);
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d2c522e67f26..e8885133da2e 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -44,7 +44,7 @@ struct init_status {
ushort chip_clk;
ushort mem_clk;
ushort master_clk;
- ushort setAllEngOff;
+ ushort set_all_eng_off;
ushort reset_memory;
};
@@ -97,7 +97,7 @@ struct sm750_dev {
unsigned long vidreg_start;
__u32 vidmem_size;
__u32 vidreg_size;
- void __iomem *pvReg;
+ void __iomem *pv_reg;
unsigned char __iomem *vmem;
/* locks*/
spinlock_t slock;
--
2.53.0
^ permalink raw reply related
* [PATCH] staging: sm750fb: Mark g_noaccel, g_nomtrr and g_dualview as __ro_after_init
From: Len Bao @ 2026-05-16 14:23 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: Len Bao, linux-fbdev, linux-staging, linux-kernel
The 'g_noaccel', 'g_nomtrr' and 'g_dualview' variables are initialized
only during the init phase in the 'lynxfb_setup' function and never
changed. So, mark them as __ro_after_init.
Signed-off-by: Len Bao <len.bao@gmx.us>
---
drivers/staging/sm750fb/sm750.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 9f3e3d37e..99f5269f1 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -31,12 +31,12 @@
/* common var for all device */
static int g_hwcursor = 1;
-static int g_noaccel;
-static int g_nomtrr;
+static int g_noaccel __ro_after_init;
+static int g_nomtrr __ro_after_init;
static const char *g_fbmode[] = {NULL, NULL};
static const char *g_def_fbmode = "1024x768-32@60";
static char *g_settings;
-static int g_dualview;
+static int g_dualview __ro_after_init;
static char *g_option;
static const struct fb_videomode lynx750_ext[] = {
--
2.43.0
^ permalink raw reply related
* Re: [PATCH] staging: sm750: rename CamelCase variable in sm750.c
From: kernel test robot @ 2026-05-15 23:48 UTC (permalink / raw)
To: Rupesh Majhi, gregkh
Cc: oe-kbuild-all, sudipm.mukherjee, teddy.wang, linux-fbdev,
linux-staging, linux-kernel, Rupesh Majhi
In-Reply-To: <20260515103811.2808620-1-zoone.rupert@gmail.com>
Hi Rupesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Rupesh-Majhi/staging-sm750-rename-CamelCase-variable-in-sm750-c/20260515-213450
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260515103811.2808620-1-zoone.rupert%40gmail.com
patch subject: [PATCH] staging: sm750: rename CamelCase variable in sm750.c
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20260516/202605160741.A9M01x77-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260516/202605160741.A9M01x77-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605160741.A9M01x77-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/staging/sm750fb/sm750.c: In function 'lynxfb_set_fbinfo':
>> drivers/staging/sm750fb/sm750.c:758:40: error: 'struct sm750_dev' has no member named 'pv_reg'; did you mean 'pvReg'?
758 | crtc->cursor.mmio = sm750_dev->pv_reg +
| ^~~~~~
| pvReg
drivers/staging/sm750fb/sm750.c: In function 'sm750fb_setup':
>> drivers/staging/sm750fb/sm750.c:863:30: error: 'struct init_status' has no member named 'set_all_eng_off'; did you mean 'setAllEngOff'?
863 | sm750_dev->init_parm.set_all_eng_off = 0;
| ^~~~~~~~~~~~~~~
| setAllEngOff
drivers/staging/sm750fb/sm750.c: In function 'lynxfb_pci_remove':
drivers/staging/sm750fb/sm750.c:1062:28: error: 'struct sm750_dev' has no member named 'pv_reg'; did you mean 'pvReg'?
1062 | iounmap(sm750_dev->pv_reg);
| ^~~~~~
| pvReg
vim +758 drivers/staging/sm750fb/sm750.c
719
720 static int lynxfb_set_fbinfo(struct fb_info *info, int index)
721 {
722 int i;
723 struct lynxfb_par *par;
724 struct sm750_dev *sm750_dev;
725 struct lynxfb_crtc *crtc;
726 struct lynxfb_output *output;
727 struct fb_var_screeninfo *var;
728 struct fb_fix_screeninfo *fix;
729
730 const struct fb_videomode *pdb[] = {
731 lynx750_ext, NULL, vesa_modes,
732 };
733 int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
734 static const char * const fix_id[2] = {
735 "sm750_fb1", "sm750_fb2",
736 };
737
738 int ret, line_length;
739
740 ret = 0;
741 par = (struct lynxfb_par *)info->par;
742 sm750_dev = par->dev;
743 crtc = &par->crtc;
744 output = &par->output;
745 var = &info->var;
746 fix = &info->fix;
747
748 /* set index */
749 par->index = index;
750 output->channel = &crtc->channel;
751 sm750fb_set_drv(par);
752
753 /*
754 * set current cursor variable and proc pointer,
755 * must be set after crtc member initialized
756 */
757 crtc->cursor.offset = crtc->o_screen + crtc->vidmem_size - 1024;
> 758 crtc->cursor.mmio = sm750_dev->pv_reg +
759 0x800f0 + (int)crtc->channel * 0x140;
760
761 crtc->cursor.max_h = 64;
762 crtc->cursor.max_w = 64;
763 crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
764 crtc->cursor.vstart = sm750_dev->vmem + crtc->cursor.offset;
765
766 memset_io(crtc->cursor.vstart, 0, crtc->cursor.size);
767 if (!g_hwcursor)
768 sm750_hw_cursor_disable(&crtc->cursor);
769
770 /* set info->fbops, must be set before fb_find_mode */
771 if (!sm750_dev->accel_off) {
772 /* use 2d acceleration */
773 if (!g_hwcursor)
774 info->fbops = &lynxfb_ops_accel;
775 else
776 info->fbops = &lynxfb_ops_accel_with_cursor;
777 } else {
778 if (!g_hwcursor)
779 info->fbops = &lynxfb_ops;
780 else
781 info->fbops = &lynxfb_ops_with_cursor;
782 }
783
784 if (!g_fbmode[index]) {
785 g_fbmode[index] = g_def_fbmode;
786 if (index)
787 g_fbmode[index] = g_fbmode[0];
788 }
789
790 for (i = 0; i < 3; i++) {
791 ret = fb_find_mode(var, info, g_fbmode[index],
792 pdb[i], cdb[i], NULL, 8);
793
794 if (ret == 1 || ret == 2)
795 break;
796 }
797
798 /* set par */
799 par->info = info;
800
801 /* set info */
802 line_length = ALIGN((var->xres_virtual * var->bits_per_pixel / 8),
803 crtc->line_pad);
804
805 info->pseudo_palette = &par->pseudo_palette[0];
806 info->screen_base = crtc->v_screen;
807 info->screen_size = line_length * var->yres_virtual;
808
809 /* set info->fix */
810 fix->type = FB_TYPE_PACKED_PIXELS;
811 fix->type_aux = 0;
812 fix->xpanstep = crtc->xpanstep;
813 fix->ypanstep = crtc->ypanstep;
814 fix->ywrapstep = crtc->ywrapstep;
815 fix->accel = FB_ACCEL_SMI;
816
817 strscpy(fix->id, fix_id[index], sizeof(fix->id));
818
819 fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
820 /*
821 * according to mmap experiment from user space application,
822 * fix->mmio_len should not larger than virtual size
823 * (xres_virtual x yres_virtual x ByPP)
824 * Below line maybe buggy when user mmap fb dev node and write
825 * data into the bound over virtual size
826 */
827 fix->smem_len = crtc->vidmem_size;
828 info->screen_size = fix->smem_len;
829 fix->line_length = line_length;
830 fix->mmio_start = sm750_dev->vidreg_start;
831 fix->mmio_len = sm750_dev->vidreg_size;
832
833 lynxfb_set_visual_mode(info);
834
835 /* set var */
836 var->activate = FB_ACTIVATE_NOW;
837 var->accel_flags = 0;
838 var->vmode = FB_VMODE_NONINTERLACED;
839
840 ret = fb_alloc_cmap(&info->cmap, 256, 0);
841 if (ret < 0) {
842 dev_err(info->device, "Could not allocate memory for cmap.\n");
843 goto exit;
844 }
845
846 exit:
847 lynxfb_ops_check_var(var, info);
848 return ret;
849 }
850
851 /* chip specific g_option configuration routine */
852 static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
853 {
854 char *opt;
855 int swap;
856
857 swap = 0;
858
859 sm750_dev->init_parm.chip_clk = 0;
860 sm750_dev->init_parm.mem_clk = 0;
861 sm750_dev->init_parm.master_clk = 0;
862 sm750_dev->init_parm.power_mode = 0;
> 863 sm750_dev->init_parm.set_all_eng_off = 0;
864 sm750_dev->init_parm.reset_memory = 1;
865
866 /* defaultly turn g_hwcursor on for both view */
867 g_hwcursor = 3;
868
869 if (!src || !*src) {
870 dev_warn(&sm750_dev->pdev->dev, "no specific g_option.\n");
871 goto NO_PARAM;
872 }
873
874 while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
875 dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
876 dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
877
878 if (!strncmp(opt, "swap", strlen("swap"))) {
879 swap = 1;
880 } else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
881 sm750_dev->nocrt = 1;
882 } else if (!strncmp(opt, "36bit", strlen("36bit"))) {
883 sm750_dev->pnltype = SM750_DOUBLE_TFT;
884 } else if (!strncmp(opt, "18bit", strlen("18bit"))) {
885 sm750_dev->pnltype = SM750_DUAL_TFT;
886 } else if (!strncmp(opt, "24bit", strlen("24bit"))) {
887 sm750_dev->pnltype = SM750_24TFT;
888 } else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
889 g_hwcursor &= ~0x1;
890 } else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
891 g_hwcursor &= ~0x2;
892 } else if (!strncmp(opt, "nohwc", strlen("nohwc"))) {
893 g_hwcursor = 0;
894 } else {
895 if (!g_fbmode[0]) {
896 g_fbmode[0] = opt;
897 dev_info(&sm750_dev->pdev->dev,
898 "find fbmode0 : %s\n", g_fbmode[0]);
899 } else if (!g_fbmode[1]) {
900 g_fbmode[1] = opt;
901 dev_info(&sm750_dev->pdev->dev,
902 "find fbmode1 : %s\n", g_fbmode[1]);
903 } else {
904 dev_warn(&sm750_dev->pdev->dev, "How many view you wann set?\n");
905 }
906 }
907 }
908
909 NO_PARAM:
910 if (sm750_dev->revid != SM750LE_REVISION_ID) {
911 if (sm750_dev->fb_count > 1) {
912 if (swap)
913 sm750_dev->dataflow = sm750_dual_swap;
914 else
915 sm750_dev->dataflow = sm750_dual_normal;
916 } else {
917 if (swap)
918 sm750_dev->dataflow = sm750_simul_sec;
919 else
920 sm750_dev->dataflow = sm750_simul_pri;
921 }
922 } else {
923 /* SM750LE only have one crt channel */
924 sm750_dev->dataflow = sm750_simul_sec;
925 /* sm750le do not have complex attributes */
926 sm750_dev->nocrt = 0;
927 }
928 }
929
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH] staging: sm750: rename CamelCase variable in sm750.c
From: kernel test robot @ 2026-05-15 22:35 UTC (permalink / raw)
To: Rupesh Majhi, gregkh
Cc: llvm, oe-kbuild-all, sudipm.mukherjee, teddy.wang, linux-fbdev,
linux-staging, linux-kernel, Rupesh Majhi
In-Reply-To: <20260515103811.2808620-1-zoone.rupert@gmail.com>
Hi Rupesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Rupesh-Majhi/staging-sm750-rename-CamelCase-variable-in-sm750-c/20260515-213450
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260515103811.2808620-1-zoone.rupert%40gmail.com
patch subject: [PATCH] staging: sm750: rename CamelCase variable in sm750.c
config: powerpc64-randconfig-002-20260516 (https://download.01.org/0day-ci/archive/20260516/202605160624.pd29nXG5-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260516/202605160624.pd29nXG5-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605160624.pd29nXG5-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/staging/sm750fb/sm750.c:758:33: error: no member named 'pv_reg' in 'struct sm750_dev'
758 | crtc->cursor.mmio = sm750_dev->pv_reg +
| ~~~~~~~~~ ^
>> drivers/staging/sm750fb/sm750.c:863:23: error: no member named 'set_all_eng_off' in 'struct init_status'
863 | sm750_dev->init_parm.set_all_eng_off = 0;
| ~~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/sm750fb/sm750.c:1062:21: error: no member named 'pv_reg' in 'struct sm750_dev'
1062 | iounmap(sm750_dev->pv_reg);
| ~~~~~~~~~ ^
3 errors generated.
vim +758 drivers/staging/sm750fb/sm750.c
719
720 static int lynxfb_set_fbinfo(struct fb_info *info, int index)
721 {
722 int i;
723 struct lynxfb_par *par;
724 struct sm750_dev *sm750_dev;
725 struct lynxfb_crtc *crtc;
726 struct lynxfb_output *output;
727 struct fb_var_screeninfo *var;
728 struct fb_fix_screeninfo *fix;
729
730 const struct fb_videomode *pdb[] = {
731 lynx750_ext, NULL, vesa_modes,
732 };
733 int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
734 static const char * const fix_id[2] = {
735 "sm750_fb1", "sm750_fb2",
736 };
737
738 int ret, line_length;
739
740 ret = 0;
741 par = (struct lynxfb_par *)info->par;
742 sm750_dev = par->dev;
743 crtc = &par->crtc;
744 output = &par->output;
745 var = &info->var;
746 fix = &info->fix;
747
748 /* set index */
749 par->index = index;
750 output->channel = &crtc->channel;
751 sm750fb_set_drv(par);
752
753 /*
754 * set current cursor variable and proc pointer,
755 * must be set after crtc member initialized
756 */
757 crtc->cursor.offset = crtc->o_screen + crtc->vidmem_size - 1024;
> 758 crtc->cursor.mmio = sm750_dev->pv_reg +
759 0x800f0 + (int)crtc->channel * 0x140;
760
761 crtc->cursor.max_h = 64;
762 crtc->cursor.max_w = 64;
763 crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
764 crtc->cursor.vstart = sm750_dev->vmem + crtc->cursor.offset;
765
766 memset_io(crtc->cursor.vstart, 0, crtc->cursor.size);
767 if (!g_hwcursor)
768 sm750_hw_cursor_disable(&crtc->cursor);
769
770 /* set info->fbops, must be set before fb_find_mode */
771 if (!sm750_dev->accel_off) {
772 /* use 2d acceleration */
773 if (!g_hwcursor)
774 info->fbops = &lynxfb_ops_accel;
775 else
776 info->fbops = &lynxfb_ops_accel_with_cursor;
777 } else {
778 if (!g_hwcursor)
779 info->fbops = &lynxfb_ops;
780 else
781 info->fbops = &lynxfb_ops_with_cursor;
782 }
783
784 if (!g_fbmode[index]) {
785 g_fbmode[index] = g_def_fbmode;
786 if (index)
787 g_fbmode[index] = g_fbmode[0];
788 }
789
790 for (i = 0; i < 3; i++) {
791 ret = fb_find_mode(var, info, g_fbmode[index],
792 pdb[i], cdb[i], NULL, 8);
793
794 if (ret == 1 || ret == 2)
795 break;
796 }
797
798 /* set par */
799 par->info = info;
800
801 /* set info */
802 line_length = ALIGN((var->xres_virtual * var->bits_per_pixel / 8),
803 crtc->line_pad);
804
805 info->pseudo_palette = &par->pseudo_palette[0];
806 info->screen_base = crtc->v_screen;
807 info->screen_size = line_length * var->yres_virtual;
808
809 /* set info->fix */
810 fix->type = FB_TYPE_PACKED_PIXELS;
811 fix->type_aux = 0;
812 fix->xpanstep = crtc->xpanstep;
813 fix->ypanstep = crtc->ypanstep;
814 fix->ywrapstep = crtc->ywrapstep;
815 fix->accel = FB_ACCEL_SMI;
816
817 strscpy(fix->id, fix_id[index], sizeof(fix->id));
818
819 fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
820 /*
821 * according to mmap experiment from user space application,
822 * fix->mmio_len should not larger than virtual size
823 * (xres_virtual x yres_virtual x ByPP)
824 * Below line maybe buggy when user mmap fb dev node and write
825 * data into the bound over virtual size
826 */
827 fix->smem_len = crtc->vidmem_size;
828 info->screen_size = fix->smem_len;
829 fix->line_length = line_length;
830 fix->mmio_start = sm750_dev->vidreg_start;
831 fix->mmio_len = sm750_dev->vidreg_size;
832
833 lynxfb_set_visual_mode(info);
834
835 /* set var */
836 var->activate = FB_ACTIVATE_NOW;
837 var->accel_flags = 0;
838 var->vmode = FB_VMODE_NONINTERLACED;
839
840 ret = fb_alloc_cmap(&info->cmap, 256, 0);
841 if (ret < 0) {
842 dev_err(info->device, "Could not allocate memory for cmap.\n");
843 goto exit;
844 }
845
846 exit:
847 lynxfb_ops_check_var(var, info);
848 return ret;
849 }
850
851 /* chip specific g_option configuration routine */
852 static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
853 {
854 char *opt;
855 int swap;
856
857 swap = 0;
858
859 sm750_dev->init_parm.chip_clk = 0;
860 sm750_dev->init_parm.mem_clk = 0;
861 sm750_dev->init_parm.master_clk = 0;
862 sm750_dev->init_parm.power_mode = 0;
> 863 sm750_dev->init_parm.set_all_eng_off = 0;
864 sm750_dev->init_parm.reset_memory = 1;
865
866 /* defaultly turn g_hwcursor on for both view */
867 g_hwcursor = 3;
868
869 if (!src || !*src) {
870 dev_warn(&sm750_dev->pdev->dev, "no specific g_option.\n");
871 goto NO_PARAM;
872 }
873
874 while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
875 dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
876 dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
877
878 if (!strncmp(opt, "swap", strlen("swap"))) {
879 swap = 1;
880 } else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
881 sm750_dev->nocrt = 1;
882 } else if (!strncmp(opt, "36bit", strlen("36bit"))) {
883 sm750_dev->pnltype = SM750_DOUBLE_TFT;
884 } else if (!strncmp(opt, "18bit", strlen("18bit"))) {
885 sm750_dev->pnltype = SM750_DUAL_TFT;
886 } else if (!strncmp(opt, "24bit", strlen("24bit"))) {
887 sm750_dev->pnltype = SM750_24TFT;
888 } else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
889 g_hwcursor &= ~0x1;
890 } else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
891 g_hwcursor &= ~0x2;
892 } else if (!strncmp(opt, "nohwc", strlen("nohwc"))) {
893 g_hwcursor = 0;
894 } else {
895 if (!g_fbmode[0]) {
896 g_fbmode[0] = opt;
897 dev_info(&sm750_dev->pdev->dev,
898 "find fbmode0 : %s\n", g_fbmode[0]);
899 } else if (!g_fbmode[1]) {
900 g_fbmode[1] = opt;
901 dev_info(&sm750_dev->pdev->dev,
902 "find fbmode1 : %s\n", g_fbmode[1]);
903 } else {
904 dev_warn(&sm750_dev->pdev->dev, "How many view you wann set?\n");
905 }
906 }
907 }
908
909 NO_PARAM:
910 if (sm750_dev->revid != SM750LE_REVISION_ID) {
911 if (sm750_dev->fb_count > 1) {
912 if (swap)
913 sm750_dev->dataflow = sm750_dual_swap;
914 else
915 sm750_dev->dataflow = sm750_dual_normal;
916 } else {
917 if (swap)
918 sm750_dev->dataflow = sm750_simul_sec;
919 else
920 sm750_dev->dataflow = sm750_simul_pri;
921 }
922 } else {
923 /* SM750LE only have one crt channel */
924 sm750_dev->dataflow = sm750_simul_sec;
925 /* sm750le do not have complex attributes */
926 sm750_dev->nocrt = 0;
927 }
928 }
929
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH] staging: sm750: rename CamelCase variable in sm750.c
From: Ahmet Sezgin Duran @ 2026-05-15 17:19 UTC (permalink / raw)
To: Rupert Zoone, Greg KH
Cc: M.samet Duman, sudipm.mukherjee, teddy.wang, linux-fbdev,
linux-staging, linux-kernel
In-Reply-To: <CABpb+S7EcSUnmnCn_aRURnVON39Jyrxe3oktnPphyOFzpaTU0g@mail.gmail.com>
On 5/15/26 7:37 PM, Rupert Zoone wrote:
> Hi Ahmet,
> Yes, I compiled the patch successfully without errors and warnings.
> rupesh@yantra:~/patches/staging$ grep -n "pv_reg\|set_all_eng_off"
> drivers/staging/sm750fb/sm750.c | head -10
> 758: crtc->cursor.mmio = sm750_dev->pv_reg +
> 863: sm750_dev->init_parm.set_all_eng_off = 0;
> 1062: iounmap(sm750_dev->pv_reg);
>
I asked if you compiled it, you wrote the grep results of variable names.
You might have forgotten to enable the sm750fb module. Make sure that
you enable it, then please, actually compile the changes, using `make`
or whatever actual command you use in order to compile.
Spoiler alert: No, it does not compile.
Regards,
Ahmet Sezgin Duran
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox