Re: [PATCH V3 2/2] leds: bcm63138: add support for BCM63138 controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> From: Rafał Miłecki <rafal@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>

> 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.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux