* [PATCH 4/4] arm64: dts: freescale: moduline-display-av123z7m-n17: add backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
Add the missing backlight.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
...p-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
index 3eb665ce9d5d2a1c742ffb4feca046e406e29956..9124cd87cce54a5aa7b7ad674f70f814d1dc3515 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
+++ b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
@@ -16,6 +16,7 @@
panel {
compatible = "boe,av123z7m-n17";
+ backlight = <&backlight>;
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&pinctrl_panel>;
pinctrl-names = "default";
@@ -91,10 +92,26 @@ lvds1_out: endpoint {
};
};
- /* max25014 @ 0x6f */
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 1>;
+ };
};
&iomuxc {
+ pinctrl_backlight: backlightgrp {
+ fsl,pins = <
+ MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04
+ (MX8MP_PULL_UP | MX8MP_PULL_ENABLE)
+ >;
+ };
+
pinctrl_lvds_bridge: lvdsbridgegrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_TXD2__GPIO4_IO14
--
2.50.1
^ permalink raw reply related
* [PATCH 3/4] arm64: dts: freescale: moduline-display-av101hdt-a10: add backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
Add the missing backlight driver.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
...tx8p-ml81-moduline-display-106-av101hdt-a10.dtso | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
index e3965caca6be42a17aa89b77bd5b919382c84151..143243ba95cd7a69c7b043fa0fb32c37b67e1064 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
+++ b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
@@ -17,6 +17,7 @@
panel {
compatible = "boe,av101hdt-a10";
+ backlight = <&backlight>;
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&pinctrl_panel>;
pinctrl-names = "default";
@@ -40,7 +41,27 @@ reg_vbus: regulator-vbus {
};
};
+&i2c4 {
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 0>;
+ };
+};
+
&iomuxc {
+ pinctrl_backlight: backlightgrp {
+ fsl,pins = <
+ MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04
+ (MX8MP_PULL_UP | MX8MP_PULL_ENABLE)
+ >;
+ };
+
pinctrl_panel: panelgrp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO07__GPIO1_IO07
--
2.50.1
^ permalink raw reply related
* [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
with intgrated boost controller.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
.../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
MAINTAINERS | 5 ++
2 files changed, 83 insertions(+)
diff --git a/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml b/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..63baf1cbcbb14ed93d7e45ba013080872060ce71
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/maxim,max25014.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim max25014 backlight controller
+
+maintainers:
+ - Maud Spierings <maudspierings@gocontroll.com>
+
+allOf:
+ - $ref: common.yaml#
+
+properties:
+ compatible:
+ enum:
+ - maxim,max25014
+
+ reg:
+ maxItems: 1
+
+ enable-gpios:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ power-supply:
+ description: Regulator which controls the boost converter input rail.
+
+ pwms:
+ maxItems: 1
+
+ maxim,iset:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 11
+ description:
+ Value of the ISET register field (0-15). Default is 11.
+
+ maxim,strings:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ A 4-bit bitfield that describes which led strings to turn on.
+ minItems: 4
+ maxItems: 4
+
+required:
+ - compatible
+ - reg
+ - maxim,strings
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ bl-name = "max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 1>;
+ };
+ };
+
diff --git a/MAINTAINERS b/MAINTAINERS
index 5e18349a5556e4d793b63a6b3c600000b21b0418..9e9a45442b7bf60b00eaf3f8ebadf8f4fbaf3bef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14907,6 +14907,11 @@ F: Documentation/userspace-api/media/drivers/max2175.rst
F: drivers/media/i2c/max2175*
F: include/uapi/linux/max2175.h
+MAX25014 BACKLIGHT DRIVER
+M: Maud Spierings <maudspierings@gocontroll.com>
+S: Maintained
+F: Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
+
MAX31335 RTC DRIVER
M: Antoniu Miclaus <antoniu.miclaus@analog.com>
L: linux-rtc@vger.kernel.org
--
2.50.1
^ permalink raw reply related
* [PATCH 2/4] backlight: add max25014atg backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings,
"Maud Spierings maudspierings"
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
with intgrated boost controller.
Signed-off-by: Maud Spierings maudspierings@gocontroll.com
---
MAINTAINERS | 2 +
drivers/video/backlight/Kconfig | 7 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/max25014.c | 449 +++++++++++++++++++++++++++++++++
include/linux/platform_data/max25014.h | 24 ++
5 files changed, 483 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9e9a45442b7bf60b00eaf3f8ebadf8f4fbaf3bef..3cae3402f531921a93208626ba9477018e7ef347 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14911,6 +14911,8 @@ MAX25014 BACKLIGHT DRIVER
M: Maud Spierings <maudspierings@gocontroll.com>
S: Maintained
F: Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
+F: drivers/video/backlight/max25014.c
+F: include/linux/platform_data/max25014.h
MAX31335 RTC DRIVER
M: Antoniu Miclaus <antoniu.miclaus@analog.com>
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d9374d208ceebbf8b3c27976e9cb4d725939b942..d3bb6ccd41853d940f24c6ab8135e4b9b9ebefd7 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -262,6 +262,13 @@ config BACKLIGHT_DA9052
help
Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs.
+config BACKLIGHT_MAX25014
+ tristate "Backlight driver for the Maxim MAX25014 chip"
+ depends on I2C
+ select REGMAP_I2C
+ help
+ If you are using a MAX25014 chip as a backlight driver say Y to enable it.
+
config BACKLIGHT_MAX8925
tristate "Backlight driver for MAX8925"
depends on MFD_MAX8925
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index dfbb169bf6ea215704859f633b6c4a887f4ebacd..1170d9ec40b8dbd52aeec1dade1cd2d2b56af466 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o
+obj-$(CONFIG_BACKLIGHT_MAX25014) += max25014.o
obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o
obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o
obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o
diff --git a/drivers/video/backlight/max25014.c b/drivers/video/backlight/max25014.c
new file mode 100644
index 0000000000000000000000000000000000000000..371b6017953ae5955f4dfef921980dfdedd65d85
--- /dev/null
+++ b/drivers/video/backlight/max25014.c
@@ -0,0 +1,449 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Backlight driver for Maxim MAX25014
+ *
+ * Copyright (C) 2025 GOcontroll B.V.
+ * Author: Maud Spierings <maudspierings@gocontroll.com>
+ */
+
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/platform_data/max25014.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define MAX25014_ISET_DEFAULT_100 11U
+#define MAX_BRIGHTNESS (100U)
+#define MIN_BRIGHTNESS (0U)
+#define TON_MAX (130720U) /* @153Hz */
+#define TON_STEP (1307U) /* @153Hz */
+#define TON_MIN (0U)
+
+#define MAX25014_DEV_ID (0x00U)
+#define MAX25014_REV_ID (0x01U)
+#define MAX25014_ISET (0x02U)
+#define MAX25014_IMODE (0x03U)
+#define MAX25014_TON1H (0x04U)
+#define MAX25014_TON1L (0x05U)
+#define MAX25014_TON2H (0x06U)
+#define MAX25014_TON2L (0x07U)
+#define MAX25014_TON3H (0x08U)
+#define MAX25014_TON3L (0x09U)
+#define MAX25014_TON4H (0x0AU)
+#define MAX25014_TON4L (0x0BU)
+#define MAX25014_TON_1_4_LSB (0x0CU)
+#define MAX25014_SETTING (0x12U)
+#define MAX25014_DISABLE (0x13U)
+#define MAX25014_BSTMON (0x14U)
+#define MAX25014_IOUT1 (0x15U)
+#define MAX25014_IOUT2 (0x16U)
+#define MAX25014_IOUT3 (0x17U)
+#define MAX25014_IOUT4 (0x18U)
+#define MAX25014_OPEN (0x1BU)
+#define MAX25014_SHORT_GND (0x1CU)
+#define MAX25014_SHORT_LED (0x1DU)
+#define MAX25014_MASK (0x1EU)
+#define MAX25014_DIAG (0x1FU)
+
+#define MAX25014_IMODE_HDIM BIT(2)
+#define MAX25014_ISET_ENABLE BIT(5)
+#define MAX25014_ISET_PSEN BIT(4)
+#define MAX25014_DIAG_HW_RST BIT(2)
+#define MAX25014_SETTING_FPWM GENMASK(6, 4)
+
+struct max25014;
+
+struct max25014 {
+ const char *chipname;
+ struct i2c_client *client;
+ struct backlight_device *bl;
+ struct device *dev;
+ struct regmap *regmap;
+ struct max25014_platform_data *pdata;
+ struct gpio_desc *enable;
+ struct regulator *vin; /* regulator for boost converter Vin rail */
+};
+
+static const struct regmap_config max25014_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = MAX25014_DIAG,
+};
+
+/**
+ * @brief get the bit mask for the DISABLE register.
+ *
+ * @param strings the led string configuration array.
+ * @return uint8_t bits to set in the register.
+ */
+static uint8_t strings_mask(struct max25014 *maxim)
+{
+ uint8_t res, i;
+
+ for (i = 0; i < 4; i++) {
+ if (maxim->pdata->strings[i] == 0)
+ res |= 1 << i;
+ }
+ return res;
+}
+
+/**
+ * @brief control the brightness with i2c registers
+ *
+ * @param regmap trivial
+ * @param brt brightness
+ * @return int
+ */
+static int max25014_register_control(struct regmap *regmap, uint32_t brt)
+{
+ uint32_t reg = TON_STEP * brt;
+ int ret;
+ /*
+ * 18 bit number lowest, 2 bits in first register,
+ * next lowest 8 in the L register, next 8 in the H register
+ * Seemingly setting the strength of only one string controls all of
+ * them, individual settings don't affect the outcome.
+ */
+
+ ret = regmap_write(regmap, MAX25014_TON_1_4_LSB, reg & 0b00000011);
+ if (ret != 0)
+ return ret;
+ ret = regmap_write(regmap, MAX25014_TON1L, (reg >> 2) & 0b11111111);
+ if (ret != 0)
+ return ret;
+ return regmap_write(regmap, MAX25014_TON1H, (reg >> 10) & 0b11111111);
+}
+
+static int max25014_check_errors(struct max25014 *maxim)
+{
+ uint8_t i;
+ int ret;
+ uint32_t val;
+
+ ret = regmap_read(maxim->regmap, MAX25014_OPEN, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Open led strings detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_SHORT_GND, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Short to ground detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_SHORT_GND, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Shorted led detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_DIAG, &val);
+ if (ret != 0)
+ return ret;
+ /*
+ * The HW_RST bit always starts at 1 after power up.
+ * It is reset on first read, does not indicate an error.
+ */
+ if (val > 0 && val != MAX25014_DIAG_HW_RST) {
+ if (val & 0b1)
+ dev_err(maxim->dev, "Overtemperature shutdown\n");
+ if (val & 0b10)
+ dev_warn(maxim->dev,
+ "Chip is getting too hot (>125C)\n");
+ if (val & 0b1000)
+ dev_err(maxim->dev, "Boost converter overvoltage\n");
+ if (val & 0b10000)
+ dev_err(maxim->dev, "Boost converter undervoltage\n");
+ if (val & 0b100000)
+ dev_err(maxim->dev, "IREF out of range\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+/*
+ * 1. disable unused strings
+ * 2. set dim mode
+ * 3. set initial brightness
+ * 4. set setting register
+ * 5. enable the backlight
+ */
+static int max25014_configure(struct max25014 *maxim)
+{
+ int ret;
+ uint32_t val;
+
+ ret = regmap_write(maxim->regmap, MAX25014_DISABLE,
+ strings_mask(maxim));
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(maxim->regmap, MAX25014_IMODE, MAX25014_IMODE_HDIM);
+ if (ret != 0)
+ return ret;
+
+ max25014_register_control(maxim->regmap,
+ maxim->pdata->initial_brightness);
+
+ ret = regmap_read(maxim->regmap, MAX25014_SETTING, &val);
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(
+ maxim->regmap, MAX25014_SETTING,
+ val & ~MAX25014_SETTING_FPWM);
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(maxim->regmap, MAX25014_ISET,
+ maxim->pdata->iset | MAX25014_ISET_ENABLE | MAX25014_ISET_PSEN);
+ return ret;
+}
+
+static int max25014_update_status(struct backlight_device *bl_dev)
+{
+ struct max25014 *maxim = bl_get_data(bl_dev);
+
+ if (bl_dev->props.state & BL_CORE_SUSPENDED)
+ bl_dev->props.brightness = 0;
+
+ return max25014_register_control(maxim->regmap, bl_dev->props.brightness);
+}
+
+static const struct backlight_ops max25014_bl_ops = {
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = max25014_update_status,
+};
+
+static int max25014_backlight_register(struct max25014 *maxim)
+{
+ struct backlight_device *bl;
+ struct backlight_properties props;
+ struct max25014_platform_data *pdata = maxim->pdata;
+
+ memset(&props, 0, sizeof(props));
+ props.type = BACKLIGHT_PLATFORM;
+ props.max_brightness = MAX_BRIGHTNESS;
+
+ if (pdata->initial_brightness > props.max_brightness)
+ pdata->initial_brightness = props.max_brightness;
+
+ props.brightness = pdata->initial_brightness;
+
+ bl = devm_backlight_device_register(maxim->dev, maxim->chipname, maxim->dev,
+ maxim, &max25014_bl_ops, &props);
+ if (IS_ERR(bl))
+ return PTR_ERR(bl);
+
+ maxim->bl = bl;
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static int max25014_parse_dt(struct max25014 *maxim)
+{
+ struct device *dev = maxim->dev;
+ struct device_node *node = dev->of_node;
+ struct max25014_platform_data *pdata;
+
+ int res;
+
+ if (!node) {
+ dev_err(dev, "no platform data\n");
+ return -EINVAL;
+ }
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+
+ res = of_property_count_u32_elems(node, "maxim,strings");
+ if (res == 4) {
+ of_property_read_u32_array(node, "maxim,strings", pdata->strings, 4);
+ } else {
+ dev_err(dev, "strings property not correctly defined\n");
+ return -EINVAL;
+ }
+
+ pdata->initial_brightness = 50U;
+ of_property_read_u32(node, "default-brightness", &pdata->initial_brightness);
+ pdata->iset = MAX25014_ISET_DEFAULT_100;
+ of_property_read_u32(node, "maxim,iset", &pdata->iset);
+
+ if (pdata->iset < 0 || pdata->iset > 15) {
+ dev_err(dev,
+ "Invalid iset, should be a value from 0-15, entered was %d\n",
+ pdata->iset);
+ return -EINVAL;
+ }
+
+ if (pdata->initial_brightness < 0 || pdata->initial_brightness > 100) {
+ dev_err(dev,
+ "Invalid initial brightness, should be a value from 0-100, entered was %d\n",
+ pdata->initial_brightness);
+ return -EINVAL;
+ }
+
+ maxim->pdata = pdata;
+
+ return 0;
+}
+#else
+static int max25014_parse_dt(struct max25014 *maxim)
+{
+ dev_err(maxim->dev,
+ "CONFIG_OF not configured, unable to parse devicetree");
+ return -EINVAL;
+}
+#endif
+
+static int max25014_probe(struct i2c_client *cl)
+{
+ const struct i2c_device_id *id = i2c_client_get_device_id(cl);
+ struct max25014 *maxim;
+ int ret;
+
+ maxim = devm_kzalloc(&cl->dev, sizeof(struct max25014), GFP_KERNEL);
+ if (!maxim)
+ return -ENOMEM;
+
+ maxim->client = cl;
+ maxim->dev = &cl->dev;
+ maxim->chipname = id->name;
+ maxim->pdata = dev_get_platdata(&cl->dev);
+
+ if (!maxim->pdata) {
+ ret = max25014_parse_dt(maxim);
+ if (ret < 0)
+ return ret;
+ }
+
+ maxim->vin = devm_regulator_get(maxim->dev, "power");
+ if (IS_ERR(maxim->vin)) {
+ if (PTR_ERR(maxim->vin) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ maxim->vin = NULL;
+ }
+
+ if (maxim->vin) {
+ ret = regulator_enable(maxim->vin);
+ if (ret < 0) {
+ dev_err(maxim->dev, "failed to enable Vin: %d\n", ret);
+ return ret;
+ }
+ }
+
+ maxim->enable =
+ devm_gpiod_get_optional(maxim->dev, "enable", GPIOD_ASIS);
+ if (IS_ERR(maxim->enable)) {
+ ret = PTR_ERR(maxim->enable);
+ dev_err(maxim->dev, "failed to get enable gpio: %d\n", ret);
+ goto disable_vin;
+ }
+
+ if (maxim->enable) {
+ gpiod_set_value_cansleep(maxim->enable, 1);
+
+ /* Datasheet Electrical Characteristics tSTARTUP 2ms */
+ usleep_range(2000, 2500);
+ }
+
+ maxim->regmap = devm_regmap_init_i2c(cl, &max25014_regmap_config);
+ if (IS_ERR(maxim->regmap)) {
+ ret = PTR_ERR(maxim->regmap);
+ dev_err(maxim->dev, "failed to initialize the i2c regmap: %d\n", ret);
+ goto disable_full;
+ }
+
+ i2c_set_clientdata(cl, maxim);
+
+ ret = max25014_check_errors(maxim);
+ if (ret) { /* error is already reported in the above function */
+ goto disable_full;
+ }
+
+ ret = max25014_configure(maxim);
+ if (ret) {
+ dev_err(maxim->dev, "device config err: %d", ret);
+ goto disable_full;
+ }
+
+ ret = max25014_backlight_register(maxim);
+ if (ret) {
+ dev_err(maxim->dev, "failed to register backlight. err: %d\n",
+ ret);
+ goto disable_full;
+ }
+
+ dev_dbg(maxim->dev, "max25014 probed.\n");
+
+ return 0;
+
+disable_full:
+ if (maxim->enable)
+ gpiod_set_value_cansleep(maxim->enable, 0);
+disable_vin:
+ if (maxim->vin)
+ regulator_disable(maxim->vin);
+ return ret;
+}
+
+static void max25014_remove(struct i2c_client *cl)
+{
+ struct max25014 *maxim = i2c_get_clientdata(cl);
+
+ maxim->bl->props.brightness = 0;
+ max25014_update_status(maxim->bl);
+ if (maxim->enable)
+ gpiod_set_value_cansleep(maxim->enable, 0);
+ if (maxim->vin)
+ regulator_disable(maxim->vin);
+}
+
+static const struct of_device_id max25014_dt_ids[] = {
+ { .compatible = "maxim,max25014", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, max25014_dt_ids);
+
+static const struct i2c_device_id max25014_ids[] = {
+ { "max25014" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, max25014_ids);
+
+static struct i2c_driver max25014_driver = {
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .of_match_table = of_match_ptr(max25014_dt_ids),
+ },
+ .probe = max25014_probe,
+ .remove = max25014_remove,
+ .id_table = max25014_ids,
+};
+module_i2c_driver(max25014_driver);
+
+MODULE_DESCRIPTION("Maxim MAX25014 backlight driver");
+MODULE_AUTHOR("Maud Spierings <maudspierings@gocontroll.com>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/platform_data/max25014.h b/include/linux/platform_data/max25014.h
new file mode 100644
index 0000000000000000000000000000000000000000..048f11015e9551e619ddec9167e3f10394f44bb9
--- /dev/null
+++ b/include/linux/platform_data/max25014.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Backlight driver for Maxim MAX25014
+ *
+ * Copyright (C) 2025 GOcontroll B.V.
+ * Author: Maud Spierings <maudspierings@gocontroll.com>
+ */
+
+#ifndef _MAX25014_H
+#define _MAX25014_H
+
+/**
+ * struct max25014_platform_data
+ * @initial_brightness : Initial value of the backlight brightness.
+ * @iset : Value of the iset field which scales the amperage/limits it.
+ * @strings : Which, out of four, led strings are in use.
+ */
+struct max25014_platform_data {
+ uint32_t initial_brightness;
+ uint32_t iset;
+ uint32_t strings[4];
+};
+
+#endif
--
2.50.1
^ permalink raw reply related
* [PATCH 0/4] backlight: add new max25014 backlight driver
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings,
"Maud Spierings maudspierings"
The Maxim MAX25014 is an automotive grade backlight driver IC. Its
datasheet can be found at [1].
With its integrated boost controller, it can power 4 channels (led
strings) and has a number of different modes using pwm and or i2c.
Currently implemented is only i2c control.
link: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX25014.pdf [1]
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
Maud Spierings (4):
dt-bindings: backlight: Add max25014 bindings
backlight: add max25014atg backlight
arm64: dts: freescale: moduline-display-av101hdt-a10: add backlight
arm64: dts: freescale: moduline-display-av123z7m-n17: add backlight
.../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++
MAINTAINERS | 7 +
...x8p-ml81-moduline-display-106-av101hdt-a10.dtso | 21 +
...x8p-ml81-moduline-display-106-av123z7m-n17.dtso | 19 +-
drivers/video/backlight/Kconfig | 7 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/max25014.c | 449 +++++++++++++++++++++
include/linux/platform_data/max25014.h | 24 ++
8 files changed, 605 insertions(+), 1 deletion(-)
---
base-commit: d7af19298454ed155f5cf67201a70f5cf836c842
change-id: 20250626-max25014-4207591e1af5
Best regards,
--
Maud Spierings <maudspierings@gocontroll.com>
^ permalink raw reply
* [PATCH] fbdev: Fix typo in Kconfig text for FB_DEVICE
From: Daniel Palmer via B4 Relay @ 2025-07-25 5:30 UTC (permalink / raw)
To: Simona Vetter, Helge Deller
Cc: linux-fbdev, dri-devel, linux-kernel, Daniel Palmer
From: Daniel Palmer <daniel.palmer@sony.com>
Seems like someone hit 'c' when they meant to hit 'd'.
Signed-off-by: Daniel Palmer <daniel.palmer@sony.com>
---
drivers/video/fbdev/core/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/core/Kconfig b/drivers/video/fbdev/core/Kconfig
index 4abe12db7594..413cbfac569d 100644
--- a/drivers/video/fbdev/core/Kconfig
+++ b/drivers/video/fbdev/core/Kconfig
@@ -31,7 +31,7 @@ config FB_DEVICE
default FB
help
Say Y here if you want the legacy /dev/fb* device file and
- interfaces within sysfs anc procfs. It is only required if you
+ interfaces within sysfs and procfs. It is only required if you
have userspace programs that depend on fbdev for graphics output.
This does not affect the framebuffer console. If unsure, say N.
---
base-commit: e04c78d86a9699d136910cfc0bdcf01087e3267e
change-id: 20250725-fbdev-typo-90045c2b1dce
Best regards,
--
Daniel Palmer <daniel.palmer@sony.com>
^ permalink raw reply related
* Re: [PATCH] fbdev: atmel_lcdfb: Fix potential NULL dereference
From: Alexandre Belloni @ 2025-07-24 7:29 UTC (permalink / raw)
To: Salah Triki
Cc: Nicolas Ferre, Helge Deller, Claudiu Beznea, linux-fbdev,
dri-devel, linux-arm-kernel, linux-kernel
In-Reply-To: <aIGg7erPjz1qJQ1F@pc>
On 24/07/2025 03:56:45+0100, Salah Triki wrote:
> of_match_device() returns NULL in case of failure, so check its return
> value before casting and accessing to data field in order to prevent NULL
> dereference.
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> drivers/video/fbdev/atmel_lcdfb.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
> index 9dfbc5310210..b1017ac9c73b 100644
> --- a/drivers/video/fbdev/atmel_lcdfb.c
> +++ b/drivers/video/fbdev/atmel_lcdfb.c
> @@ -922,6 +922,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> struct device *dev = &sinfo->pdev->dev;
> struct device_node *np =dev->of_node;
> struct device_node *display_np;
> + const struct of_device_id *match;
> struct atmel_lcdfb_power_ctrl_gpio *og;
> bool is_gpio_power = false;
> struct fb_videomode fb_vm;
> @@ -930,8 +931,11 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> int ret;
> int i;
>
> - sinfo->config = (struct atmel_lcdfb_config*)
> - of_match_device(atmel_lcdfb_dt_ids, dev)->data;
> + match = of_match_device(atmel_lcdfb_dt_ids, dev);
> + if (!match)
> + return -ENODEV;
This is dead code, it will never happen because atmel_lcdfb_of_init is only
called from atmel_lcdfb_probe which will only be called when there is a match.
> +
> + sinfo->config = (struct atmel_lcdfb_config *)match->data;
>
> display_np = of_parse_phandle(np, "display", 0);
> if (!display_np) {
> --
> 2.43.0
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply
* [PATCH] fbdev: Check fb_add_videomode to prevent null-ptr-deref
From: Chenyuan Yang @ 2025-07-24 3:25 UTC (permalink / raw)
To: s.hauer, deller
Cc: kernel, shawnguo, festevam, msp, plagnioj, linux-fbdev,
linux-arm-kernel, dri-devel, imx, linux-kernel, Chenyuan Yang
fb_add_videomode() can fail with -ENOMEM when its internal kmalloc()
cannot allocate a struct fb_modelist.
If that happens, the modelist stays empty but the driver continues to
register.
Add a check for its return value to prevent poteintial null-ptr-deref,
which is similar to the commit 17186f1f90d3
("fbdev: Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var").
Fixes: 1b6c79361ba5 ("video: imxfb: Add DT support")
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
---
drivers/video/fbdev/imxfb.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index f30da32cdaed..a077bf346bdf 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -996,8 +996,13 @@ static int imxfb_probe(struct platform_device *pdev)
info->fix.smem_start = fbi->map_dma;
INIT_LIST_HEAD(&info->modelist);
- for (i = 0; i < fbi->num_modes; i++)
- fb_add_videomode(&fbi->mode[i].mode, &info->modelist);
+ for (i = 0; i < fbi->num_modes; i++) {
+ ret = fb_add_videomode(&fbi->mode[i].mode, &info->modelist);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to add videomode\n");
+ goto failed_cmap;
+ }
+ }
/*
* This makes sure that our colour bitfield
--
2.34.1
^ permalink raw reply related
* [PATCH] fbdev: atmel_lcdfb: Fix potential NULL dereference
From: Salah Triki @ 2025-07-24 2:56 UTC (permalink / raw)
To: Nicolas Ferre, Helge Deller, Alexandre Belloni, Claudiu Beznea,
linux-fbdev, dri-devel, linux-arm-kernel, linux-kernel
Cc: salah.triki
of_match_device() returns NULL in case of failure, so check its return
value before casting and accessing to data field in order to prevent NULL
dereference.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/video/fbdev/atmel_lcdfb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index 9dfbc5310210..b1017ac9c73b 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -922,6 +922,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
struct device *dev = &sinfo->pdev->dev;
struct device_node *np =dev->of_node;
struct device_node *display_np;
+ const struct of_device_id *match;
struct atmel_lcdfb_power_ctrl_gpio *og;
bool is_gpio_power = false;
struct fb_videomode fb_vm;
@@ -930,8 +931,11 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
int ret;
int i;
- sinfo->config = (struct atmel_lcdfb_config*)
- of_match_device(atmel_lcdfb_dt_ids, dev)->data;
+ match = of_match_device(atmel_lcdfb_dt_ids, dev);
+ if (!match)
+ return -ENODEV;
+
+ sinfo->config = (struct atmel_lcdfb_config *)match->data;
display_np = of_parse_phandle(np, "display", 0);
if (!display_np) {
--
2.43.0
^ permalink raw reply related
* [bug report] staging: sm750fb: Fix polarity assignment for vertical and horizontal mode
From: Alok Tiwari @ 2025-07-23 19:24 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging
Cc: alok.a.tiwari, linux-kernel
In drivers/staging/sm750fb/sm750_hw.c,
the vertical and horizontal sync polarity assignments were incorrectly
ordered.
The assignment for modparm.vertical_sync_polarity was mistakenly using
the FB_SYNC_HOR_HIGH_ACT bit instead of FB_SYNC_VERT_HIGH_ACT,
and the horizontal polarity line was commented out or missing.
This patch corrects the logic by properly assigning:
vertical_sync_polarity -> from FB_SYNC_VERT_HIGH_ACT
horizontal_sync_polarity -> from FB_SYNC_HOR_HIGH_ACT
Please let me know your feedback.
Thanks,
Alok
---
Fixes: 81dee67e215b ("staging: sm750fb: add sm750 to staging")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
drivers/staging/sm750fb/sm750_hw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 7119b67efe11b..5a32756f98c31 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -280,9 +280,9 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
/* set timing */
modparm.pixel_clock = ps_to_hz(var->pixclock);
modparm.vertical_sync_polarity =
- (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS : NEG;
- modparm.horizontal_sync_polarity =
(var->sync & FB_SYNC_VERT_HIGH_ACT) ? POS : NEG;
+ modparm.horizontal_sync_polarity =
+ (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS : NEG;
modparm.clock_phase_polarity =
(var->sync & FB_SYNC_COMP_HIGH_ACT) ? POS : NEG;
modparm.horizontal_display_end = var->xres;
--
2.46.0
^ permalink raw reply related
* Re: [PATCH v2 01/15] platform/x86: dell-uart-backlight: Use blacklight power constant
From: Ilpo Järvinen @ 2025-07-22 13:03 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
Hans de Goede, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev, Hans de Goede
In-Reply-To: <90d816ba-aaf3-4b7b-9c52-72613be5b85a@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]
On Mon, 21 Jul 2025, Thomas Zimmermann wrote:
> Hi
>
> Am 21.07.25 um 13:43 schrieb Ilpo Järvinen:
> > On Tue, 15 Jul 2025, Thomas Zimmermann wrote:
> >
> > > The backlight subsystem has gotten its own power constants. Replace
> > > FB_BLANK_UNBLANK with BACKLIGHT_POWER_ON.
> > >
> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > > Reviewed-by: Hans de Goede <hansg@kernel.org>
> > > Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > ---
> > > drivers/platform/x86/dell/dell-uart-backlight.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c
> > > b/drivers/platform/x86/dell/dell-uart-backlight.c
> > > index 8f868f845350..f323a667dc2d 100644
> > > --- a/drivers/platform/x86/dell/dell-uart-backlight.c
> > > +++ b/drivers/platform/x86/dell/dell-uart-backlight.c
> > > @@ -305,7 +305,7 @@ static int dell_uart_bl_serdev_probe(struct
> > > serdev_device *serdev)
> > > dev_dbg(dev, "Firmware version: %.*s\n", resp[RESP_LEN] - 3, resp +
> > > RESP_DATA);
> > > /* Initialize bl_power to a known value */
> > > - ret = dell_uart_set_bl_power(dell_bl, FB_BLANK_UNBLANK);
> > > + ret = dell_uart_set_bl_power(dell_bl, BACKLIGHT_POWER_ON);
> > > if (ret)
> > > return ret;
> > Hi Thomas,
> >
> > Do you expect this entire series to go in this cycle through some other
> > tree than pdx86? If not, I'll take this through pdx86 tree in this cycle.
>
> I don't know when the series will get merged, but it might still take a bit.
> Please take this patch through your tree. Good to have it off the list.
Thanks.
Applied it to the review-ilpo-next branch.
--
i.
^ permalink raw reply
* Re: [PATCH v2 01/15] platform/x86: dell-uart-backlight: Use blacklight power constant
From: Thomas Zimmermann @ 2025-07-21 19:42 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
Hans de Goede, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev, Hans de Goede
In-Reply-To: <c380d3a4-2a99-cf52-0952-ee916b6c9676@linux.intel.com>
Hi
Am 21.07.25 um 13:43 schrieb Ilpo Järvinen:
> On Tue, 15 Jul 2025, Thomas Zimmermann wrote:
>
>> The backlight subsystem has gotten its own power constants. Replace
>> FB_BLANK_UNBLANK with BACKLIGHT_POWER_ON.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Reviewed-by: Hans de Goede <hansg@kernel.org>
>> Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>> ---
>> drivers/platform/x86/dell/dell-uart-backlight.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/platform/x86/dell/dell-uart-backlight.c
>> index 8f868f845350..f323a667dc2d 100644
>> --- a/drivers/platform/x86/dell/dell-uart-backlight.c
>> +++ b/drivers/platform/x86/dell/dell-uart-backlight.c
>> @@ -305,7 +305,7 @@ static int dell_uart_bl_serdev_probe(struct serdev_device *serdev)
>> dev_dbg(dev, "Firmware version: %.*s\n", resp[RESP_LEN] - 3, resp + RESP_DATA);
>>
>> /* Initialize bl_power to a known value */
>> - ret = dell_uart_set_bl_power(dell_bl, FB_BLANK_UNBLANK);
>> + ret = dell_uart_set_bl_power(dell_bl, BACKLIGHT_POWER_ON);
>> if (ret)
>> return ret;
> Hi Thomas,
>
> Do you expect this entire series to go in this cycle through some other
> tree than pdx86? If not, I'll take this through pdx86 tree in this cycle.
I don't know when the series will get merged, but it might still take a
bit. Please take this patch through your tree. Good to have it off the list.
Best regards
Thomas
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply
* [PATCH] fbdev: svgalib: Clean up coding style
From: Darshan R. @ 2025-07-21 12:56 UTC (permalink / raw)
To: simona, deller; +Cc: linux-fbdev, dri-devel, linux-kernel, dishank, Darshan R.
This patch addresses various coding style issues in `svgalib.c` to improve readability and better align the code with the Linux kernel's formatting standards.
The changes primarily consist of:
- Adjusting whitespace around operators and after keywords.
- Standardizing brace placement for control flow statements.
- Removing unnecessary braces on single-statement if/else blocks.
- Deleting extraneous blank lines throughout the file.
These changes are purely stylistic and introduce no functional modifications.
Signed-off-by: Darshan R. <rathod.darshan.0896@gmail.com>
---
drivers/video/fbdev/core/svgalib.c | 95 +++++++++++++-----------------
1 file changed, 42 insertions(+), 53 deletions(-)
diff --git a/drivers/video/fbdev/core/svgalib.c b/drivers/video/fbdev/core/svgalib.c
index 821b89a0a645..5234ad109dfd 100644
--- a/drivers/video/fbdev/core/svgalib.c
+++ b/drivers/video/fbdev/core/svgalib.c
@@ -19,7 +19,6 @@
#include <asm/types.h>
#include <asm/io.h>
-
/* Write a CRT register value spread across multiple registers */
void svga_wcrt_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value)
{
@@ -31,12 +30,13 @@ void svga_wcrt_multi(void __iomem *regbase, const struct vga_regset *regset, u32
while (bitnum <= regset->highbit) {
bitval = 1 << bitnum;
regval = regval & ~bitval;
- if (value & 1) regval = regval | bitval;
- bitnum ++;
+ if (value & 1)
+ regval = regval | bitval;
+ bitnum++;
value = value >> 1;
}
vga_wcrt(regbase, regset->regnum, regval);
- regset ++;
+ regset++;
}
}
@@ -51,12 +51,13 @@ void svga_wseq_multi(void __iomem *regbase, const struct vga_regset *regset, u32
while (bitnum <= regset->highbit) {
bitval = 1 << bitnum;
regval = regval & ~bitval;
- if (value & 1) regval = regval | bitval;
- bitnum ++;
+ if (value & 1)
+ regval = regval | bitval;
+ bitnum++;
value = value >> 1;
}
vga_wseq(regbase, regset->regnum, regval);
- regset ++;
+ regset++;
}
}
@@ -66,15 +67,13 @@ static unsigned int svga_regset_size(const struct vga_regset *regset)
while (regset->regnum != VGA_REGSET_END_VAL) {
count += regset->highbit - regset->lowbit + 1;
- regset ++;
+ regset++;
}
return 1 << count;
}
-
/* ------------------------------------------------------------------------- */
-
/* Set graphics controller registers to sane values */
void svga_set_default_gfx_regs(void __iomem *regbase)
{
@@ -102,7 +101,7 @@ void svga_set_default_atc_regs(void __iomem *regbase)
vga_w(regbase, VGA_ATT_W, 0x00);
/* All standard ATC registers (AR00 - AR14) */
- for (count = 0; count <= 0xF; count ++)
+ for (count = 0; count <= 0xF; count++)
svga_wattr(regbase, count, count);
svga_wattr(regbase, VGA_ATC_MODE, 0x01);
@@ -187,10 +186,8 @@ void svga_dump_var(struct fb_var_screeninfo *var, int node)
}
#endif /* 0 */
-
/* ------------------------------------------------------------------------- */
-
void svga_settile(struct fb_info *info, struct fb_tilemap *map)
{
const u8 *font = map->data;
@@ -229,7 +226,7 @@ void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area)
((area->sy == area->dy) && (area->sx > area->dx))) {
src = fb + area->sx * colstride + area->sy * rowstride;
dst = fb + area->dx * colstride + area->dy * rowstride;
- } else {
+ } else {
src = fb + (area->sx + area->width - 1) * colstride
+ (area->sy + area->height - 1) * rowstride;
dst = fb + (area->dx + area->width - 1) * colstride
@@ -237,7 +234,7 @@ void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area)
colstride = -colstride;
rowstride = -rowstride;
- }
+ }
for (dy = 0; dy < area->height; dy++) {
u16 __iomem *src2 = src;
@@ -284,19 +281,19 @@ void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit)
u8 __iomem *fb = (u8 __iomem *)info->screen_base;
fb += blit->sx * colstride + blit->sy * rowstride;
- i=0;
- for (dy=0; dy < blit->height; dy ++) {
+ i = 0;
+ for (dy = 0; dy < blit->height; dy++) {
u8 __iomem *fb2 = fb;
- for (dx = 0; dx < blit->width; dx ++) {
+ for (dx = 0; dx < blit->width; dx++) {
fb_writeb(blit->indices[i], fb2);
fb_writeb(attr, fb2 + 1);
fb2 += colstride;
- i ++;
- if (i == blit->length) return;
+ i++;
+ if (i == blit->length)
+ return;
}
fb += rowstride;
}
-
}
/* Set cursor in text (tileblit) mode */
@@ -308,15 +305,15 @@ void svga_tilecursor(void __iomem *regbase, struct fb_info *info, struct fb_tile
+ (cursor->sy + (info->var.yoffset / 16))
* (info->var.xres_virtual / 8);
- if (! cursor -> mode)
+ if (!cursor->mode)
return;
svga_wcrt_mask(regbase, 0x0A, 0x20, 0x20); /* disable cursor */
- if (cursor -> shape == FB_TILE_CURSOR_NONE)
+ if (cursor->shape == FB_TILE_CURSOR_NONE)
return;
- switch (cursor -> shape) {
+ switch (cursor->shape) {
case FB_TILE_CURSOR_UNDERLINE:
cs = 0x0d;
break;
@@ -374,7 +371,6 @@ EXPORT_SYMBOL(svga_get_caps);
/* ------------------------------------------------------------------------- */
-
/*
* Compute PLL settings (M, N, R)
* F_VCO = (F_BASE * M) / N
@@ -385,7 +381,7 @@ int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u
u16 am, an, ar;
u32 f_vco, f_current, delta_current, delta_best;
- pr_debug("fb%d: ideal frequency: %d kHz\n", node, (unsigned int) f_wanted);
+ pr_debug("fb%d: ideal frequency: %d kHz\n", node, (unsigned int)f_wanted);
ar = pll->r_max;
f_vco = f_wanted << ar;
@@ -416,7 +412,7 @@ int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u
while ((am <= pll->m_max) && (an <= pll->n_max)) {
f_current = (pll->f_base * am) / an;
- delta_current = abs_diff (f_current, f_vco);
+ delta_current = abs_diff(f_current, f_vco);
if (delta_current < delta_best) {
delta_best = delta_current;
@@ -424,58 +420,55 @@ int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u
*n = an;
}
- if (f_current <= f_vco) {
- am ++;
- } else {
- an ++;
- }
+ if (f_current <= f_vco)
+ am++;
+ else
+ an++;
}
f_current = (pll->f_base * *m) / *n;
- pr_debug("fb%d: found frequency: %d kHz (VCO %d kHz)\n", node, (int) (f_current >> ar), (int) f_current);
- pr_debug("fb%d: m = %d n = %d r = %d\n", node, (unsigned int) *m, (unsigned int) *n, (unsigned int) *r);
+ pr_debug("fb%d: found frequency: %d kHz (VCO %d kHz)\n", node, (int)(f_current >> ar), (int)f_current);
+ pr_debug("fb%d: m = %d n = %d r = %d\n", node, (unsigned int)*m, (unsigned int)*n, (unsigned int)*r);
return 0;
}
-
/* ------------------------------------------------------------------------- */
-
/* Check CRT timing values */
int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node)
{
u32 value;
- var->xres = (var->xres+7)&~7;
- var->left_margin = (var->left_margin+7)&~7;
- var->right_margin = (var->right_margin+7)&~7;
- var->hsync_len = (var->hsync_len+7)&~7;
+ var->xres = (var->xres + 7) & ~7;
+ var->left_margin = (var->left_margin + 7) & ~7;
+ var->right_margin = (var->right_margin + 7) & ~7;
+ var->hsync_len = (var->hsync_len + 7) & ~7;
/* Check horizontal total */
value = var->xres + var->left_margin + var->right_margin + var->hsync_len;
- if (((value / 8) - 5) >= svga_regset_size (tm->h_total_regs))
+ if (((value / 8) - 5) >= svga_regset_size(tm->h_total_regs))
return -EINVAL;
/* Check horizontal display and blank start */
value = var->xres;
- if (((value / 8) - 1) >= svga_regset_size (tm->h_display_regs))
+ if (((value / 8) - 1) >= svga_regset_size(tm->h_display_regs))
return -EINVAL;
- if (((value / 8) - 1) >= svga_regset_size (tm->h_blank_start_regs))
+ if (((value / 8) - 1) >= svga_regset_size(tm->h_blank_start_regs))
return -EINVAL;
/* Check horizontal sync start */
value = var->xres + var->right_margin;
- if (((value / 8) - 1) >= svga_regset_size (tm->h_sync_start_regs))
+ if (((value / 8) - 1) >= svga_regset_size(tm->h_sync_start_regs))
return -EINVAL;
/* Check horizontal blank end (or length) */
value = var->left_margin + var->right_margin + var->hsync_len;
- if ((value == 0) || ((value / 8) >= svga_regset_size (tm->h_blank_end_regs)))
+ if ((value == 0) || ((value / 8) >= svga_regset_size(tm->h_blank_end_regs)))
return -EINVAL;
/* Check horizontal sync end (or length) */
value = var->hsync_len;
- if ((value == 0) || ((value / 8) >= svga_regset_size (tm->h_sync_end_regs)))
+ if ((value == 0) || ((value / 8) >= svga_regset_size(tm->h_sync_end_regs)))
return -EINVAL;
/* Check vertical total */
@@ -497,12 +490,12 @@ int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screenin
/* Check vertical blank end (or length) */
value = var->upper_margin + var->lower_margin + var->vsync_len;
- if ((value == 0) || (value >= svga_regset_size (tm->v_blank_end_regs)))
+ if ((value == 0) || (value >= svga_regset_size(tm->v_blank_end_regs)))
return -EINVAL;
/* Check vertical sync end (or length) */
value = var->vsync_len;
- if ((value == 0) || (value >= svga_regset_size (tm->v_sync_end_regs)))
+ if ((value == 0) || (value >= svga_regset_size(tm->v_sync_end_regs)))
return -EINVAL;
return 0;
@@ -596,18 +589,15 @@ void svga_set_timings(void __iomem *regbase, const struct svga_timing_regs *tm,
vga_w(regbase, VGA_MIS_W, regval);
}
-
/* ------------------------------------------------------------------------- */
-
static inline int match_format(const struct svga_fb_format *frm,
struct fb_var_screeninfo *var)
{
int i = 0;
int stored = -EINVAL;
- while (frm->bits_per_pixel != SVGA_FORMAT_END_VAL)
- {
+ while (frm->bits_per_pixel != SVGA_FORMAT_END_VAL) {
if ((var->bits_per_pixel == frm->bits_per_pixel) &&
(var->red.length <= frm->red.length) &&
(var->green.length <= frm->green.length) &&
@@ -647,7 +637,6 @@ int svga_match_format(const struct svga_fb_format *frm,
return i;
}
-
EXPORT_SYMBOL(svga_wcrt_multi);
EXPORT_SYMBOL(svga_wseq_multi);
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v2 01/15] platform/x86: dell-uart-backlight: Use blacklight power constant
From: Ilpo Järvinen @ 2025-07-21 11:43 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
Hans de Goede, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev, Hans de Goede
In-Reply-To: <20250715122643.137027-2-tzimmermann@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]
On Tue, 15 Jul 2025, Thomas Zimmermann wrote:
> The backlight subsystem has gotten its own power constants. Replace
> FB_BLANK_UNBLANK with BACKLIGHT_POWER_ON.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Hans de Goede <hansg@kernel.org>
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/platform/x86/dell/dell-uart-backlight.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/platform/x86/dell/dell-uart-backlight.c
> index 8f868f845350..f323a667dc2d 100644
> --- a/drivers/platform/x86/dell/dell-uart-backlight.c
> +++ b/drivers/platform/x86/dell/dell-uart-backlight.c
> @@ -305,7 +305,7 @@ static int dell_uart_bl_serdev_probe(struct serdev_device *serdev)
> dev_dbg(dev, "Firmware version: %.*s\n", resp[RESP_LEN] - 3, resp + RESP_DATA);
>
> /* Initialize bl_power to a known value */
> - ret = dell_uart_set_bl_power(dell_bl, FB_BLANK_UNBLANK);
> + ret = dell_uart_set_bl_power(dell_bl, BACKLIGHT_POWER_ON);
> if (ret)
> return ret;
Hi Thomas,
Do you expect this entire series to go in this cycle through some other
tree than pdx86? If not, I'll take this through pdx86 tree in this cycle.
--
i.
^ permalink raw reply
* Re: [PATCH v2 15/15] backlight: Do not include <linux/fb.h> in header file
From: Thomas Zimmermann @ 2025-07-16 6:44 UTC (permalink / raw)
To: Simona Vetter
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <aHZWGnJ9D72YFgNh@phenom.ffwll.local>
Hi
Am 15.07.25 um 15:22 schrieb Simona Vetter:
> On Tue, Jul 15, 2025 at 02:24:52PM +0200, Thomas Zimmermann wrote:
>> The backlight interfaces don't require anything from <linux/fb.h>, so
>> don't include it.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> I like this very much.
>
> Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
Thanks for reviewing. backlight.h is also the last major header file the
includes <linux/fb.h>. Not including it here will free many other files
from the dependency.
>
> I guess also my Acked-by for merging the entire pile through the backlight
> subsystem, that's probably the easiest path to land this all.
Yeah, that was the plan.
Best regards
Thomas
>
> Cheers, Sima
>
>> ---
>> include/linux/backlight.h | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
>> index 10e626db7eee..f29a9ef1052e 100644
>> --- a/include/linux/backlight.h
>> +++ b/include/linux/backlight.h
>> @@ -10,7 +10,6 @@
>> #define _LINUX_BACKLIGHT_H
>>
>> #include <linux/device.h>
>> -#include <linux/fb.h>
>> #include <linux/mutex.h>
>> #include <linux/types.h>
>>
>> --
>> 2.50.0
>>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply
* Re: [PATCH v2 13/15] backlight: rave-sp: Include <linux/of.h> and <linux/mod_devicetable.h>
From: Thomas Zimmermann @ 2025-07-16 6:39 UTC (permalink / raw)
To: Rob Herring
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <CAL_JsqKSjQy8CVohbVL50kn=o_kPVUsAUFjYvNC3mpcA7pm_Og@mail.gmail.com>
Hi
Am 15.07.25 um 15:34 schrieb Rob Herring:
> On Tue, Jul 15, 2025 at 7:30 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Include <linux/of.h> to declare struct device_node and include
>> <linux/mod_devicetable.h> to declare struct of_device_id. Avoids
>> dependency on backlight header to include it.
> struct device_node should be opaque...
>
> /*
> * If there is a phandle pointing to the device node we can
> * assume that another device will manage the status changes.
> * If not we make sure the backlight is in a consistent state.
> */
> if (!dev->of_node->phandle)
> backlight_update_status(bd);
>
> Well, that is ugly. IMO, we should just drop the check. A DT built
> with "-@" option will have phandle set, so that's not a reliable test.
Not that I disagree, but fixing it is out of scope for this series.
Best regards
Thomas
>
> Rob
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply
* Re: [PATCH v2 02/15] drm/panel: panel-samsung-s6e63m0: Include <linux/of.h>
From: Thomas Zimmermann @ 2025-07-16 6:37 UTC (permalink / raw)
To: Sebastian Reichel
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <67hurwpxz4c2ropgbq3q6umybr2fgucgtbdu4qc6y3qk3uypc4@3xkijgin5ydl>
Hi
Am 16.07.25 um 01:43 schrieb Sebastian Reichel:
> Hi,
>
> On Tue, Jul 15, 2025 at 02:24:39PM +0200, Thomas Zimmermann wrote:
>> Include <linux/of.h> to declare device_property_read_u32(). Avoids
>> dependency on backlight header to include it.
> device_property_*() is from <linux/property.h>, which is already
> included in the following line...
Oh, that has been fixed already by commit d1a1807bae39 ("drm/panel:
panel-samsung-s6e63m0: Include <linux/property.h>") from last October.
Some of the patches in this series have been written a while ago. The
one here is from Feb 2024. I'll double check the others, there might be
similar cases. Thanks for reviewing.
Best regards
Thomas
>
> Greetings,
>
> -- Sebastian
>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>> drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
>> index ea241c89593b..930948cb615f 100644
>> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
>> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
>> @@ -16,6 +16,7 @@
>> #include <linux/export.h>
>> #include <linux/gpio/consumer.h>
>> #include <linux/module.h>
>> +#include <linux/of.h>
>> #include <linux/property.h>
>> #include <linux/regulator/consumer.h>
>> #include <linux/media-bus-format.h>
>> --
>> 2.50.0
>>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply
* Re: [PATCH v2 02/15] drm/panel: panel-samsung-s6e63m0: Include <linux/of.h>
From: Sebastian Reichel @ 2025-07-15 23:43 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-3-tzimmermann@suse.de>
Hi,
On Tue, Jul 15, 2025 at 02:24:39PM +0200, Thomas Zimmermann wrote:
> Include <linux/of.h> to declare device_property_read_u32(). Avoids
> dependency on backlight header to include it.
device_property_*() is from <linux/property.h>, which is already
included in the following line...
Greetings,
-- Sebastian
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index ea241c89593b..930948cb615f 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -16,6 +16,7 @@
> #include <linux/export.h>
> #include <linux/gpio/consumer.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/property.h>
> #include <linux/regulator/consumer.h>
> #include <linux/media-bus-format.h>
> --
> 2.50.0
>
^ permalink raw reply
* Re: [PATCH v2 13/15] backlight: rave-sp: Include <linux/of.h> and <linux/mod_devicetable.h>
From: Rob Herring @ 2025-07-15 13:34 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-14-tzimmermann@suse.de>
On Tue, Jul 15, 2025 at 7:30 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Include <linux/of.h> to declare struct device_node and include
> <linux/mod_devicetable.h> to declare struct of_device_id. Avoids
> dependency on backlight header to include it.
struct device_node should be opaque...
/*
* If there is a phandle pointing to the device node we can
* assume that another device will manage the status changes.
* If not we make sure the backlight is in a consistent state.
*/
if (!dev->of_node->phandle)
backlight_update_status(bd);
Well, that is ugly. IMO, we should just drop the check. A DT built
with "-@" option will have phandle set, so that's not a reliable test.
Rob
^ permalink raw reply
* Re: [PATCH v2 04/15] drm/panel: panel-summit: Include <linux/of.h>
From: Rob Herring @ 2025-07-15 13:28 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-5-tzimmermann@suse.de>
On Tue, Jul 15, 2025 at 7:30 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Include <linux/of.h> to declare device_property_read_u32() and
> struct of_device_id. Avoids dependency on backlight header to include
> it.
Neither of those come from of.h.
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Janne Grunau <j@jannau.net>
> ---
> drivers/gpu/drm/panel/panel-summit.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-summit.c b/drivers/gpu/drm/panel/panel-summit.c
> index 4854437e2899..02aa1ec287d6 100644
> --- a/drivers/gpu/drm/panel/panel-summit.c
> +++ b/drivers/gpu/drm/panel/panel-summit.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0-only
>
> #include <linux/backlight.h>
> +#include <linux/of.h>
> #include <drm/drm_device.h>
> #include <drm/drm_mipi_dsi.h>
> #include <drm/drm_mode.h>
> --
> 2.50.0
>
^ permalink raw reply
* Re: [PATCH v2 15/15] backlight: Do not include <linux/fb.h> in header file
From: Simona Vetter @ 2025-07-15 13:22 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-16-tzimmermann@suse.de>
On Tue, Jul 15, 2025 at 02:24:52PM +0200, Thomas Zimmermann wrote:
> The backlight interfaces don't require anything from <linux/fb.h>, so
> don't include it.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
I like this very much.
Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
I guess also my Acked-by for merging the entire pile through the backlight
subsystem, that's probably the easiest path to land this all.
Cheers, Sima
> ---
> include/linux/backlight.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index 10e626db7eee..f29a9ef1052e 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -10,7 +10,6 @@
> #define _LINUX_BACKLIGHT_H
>
> #include <linux/device.h>
> -#include <linux/fb.h>
> #include <linux/mutex.h>
> #include <linux/types.h>
>
> --
> 2.50.0
>
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply
* Re: [PATCH v2 05/15] fbcon: Add necessary include statements and forward declarations
From: Simona Vetter @ 2025-07-15 13:20 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-6-tzimmermann@suse.de>
On Tue, Jul 15, 2025 at 02:24:42PM +0200, Thomas Zimmermann wrote:
> Make the header self contained for including.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
> ---
> include/linux/fbcon.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> index 2382dec6d6ab..81f0e698acbf 100644
> --- a/include/linux/fbcon.h
> +++ b/include/linux/fbcon.h
> @@ -1,6 +1,13 @@
> #ifndef _LINUX_FBCON_H
> #define _LINUX_FBCON_H
>
> +#include <linux/compiler_types.h>
> +
> +struct fb_blit_caps;
> +struct fb_info;
> +struct fb_var_screeninfo;
> +struct fb_videomode;
> +
> #ifdef CONFIG_FRAMEBUFFER_CONSOLE
> void __init fb_console_init(void);
> void __exit fb_console_exit(void);
> --
> 2.50.0
>
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply
* Re: [PATCH v2 02/15] drm/panel: panel-samsung-s6e63m0: Include <linux/of.h>
From: Simona Vetter @ 2025-07-15 13:19 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic, dri-devel, asahi, platform-driver-x86,
linux-arm-kernel, linux-fbdev
In-Reply-To: <20250715122643.137027-3-tzimmermann@suse.de>
On Tue, Jul 15, 2025 at 02:24:39PM +0200, Thomas Zimmermann wrote:
> Include <linux/of.h> to declare device_property_read_u32(). Avoids
> dependency on backlight header to include it.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index ea241c89593b..930948cb615f 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -16,6 +16,7 @@
> #include <linux/export.h>
> #include <linux/gpio/consumer.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/property.h>
> #include <linux/regulator/consumer.h>
> #include <linux/media-bus-format.h>
> --
> 2.50.0
>
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply
* [PATCH v2 10/15] backlight: jornada720: Include <linux/io.h>
From: Thomas Zimmermann @ 2025-07-15 12:24 UTC (permalink / raw)
To: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic
Cc: dri-devel, asahi, platform-driver-x86, linux-arm-kernel,
linux-fbdev, Thomas Zimmermann
In-Reply-To: <20250715122643.137027-1-tzimmermann@suse.de>
Include <linux/io.h> to declare IOMEM(). Avoids dependency on
backlight header to include it.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/video/backlight/jornada720_bl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c
index e28d2c071798..bbb65fdaddc7 100644
--- a/drivers/video/backlight/jornada720_bl.c
+++ b/drivers/video/backlight/jornada720_bl.c
@@ -7,6 +7,7 @@
#include <linux/backlight.h>
#include <linux/device.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
--
2.50.0
^ permalink raw reply related
* [PATCH v2 11/15] backlight: ktd2801: Include <linux/mod_devicetable.h>
From: Thomas Zimmermann @ 2025-07-15 12:24 UTC (permalink / raw)
To: lee, danielt, jingoohan1, neil.armstrong, jessica.zhang, deller,
maarten.lankhorst, mripard, airlied, simona, fnkl.kernel, j,
hdegoede, ilpo.jarvinen, sven, alyssa, neal, support.opensource,
duje.mihanovic
Cc: dri-devel, asahi, platform-driver-x86, linux-arm-kernel,
linux-fbdev, Thomas Zimmermann, Nick Chan
In-Reply-To: <20250715122643.137027-1-tzimmermann@suse.de>
Include <linux/mod_devicetable.h> to declare struct of_device_id.
Avoids dependency on backlight header to include it.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Nick Chan <towinchenmi@gmail.com>
---
drivers/video/backlight/ktd2801-backlight.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/backlight/ktd2801-backlight.c b/drivers/video/backlight/ktd2801-backlight.c
index 0489b0615ceb..17eac1b3bce4 100644
--- a/drivers/video/backlight/ktd2801-backlight.c
+++ b/drivers/video/backlight/ktd2801-backlight.c
@@ -6,6 +6,7 @@
#include <linux/backlight.h>
#include <linux/gpio/consumer.h>
#include <linux/leds-expresswire.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/property.h>
--
2.50.0
^ permalink raw reply related
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