summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp55xx-common.h
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-06-26 18:00:22 +0200
committerLee Jones <lee@kernel.org>2024-06-26 18:08:31 +0200
commit5a15b2ab57095a7c8597d42efbfe452844578785 (patch)
treea584c06422cbf20ccd203d52e3a45a76be80fb61 /drivers/leds/leds-lp55xx-common.h
parentleds: leds-lp55xx: Generalize sysfs engine_leds (diff)
downloadlinux-5a15b2ab57095a7c8597d42efbfe452844578785.tar.xz
linux-5a15b2ab57095a7c8597d42efbfe452844578785.zip
leds: leds-lp55xx: Generalize sysfs master_fader
Generalize sysfs master_fader since their implementation is the same across some lp55xx based LED driver. Suggested-by: Lee Jones <lee@kernel.org> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20240626160027.19703-18-ansuelsmth@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds/leds-lp55xx-common.h')
-rw-r--r--drivers/leds/leds-lp55xx-common.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h
index 5f2394a6de15..6dcffa0db647 100644
--- a/drivers/leds/leds-lp55xx-common.h
+++ b/drivers/leds/leds-lp55xx-common.h
@@ -76,6 +76,22 @@ static ssize_t store_engine##nr##_load(struct device *dev, \
} \
static LP55XX_DEV_ATTR_WO(engine##nr##_load, store_engine##nr##_load)
+#define LP55XX_DEV_ATTR_MASTER_FADER(nr) \
+static ssize_t show_master_fader##nr(struct device *dev, \
+ struct device_attribute *attr, \
+ char *buf) \
+{ \
+ return lp55xx_show_master_fader(dev, attr, buf, nr); \
+} \
+static ssize_t store_master_fader##nr(struct device *dev, \
+ struct device_attribute *attr, \
+ const char *buf, size_t len) \
+{ \
+ return lp55xx_store_master_fader(dev, attr, buf, len, nr); \
+} \
+static LP55XX_DEV_ATTR_RW(master_fader##nr, show_master_fader##nr, \
+ store_master_fader##nr)
+
struct lp55xx_led;
struct lp55xx_chip;
@@ -103,6 +119,8 @@ struct lp55xx_reg {
* @prog_mem_base : Chip specific base reg address for chip SMEM programming
* @reg_led_pwm_base : Chip specific base reg address for LED PWM conf
* @reg_led_current_base : Chip specific base reg address for LED current conf
+ * @reg_master_fader_base : Chip specific base reg address for master fader base
+ * @reg_led_ctrl_base : Chip specific base reg address for LED ctrl base
* @pages_per_engine : Assigned pages for each engine
* (if not set chip doesn't support pages)
* @max_channel : Maximum number of channels
@@ -123,6 +141,8 @@ struct lp55xx_device_config {
const struct lp55xx_reg prog_mem_base;
const struct lp55xx_reg reg_led_pwm_base;
const struct lp55xx_reg reg_led_current_base;
+ const struct lp55xx_reg reg_master_fader_base;
+ const struct lp55xx_reg reg_led_ctrl_base;
const int pages_per_engine;
const int max_channel;
@@ -244,5 +264,17 @@ extern ssize_t lp55xx_show_engine_leds(struct device *dev,
extern ssize_t lp55xx_store_engine_leds(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len, int nr);
+extern ssize_t lp55xx_show_master_fader(struct device *dev,
+ struct device_attribute *attr,
+ char *buf, int nr);
+extern ssize_t lp55xx_store_master_fader(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len, int nr);
+extern ssize_t lp55xx_show_master_fader_leds(struct device *dev,
+ struct device_attribute *attr,
+ char *buf);
+extern ssize_t lp55xx_store_master_fader_leds(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len);
#endif /* _LEDS_LP55XX_COMMON_H */