* [PATCH v2 3/9] mfd: pcF50633-gpio: Remove
From: linux @ 2025-03-11 1:49 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel, Dr. David Alan Gilbert
In-Reply-To: <20250311014959.743322-1-linux@treblig.org>
From: "Dr. David Alan Gilbert" <linux@treblig.org>
The pcf50633 was used as part of the OpenMoko devices but
the support for its main chip was recently removed in:
commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
arch/mips/configs/ip27_defconfig | 1 -
drivers/mfd/Kconfig | 7 ---
drivers/mfd/Makefile | 1 -
drivers/mfd/pcf50633-gpio.c | 92 -------------------------------
include/linux/mfd/pcf50633/gpio.h | 48 ----------------
5 files changed, 149 deletions(-)
delete mode 100644 drivers/mfd/pcf50633-gpio.c
delete mode 100644 include/linux/mfd/pcf50633/gpio.h
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 66085bb71bc4..0a9ec09aff65 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -256,7 +256,6 @@ CONFIG_I2C_STUB=m
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_MFD_PCF50633=m
-CONFIG_PCF50633_GPIO=m
# CONFIG_VGA_ARB is not set
CONFIG_LEDS_LP3944=m
CONFIG_LEDS_PCA955X=m
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 051272126fe1..766453ef6c2d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1129,13 +1129,6 @@ config MFD_PCF50633
facilities, and registers devices for the various functions
so that function-specific drivers can bind to them.
-config PCF50633_GPIO
- tristate "NXP PCF50633 GPIO"
- depends on MFD_PCF50633
- help
- Say yes here if you want to include support GPIO for pins on
- the PCF50633 chip.
-
config MFD_PM8XXX
tristate "Qualcomm PM8xxx PMIC chips driver"
depends on ARM || HEXAGON || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index e085da3f13c3..d769e40251c8 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -185,7 +185,6 @@ obj-$(CONFIG_MFD_MT6397) += mt6397.o
pcf50633-objs := pcf50633-core.o pcf50633-irq.o
obj-$(CONFIG_MFD_PCF50633) += pcf50633.o
-obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o
obj-$(CONFIG_RZ_MTU3) += rz-mtu3.o
obj-$(CONFIG_ABX500_CORE) += abx500-core.o
obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o
diff --git a/drivers/mfd/pcf50633-gpio.c b/drivers/mfd/pcf50633-gpio.c
deleted file mode 100644
index 3e368219479a..000000000000
--- a/drivers/mfd/pcf50633-gpio.c
+++ /dev/null
@@ -1,92 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* NXP PCF50633 GPIO Driver
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * Author: Balaji Rao <balajirrao@openmoko.org>
- * All rights reserved.
- *
- * Broken down from monstrous PCF50633 driver mainly by
- * Harald Welte, Andy Green and Werner Almesberger
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/gpio.h>
-#include <linux/mfd/pcf50633/pmic.h>
-
-static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = {
- [PCF50633_REGULATOR_AUTO] = PCF50633_REG_AUTOOUT,
- [PCF50633_REGULATOR_DOWN1] = PCF50633_REG_DOWN1OUT,
- [PCF50633_REGULATOR_DOWN2] = PCF50633_REG_DOWN2OUT,
- [PCF50633_REGULATOR_MEMLDO] = PCF50633_REG_MEMLDOOUT,
- [PCF50633_REGULATOR_LDO1] = PCF50633_REG_LDO1OUT,
- [PCF50633_REGULATOR_LDO2] = PCF50633_REG_LDO2OUT,
- [PCF50633_REGULATOR_LDO3] = PCF50633_REG_LDO3OUT,
- [PCF50633_REGULATOR_LDO4] = PCF50633_REG_LDO4OUT,
- [PCF50633_REGULATOR_LDO5] = PCF50633_REG_LDO5OUT,
- [PCF50633_REGULATOR_LDO6] = PCF50633_REG_LDO6OUT,
- [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOOUT,
-};
-
-int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val)
-{
- u8 reg;
-
- reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
-
- return pcf50633_reg_set_bit_mask(pcf, reg, 0x07, val);
-}
-EXPORT_SYMBOL_GPL(pcf50633_gpio_set);
-
-u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio)
-{
- u8 reg, val;
-
- reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
- val = pcf50633_reg_read(pcf, reg) & 0x07;
-
- return val;
-}
-EXPORT_SYMBOL_GPL(pcf50633_gpio_get);
-
-int pcf50633_gpio_invert_set(struct pcf50633 *pcf, int gpio, int invert)
-{
- u8 val, reg;
-
- reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
- val = !!invert << 3;
-
- return pcf50633_reg_set_bit_mask(pcf, reg, 1 << 3, val);
-}
-EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_set);
-
-int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio)
-{
- u8 reg, val;
-
- reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
- val = pcf50633_reg_read(pcf, reg);
-
- return val & (1 << 3);
-}
-EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_get);
-
-int pcf50633_gpio_power_supply_set(struct pcf50633 *pcf,
- int gpio, int regulator, int on)
-{
- u8 reg, val, mask;
-
- /* the *ENA register is always one after the *OUT register */
- reg = pcf50633_regulator_registers[regulator] + 1;
-
- val = !!on << (gpio - PCF50633_GPIO1);
- mask = 1 << (gpio - PCF50633_GPIO1);
-
- return pcf50633_reg_set_bit_mask(pcf, reg, mask, val);
-}
-EXPORT_SYMBOL_GPL(pcf50633_gpio_power_supply_set);
-
-MODULE_DESCRIPTION("NXP PCF50633 GPIO Driver");
-MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/pcf50633/gpio.h b/include/linux/mfd/pcf50633/gpio.h
deleted file mode 100644
index f589e35795f1..000000000000
--- a/include/linux/mfd/pcf50633/gpio.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * gpio.h -- GPIO driver for NXP PCF50633
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- */
-
-#ifndef __LINUX_MFD_PCF50633_GPIO_H
-#define __LINUX_MFD_PCF50633_GPIO_H
-
-#include <linux/mfd/pcf50633/core.h>
-
-#define PCF50633_GPIO1 1
-#define PCF50633_GPIO2 2
-#define PCF50633_GPIO3 3
-#define PCF50633_GPO 4
-
-#define PCF50633_REG_GPIO1CFG 0x14
-#define PCF50633_REG_GPIO2CFG 0x15
-#define PCF50633_REG_GPIO3CFG 0x16
-#define PCF50633_REG_GPOCFG 0x17
-
-#define PCF50633_GPOCFG_GPOSEL_MASK 0x07
-
-enum pcf50633_reg_gpocfg {
- PCF50633_GPOCFG_GPOSEL_0 = 0x00,
- PCF50633_GPOCFG_GPOSEL_LED_NFET = 0x01,
- PCF50633_GPOCFG_GPOSEL_SYSxOK = 0x02,
- PCF50633_GPOCFG_GPOSEL_CLK32K = 0x03,
- PCF50633_GPOCFG_GPOSEL_ADAPUSB = 0x04,
- PCF50633_GPOCFG_GPOSEL_USBxOK = 0x05,
- PCF50633_GPOCFG_GPOSEL_ACTPH4 = 0x06,
- PCF50633_GPOCFG_GPOSEL_1 = 0x07,
- PCF50633_GPOCFG_GPOSEL_INVERSE = 0x08,
-};
-
-int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val);
-u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio);
-
-int pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert);
-int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio);
-
-int pcf50633_gpio_power_supply_set(struct pcf50633 *,
- int gpio, int regulator, int on);
-#endif /* __LINUX_MFD_PCF50633_GPIO_H */
-
-
--
2.48.1
^ permalink raw reply related
* [PATCH v2 8/9] mfd: pcf50633: Remove irq code
From: linux @ 2025-03-11 1:49 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel, Dr. David Alan Gilbert
In-Reply-To: <20250311014959.743322-1-linux@treblig.org>
From: "Dr. David Alan Gilbert" <linux@treblig.org>
As part of the pcf50633 removal, take out it's irq code
(which includes one bit still called from the core, but it'll
go soon).
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/mfd/Makefile | 2 +-
drivers/mfd/pcf50633-core.c | 5 +-
drivers/mfd/pcf50633-irq.c | 312 ------------------------------------
3 files changed, 2 insertions(+), 317 deletions(-)
delete mode 100644 drivers/mfd/pcf50633-irq.c
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index d769e40251c8..f1c7a15c8f7b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -183,7 +183,7 @@ obj-$(CONFIG_MFD_MT6370) += mt6370.o
mt6397-objs := mt6397-core.o mt6397-irq.o mt6358-irq.o
obj-$(CONFIG_MFD_MT6397) += mt6397.o
-pcf50633-objs := pcf50633-core.o pcf50633-irq.o
+pcf50633-objs := pcf50633-core.o
obj-$(CONFIG_MFD_PCF50633) += pcf50633.o
obj-$(CONFIG_RZ_MTU3) += rz-mtu3.o
obj-$(CONFIG_ABX500_CORE) += abx500-core.o
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 014a68711b18..5605f176061a 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -204,8 +204,6 @@ static int pcf50633_probe(struct i2c_client *client)
dev_info(pcf->dev, "Probed device version %d variant %d\n",
version, variant);
- pcf50633_irq_init(pcf, client->irq);
-
/* Create sub devices */
pcf50633_client_dev_register(pcf, "pcf50633-input", &pcf->input_pdev);
pcf50633_client_dev_register(pcf, "pcf50633-rtc", &pcf->rtc_pdev);
@@ -258,7 +256,6 @@ static void pcf50633_remove(struct i2c_client *client)
int i;
sysfs_remove_group(&client->dev.kobj, &pcf_attr_group);
- pcf50633_irq_free(pcf);
platform_device_unregister(pcf->input_pdev);
platform_device_unregister(pcf->rtc_pdev);
@@ -279,7 +276,7 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table);
static struct i2c_driver pcf50633_driver = {
.driver = {
.name = "pcf50633",
- .pm = pm_sleep_ptr(&pcf50633_pm),
+ /* going.... .pm = pm_sleep_ptr(&pcf50633_pm), */
},
.id_table = pcf50633_id_table,
.probe = pcf50633_probe,
diff --git a/drivers/mfd/pcf50633-irq.c b/drivers/mfd/pcf50633-irq.c
deleted file mode 100644
index e85af7f1cb0b..000000000000
--- a/drivers/mfd/pcf50633-irq.c
+++ /dev/null
@@ -1,312 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* NXP PCF50633 Power Management Unit (PMU) driver
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * Author: Harald Welte <laforge@openmoko.org>
- * Balaji Rao <balajirrao@openmoko.org>
- * All rights reserved.
- */
-
-#include <linux/i2c.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/mutex.h>
-#include <linux/export.h>
-#include <linux/slab.h>
-
-#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/mbc.h>
-
-int pcf50633_register_irq(struct pcf50633 *pcf, int irq,
- void (*handler) (int, void *), void *data)
-{
- if (irq < 0 || irq >= PCF50633_NUM_IRQ || !handler)
- return -EINVAL;
-
- if (WARN_ON(pcf->irq_handler[irq].handler))
- return -EBUSY;
-
- mutex_lock(&pcf->lock);
- pcf->irq_handler[irq].handler = handler;
- pcf->irq_handler[irq].data = data;
- mutex_unlock(&pcf->lock);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(pcf50633_register_irq);
-
-int pcf50633_free_irq(struct pcf50633 *pcf, int irq)
-{
- if (irq < 0 || irq >= PCF50633_NUM_IRQ)
- return -EINVAL;
-
- mutex_lock(&pcf->lock);
- pcf->irq_handler[irq].handler = NULL;
- mutex_unlock(&pcf->lock);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(pcf50633_free_irq);
-
-static int __pcf50633_irq_mask_set(struct pcf50633 *pcf, int irq, u8 mask)
-{
- u8 reg, bit;
- int idx;
-
- idx = irq >> 3;
- reg = PCF50633_REG_INT1M + idx;
- bit = 1 << (irq & 0x07);
-
- pcf50633_reg_set_bit_mask(pcf, reg, bit, mask ? bit : 0);
-
- mutex_lock(&pcf->lock);
-
- if (mask)
- pcf->mask_regs[idx] |= bit;
- else
- pcf->mask_regs[idx] &= ~bit;
-
- mutex_unlock(&pcf->lock);
-
- return 0;
-}
-
-int pcf50633_irq_mask(struct pcf50633 *pcf, int irq)
-{
- dev_dbg(pcf->dev, "Masking IRQ %d\n", irq);
-
- return __pcf50633_irq_mask_set(pcf, irq, 1);
-}
-EXPORT_SYMBOL_GPL(pcf50633_irq_mask);
-
-int pcf50633_irq_unmask(struct pcf50633 *pcf, int irq)
-{
- dev_dbg(pcf->dev, "Unmasking IRQ %d\n", irq);
-
- return __pcf50633_irq_mask_set(pcf, irq, 0);
-}
-EXPORT_SYMBOL_GPL(pcf50633_irq_unmask);
-
-int pcf50633_irq_mask_get(struct pcf50633 *pcf, int irq)
-{
- u8 reg, bits;
-
- reg = irq >> 3;
- bits = 1 << (irq & 0x07);
-
- return pcf->mask_regs[reg] & bits;
-}
-EXPORT_SYMBOL_GPL(pcf50633_irq_mask_get);
-
-static void pcf50633_irq_call_handler(struct pcf50633 *pcf, int irq)
-{
- if (pcf->irq_handler[irq].handler)
- pcf->irq_handler[irq].handler(irq, pcf->irq_handler[irq].data);
-}
-
-/* Maximum amount of time ONKEY is held before emergency action is taken */
-#define PCF50633_ONKEY1S_TIMEOUT 8
-
-static irqreturn_t pcf50633_irq(int irq, void *data)
-{
- struct pcf50633 *pcf = data;
- int ret, i, j;
- u8 pcf_int[5], chgstat;
-
- /* Read the 5 INT regs in one transaction */
- ret = pcf50633_read_block(pcf, PCF50633_REG_INT1,
- ARRAY_SIZE(pcf_int), pcf_int);
- if (ret != ARRAY_SIZE(pcf_int)) {
- dev_err(pcf->dev, "Error reading INT registers\n");
-
- /*
- * If this doesn't ACK the interrupt to the chip, we'll be
- * called once again as we're level triggered.
- */
- goto out;
- }
-
- /* defeat 8s death from lowsys on A5 */
- pcf50633_reg_write(pcf, PCF50633_REG_OOCSHDWN, 0x04);
-
- /* We immediately read the usb and adapter status. We thus make sure
- * only of USBINS/USBREM IRQ handlers are called */
- if (pcf_int[0] & (PCF50633_INT1_USBINS | PCF50633_INT1_USBREM)) {
- chgstat = pcf50633_reg_read(pcf, PCF50633_REG_MBCS2);
- if (chgstat & (0x3 << 4))
- pcf_int[0] &= ~PCF50633_INT1_USBREM;
- else
- pcf_int[0] &= ~PCF50633_INT1_USBINS;
- }
-
- /* Make sure only one of ADPINS or ADPREM is set */
- if (pcf_int[0] & (PCF50633_INT1_ADPINS | PCF50633_INT1_ADPREM)) {
- chgstat = pcf50633_reg_read(pcf, PCF50633_REG_MBCS2);
- if (chgstat & (0x3 << 4))
- pcf_int[0] &= ~PCF50633_INT1_ADPREM;
- else
- pcf_int[0] &= ~PCF50633_INT1_ADPINS;
- }
-
- dev_dbg(pcf->dev, "INT1=0x%02x INT2=0x%02x INT3=0x%02x "
- "INT4=0x%02x INT5=0x%02x\n", pcf_int[0],
- pcf_int[1], pcf_int[2], pcf_int[3], pcf_int[4]);
-
- /* Some revisions of the chip don't have a 8s standby mode on
- * ONKEY1S press. We try to manually do it in such cases. */
- if ((pcf_int[0] & PCF50633_INT1_SECOND) && pcf->onkey1s_held) {
- dev_info(pcf->dev, "ONKEY1S held for %d secs\n",
- pcf->onkey1s_held);
- if (pcf->onkey1s_held++ == PCF50633_ONKEY1S_TIMEOUT)
- if (pcf->pdata->force_shutdown)
- pcf->pdata->force_shutdown(pcf);
- }
-
- if (pcf_int[2] & PCF50633_INT3_ONKEY1S) {
- dev_info(pcf->dev, "ONKEY1S held\n");
- pcf->onkey1s_held = 1 ;
-
- /* Unmask IRQ_SECOND */
- pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT1M,
- PCF50633_INT1_SECOND);
-
- /* Unmask IRQ_ONKEYR */
- pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT2M,
- PCF50633_INT2_ONKEYR);
- }
-
- if ((pcf_int[1] & PCF50633_INT2_ONKEYR) && pcf->onkey1s_held) {
- pcf->onkey1s_held = 0;
-
- /* Mask SECOND and ONKEYR interrupts */
- if (pcf->mask_regs[0] & PCF50633_INT1_SECOND)
- pcf50633_reg_set_bit_mask(pcf,
- PCF50633_REG_INT1M,
- PCF50633_INT1_SECOND,
- PCF50633_INT1_SECOND);
-
- if (pcf->mask_regs[1] & PCF50633_INT2_ONKEYR)
- pcf50633_reg_set_bit_mask(pcf,
- PCF50633_REG_INT2M,
- PCF50633_INT2_ONKEYR,
- PCF50633_INT2_ONKEYR);
- }
-
- /* Have we just resumed ? */
- if (pcf->is_suspended) {
- pcf->is_suspended = 0;
-
- /* Set the resume reason filtering out non resumers */
- for (i = 0; i < ARRAY_SIZE(pcf_int); i++)
- pcf->resume_reason[i] = pcf_int[i] &
- pcf->pdata->resumers[i];
-
- /* Make sure we don't pass on any ONKEY events to
- * userspace now */
- pcf_int[1] &= ~(PCF50633_INT2_ONKEYR | PCF50633_INT2_ONKEYF);
- }
-
- for (i = 0; i < ARRAY_SIZE(pcf_int); i++) {
- /* Unset masked interrupts */
- pcf_int[i] &= ~pcf->mask_regs[i];
-
- for (j = 0; j < 8 ; j++)
- if (pcf_int[i] & (1 << j))
- pcf50633_irq_call_handler(pcf, (i * 8) + j);
- }
-
-out:
- return IRQ_HANDLED;
-}
-
-static int pcf50633_suspend(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct pcf50633 *pcf = i2c_get_clientdata(client);
- int ret;
- int i;
- u8 res[5];
-
-
- /* Make sure our interrupt handlers are not called
- * henceforth */
- disable_irq(pcf->irq);
-
- /* Save the masks */
- ret = pcf50633_read_block(pcf, PCF50633_REG_INT1M,
- ARRAY_SIZE(pcf->suspend_irq_masks),
- pcf->suspend_irq_masks);
- if (ret < 0) {
- dev_err(pcf->dev, "error saving irq masks\n");
- goto out;
- }
-
- /* Write wakeup irq masks */
- for (i = 0; i < ARRAY_SIZE(res); i++)
- res[i] = ~pcf->pdata->resumers[i];
-
- ret = pcf50633_write_block(pcf, PCF50633_REG_INT1M,
- ARRAY_SIZE(res), &res[0]);
- if (ret < 0) {
- dev_err(pcf->dev, "error writing wakeup irq masks\n");
- goto out;
- }
-
- pcf->is_suspended = 1;
-
-out:
- return ret;
-}
-
-static int pcf50633_resume(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct pcf50633 *pcf = i2c_get_clientdata(client);
- int ret;
-
- /* Write the saved mask registers */
- ret = pcf50633_write_block(pcf, PCF50633_REG_INT1M,
- ARRAY_SIZE(pcf->suspend_irq_masks),
- pcf->suspend_irq_masks);
- if (ret < 0)
- dev_err(pcf->dev, "Error restoring saved suspend masks\n");
-
- enable_irq(pcf->irq);
-
- return ret;
-}
-
-EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
-
-int pcf50633_irq_init(struct pcf50633 *pcf, int irq)
-{
- int ret;
-
- pcf->irq = irq;
-
- /* Enable all interrupts except RTC SECOND */
- pcf->mask_regs[0] = 0x80;
- pcf50633_reg_write(pcf, PCF50633_REG_INT1M, pcf->mask_regs[0]);
- pcf50633_reg_write(pcf, PCF50633_REG_INT2M, 0x00);
- pcf50633_reg_write(pcf, PCF50633_REG_INT3M, 0x00);
- pcf50633_reg_write(pcf, PCF50633_REG_INT4M, 0x00);
- pcf50633_reg_write(pcf, PCF50633_REG_INT5M, 0x00);
-
- ret = request_threaded_irq(irq, NULL, pcf50633_irq,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- "pcf50633", pcf);
-
- if (ret)
- dev_err(pcf->dev, "Failed to request IRQ %d\n", ret);
-
- if (enable_irq_wake(irq) < 0)
- dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source"
- "in this hardware revision", irq);
-
- return ret;
-}
-
-void pcf50633_irq_free(struct pcf50633 *pcf)
-{
- free_irq(pcf->irq, pcf);
-}
--
2.48.1
^ permalink raw reply related
* [PATCH v2 7/9] backlight: pcf50633-backlight: Remove
From: linux @ 2025-03-11 1:49 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel, Dr. David Alan Gilbert
In-Reply-To: <20250311014959.743322-1-linux@treblig.org>
From: "Dr. David Alan Gilbert" <linux@treblig.org>
The pcf50633 was used as part of the OpenMoko devices but
the support for its main chip was recently removed in:
commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/video/backlight/Kconfig | 7 -
drivers/video/backlight/Makefile | 1 -
drivers/video/backlight/pcf50633-backlight.c | 154 -------------------
include/linux/mfd/pcf50633/backlight.h | 42 -----
include/linux/mfd/pcf50633/core.h | 3 -
5 files changed, 207 deletions(-)
delete mode 100644 drivers/video/backlight/pcf50633-backlight.c
delete mode 100644 include/linux/mfd/pcf50633/backlight.h
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 3614a5d29c71..ef4ac1ac7520 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -359,13 +359,6 @@ config BACKLIGHT_88PM860X
help
Say Y to enable the backlight driver for Marvell 88PM8606.
-config BACKLIGHT_PCF50633
- tristate "Backlight driver for NXP PCF50633 MFD"
- depends on MFD_PCF50633
- help
- If you have a backlight driven by a NXP PCF50633 MFD, say Y here to
- enable its driver.
-
config BACKLIGHT_AAT2870
tristate "AnalogicTech AAT2870 Backlight"
depends on MFD_AAT2870_CORE
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 8fc98f760a8a..21bf62bcaccf 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -49,7 +49,6 @@ obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o
obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o
obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
-obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
obj-$(CONFIG_BACKLIGHT_QCOM_WLED) += qcom-wled.o
obj-$(CONFIG_BACKLIGHT_RT4831) += rt4831-backlight.o
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c
deleted file mode 100644
index 157be2f366df..000000000000
--- a/drivers/video/backlight/pcf50633-backlight.c
+++ /dev/null
@@ -1,154 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
- * PCF50633 backlight device driver
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-
-#include <linux/backlight.h>
-
-#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/backlight.h>
-
-struct pcf50633_bl {
- struct pcf50633 *pcf;
- struct backlight_device *bl;
-
- unsigned int brightness;
- unsigned int brightness_limit;
-};
-
-/*
- * pcf50633_bl_set_brightness_limit
- *
- * Update the brightness limit for the pc50633 backlight. The actual brightness
- * will not go above the limit. This is useful to limit power drain for example
- * on low battery.
- *
- * @dev: Pointer to a pcf50633 device
- * @limit: The brightness limit. Valid values are 0-63
- */
-int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit)
-{
- struct pcf50633_bl *pcf_bl = platform_get_drvdata(pcf->bl_pdev);
-
- if (!pcf_bl)
- return -ENODEV;
-
- pcf_bl->brightness_limit = limit & 0x3f;
- backlight_update_status(pcf_bl->bl);
-
- return 0;
-}
-
-static int pcf50633_bl_update_status(struct backlight_device *bl)
-{
- struct pcf50633_bl *pcf_bl = bl_get_data(bl);
- unsigned int new_brightness;
-
-
- if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK) ||
- bl->props.power != BACKLIGHT_POWER_ON)
- new_brightness = 0;
- else if (bl->props.brightness < pcf_bl->brightness_limit)
- new_brightness = bl->props.brightness;
- else
- new_brightness = pcf_bl->brightness_limit;
-
-
- if (pcf_bl->brightness == new_brightness)
- return 0;
-
- if (new_brightness) {
- pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDOUT,
- new_brightness);
- if (!pcf_bl->brightness)
- pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 1);
- } else {
- pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 0);
- }
-
- pcf_bl->brightness = new_brightness;
-
- return 0;
-}
-
-static int pcf50633_bl_get_brightness(struct backlight_device *bl)
-{
- struct pcf50633_bl *pcf_bl = bl_get_data(bl);
-
- return pcf_bl->brightness;
-}
-
-static const struct backlight_ops pcf50633_bl_ops = {
- .get_brightness = pcf50633_bl_get_brightness,
- .update_status = pcf50633_bl_update_status,
- .options = BL_CORE_SUSPENDRESUME,
-};
-
-static int pcf50633_bl_probe(struct platform_device *pdev)
-{
- struct pcf50633_bl *pcf_bl;
- struct device *parent = pdev->dev.parent;
- struct pcf50633_platform_data *pcf50633_data = dev_get_platdata(parent);
- struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data;
- struct backlight_properties bl_props;
-
- pcf_bl = devm_kzalloc(&pdev->dev, sizeof(*pcf_bl), GFP_KERNEL);
- if (!pcf_bl)
- return -ENOMEM;
-
- memset(&bl_props, 0, sizeof(bl_props));
- bl_props.type = BACKLIGHT_RAW;
- bl_props.max_brightness = 0x3f;
- bl_props.power = BACKLIGHT_POWER_ON;
-
- if (pdata) {
- bl_props.brightness = pdata->default_brightness;
- pcf_bl->brightness_limit = pdata->default_brightness_limit;
- } else {
- bl_props.brightness = 0x3f;
- pcf_bl->brightness_limit = 0x3f;
- }
-
- pcf_bl->pcf = dev_to_pcf50633(pdev->dev.parent);
-
- pcf_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name,
- &pdev->dev, pcf_bl,
- &pcf50633_bl_ops, &bl_props);
-
- if (IS_ERR(pcf_bl->bl))
- return PTR_ERR(pcf_bl->bl);
-
- platform_set_drvdata(pdev, pcf_bl);
-
- pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time);
-
- /*
- * Should be different from bl_props.brightness, so we do not exit
- * update_status early the first time it's called
- */
- pcf_bl->brightness = pcf_bl->bl->props.brightness + 1;
-
- backlight_update_status(pcf_bl->bl);
-
- return 0;
-}
-
-static struct platform_driver pcf50633_bl_driver = {
- .probe = pcf50633_bl_probe,
- .driver = {
- .name = "pcf50633-backlight",
- },
-};
-
-module_platform_driver(pcf50633_bl_driver);
-
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_DESCRIPTION("PCF50633 backlight driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:pcf50633-backlight");
diff --git a/include/linux/mfd/pcf50633/backlight.h b/include/linux/mfd/pcf50633/backlight.h
deleted file mode 100644
index fd4a4f8d6c13..000000000000
--- a/include/linux/mfd/pcf50633/backlight.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
- * PCF50633 backlight device driver
- */
-
-#ifndef __LINUX_MFD_PCF50633_BACKLIGHT
-#define __LINUX_MFD_PCF50633_BACKLIGHT
-
-/*
-* @default_brightness: Backlight brightness is initialized to this value
-*
-* Brightness to be used after the driver has been probed.
-* Valid range 0-63.
-*
-* @default_brightness_limit: The actual brightness is limited by this value
-*
-* Brightness limit to be used after the driver has been probed. This is useful
-* when it is not known how much power is available for the backlight during
-* probe.
-* Valid range 0-63. Can be changed later with pcf50633_bl_set_brightness_limit.
-*
-* @ramp_time: Display ramp time when changing brightness
-*
-* When changing the backlights brightness the change is not instant, instead
-* it fades smooth from one state to another. This value specifies how long
-* the fade should take. The lower the value the higher the fade time.
-* Valid range 0-255
-*/
-struct pcf50633_bl_platform_data {
- unsigned int default_brightness;
- unsigned int default_brightness_limit;
- uint8_t ramp_time;
-};
-
-
-struct pcf50633;
-
-int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit);
-
-#endif
-
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 539f27f8bd89..42d2b0e4884e 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -15,7 +15,6 @@
#include <linux/regulator/machine.h>
#include <linux/pm.h>
#include <linux/power_supply.h>
-#include <linux/mfd/pcf50633/backlight.h>
struct pcf50633;
struct regmap;
@@ -42,8 +41,6 @@ struct pcf50633_platform_data {
void (*force_shutdown)(struct pcf50633 *);
u8 resumers[5];
-
- struct pcf50633_bl_platform_data *backlight_data;
};
struct pcf50633_irq {
--
2.48.1
^ permalink raw reply related
* [PATCH v2 6/9] power: supply: pcf50633: Remove charger
From: linux @ 2025-03-11 1:49 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel, Dr. David Alan Gilbert
In-Reply-To: <20250311014959.743322-1-linux@treblig.org>
From: "Dr. David Alan Gilbert" <linux@treblig.org>
The pcf50633 was used as part of the OpenMoko devices but
the support for its main chip was recently removed in:
commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/power/supply/Kconfig | 6 -
drivers/power/supply/Makefile | 1 -
drivers/power/supply/pcf50633-charger.c | 466 ------------------------
3 files changed, 473 deletions(-)
delete mode 100644 drivers/power/supply/pcf50633-charger.c
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index 7b18358f194a..aa569badaf73 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -449,12 +449,6 @@ config CHARGER_88PM860X
help
Say Y here to enable charger for Marvell 88PM860x chip.
-config CHARGER_PCF50633
- tristate "NXP PCF50633 MBC"
- depends on MFD_PCF50633
- help
- Say Y to include support for NXP PCF50633 Main Battery Charger.
-
config BATTERY_RX51
tristate "Nokia RX-51 (N900) battery driver"
depends on TWL4030_MADC
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index b55cc48a4c86..eedb00e377cb 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -62,7 +62,6 @@ obj-$(CONFIG_CHARGER_RT9467) += rt9467-charger.o
obj-$(CONFIG_CHARGER_RT9471) += rt9471.o
obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o
obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o
-obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o
obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o
obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o
obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o
diff --git a/drivers/power/supply/pcf50633-charger.c b/drivers/power/supply/pcf50633-charger.c
deleted file mode 100644
index 0136bc87b105..000000000000
--- a/drivers/power/supply/pcf50633-charger.c
+++ /dev/null
@@ -1,466 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* NXP PCF50633 Main Battery Charger Driver
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * Author: Balaji Rao <balajirrao@openmoko.org>
- * All rights reserved.
- *
- * Broken down from monstrous PCF50633 driver mainly by
- * Harald Welte, Andy Green and Werner Almesberger
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/sysfs.h>
-#include <linux/platform_device.h>
-#include <linux/power_supply.h>
-
-#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/mbc.h>
-
-struct pcf50633_mbc {
- struct pcf50633 *pcf;
-
- int adapter_online;
- int usb_online;
-
- struct power_supply *usb;
- struct power_supply *adapter;
- struct power_supply *ac;
-};
-
-int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
-{
- struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev);
- int ret = 0;
- u8 bits;
- u8 mbcs2, chgmod;
- unsigned int mbcc5;
-
- if (ma >= 1000) {
- bits = PCF50633_MBCC7_USB_1000mA;
- ma = 1000;
- } else if (ma >= 500) {
- bits = PCF50633_MBCC7_USB_500mA;
- ma = 500;
- } else if (ma >= 100) {
- bits = PCF50633_MBCC7_USB_100mA;
- ma = 100;
- } else {
- bits = PCF50633_MBCC7_USB_SUSPEND;
- ma = 0;
- }
-
- ret = pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC7,
- PCF50633_MBCC7_USB_MASK, bits);
- if (ret)
- dev_err(pcf->dev, "error setting usb curlim to %d mA\n", ma);
- else
- dev_info(pcf->dev, "usb curlim to %d mA\n", ma);
-
- /*
- * We limit the charging current to be the USB current limit.
- * The reason is that on pcf50633, when it enters PMU Standby mode,
- * which it does when the device goes "off", the USB current limit
- * reverts to the variant default. In at least one common case, that
- * default is 500mA. By setting the charging current to be the same
- * as the USB limit we set here before PMU standby, we enforce it only
- * using the correct amount of current even when the USB current limit
- * gets reset to the wrong thing
- */
-
- if (mbc->pcf->pdata->charger_reference_current_ma) {
- mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma;
- if (mbcc5 > 255)
- mbcc5 = 255;
- pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5);
- }
-
- mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2);
- chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK);
-
- /* If chgmod == BATFULL, setting chgena has no effect.
- * Datasheet says we need to set resume instead but when autoresume is
- * used resume doesn't work. Clear and set chgena instead.
- */
- if (chgmod != PCF50633_MBCS2_MBC_BAT_FULL)
- pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC1,
- PCF50633_MBCC1_CHGENA, PCF50633_MBCC1_CHGENA);
- else {
- pcf50633_reg_clear_bits(pcf, PCF50633_REG_MBCC1,
- PCF50633_MBCC1_CHGENA);
- pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC1,
- PCF50633_MBCC1_CHGENA, PCF50633_MBCC1_CHGENA);
- }
-
- power_supply_changed(mbc->usb);
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(pcf50633_mbc_usb_curlim_set);
-
-int pcf50633_mbc_get_status(struct pcf50633 *pcf)
-{
- struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev);
- int status = 0;
- u8 chgmod;
-
- if (!mbc)
- return 0;
-
- chgmod = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2)
- & PCF50633_MBCS2_MBC_MASK;
-
- if (mbc->usb_online)
- status |= PCF50633_MBC_USB_ONLINE;
- if (chgmod == PCF50633_MBCS2_MBC_USB_PRE ||
- chgmod == PCF50633_MBCS2_MBC_USB_PRE_WAIT ||
- chgmod == PCF50633_MBCS2_MBC_USB_FAST ||
- chgmod == PCF50633_MBCS2_MBC_USB_FAST_WAIT)
- status |= PCF50633_MBC_USB_ACTIVE;
- if (mbc->adapter_online)
- status |= PCF50633_MBC_ADAPTER_ONLINE;
- if (chgmod == PCF50633_MBCS2_MBC_ADP_PRE ||
- chgmod == PCF50633_MBCS2_MBC_ADP_PRE_WAIT ||
- chgmod == PCF50633_MBCS2_MBC_ADP_FAST ||
- chgmod == PCF50633_MBCS2_MBC_ADP_FAST_WAIT)
- status |= PCF50633_MBC_ADAPTER_ACTIVE;
-
- return status;
-}
-EXPORT_SYMBOL_GPL(pcf50633_mbc_get_status);
-
-int pcf50633_mbc_get_usb_online_status(struct pcf50633 *pcf)
-{
- struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev);
-
- if (!mbc)
- return 0;
-
- return mbc->usb_online;
-}
-EXPORT_SYMBOL_GPL(pcf50633_mbc_get_usb_online_status);
-
-static ssize_t
-show_chgmode(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
-
- u8 mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2);
- u8 chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK);
-
- return sysfs_emit(buf, "%d\n", chgmod);
-}
-static DEVICE_ATTR(chgmode, S_IRUGO, show_chgmode, NULL);
-
-static ssize_t
-show_usblim(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
- u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) &
- PCF50633_MBCC7_USB_MASK;
- unsigned int ma;
-
- if (usblim == PCF50633_MBCC7_USB_1000mA)
- ma = 1000;
- else if (usblim == PCF50633_MBCC7_USB_500mA)
- ma = 500;
- else if (usblim == PCF50633_MBCC7_USB_100mA)
- ma = 100;
- else
- ma = 0;
-
- return sysfs_emit(buf, "%u\n", ma);
-}
-
-static ssize_t set_usblim(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
-{
- struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
- unsigned long ma;
- int ret;
-
- ret = kstrtoul(buf, 10, &ma);
- if (ret)
- return ret;
-
- pcf50633_mbc_usb_curlim_set(mbc->pcf, ma);
-
- return count;
-}
-
-static DEVICE_ATTR(usb_curlim, S_IRUGO | S_IWUSR, show_usblim, set_usblim);
-
-static ssize_t
-show_chglim(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
- u8 mbcc5 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC5);
- unsigned int ma;
-
- if (!mbc->pcf->pdata->charger_reference_current_ma)
- return -ENODEV;
-
- ma = (mbc->pcf->pdata->charger_reference_current_ma * mbcc5) >> 8;
-
- return sysfs_emit(buf, "%u\n", ma);
-}
-
-static ssize_t set_chglim(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
-{
- struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
- unsigned long ma;
- unsigned int mbcc5;
- int ret;
-
- if (!mbc->pcf->pdata->charger_reference_current_ma)
- return -ENODEV;
-
- ret = kstrtoul(buf, 10, &ma);
- if (ret)
- return ret;
-
- mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma;
- if (mbcc5 > 255)
- mbcc5 = 255;
- pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5);
-
- return count;
-}
-
-/*
- * This attribute allows to change MBC charging limit on the fly
- * independently of usb current limit. It also gets set automatically every
- * time usb current limit is changed.
- */
-static DEVICE_ATTR(chg_curlim, S_IRUGO | S_IWUSR, show_chglim, set_chglim);
-
-static struct attribute *pcf50633_mbc_sysfs_attrs[] = {
- &dev_attr_chgmode.attr,
- &dev_attr_usb_curlim.attr,
- &dev_attr_chg_curlim.attr,
- NULL,
-};
-
-ATTRIBUTE_GROUPS(pcf50633_mbc_sysfs);
-
-static void
-pcf50633_mbc_irq_handler(int irq, void *data)
-{
- struct pcf50633_mbc *mbc = data;
-
- /* USB */
- if (irq == PCF50633_IRQ_USBINS) {
- mbc->usb_online = 1;
- } else if (irq == PCF50633_IRQ_USBREM) {
- mbc->usb_online = 0;
- pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
- }
-
- /* Adapter */
- if (irq == PCF50633_IRQ_ADPINS)
- mbc->adapter_online = 1;
- else if (irq == PCF50633_IRQ_ADPREM)
- mbc->adapter_online = 0;
-
- power_supply_changed(mbc->ac);
- power_supply_changed(mbc->usb);
- power_supply_changed(mbc->adapter);
-
- if (mbc->pcf->pdata->mbc_event_callback)
- mbc->pcf->pdata->mbc_event_callback(mbc->pcf, irq);
-}
-
-static int adapter_get_property(struct power_supply *psy,
- enum power_supply_property psp,
- union power_supply_propval *val)
-{
- struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy);
- int ret = 0;
-
- switch (psp) {
- case POWER_SUPPLY_PROP_ONLINE:
- val->intval = mbc->adapter_online;
- break;
- default:
- ret = -EINVAL;
- break;
- }
- return ret;
-}
-
-static int usb_get_property(struct power_supply *psy,
- enum power_supply_property psp,
- union power_supply_propval *val)
-{
- struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy);
- int ret = 0;
- u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) &
- PCF50633_MBCC7_USB_MASK;
-
- switch (psp) {
- case POWER_SUPPLY_PROP_ONLINE:
- val->intval = mbc->usb_online &&
- (usblim <= PCF50633_MBCC7_USB_500mA);
- break;
- default:
- ret = -EINVAL;
- break;
- }
- return ret;
-}
-
-static int ac_get_property(struct power_supply *psy,
- enum power_supply_property psp,
- union power_supply_propval *val)
-{
- struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy);
- int ret = 0;
- u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) &
- PCF50633_MBCC7_USB_MASK;
-
- switch (psp) {
- case POWER_SUPPLY_PROP_ONLINE:
- val->intval = mbc->usb_online &&
- (usblim == PCF50633_MBCC7_USB_1000mA);
- break;
- default:
- ret = -EINVAL;
- break;
- }
- return ret;
-}
-
-static enum power_supply_property power_props[] = {
- POWER_SUPPLY_PROP_ONLINE,
-};
-
-static const u8 mbc_irq_handlers[] = {
- PCF50633_IRQ_ADPINS,
- PCF50633_IRQ_ADPREM,
- PCF50633_IRQ_USBINS,
- PCF50633_IRQ_USBREM,
- PCF50633_IRQ_BATFULL,
- PCF50633_IRQ_CHGHALT,
- PCF50633_IRQ_THLIMON,
- PCF50633_IRQ_THLIMOFF,
- PCF50633_IRQ_USBLIMON,
- PCF50633_IRQ_USBLIMOFF,
- PCF50633_IRQ_LOWSYS,
- PCF50633_IRQ_LOWBAT,
-};
-
-static const struct power_supply_desc pcf50633_mbc_adapter_desc = {
- .name = "adapter",
- .type = POWER_SUPPLY_TYPE_MAINS,
- .properties = power_props,
- .num_properties = ARRAY_SIZE(power_props),
- .get_property = &adapter_get_property,
-};
-
-static const struct power_supply_desc pcf50633_mbc_usb_desc = {
- .name = "usb",
- .type = POWER_SUPPLY_TYPE_USB,
- .properties = power_props,
- .num_properties = ARRAY_SIZE(power_props),
- .get_property = usb_get_property,
-};
-
-static const struct power_supply_desc pcf50633_mbc_ac_desc = {
- .name = "ac",
- .type = POWER_SUPPLY_TYPE_MAINS,
- .properties = power_props,
- .num_properties = ARRAY_SIZE(power_props),
- .get_property = ac_get_property,
-};
-
-static int pcf50633_mbc_probe(struct platform_device *pdev)
-{
- struct power_supply_config psy_cfg = {};
- struct power_supply_config usb_psy_cfg;
- struct pcf50633_mbc *mbc;
- int i;
- u8 mbcs1;
-
- mbc = devm_kzalloc(&pdev->dev, sizeof(*mbc), GFP_KERNEL);
- if (!mbc)
- return -ENOMEM;
-
- platform_set_drvdata(pdev, mbc);
- mbc->pcf = dev_to_pcf50633(pdev->dev.parent);
-
- /* Set up IRQ handlers */
- for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++)
- pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i],
- pcf50633_mbc_irq_handler, mbc);
-
- psy_cfg.supplied_to = mbc->pcf->pdata->batteries;
- psy_cfg.num_supplicants = mbc->pcf->pdata->num_batteries;
- psy_cfg.drv_data = mbc;
-
- /* Create power supplies */
- mbc->adapter = devm_power_supply_register(&pdev->dev,
- &pcf50633_mbc_adapter_desc,
- &psy_cfg);
- if (IS_ERR(mbc->adapter)) {
- dev_err(mbc->pcf->dev, "failed to register adapter\n");
- return PTR_ERR(mbc->adapter);
- }
-
- usb_psy_cfg = psy_cfg;
- usb_psy_cfg.attr_grp = pcf50633_mbc_sysfs_groups;
-
- mbc->usb = devm_power_supply_register(&pdev->dev,
- &pcf50633_mbc_usb_desc,
- &usb_psy_cfg);
- if (IS_ERR(mbc->usb)) {
- dev_err(mbc->pcf->dev, "failed to register usb\n");
- return PTR_ERR(mbc->usb);
- }
-
- mbc->ac = devm_power_supply_register(&pdev->dev,
- &pcf50633_mbc_ac_desc,
- &psy_cfg);
- if (IS_ERR(mbc->ac)) {
- dev_err(mbc->pcf->dev, "failed to register ac\n");
- return PTR_ERR(mbc->ac);
- }
-
- mbcs1 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS1);
- if (mbcs1 & PCF50633_MBCS1_USBPRES)
- pcf50633_mbc_irq_handler(PCF50633_IRQ_USBINS, mbc);
- if (mbcs1 & PCF50633_MBCS1_ADAPTPRES)
- pcf50633_mbc_irq_handler(PCF50633_IRQ_ADPINS, mbc);
-
- return 0;
-}
-
-static void pcf50633_mbc_remove(struct platform_device *pdev)
-{
- struct pcf50633_mbc *mbc = platform_get_drvdata(pdev);
- int i;
-
- /* Remove IRQ handlers */
- for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++)
- pcf50633_free_irq(mbc->pcf, mbc_irq_handlers[i]);
-}
-
-static struct platform_driver pcf50633_mbc_driver = {
- .driver = {
- .name = "pcf50633-mbc",
- },
- .probe = pcf50633_mbc_probe,
- .remove = pcf50633_mbc_remove,
-};
-
-module_platform_driver(pcf50633_mbc_driver);
-
-MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>");
-MODULE_DESCRIPTION("PCF50633 mbc driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:pcf50633-mbc");
--
2.48.1
^ permalink raw reply related
* Re: [PATCH 0/9] Remove pcf50633
From: Dr. David Alan Gilbert @ 2025-03-11 1:51 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <Z883nYWpaOF2OZbs@gallifrey>
* Dr. David Alan Gilbert (linux@treblig.org) wrote:
> * linux@treblig.org (linux@treblig.org) wrote:
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >
> > The pcf50633 was used as part of the OpenMoko devices but
> > the support for its main chip was recently removed in:
> > commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
> >
> > See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
> >
> > Remove it.
> >
> > I've split this up based on the subcomponents to make the size
> > of each patch sensible.
> >
>
> Both Alexandre and Mark would prefer the mfd changes to be
> more separate from the subsystem changes, so I'll cook a v2
> shortly.
v2 thread starting with message
20250311014959.743322-1-linux@treblig.org
just posted.
Thanks!
Dave
> Dave
>
> >
> > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> >
> >
> > Dr. David Alan Gilbert (9):
> > mfd: pcf50633-adc: Remove
> > backlight: pcf50633-backlight: Remove
> > rtc: pcf50633: Remove
> > mfd: pcF50633-gpio: Remove
> > Input: pcf50633-input - Remove
> > regulator: pcf50633-regulator: Remove
> > power: supply: pcf50633: Remove charger
> > mfd: pcf50633: Remove irq code
> > mfd: pcf50633: Remove remains
> >
> > arch/mips/configs/ip27_defconfig | 3 -
> > drivers/input/misc/Kconfig | 7 -
> > drivers/input/misc/Makefile | 1 -
> > drivers/input/misc/pcf50633-input.c | 113 -----
> > drivers/mfd/Kconfig | 24 -
> > drivers/mfd/Makefile | 4 -
> > drivers/mfd/pcf50633-adc.c | 255 ----------
> > drivers/mfd/pcf50633-core.c | 304 ------------
> > drivers/mfd/pcf50633-gpio.c | 92 ----
> > drivers/mfd/pcf50633-irq.c | 312 -------------
> > drivers/power/supply/Kconfig | 6 -
> > drivers/power/supply/Makefile | 1 -
> > drivers/power/supply/pcf50633-charger.c | 466 -------------------
> > drivers/regulator/Kconfig | 7 -
> > drivers/regulator/Makefile | 1 -
> > drivers/regulator/pcf50633-regulator.c | 124 -----
> > drivers/rtc/Kconfig | 7 -
> > drivers/rtc/Makefile | 1 -
> > drivers/rtc/rtc-pcf50633.c | 284 -----------
> > drivers/video/backlight/Kconfig | 7 -
> > drivers/video/backlight/Makefile | 1 -
> > drivers/video/backlight/pcf50633-backlight.c | 154 ------
> > include/linux/mfd/pcf50633/adc.h | 69 ---
> > include/linux/mfd/pcf50633/backlight.h | 42 --
> > include/linux/mfd/pcf50633/core.h | 232 ---------
> > include/linux/mfd/pcf50633/gpio.h | 48 --
> > include/linux/mfd/pcf50633/mbc.h | 130 ------
> > include/linux/mfd/pcf50633/pmic.h | 68 ---
> > 28 files changed, 2763 deletions(-)
> > delete mode 100644 drivers/input/misc/pcf50633-input.c
> > delete mode 100644 drivers/mfd/pcf50633-adc.c
> > delete mode 100644 drivers/mfd/pcf50633-core.c
> > delete mode 100644 drivers/mfd/pcf50633-gpio.c
> > delete mode 100644 drivers/mfd/pcf50633-irq.c
> > delete mode 100644 drivers/power/supply/pcf50633-charger.c
> > delete mode 100644 drivers/regulator/pcf50633-regulator.c
> > delete mode 100644 drivers/rtc/rtc-pcf50633.c
> > delete mode 100644 drivers/video/backlight/pcf50633-backlight.c
> > delete mode 100644 include/linux/mfd/pcf50633/adc.h
> > delete mode 100644 include/linux/mfd/pcf50633/backlight.h
> > delete mode 100644 include/linux/mfd/pcf50633/core.h
> > delete mode 100644 include/linux/mfd/pcf50633/gpio.h
> > delete mode 100644 include/linux/mfd/pcf50633/mbc.h
> > delete mode 100644 include/linux/mfd/pcf50633/pmic.h
> >
> > --
> > 2.48.1
> >
> --
> -----Open up your eyes, open up your mind, open up your code -------
> / Dr. David Alan Gilbert | Running GNU/Linux | Happy \
> \ dave @ treblig.org | | In Hex /
> \ _________________________|_____ http://www.treblig.org |_______/
>
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply
* Re: [PATCH v2] fbdev: fsl-diu-fb: add missing device_remove_file()
From: Shixiong Ou @ 2025-03-11 7:48 UTC (permalink / raw)
To: Helge Deller, Timur Tabi
Cc: linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
In-Reply-To: <0a15e04f-bd6d-4c2b-a8e1-708880fa433c@gmx.de>
Yeah, you are right, but I believe it would be better to retain the checks.
Anyway, I have submitted the V3 patch which has dropped the checks.
Thanks and Regards,
Shixiong Ou.
在 2025/3/10 03:42, Helge Deller 写道:
> On 3/9/25 09:16, Shixiong Ou wrote:
>> From: Shixiong Ou <oushixiong@kylinos.cn>
>>
>> Call device_remove_file() when driver remove.
>>
>> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
>> ---
>> v1->v2:
>> add has_sysfs_attrs flag.
>>
>> drivers/video/fbdev/fsl-diu-fb.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/fsl-diu-fb.c
>> b/drivers/video/fbdev/fsl-diu-fb.c
>> index 5ac8201c3533..57f7fe6a4c76 100644
>> --- a/drivers/video/fbdev/fsl-diu-fb.c
>> +++ b/drivers/video/fbdev/fsl-diu-fb.c
>> @@ -384,6 +384,7 @@ struct fsl_diu_data {
>> __le16 next_cursor[MAX_CURS * MAX_CURS] __aligned(32);
>> uint8_t edid_data[EDID_LENGTH];
>> bool has_edid;
>> + bool has_dev_attr;
>> } __aligned(32);
>>
>> /* Determine the DMA address of a member of the fsl_diu_data
>> structure */
>> @@ -1809,6 +1810,7 @@ static int fsl_diu_probe(struct platform_device
>> *pdev)
>> data->dev_attr.attr.name);
>> }
>>
>> + data->has_dev_attr = true;
>> dev_set_drvdata(&pdev->dev, data);
>> return 0;
>>
>> @@ -1827,6 +1829,10 @@ static void fsl_diu_remove(struct
>> platform_device *pdev)
>> int i;
>>
>> data = dev_get_drvdata(&pdev->dev);
>> +
>> + if (data->has_dev_attr)
>
> Looking at other drivers (e.g. drivers/net/can/usb/esd_usb.c) it seems
> that device_remove_file() is ok even if it's not fully initialized...
>
> I think you can drop those extra checks.
>
> Helge
>
>
>> + device_remove_file(&pdev->dev, &data->dev_attr);
>> +
>> disable_lcdc(&data->fsl_diu_info[0]);
>>
>> free_irq(data->irq, data->diu_reg);
^ permalink raw reply
* [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
From: oushixiong1025 @ 2025-03-11 11:28 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Thomas Zimmermann, Samuel Thibault, Zsolt Kajtar,
linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
From: Shixiong Ou <oushixiong@kylinos.cn>
Use device_add_group() to simplify creation and removal.
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 48 +++++++++++++++-----------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 07d127110ca4..51c3e8a5a092 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3159,7 +3159,7 @@ static const struct consw fb_con = {
.con_debug_leave = fbcon_debug_leave,
};
-static ssize_t store_rotate(struct device *device,
+static ssize_t rotate_store(struct device *device,
struct device_attribute *attr, const char *buf,
size_t count)
{
@@ -3181,7 +3181,7 @@ static ssize_t store_rotate(struct device *device,
return count;
}
-static ssize_t store_rotate_all(struct device *device,
+static ssize_t rotate_all_store(struct device *device,
struct device_attribute *attr,const char *buf,
size_t count)
{
@@ -3203,7 +3203,7 @@ static ssize_t store_rotate_all(struct device *device,
return count;
}
-static ssize_t show_rotate(struct device *device,
+static ssize_t rotate_show(struct device *device,
struct device_attribute *attr,char *buf)
{
struct fb_info *info;
@@ -3222,7 +3222,7 @@ static ssize_t show_rotate(struct device *device,
return sysfs_emit(buf, "%d\n", rotate);
}
-static ssize_t show_cursor_blink(struct device *device,
+static ssize_t cursor_blink_show(struct device *device,
struct device_attribute *attr, char *buf)
{
struct fb_info *info;
@@ -3247,7 +3247,7 @@ static ssize_t show_cursor_blink(struct device *device,
return sysfs_emit(buf, "%d\n", blink);
}
-static ssize_t store_cursor_blink(struct device *device,
+static ssize_t cursor_blink_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -3281,32 +3281,30 @@ static ssize_t store_cursor_blink(struct device *device,
return count;
}
-static struct device_attribute device_attrs[] = {
- __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
- __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
- __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
- store_cursor_blink),
+static DEVICE_ATTR_RW(rotate);
+static DEVICE_ATTR_WO(rotate_all);
+static DEVICE_ATTR_RW(cursor_blink);
+
+static struct attribute *fbcon_device_attrs[] = {
+ &dev_attr_rotate.attr,
+ &dev_attr_rotate_all.attr,
+ &dev_attr_cursor_blink.attr,
+ NULL,
+};
+
+static const struct attribute_group fbcon_device_attr_group = {
+ .attrs = fbcon_device_attrs,
};
static int fbcon_init_device(void)
{
- int i, error = 0;
+ int ret;
fbcon_has_sysfs = 1;
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
- error = device_create_file(fbcon_device, &device_attrs[i]);
-
- if (error)
- break;
- }
-
- if (error) {
- while (--i >= 0)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
+ ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
+ if (ret)
fbcon_has_sysfs = 0;
- }
return 0;
}
@@ -3389,11 +3387,9 @@ void __init fb_console_init(void)
static void __exit fbcon_deinit_device(void)
{
- int i;
if (fbcon_has_sysfs) {
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
- device_remove_file(fbcon_device, &device_attrs[i]);
+ device_remove_group(fb_info->dev, &fbcon_device_attr_group);
fbcon_has_sysfs = 0;
}
--
2.25.1
^ permalink raw reply related
* [PATCH 2/2] fbcon: Change return value type to void
From: oushixiong1025 @ 2025-03-11 11:28 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Thomas Zimmermann, Samuel Thibault, Zsolt Kajtar,
linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
In-Reply-To: <20250311112856.1020095-1-oushixiong1025@163.com>
From: Shixiong Ou <oushixiong@kylinos.cn>
fbcon_init_device() doesn't need to return a value.
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 51c3e8a5a092..c1692b68f69e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3296,7 +3296,7 @@ static const struct attribute_group fbcon_device_attr_group = {
.attrs = fbcon_device_attrs,
};
-static int fbcon_init_device(void)
+static void fbcon_init_device(void)
{
int ret;
@@ -3305,8 +3305,6 @@ static int fbcon_init_device(void)
ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
if (ret)
fbcon_has_sysfs = 0;
-
- return 0;
}
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
--
2.25.1
^ permalink raw reply related
* Re: [PATCH v3 2/2] mfd: lm3533: convert to use OF
From: Lee Jones @ 2025-03-11 13:40 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Svyatoslav Ryhel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Lars-Peter Clausen, Pavel Machek, Daniel Thompson, Jingoo Han,
Helge Deller, Andy Shevchenko, Uwe Kleine-König, devicetree,
linux-kernel, linux-iio, linux-leds, dri-devel, linux-fbdev
In-Reply-To: <20250308171932.2a5f0a9b@jic23-huawei>
On Sat, 08 Mar 2025, Jonathan Cameron wrote:
> On Wed, 5 Mar 2025 16:18:38 +0200
> Svyatoslav Ryhel <clamor95@gmail.com> wrote:
>
> > ср, 5 бер. 2025 р. о 15:45 Jonathan Cameron <jic23@kernel.org> пише:
> > >
> > > On Fri, 28 Feb 2025 11:30:51 +0200
> > > Svyatoslav Ryhel <clamor95@gmail.com> wrote:
> > >
> > > > пт, 28 лют. 2025 р. о 10:59 Lee Jones <lee@kernel.org> пише:
> > > > >
> > > > > On Mon, 24 Feb 2025, Svyatoslav Ryhel wrote:
> > > > >
> > > > > > Remove platform data and fully relay on OF and device tree
> > > > > > parsing and binding devices.
> > > > > >
> > > > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > > > ---
> > > > > > drivers/iio/light/lm3533-als.c | 40 ++++---
> > > > > > drivers/leds/leds-lm3533.c | 46 +++++---
> > > > > > drivers/mfd/lm3533-core.c | 159 ++++++++--------------------
> > > > > > drivers/video/backlight/lm3533_bl.c | 71 ++++++++++---
> > > > > > include/linux/mfd/lm3533.h | 35 +-----
> > > > > > 5 files changed, 164 insertions(+), 187 deletions(-)
> > > > > >
> > ...
> > > > > > /* ALS input is always high impedance in PWM-mode. */
> > > > > > - if (!pdata->pwm_mode) {
> > > > > > - ret = lm3533_als_set_resistor(als, pdata->r_select);
> > > > > > + if (!als->pwm_mode) {
> > > > > > + ret = lm3533_als_set_resistor(als, als->r_select);
> > > > >
> > > > > You're already passing 'als'.
> > > > >
> > > > > Just teach lm3533_als_set_resistor that 'r_select' is now contained.
> > > > >
> > > >
> > > > This is not scope of this patchset. I was already accused in too much
> > > > changes which make it unreadable. This patchset is dedicated to
> > > > swapping platform data to use of the device tree. NOT improving
> > > > functions, NOT rewriting arbitrary mechanics. If you feed a need for
> > > > this change, then propose a followup. I need from this driver only one
> > > > thing, that it could work with device tree. But it seems that it is
> > > > better that it just rots in the garbage bin until removed cause no one
> > > > cared.
> > >
> > > This is not an unreasonable request as you added r_select to als.
> > > Perhaps it belongs in a separate follow up patch.
> >
> > I have just moved values used in pdata to private structs of each
> > driver. Without changing names or purpose.
> >
> > > However
> > > it is worth remembering the motivation here is that you want get
> > > this code upstream, the maintainers don't have that motivation.
> >
> > This driver is already upstream and it is useless and incompatible
> > with majority of supported devices. Maintainers should encourage those
> > who try to help and instead we have what? A total discouragement. Well
> > defined path into nowhere.
>
> That is not how I read the situation. A simple request was made to
> result in more maintainable code as a direct result of that
> improvement being enabled by code changes you were making.
> I'm sorry to hear that discouraged you.
>
> >
> > >
> > > Greg KH has given various talks on the different motivations in the
> > > past. It maybe worth a watch.
> > >
> > >
> > > >
> > > > > > if (ret)
> > > > > > return ret;
> > > > > > }
> > > > > > @@ -828,22 +833,16 @@ 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;
> > > > > > + u32 val;
> > > > >
> > > > > Value of what, potatoes?
> > > > >
> > > >
> > > > Oranges.
> > >
> > > A well named variable would avoid need for any discussion of
> > > what it is the value of.
> > >
> >
> > This is temporary placeholder used to get values from the tree and
> > then pass it driver struct.
>
> Better if it is a temporary placeholder with a meaningful name.
>
> >
> > > >
> > > > > > int ret;
> > > > > >
> > > > > > lm3533 = dev_get_drvdata(pdev->dev.parent);
> > > > > > 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;
> > > > > > @@ -864,13 +863,21 @@ static int lm3533_als_probe(struct platform_device *pdev)
> > > > > >
> > > > > > platform_set_drvdata(pdev, indio_dev);
> > > > > >
> > > > > > + val = 200 * KILO; /* 200kOhm */
> > > > >
> > > > > Better to #define magic numbers; DEFAULT_{DESCRIPTION}_OHMS
> > > > >
> > > >
> > > > Why? that is not needed.
> > > If this variable had a more useful name there would be no need for
> > > the comment either.
> > >
> > > val_resitor_ohms = 200 * KILLO;
> > >
> > > or similar.
> > >
> >
> > So I have to add a "reasonably" named variable for each property I
> > want to get from device tree? Why? It seems to be a bit of overkill,
> > no? Maybe I am not aware, have variables stopped being reusable?
>
> Lets go with yes if you want a definitive answer. In reality it's
> a question of how many are needed. If 10-100s sure reuse is fine,
> if just a few sensible naming can remove the need for comments
> and improve readability.
>
> Jonathan
You clearly have more patience for this than I do! =;-)
--
Lee Jones [李琼斯]
^ permalink raw reply
* [PATCH 5.4 120/328] m68k: vga: Fix I/O defines
From: Greg Kroah-Hartman @ 2025-03-11 14:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Zimmermann, kernel test robot,
Geert Uytterhoeven, linux-fbdev, dri-devel, Helge Deller
In-Reply-To: <20250311145714.865727435@linuxfoundation.org>
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <tzimmermann@suse.de>
commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results
in conflicting defines with io_no.h for various I/O macros from the
__raw_read and __raw_write families. An example error is
In file included from arch/m68k/include/asm/vga.h:12,
from include/video/vga.h:22,
from include/linux/vgaarb.h:34,
from drivers/video/aperture.c:12:
>> arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
39 | #define __raw_readb in_8
|
In file included from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from include/linux/ftrace.h:10,
from include/linux/kprobes.h:28,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/video/aperture.c:5:
arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
16 | #define __raw_readb(addr) \
|
Include <asm/io.h>, which avoids raw_io.h on nommu platforms.
Also change the defined values of some of the read/write symbols in
vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not
generally available.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501071629.DNEswlm8-lkp@intel.com/
Fixes: 5c3f968712ce ("m68k/video: Create <asm/vga.h>")
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v3.5+
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/20250107095912.130530-1-tzimmermann@suse.de
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/m68k/include/asm/vga.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/m68k/include/asm/vga.h
+++ b/arch/m68k/include/asm/vga.h
@@ -9,7 +9,7 @@
*/
#ifndef CONFIG_PCI
-#include <asm/raw_io.h>
+#include <asm/io.h>
#include <asm/kmap.h>
/*
@@ -29,9 +29,9 @@
#define inw_p(port) 0
#define outb_p(port, val) do { } while (0)
#define outw(port, val) do { } while (0)
-#define readb raw_inb
-#define writeb raw_outb
-#define writew raw_outw
+#define readb __raw_readb
+#define writeb __raw_writeb
+#define writew __raw_writew
#endif /* CONFIG_PCI */
#endif /* _ASM_M68K_VGA_H */
^ permalink raw reply
* [PATCH 5.10 167/462] m68k: vga: Fix I/O defines
From: Greg Kroah-Hartman @ 2025-03-11 14:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Zimmermann, kernel test robot,
Geert Uytterhoeven, linux-fbdev, dri-devel, Helge Deller
In-Reply-To: <20250311145758.343076290@linuxfoundation.org>
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <tzimmermann@suse.de>
commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results
in conflicting defines with io_no.h for various I/O macros from the
__raw_read and __raw_write families. An example error is
In file included from arch/m68k/include/asm/vga.h:12,
from include/video/vga.h:22,
from include/linux/vgaarb.h:34,
from drivers/video/aperture.c:12:
>> arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
39 | #define __raw_readb in_8
|
In file included from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from include/linux/ftrace.h:10,
from include/linux/kprobes.h:28,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/video/aperture.c:5:
arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
16 | #define __raw_readb(addr) \
|
Include <asm/io.h>, which avoids raw_io.h on nommu platforms.
Also change the defined values of some of the read/write symbols in
vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not
generally available.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501071629.DNEswlm8-lkp@intel.com/
Fixes: 5c3f968712ce ("m68k/video: Create <asm/vga.h>")
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v3.5+
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/20250107095912.130530-1-tzimmermann@suse.de
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/m68k/include/asm/vga.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/m68k/include/asm/vga.h
+++ b/arch/m68k/include/asm/vga.h
@@ -9,7 +9,7 @@
*/
#ifndef CONFIG_PCI
-#include <asm/raw_io.h>
+#include <asm/io.h>
#include <asm/kmap.h>
/*
@@ -29,9 +29,9 @@
#define inw_p(port) 0
#define outb_p(port, val) do { } while (0)
#define outw(port, val) do { } while (0)
-#define readb raw_inb
-#define writeb raw_outb
-#define writew raw_outw
+#define readb __raw_readb
+#define writeb __raw_writeb
+#define writew __raw_writew
#endif /* CONFIG_PCI */
#endif /* _ASM_M68K_VGA_H */
^ permalink raw reply
* Re: (subset) [PATCH 0/9] Remove pcf50633
From: Mark Brown @ 2025-03-11 20:12 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, alexandre.belloni,
danielt, jingoohan1, deller, linus.walleij, brgl, tsbogend, linux
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <20250309193612.251929-1-linux@treblig.org>
On Sun, 09 Mar 2025 19:36:03 +0000, linux@treblig.org wrote:
> The pcf50633 was used as part of the OpenMoko devices but
> the support for its main chip was recently removed in:
> commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
>
> See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
>
> Remove it.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[6/9] regulator: pcf50633-regulator: Remove
commit: 248bc01138b11ff3af38c3b4a39cb8db7aae6eb6
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply
* Re: (subset) [PATCH v2 0/9] Remove pcf50633
From: Mark Brown @ 2025-03-11 20:12 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, alexandre.belloni,
danielt, jingoohan1, deller, linus.walleij, brgl, tsbogend, linux
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <20250311014959.743322-1-linux@treblig.org>
On Tue, 11 Mar 2025 01:49:50 +0000, linux@treblig.org wrote:
> The pcf50633 was used as part of the OpenMoko devices but
> the support for its main chip was recently removed in:
> commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
>
> See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
>
> Remove it.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[5/9] regulator: pcf50633-regulator: Remove
commit: 248bc01138b11ff3af38c3b4a39cb8db7aae6eb6
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply
* Re: (subset) [PATCH 0/9] Remove pcf50633
From: Dr. David Alan Gilbert @ 2025-03-11 21:05 UTC (permalink / raw)
To: Mark Brown
Cc: arnd, lee, dmitry.torokhov, sre, lgirdwood, alexandre.belloni,
danielt, jingoohan1, deller, linus.walleij, brgl, tsbogend,
linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <174172393659.371198.1480937233663952854.b4-ty@kernel.org>
* Mark Brown (broonie@kernel.org) wrote:
> On Sun, 09 Mar 2025 19:36:03 +0000, linux@treblig.org wrote:
> > The pcf50633 was used as part of the OpenMoko devices but
> > the support for its main chip was recently removed in:
> > commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
> >
> > See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
> >
> > Remove it.
> >
> > [...]
>
> Applied to
>
> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
>
> Thanks!
>
> [6/9] regulator: pcf50633-regulator: Remove
> commit: 248bc01138b11ff3af38c3b4a39cb8db7aae6eb6
Thanks!
Although....I'd only tested this as part of the series and assumed
someone (Lee?) would pick the lot up in one go.
Dave
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.
>
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
>
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
>
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
>
> Thanks,
> Mark
>
>
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply
* Re: (subset) [PATCH 0/9] Remove pcf50633
From: Mark Brown @ 2025-03-11 21:15 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: arnd, lee, dmitry.torokhov, sre, lgirdwood, alexandre.belloni,
danielt, jingoohan1, deller, linus.walleij, brgl, tsbogend,
linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <Z9CltdJsg_qaTKzQ@gallifrey>
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
On Tue, Mar 11, 2025 at 09:05:57PM +0000, Dr. David Alan Gilbert wrote:
> * Mark Brown (broonie@kernel.org) wrote:
> > [6/9] regulator: pcf50633-regulator: Remove
> > commit: 248bc01138b11ff3af38c3b4a39cb8db7aae6eb6
> Thanks!
> Although....I'd only tested this as part of the series and assumed
> someone (Lee?) would pick the lot up in one go.
I test things as I apply them, it really shouldn't make a difference
either way for leaf drivers. From my PoV this way it cuts down on
resends.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v2 6/9] power: supply: pcf50633: Remove charger
From: Sebastian Reichel @ 2025-03-12 7:00 UTC (permalink / raw)
To: arnd, lee, dmitry.torokhov, sre, lgirdwood, broonie,
alexandre.belloni, danielt, jingoohan1, deller, linus.walleij,
brgl, tsbogend, linux
Cc: linux-mips, linux-input, linux-pm, linux-rtc, dri-devel,
linux-fbdev, linux-gpio, linux-kernel
In-Reply-To: <20250311014959.743322-7-linux@treblig.org>
On Tue, 11 Mar 2025 01:49:56 +0000, linux@treblig.org wrote:
> The pcf50633 was used as part of the OpenMoko devices but
> the support for its main chip was recently removed in:
> commit 61b7f8920b17 ("ARM: s3c: remove all s3c24xx support")
>
> See https://lore.kernel.org/all/Z8z236h4B5A6Ki3D@gallifrey/
>
> Remove it.
>
> [...]
Applied, thanks!
[6/9] power: supply: pcf50633: Remove charger
commit: aae075a93f7705e29c599d101abc7e467125d871
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
^ permalink raw reply
* Re: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
From: kernel test robot @ 2025-03-12 10:20 UTC (permalink / raw)
To: oushixiong1025, Simona Vetter
Cc: llvm, oe-kbuild-all, Helge Deller, Thomas Zimmermann,
Samuel Thibault, Zsolt Kajtar, linux-fbdev, dri-devel,
linux-kernel, Shixiong Ou
In-Reply-To: <20250311112856.1020095-1-oushixiong1025@163.com>
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.14-rc6 next-20250311]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/oushixiong1025-163-com/fbcon-Change-return-value-type-to-void/20250311-193230
base: linus/master
patch link: https://lore.kernel.org/r/20250311112856.1020095-1-oushixiong1025%40163.com
patch subject: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
config: sparc-randconfig-001-20250312 (https://download.01.org/0day-ci/archive/20250312/202503121852.0x6J0c7a-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250312/202503121852.0x6J0c7a-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/202503121852.0x6J0c7a-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/video/fbdev/core/fbcon.c: In function 'fbcon_deinit_device':
>> drivers/video/fbdev/core/fbcon.c:3390:37: error: 'fb_info' undeclared (first use in this function)
3390 | device_remove_group(fb_info->dev, &fbcon_device_attr_group);
| ^~~~~~~
drivers/video/fbdev/core/fbcon.c:3390:37: note: each undeclared identifier is reported only once for each function it appears in
vim +/fb_info +3390 drivers/video/fbdev/core/fbcon.c
3388
3389 if (fbcon_has_sysfs) {
> 3390 device_remove_group(fb_info->dev, &fbcon_device_attr_group);
3391
3392 fbcon_has_sysfs = 0;
3393 }
3394 }
3395
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH v2 1/2] fbcon: Register sysfs groups through device_add_group
From: Shixiong Ou @ 2025-03-12 15:45 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Jocelyn Falempe, Samuel Thibault, Thomas Zimmermann,
linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
From: Shixiong Ou <oushixiong@kylinos.cn>
Use device_add_group() to simplify creation and removal.
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
v1->v2:
fix build error.
drivers/video/fbdev/core/fbcon.c | 49 ++++++++++++++------------------
1 file changed, 22 insertions(+), 27 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e8b4e8c119b5..9ee5f8492249 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3157,7 +3157,7 @@ static const struct consw fb_con = {
.con_debug_leave = fbcon_debug_leave,
};
-static ssize_t store_rotate(struct device *device,
+static ssize_t rotate_store(struct device *device,
struct device_attribute *attr, const char *buf,
size_t count)
{
@@ -3179,7 +3179,7 @@ static ssize_t store_rotate(struct device *device,
return count;
}
-static ssize_t store_rotate_all(struct device *device,
+static ssize_t rotate_all_store(struct device *device,
struct device_attribute *attr,const char *buf,
size_t count)
{
@@ -3201,7 +3201,7 @@ static ssize_t store_rotate_all(struct device *device,
return count;
}
-static ssize_t show_rotate(struct device *device,
+static ssize_t rotate_show(struct device *device,
struct device_attribute *attr,char *buf)
{
struct fb_info *info;
@@ -3220,7 +3220,7 @@ static ssize_t show_rotate(struct device *device,
return sysfs_emit(buf, "%d\n", rotate);
}
-static ssize_t show_cursor_blink(struct device *device,
+static ssize_t cursor_blink_show(struct device *device,
struct device_attribute *attr, char *buf)
{
struct fb_info *info;
@@ -3245,7 +3245,7 @@ static ssize_t show_cursor_blink(struct device *device,
return sysfs_emit(buf, "%d\n", blink);
}
-static ssize_t store_cursor_blink(struct device *device,
+static ssize_t cursor_blink_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -3279,32 +3279,30 @@ static ssize_t store_cursor_blink(struct device *device,
return count;
}
-static struct device_attribute device_attrs[] = {
- __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
- __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
- __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
- store_cursor_blink),
+static DEVICE_ATTR_RW(rotate);
+static DEVICE_ATTR_WO(rotate_all);
+static DEVICE_ATTR_RW(cursor_blink);
+
+static struct attribute *fbcon_device_attrs[] = {
+ &dev_attr_rotate.attr,
+ &dev_attr_rotate_all.attr,
+ &dev_attr_cursor_blink.attr,
+ NULL,
+};
+
+static const struct attribute_group fbcon_device_attr_group = {
+ .attrs = fbcon_device_attrs,
};
static int fbcon_init_device(void)
{
- int i, error = 0;
+ int ret;
fbcon_has_sysfs = 1;
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
- error = device_create_file(fbcon_device, &device_attrs[i]);
-
- if (error)
- break;
- }
-
- if (error) {
- while (--i >= 0)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
+ ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
+ if (ret)
fbcon_has_sysfs = 0;
- }
return 0;
}
@@ -3387,11 +3385,8 @@ void __init fb_console_init(void)
static void __exit fbcon_deinit_device(void)
{
- int i;
-
if (fbcon_has_sysfs) {
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
- device_remove_file(fbcon_device, &device_attrs[i]);
+ device_remove_group(fbcon_device, &fbcon_device_attr_group);
fbcon_has_sysfs = 0;
}
--
2.43.0
^ permalink raw reply related
* [PATCH v2 2/2] fbcon: Change return value type to void
From: Shixiong Ou @ 2025-03-12 15:45 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Jocelyn Falempe, Samuel Thibault, Thomas Zimmermann,
linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
In-Reply-To: <20250312154507.10881-1-oushixiong1025@163.com>
From: Shixiong Ou <oushixiong@kylinos.cn>
fbcon_init_device() doesn't need to return a value.
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 9ee5f8492249..619645ff4f21 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3294,7 +3294,7 @@ static const struct attribute_group fbcon_device_attr_group = {
.attrs = fbcon_device_attrs,
};
-static int fbcon_init_device(void)
+static void fbcon_init_device(void)
{
int ret;
@@ -3303,8 +3303,6 @@ static int fbcon_init_device(void)
ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
if (ret)
fbcon_has_sysfs = 0;
-
- return 0;
}
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
--
2.43.0
^ permalink raw reply related
* Re: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
From: kernel test robot @ 2025-03-12 16:19 UTC (permalink / raw)
To: oushixiong1025, Simona Vetter
Cc: llvm, oe-kbuild-all, Helge Deller, Thomas Zimmermann,
Samuel Thibault, Zsolt Kajtar, linux-fbdev, dri-devel,
linux-kernel, Shixiong Ou
In-Reply-To: <20250311112856.1020095-1-oushixiong1025@163.com>
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.14-rc6 next-20250312]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/oushixiong1025-163-com/fbcon-Change-return-value-type-to-void/20250311-193230
base: linus/master
patch link: https://lore.kernel.org/r/20250311112856.1020095-1-oushixiong1025%40163.com
patch subject: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20250312/202503122323.h75SQfrd-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project e15545cad8297ec7555f26e5ae74a9f0511203e7)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250312/202503122323.h75SQfrd-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/202503122323.h75SQfrd-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/video/fbdev/core/fbcon.c:3390:23: error: use of undeclared identifier 'fb_info'
3390 | device_remove_group(fb_info->dev, &fbcon_device_attr_group);
| ^
1 error generated.
vim +/fb_info +3390 drivers/video/fbdev/core/fbcon.c
3388
3389 if (fbcon_has_sysfs) {
> 3390 device_remove_group(fb_info->dev, &fbcon_device_attr_group);
3391
3392 fbcon_has_sysfs = 0;
3393 }
3394 }
3395
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
From: Thomas Weißschuh @ 2025-03-12 16:47 UTC (permalink / raw)
To: oushixiong1025
Cc: Simona Vetter, Helge Deller, Thomas Zimmermann, Samuel Thibault,
Zsolt Kajtar, linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
In-Reply-To: <20250311112856.1020095-1-oushixiong1025@163.com>
Hi,
On Tue, Mar 11, 2025 at 07:28:55PM +0800, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@kylinos.cn>
>
> Use device_add_group() to simplify creation and removal.
>
> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
> ---
> drivers/video/fbdev/core/fbcon.c | 48 +++++++++++++++-----------------
> 1 file changed, 22 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 07d127110ca4..51c3e8a5a092 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -3159,7 +3159,7 @@ static const struct consw fb_con = {
> .con_debug_leave = fbcon_debug_leave,
> };
>
> -static ssize_t store_rotate(struct device *device,
> +static ssize_t rotate_store(struct device *device,
> struct device_attribute *attr, const char *buf,
> size_t count)
> {
> @@ -3181,7 +3181,7 @@ static ssize_t store_rotate(struct device *device,
> return count;
> }
>
> -static ssize_t store_rotate_all(struct device *device,
> +static ssize_t rotate_all_store(struct device *device,
> struct device_attribute *attr,const char *buf,
> size_t count)
> {
> @@ -3203,7 +3203,7 @@ static ssize_t store_rotate_all(struct device *device,
> return count;
> }
>
> -static ssize_t show_rotate(struct device *device,
> +static ssize_t rotate_show(struct device *device,
> struct device_attribute *attr,char *buf)
> {
> struct fb_info *info;
> @@ -3222,7 +3222,7 @@ static ssize_t show_rotate(struct device *device,
> return sysfs_emit(buf, "%d\n", rotate);
> }
>
> -static ssize_t show_cursor_blink(struct device *device,
> +static ssize_t cursor_blink_show(struct device *device,
> struct device_attribute *attr, char *buf)
> {
> struct fb_info *info;
> @@ -3247,7 +3247,7 @@ static ssize_t show_cursor_blink(struct device *device,
> return sysfs_emit(buf, "%d\n", blink);
> }
>
> -static ssize_t store_cursor_blink(struct device *device,
> +static ssize_t cursor_blink_store(struct device *device,
> struct device_attribute *attr,
> const char *buf, size_t count)
> {
> @@ -3281,32 +3281,30 @@ static ssize_t store_cursor_blink(struct device *device,
> return count;
> }
>
> -static struct device_attribute device_attrs[] = {
> - __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
> - __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
> - __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
> - store_cursor_blink),
> +static DEVICE_ATTR_RW(rotate);
> +static DEVICE_ATTR_WO(rotate_all);
> +static DEVICE_ATTR_RW(cursor_blink);
> +
> +static struct attribute *fbcon_device_attrs[] = {
> + &dev_attr_rotate.attr,
> + &dev_attr_rotate_all.attr,
> + &dev_attr_cursor_blink.attr,
> + NULL,
No trailing commas after sentinel values.
> +};
> +
> +static const struct attribute_group fbcon_device_attr_group = {
> + .attrs = fbcon_device_attrs,
> };
>
> static int fbcon_init_device(void)
> {
> - int i, error = 0;
> + int ret;
>
> fbcon_has_sysfs = 1;
>
> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
> - error = device_create_file(fbcon_device, &device_attrs[i]);
> -
> - if (error)
> - break;
> - }
> -
> - if (error) {
> - while (--i >= 0)
> - device_remove_file(fbcon_device, &device_attrs[i]);
> -
> + ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
> + if (ret)
> fbcon_has_sysfs = 0;
> - }
>
> return 0;
> }
> @@ -3389,11 +3387,9 @@ void __init fb_console_init(void)
>
> static void __exit fbcon_deinit_device(void)
> {
> - int i;
>
> if (fbcon_has_sysfs) {
> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
> - device_remove_file(fbcon_device, &device_attrs[i]);
> + device_remove_group(fb_info->dev, &fbcon_device_attr_group);
Please at least compile-test your changes before submission.
>
> fbcon_has_sysfs = 0;
> }
All of this can be simplified even more:
* fbcon_deinit_device() can be removed easily, as the attributes are
automatically removed when the device is destroyed.
* Using device_create_with_groups() the device core will take complete care of
the attribute lifecycle, also allowing to remove fbcon_init_device()
Thomas
^ permalink raw reply
* Re: [PATCH 1/2] fbcon: Register sysfs groups through device_add_group
From: Shixiong Ou @ 2025-03-13 12:24 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Simona Vetter, Helge Deller, Thomas Zimmermann, Samuel Thibault,
Zsolt Kajtar, linux-fbdev, dri-devel, linux-kernel, Shixiong Ou
In-Reply-To: <20250312173916-23dd381c-2111-413f-8b90-6bda1faaf3d5@linutronix.de>
在 2025/3/13 00:47, Thomas Weißschuh 写道:
> Hi,
>
> On Tue, Mar 11, 2025 at 07:28:55PM +0800, oushixiong1025@163.com wrote:
>> From: Shixiong Ou <oushixiong@kylinos.cn>
>>
>> Use device_add_group() to simplify creation and removal.
>>
>> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
>> ---
>> drivers/video/fbdev/core/fbcon.c | 48 +++++++++++++++-----------------
>> 1 file changed, 22 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
>> index 07d127110ca4..51c3e8a5a092 100644
>> --- a/drivers/video/fbdev/core/fbcon.c
>> +++ b/drivers/video/fbdev/core/fbcon.c
>> @@ -3159,7 +3159,7 @@ static const struct consw fb_con = {
>> .con_debug_leave = fbcon_debug_leave,
>> };
>>
>> -static ssize_t store_rotate(struct device *device,
>> +static ssize_t rotate_store(struct device *device,
>> struct device_attribute *attr, const char *buf,
>> size_t count)
>> {
>> @@ -3181,7 +3181,7 @@ static ssize_t store_rotate(struct device *device,
>> return count;
>> }
>>
>> -static ssize_t store_rotate_all(struct device *device,
>> +static ssize_t rotate_all_store(struct device *device,
>> struct device_attribute *attr,const char *buf,
>> size_t count)
>> {
>> @@ -3203,7 +3203,7 @@ static ssize_t store_rotate_all(struct device *device,
>> return count;
>> }
>>
>> -static ssize_t show_rotate(struct device *device,
>> +static ssize_t rotate_show(struct device *device,
>> struct device_attribute *attr,char *buf)
>> {
>> struct fb_info *info;
>> @@ -3222,7 +3222,7 @@ static ssize_t show_rotate(struct device *device,
>> return sysfs_emit(buf, "%d\n", rotate);
>> }
>>
>> -static ssize_t show_cursor_blink(struct device *device,
>> +static ssize_t cursor_blink_show(struct device *device,
>> struct device_attribute *attr, char *buf)
>> {
>> struct fb_info *info;
>> @@ -3247,7 +3247,7 @@ static ssize_t show_cursor_blink(struct device *device,
>> return sysfs_emit(buf, "%d\n", blink);
>> }
>>
>> -static ssize_t store_cursor_blink(struct device *device,
>> +static ssize_t cursor_blink_store(struct device *device,
>> struct device_attribute *attr,
>> const char *buf, size_t count)
>> {
>> @@ -3281,32 +3281,30 @@ static ssize_t store_cursor_blink(struct device *device,
>> return count;
>> }
>>
>> -static struct device_attribute device_attrs[] = {
>> - __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
>> - __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
>> - __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
>> - store_cursor_blink),
>> +static DEVICE_ATTR_RW(rotate);
>> +static DEVICE_ATTR_WO(rotate_all);
>> +static DEVICE_ATTR_RW(cursor_blink);
>> +
>> +static struct attribute *fbcon_device_attrs[] = {
>> + &dev_attr_rotate.attr,
>> + &dev_attr_rotate_all.attr,
>> + &dev_attr_cursor_blink.attr,
>> + NULL,
> No trailing commas after sentinel values.
>
>> +};
>> +
>> +static const struct attribute_group fbcon_device_attr_group = {
>> + .attrs = fbcon_device_attrs,
>> };
>>
>> static int fbcon_init_device(void)
>> {
>> - int i, error = 0;
>> + int ret;
>>
>> fbcon_has_sysfs = 1;
>>
>> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
>> - error = device_create_file(fbcon_device, &device_attrs[i]);
>> -
>> - if (error)
>> - break;
>> - }
>> -
>> - if (error) {
>> - while (--i >= 0)
>> - device_remove_file(fbcon_device, &device_attrs[i]);
>> -
>> + ret = device_add_group(fbcon_device, &fbcon_device_attr_group);
>> + if (ret)
>> fbcon_has_sysfs = 0;
>> - }
>>
>> return 0;
>> }
>> @@ -3389,11 +3387,9 @@ void __init fb_console_init(void)
>>
>> static void __exit fbcon_deinit_device(void)
>> {
>> - int i;
>>
>> if (fbcon_has_sysfs) {
>> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
>> - device_remove_file(fbcon_device, &device_attrs[i]);
>> + device_remove_group(fb_info->dev, &fbcon_device_attr_group);
> Please at least compile-test your changes before submission.
>
>>
>> fbcon_has_sysfs = 0;
>> }
> All of this can be simplified even more:
>
> * fbcon_deinit_device() can be removed easily, as the attributes are
> automatically removed when the device is destroyed.
> * Using device_create_with_groups() the device core will take complete care of
> the attribute lifecycle, also allowing to remove fbcon_init_device()
Thanks for your advice, I will fix and refactor this code in the next patch.
Thanks and Regards,
Shixiong Ou.
>
> Thomas
^ permalink raw reply
* [PATCH] fbcon: Use static attribute groups for sysfs entries
From: oushixiong1025 @ 2025-03-13 12:38 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Thomas Zimmermann, Samuel Thibault, Zsolt Kajtar,
Thomas Weißschuh, linux-fbdev, dri-devel, linux-kernel,
Shixiong Ou
From: Shixiong Ou <oushixiong@kylinos.cn>
Using device_create_with_groups() to simplify creation and removal.
Same as commit 1083a7be4504 ("tty: Use static attribute groups for
sysfs entries").
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 67 +++++++++-----------------------
1 file changed, 19 insertions(+), 48 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e8b4e8c119b5..7f96b60c07f5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -160,7 +160,6 @@ static int info_idx = -1;
/* console rotation */
static int initial_rotation = -1;
-static int fbcon_has_sysfs;
static int margin_color;
static const struct consw fb_con;
@@ -3157,7 +3156,7 @@ static const struct consw fb_con = {
.con_debug_leave = fbcon_debug_leave,
};
-static ssize_t store_rotate(struct device *device,
+static ssize_t rotate_store(struct device *device,
struct device_attribute *attr, const char *buf,
size_t count)
{
@@ -3179,7 +3178,7 @@ static ssize_t store_rotate(struct device *device,
return count;
}
-static ssize_t store_rotate_all(struct device *device,
+static ssize_t rotate_all_store(struct device *device,
struct device_attribute *attr,const char *buf,
size_t count)
{
@@ -3201,7 +3200,7 @@ static ssize_t store_rotate_all(struct device *device,
return count;
}
-static ssize_t show_rotate(struct device *device,
+static ssize_t rotate_show(struct device *device,
struct device_attribute *attr,char *buf)
{
struct fb_info *info;
@@ -3220,7 +3219,7 @@ static ssize_t show_rotate(struct device *device,
return sysfs_emit(buf, "%d\n", rotate);
}
-static ssize_t show_cursor_blink(struct device *device,
+static ssize_t cursor_blink_show(struct device *device,
struct device_attribute *attr, char *buf)
{
struct fb_info *info;
@@ -3245,7 +3244,7 @@ static ssize_t show_cursor_blink(struct device *device,
return sysfs_emit(buf, "%d\n", blink);
}
-static ssize_t store_cursor_blink(struct device *device,
+static ssize_t cursor_blink_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -3279,35 +3278,18 @@ static ssize_t store_cursor_blink(struct device *device,
return count;
}
-static struct device_attribute device_attrs[] = {
- __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
- __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
- __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
- store_cursor_blink),
-};
-
-static int fbcon_init_device(void)
-{
- int i, error = 0;
+static DEVICE_ATTR_RW(rotate);
+static DEVICE_ATTR_WO(rotate_all);
+static DEVICE_ATTR_RW(cursor_blink);
- fbcon_has_sysfs = 1;
-
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
- error = device_create_file(fbcon_device, &device_attrs[i]);
-
- if (error)
- break;
- }
-
- if (error) {
- while (--i >= 0)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
- fbcon_has_sysfs = 0;
- }
+static struct attribute *fbcon_device_attrs[] = {
+ &dev_attr_rotate.attr,
+ &dev_attr_rotate_all.attr,
+ &dev_attr_cursor_blink.attr,
+ NULL
+};
- return 0;
-}
+ATTRIBUTE_GROUPS(fbcon_device);
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
static void fbcon_register_existing_fbs(struct work_struct *work)
@@ -3367,14 +3349,16 @@ void __init fb_console_init(void)
console_lock();
fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
"fbcon");
+ fbcon_device = device_create_with_groups(fb_class, NULL,
+ MKDEV(0, 0), NULL,
+ fbcon_device_groups, "fbcon");
if (IS_ERR(fbcon_device)) {
printk(KERN_WARNING "Unable to create device "
"for fbcon; errno = %ld\n",
PTR_ERR(fbcon_device));
fbcon_device = NULL;
- } else
- fbcon_init_device();
+ }
for (i = 0; i < MAX_NR_CONSOLES; i++)
con2fb_map[i] = -1;
@@ -3385,18 +3369,6 @@ void __init fb_console_init(void)
#ifdef MODULE
-static void __exit fbcon_deinit_device(void)
-{
- int i;
-
- if (fbcon_has_sysfs) {
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
- fbcon_has_sysfs = 0;
- }
-}
-
void __exit fb_console_exit(void)
{
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
@@ -3409,7 +3381,6 @@ void __exit fb_console_exit(void)
#endif
console_lock();
- fbcon_deinit_device();
device_destroy(fb_class, MKDEV(0, 0));
do_unregister_con_driver(&fb_con);
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v3 00/11] backlight, lcd, led: Remove fbdev dependencies
From: Lee Jones @ 2025-03-13 16:51 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: pavel, danielt, jingoohan1, deller, simona, linux-leds, dri-devel,
linux-fbdev
In-Reply-To: <20250306140947.580324-1-tzimmermann@suse.de>
On Thu, 06 Mar 2025, Thomas Zimmermann wrote:
> This series removes the remaining dependencies on fbdev from the
> backlight, lcd and led subsystems. Each depends on fbdev events to
> track display state. Make fbdev inform each subsystem via a dedicated
> interface instead.
>
> Patches 1 to 3 make fbdev track blank state for each display, so that
> backlight code doesn't have to.
>
> Patches 4 to 6 remove fbdev event handling from backlight code. Patches
> 7 and 8 remove fbdev event handling from lcd code and patches 9 and 10
> do the same for led's backlight trigger.
>
> The final patch removes the event constants from fbdev.
>
> With the series applied, the three subsystems do no longer depend on
> fbdev. It's also a clean up for fbdev. Fbdev used to send out a large
> number of events. That mechanism has been deprecated for some time and
> converted call to dedicated functions instead.
>
> Testing is very welcome, as I don't have the hardware to test this
> series.
>
> v3:
> - export several symbols
> - static-inline declare empty placeholders
> v2:
> - avoid IS_REACHABLE() in source file (Lee)
> - simplify several interfaces and helpers
> - use lock guards
> - initialize global lists and mutices
>
> Thomas Zimmermann (11):
> fbdev: Rework fb_blank()
> fbdev: Track display blanking state
> fbdev: Send old blank state in FB_EVENT_BLANK
> backlight: Implement fbdev tracking with blank state from event
> backlight: Move blank-state handling into helper
> backlight: Replace fb events with a dedicated function call
> backlight: lcd: Move event handling into helpers
> backlight: lcd: Replace fb events with a dedicated function call
> leds: backlight trigger: Move blank-state handling into helper
> leds: backlight trigger: Replace fb events with a dedicated function
> call
> fbdev: Remove constants of unused events
>
> drivers/leds/trigger/ledtrig-backlight.c | 48 +++++-----
> drivers/video/backlight/backlight.c | 93 +++++--------------
> drivers/video/backlight/lcd.c | 108 +++++++++--------------
> drivers/video/fbdev/core/fb_backlight.c | 12 +++
> drivers/video/fbdev/core/fb_info.c | 1 +
> drivers/video/fbdev/core/fbmem.c | 82 ++++++++++++++---
> drivers/video/fbdev/core/fbsysfs.c | 8 +-
> include/linux/backlight.h | 22 ++---
> include/linux/fb.h | 12 +--
> include/linux/lcd.h | 21 ++++-
> include/linux/leds.h | 6 ++
> 11 files changed, 205 insertions(+), 208 deletions(-)
No immediately obvious issues from the LEDs side.
Still needs reviews from Backlight and fbdev.
--
Lee Jones [李琼斯]
^ permalink raw reply
* [PATCH v2] fbcon: Use static attribute groups for sysfs entries
From: oushixiong1025 @ 2025-03-14 6:09 UTC (permalink / raw)
To: Simona Vetter
Cc: Helge Deller, Thomas Zimmermann, Samuel Thibault, Zsolt Kajtar,
Thomas Weißschuh, linux-fbdev, dri-devel, linux-kernel,
Shixiong Ou
From: Shixiong Ou <oushixiong@kylinos.cn>
Using device_create_with_groups() to simplify creation and removal.
Same as commit 1083a7be4504 ("tty: Use static attribute groups for
sysfs entries").
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 69 +++++++++-----------------------
1 file changed, 19 insertions(+), 50 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 07d127110ca4..1d792bd11063 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -160,7 +160,6 @@ static int info_idx = -1;
/* console rotation */
static int initial_rotation = -1;
-static int fbcon_has_sysfs;
static int margin_color;
static const struct consw fb_con;
@@ -3159,7 +3158,7 @@ static const struct consw fb_con = {
.con_debug_leave = fbcon_debug_leave,
};
-static ssize_t store_rotate(struct device *device,
+static ssize_t rotate_store(struct device *device,
struct device_attribute *attr, const char *buf,
size_t count)
{
@@ -3181,7 +3180,7 @@ static ssize_t store_rotate(struct device *device,
return count;
}
-static ssize_t store_rotate_all(struct device *device,
+static ssize_t rotate_all_store(struct device *device,
struct device_attribute *attr,const char *buf,
size_t count)
{
@@ -3203,7 +3202,7 @@ static ssize_t store_rotate_all(struct device *device,
return count;
}
-static ssize_t show_rotate(struct device *device,
+static ssize_t rotate_show(struct device *device,
struct device_attribute *attr,char *buf)
{
struct fb_info *info;
@@ -3222,7 +3221,7 @@ static ssize_t show_rotate(struct device *device,
return sysfs_emit(buf, "%d\n", rotate);
}
-static ssize_t show_cursor_blink(struct device *device,
+static ssize_t cursor_blink_show(struct device *device,
struct device_attribute *attr, char *buf)
{
struct fb_info *info;
@@ -3247,7 +3246,7 @@ static ssize_t show_cursor_blink(struct device *device,
return sysfs_emit(buf, "%d\n", blink);
}
-static ssize_t store_cursor_blink(struct device *device,
+static ssize_t cursor_blink_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -3281,35 +3280,18 @@ static ssize_t store_cursor_blink(struct device *device,
return count;
}
-static struct device_attribute device_attrs[] = {
- __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
- __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
- __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
- store_cursor_blink),
-};
-
-static int fbcon_init_device(void)
-{
- int i, error = 0;
+static DEVICE_ATTR_RW(rotate);
+static DEVICE_ATTR_WO(rotate_all);
+static DEVICE_ATTR_RW(cursor_blink);
- fbcon_has_sysfs = 1;
-
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
- error = device_create_file(fbcon_device, &device_attrs[i]);
-
- if (error)
- break;
- }
-
- if (error) {
- while (--i >= 0)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
- fbcon_has_sysfs = 0;
- }
+static struct attribute *fbcon_device_attrs[] = {
+ &dev_attr_rotate.attr,
+ &dev_attr_rotate_all.attr,
+ &dev_attr_cursor_blink.attr,
+ NULL
+};
- return 0;
-}
+ATTRIBUTE_GROUPS(fbcon_device);
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
static void fbcon_register_existing_fbs(struct work_struct *work)
@@ -3367,16 +3349,16 @@ void __init fb_console_init(void)
int i;
console_lock();
- fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
- "fbcon");
+ fbcon_device = device_create_with_groups(fb_class, NULL,
+ MKDEV(0, 0), NULL,
+ fbcon_device_groups, "fbcon");
if (IS_ERR(fbcon_device)) {
printk(KERN_WARNING "Unable to create device "
"for fbcon; errno = %ld\n",
PTR_ERR(fbcon_device));
fbcon_device = NULL;
- } else
- fbcon_init_device();
+ }
for (i = 0; i < MAX_NR_CONSOLES; i++)
con2fb_map[i] = -1;
@@ -3387,18 +3369,6 @@ void __init fb_console_init(void)
#ifdef MODULE
-static void __exit fbcon_deinit_device(void)
-{
- int i;
-
- if (fbcon_has_sysfs) {
- for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
- device_remove_file(fbcon_device, &device_attrs[i]);
-
- fbcon_has_sysfs = 0;
- }
-}
-
void __exit fb_console_exit(void)
{
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
@@ -3411,7 +3381,6 @@ void __exit fb_console_exit(void)
#endif
console_lock();
- fbcon_deinit_device();
device_destroy(fb_class, MKDEV(0, 0));
do_unregister_con_driver(&fb_con);
--
2.25.1
^ 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