From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Tom Rini" <trini@konsulko.com>, "Simon Glass" <sjg@chromium.org>,
"Alexander Gendin" <agendin@matrox.com>,
"Caleb Connolly" <caleb.connolly@linaro.org>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Kever Yang" <kever.yang@rock-chips.com>,
"Marek Behún" <kabel@kernel.org>, "Stefan Roese" <sr@denx.de>,
"Wan Yee Lau" <wan.yee.lau@intel.com>
Subject: [PATCH 13/27] pca9551_led: Delete driver
Date: Thu, 26 Sep 2024 22:44:33 +0200 [thread overview]
Message-ID: <20240926204455.963584-14-sjg@chromium.org> (raw)
In-Reply-To: <20240926204455.963584-1-sjg@chromium.org>
This driver is not used anymore. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/misc/Kconfig | 13 ---
drivers/misc/Makefile | 1 -
drivers/misc/pca9551_led.c | 170 -------------------------------------
3 files changed, 184 deletions(-)
delete mode 100644 drivers/misc/pca9551_led.c
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 6009d55f400..23eb509d974 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -446,19 +446,6 @@ config SPL_PWRSEQ
device. When the device is started up, its power sequence can be
initiated.
-config PCA9551_LED
- bool "Enable PCA9551 LED driver"
- help
- Enable driver for PCA9551 LED controller. This controller
- is connected via I2C. So I2C needs to be enabled.
-
-config PCA9551_I2C_ADDR
- hex "I2C address of PCA9551 LED controller"
- depends on PCA9551_LED
- default 0x60
- help
- The I2C address of the PCA9551 LED controller.
-
config STM32MP_FUSE
bool "Enable STM32MP fuse wrapper providing the fuse API"
depends on ARCH_STM32MP && MISC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c4941377b7d..03d87ef8a0e 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -57,7 +57,6 @@ obj-$(CONFIG_NPCM_OTP) += npcm_otp.o
obj-$(CONFIG_NPCM_HOST) += npcm_host_intf.o
obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o
obj-$(CONFIG_P2SB) += p2sb-uclass.o
-obj-$(CONFIG_PCA9551_LED) += pca9551_led.o
obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o
ifdef CONFIG_QFW
obj-y += qfw.o
diff --git a/drivers/misc/pca9551_led.c b/drivers/misc/pca9551_led.c
deleted file mode 100644
index 040d0d5cf48..00000000000
--- a/drivers/misc/pca9551_led.c
+++ /dev/null
@@ -1,170 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2015 Stefan Roese <sr@denx.de>
- */
-
-#include <errno.h>
-#include <i2c.h>
-#include <status_led.h>
-
-#ifndef CONFIG_PCA9551_I2C_ADDR
-#error "CONFIG_PCA9551_I2C_ADDR not defined!"
-#endif
-
-#define PCA9551_REG_INPUT 0x00 /* Input register (read only) */
-#define PCA9551_REG_PSC0 0x01 /* Frequency prescaler 0 */
-#define PCA9551_REG_PWM0 0x02 /* PWM0 */
-#define PCA9551_REG_PSC1 0x03 /* Frequency prescaler 1 */
-#define PCA9551_REG_PWM1 0x04 /* PWM1 */
-#define PCA9551_REG_LS0 0x05 /* LED0 to LED3 selector */
-#define PCA9551_REG_LS1 0x06 /* LED4 to LED7 selector */
-
-#define PCA9551_CTRL_AI (1 << 4) /* Auto-increment flag */
-
-#define PCA9551_LED_STATE_ON 0x00
-#define PCA9551_LED_STATE_OFF 0x01
-#define PCA9551_LED_STATE_BLINK0 0x02
-#define PCA9551_LED_STATE_BLINK1 0x03
-
-struct pca9551_blink_rate {
- u8 psc; /* Frequency preescaler, see PCA9551_7.pdf p. 6 */
- u8 pwm; /* Pulse width modulation, see PCA9551_7.pdf p. 6 */
-};
-
-static int freq_last = -1;
-static int mask_last = -1;
-static int idx_last = -1;
-static int mode_last;
-
-static int pca9551_led_get_state(int led, int *state)
-{
- unsigned int reg;
- u8 shift, buf;
- int ret;
-
- if (led < 0 || led > 7) {
- return -EINVAL;
- } else if (led < 4) {
- reg = PCA9551_REG_LS0;
- shift = led << 1;
- } else {
- reg = PCA9551_REG_LS1;
- shift = (led - 4) << 1;
- }
-
- ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- *state = (buf >> shift) & 0x03;
- return 0;
-}
-
-static int pca9551_led_set_state(int led, int state)
-{
- unsigned int reg;
- u8 shift, buf, mask;
- int ret;
-
- if (led < 0 || led > 7) {
- return -EINVAL;
- } else if (led < 4) {
- reg = PCA9551_REG_LS0;
- shift = led << 1;
- } else {
- reg = PCA9551_REG_LS1;
- shift = (led - 4) << 1;
- }
- mask = 0x03 << shift;
-
- ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- buf = (buf & ~mask) | ((state & 0x03) << shift);
-
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- return 0;
-}
-
-static int pca9551_led_set_blink_rate(int idx, struct pca9551_blink_rate rate)
-{
- unsigned int reg;
- int ret;
-
- switch (idx) {
- case 0:
- reg = PCA9551_REG_PSC0;
- break;
- case 1:
- reg = PCA9551_REG_PSC1;
- break;
- default:
- return -EINVAL;
- }
- reg |= PCA9551_CTRL_AI;
-
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, (u8 *)&rate, 2);
- if (ret)
- return ret;
-
- return 0;
-}
-
-/*
- * Functions referenced by cmd_led.c or status_led.c
- */
-void __led_init(led_id_t id, int state)
-{
-}
-
-void __led_set(led_id_t mask, int state)
-{
- if (state == CONFIG_LED_STATUS_OFF)
- pca9551_led_set_state(mask, PCA9551_LED_STATE_OFF);
- else
- pca9551_led_set_state(mask, PCA9551_LED_STATE_ON);
-}
-
-void __led_toggle(led_id_t mask)
-{
- int state = 0;
-
- pca9551_led_get_state(mask, &state);
- pca9551_led_set_state(mask, !state);
-}
-
-void __led_blink(led_id_t mask, int freq)
-{
- struct pca9551_blink_rate rate;
- int mode;
- int idx;
-
- if ((freq == freq_last) || (mask == mask_last)) {
- idx = idx_last;
- mode = mode_last;
- } else {
- /* Toggle blink index */
- if (idx_last == 0) {
- idx = 1;
- mode = PCA9551_LED_STATE_BLINK1;
- } else {
- idx = 0;
- mode = PCA9551_LED_STATE_BLINK0;
- }
-
- idx_last = idx;
- mode_last = mode;
- }
- freq_last = freq;
- mask_last = mask;
-
- rate.psc = ((freq * 38) / 1000) - 1;
- rate.pwm = 128; /* 50% duty cycle */
-
- pca9551_led_set_blink_rate(idx, rate);
- pca9551_led_set_state(mask, mode);
-}
--
2.43.0
next prev parent reply other threads:[~2024-09-26 20:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 20:44 [PATCH 00/27] led: Remove old status-LED code Simon Glass
2024-09-26 20:44 ` [PATCH 01/27] led: Drop LED_STATUS_BOARD_SPECIFIC Simon Glass
2024-09-26 20:44 ` [PATCH 02/27] arm: Drop old LED support Simon Glass
2024-09-26 20:44 ` [PATCH 03/27] common: doc: " Simon Glass
2024-09-26 20:44 ` [PATCH 04/27] st: stm32f429: Drop old LED code Simon Glass
2024-09-26 20:44 ` [PATCH 05/27] led: Make the LED config common Simon Glass
2024-09-26 20:44 ` [PATCH 06/27] eb_cpu5282: Drop STATUS_LED Simon Glass
2024-09-26 20:44 ` [PATCH 07/27] mx23_olinuxino: " Simon Glass
2024-09-26 20:44 ` [PATCH 08/27] pinephone: " Simon Glass
2024-09-26 20:44 ` [PATCH 09/27] socfpga_vining_fpga: " Simon Glass
2024-09-26 20:44 ` [PATCH 10/27] led: Drop LED_STATUS from Kconfig Simon Glass
2024-09-26 20:44 ` [PATCH 11/27] led: Drop the legacy LED command Simon Glass
2024-09-26 20:44 ` [PATCH 12/27] misc: Drop gpio_led driver Simon Glass
2024-09-26 20:44 ` Simon Glass [this message]
2024-09-26 20:44 ` [PATCH 14/27] misc: status_led: Delete driver Simon Glass
2024-09-26 20:44 ` [PATCH 15/27] m68k: Drop unused status_led.h header file Simon Glass
2024-10-01 7:21 ` Acked Angelo Dureghello
2024-09-26 20:44 ` [PATCH 16/27] powerpc: Drop status-LED code Simon Glass
2024-09-26 20:44 ` [PATCH 17/27] eb_cpu5282: " Simon Glass
2024-09-26 20:44 ` [PATCH 18/27] igep00x0: Drop unused status_led.h header file Simon Glass
2024-09-26 21:30 ` Javier Martinez Canillas
2024-09-26 20:44 ` [PATCH 19/27] mx23_olinuxino: Drop status-LED code Simon Glass
2024-09-26 21:39 ` Marek Vasut
2024-09-26 22:10 ` Simon Glass
2024-09-26 22:19 ` Marek Vasut
2024-09-27 10:43 ` Simon Glass
2024-09-27 10:51 ` Marek Vasut
2024-09-26 20:44 ` [PATCH 20/27] vining_fpga: " Simon Glass
2024-09-26 20:44 ` [PATCH 21/27] sunxi: " Simon Glass
2024-09-26 20:44 ` [PATCH 22/27] common: Drop status-LED code in board_r Simon Glass
2024-09-26 20:44 ` [PATCH 23/27] image: Drop unused status_led.h header file Simon Glass
2024-09-26 20:44 ` [PATCH 24/27] ide: " Simon Glass
2024-09-26 20:44 ` [PATCH 25/27] mpc83xx: Drop status-LED code Simon Glass
2024-09-26 20:44 ` [PATCH 26/27] net: " Simon Glass
2024-09-26 20:44 ` [PATCH 27/27] led: Drop status_led header file Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240926204455.963584-14-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=agendin@matrox.com \
--cc=caleb.connolly@linaro.org \
--cc=jonas@kwiboo.se \
--cc=kabel@kernel.org \
--cc=kever.yang@rock-chips.com \
--cc=sr@denx.de \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=wan.yee.lau@intel.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox