[PATCH V3 2/2] leds: bcm63138: add support for BCM63138 controller
Pavel Machek
pavel at ucw.cz
Sun Jul 17 04:41:41 PDT 2022
Hi!
> From: Rafał Miłecki <rafal at milecki.pl>
>
> It's a new controller first introduced in BCM63138 SoC. Later it was
> also used in BCM4908, some BCM68xx and some BCM63xxx SoCs.
>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> diff --git a/drivers/leds/blink/Kconfig b/drivers/leds/blink/Kconfig
> index 59ba81e40e85..c680af01b5a9 100644
> --- a/drivers/leds/blink/Kconfig
> +++ b/drivers/leds/blink/Kconfig
> @@ -1,3 +1,15 @@
> +config LEDS_BCM63138
> + tristate "LED Support for Broadcom BCM63138 SoC"
> + depends on LEDS_CLASS
> + depends on ARCH_BCM4908 || ARCH_BCM_5301X || BCM63XX || COMPILE_TEST
> + depends on HAS_IOMEM
> + depends on OF
> + default ARCH_BCM4908
> + help
> + This option enables support for LED controller that is part of
> + BCM63138 SoC. The same hardware block is known to be also used
> + in BCM4908, BCM6848, BCM6858, BCM63148, BCM63381 and BCM68360.
...the module will be called..?
> +#define BCM63138_MAX_LEDS 32
> +#define BCM63138_MAX_BRIGHTNESS 9
> +
> +#define BCM63138_LED_BITS 4 /* how many bits control a single LED */
> +#define BCM63138_LED_MASK ((1 << BCM63138_LED_BITS) - 1) /* 0xf */
> +#define BCM63138_LEDS_PER_REG (32 / BCM63138_LED_BITS) /* 8 */
> +
80 columns would not hurt.
> +static void bcm63138_leds_set_flash_rate(struct bcm63138_leds *leds,
> + struct bcm63138_led *led,
> + u8 value)
> +{
> + int reg_offset = (led->pin >> fls((BCM63138_LEDS_PER_REG - 1))) * 4;
The fls() dance is "interesting".
> +static void bcm63138_leds_enable_led(struct bcm63138_leds *leds,
> + struct bcm63138_led *led,
> + enum led_brightness value)
> +{
> + u32 bit = BIT(led->pin);
> +
> + bcm63138_leds_update_bits(leds, BCM63138_SW_DATA, bit,
> + value == LED_OFF ? 0 : bit);
> +}
I'd do "! value". We'll want to deprecate LED_OFF. (And you do that below).
Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220717/6f58eeeb/attachment.sig>
More information about the linux-arm-kernel
mailing list