Hi![...]
From: ChiYuan Huang <cy_huang@xxxxxxxxxxx>
Add support for RT4505 flash led controller. It can support up to 1.5A
flash current with hardware timeout and low input voltage
protection.
Please use upper-case "LED" everywhere.
This should be 2nd in the series, after DT changes.
Signed-off-by: ChiYuan Huang <cy_huang@xxxxxxxxxxx>
---
drivers/leds/Kconfig | 11 ++
drivers/leds/Makefile | 1 +
drivers/leds/leds-rt4505.c | 397 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 409 insertions(+)
create mode 100644 drivers/leds/leds-rt4505.c
+static int rt4505_torch_brightness_set(struct led_classdev *lcdev, enum led_brightness level)
+{
80 columns, where easy.
+ struct rt4505_priv *priv = container_of(lcdev, struct rt4505_priv, flash.led_cdev);
+ u32 val = 0;
+ int ret;
+
+ mutex_lock(&priv->lock);
+
+ if (level != LED_OFF) {
+ ret = regmap_update_bits(priv->regmap, RT4505_REG_ILED, RT4505_ITORCH_MASK,
+ (level - 1) << RT4505_ITORCH_SHIFT);
+ if (ret)
+ goto unlock;
+
+ val = RT4505_TORCH_SET;
+ }
+
+ ret = regmap_update_bits(priv->regmap, RT4505_REG_ENABLE, RT4505_ENABLE_MASK, val);
+
+unlock:
+ mutex_unlock(&priv->lock);
+ return ret;
+}
Why is the locking needed? What will the /sys/class/leds interface
look like on system with your flash?