Lines Matching full:leds
9 #include <linux/leds.h>
59 struct bcm63138_leds *leds; member
69 static void bcm63138_leds_write(struct bcm63138_leds *leds, unsigned int reg, in bcm63138_leds_write() argument
72 writel(data, leds->base + reg); in bcm63138_leds_write()
75 static unsigned long bcm63138_leds_read(struct bcm63138_leds *leds, in bcm63138_leds_read() argument
78 return readl(leds->base + reg); in bcm63138_leds_read()
81 static void bcm63138_leds_update_bits(struct bcm63138_leds *leds, in bcm63138_leds_update_bits() argument
86 bcm63138_leds_write(leds, reg, (bcm63138_leds_read(leds, reg) & ~mask) | (val & mask)); in bcm63138_leds_update_bits()
93 static void bcm63138_leds_set_flash_rate(struct bcm63138_leds *leds, in bcm63138_leds_set_flash_rate() argument
100 bcm63138_leds_update_bits(leds, BCM63138_FLASH_RATE_CTRL1 + reg_offset, in bcm63138_leds_set_flash_rate()
104 static void bcm63138_leds_set_bright(struct bcm63138_leds *leds, in bcm63138_leds_set_bright() argument
111 bcm63138_leds_update_bits(leds, BCM63138_BRIGHT_CTRL1 + reg_offset, in bcm63138_leds_set_bright()
115 static void bcm63138_leds_enable_led(struct bcm63138_leds *leds, in bcm63138_leds_enable_led() argument
121 bcm63138_leds_update_bits(leds, BCM63138_SW_DATA, bit, value ? bit : 0); in bcm63138_leds_enable_led()
132 struct bcm63138_leds *leds = led->leds; in bcm63138_leds_brightness_set() local
134 guard(spinlock_irqsave)(&leds->lock); in bcm63138_leds_brightness_set()
136 bcm63138_leds_enable_led(leds, led, value); in bcm63138_leds_brightness_set()
138 bcm63138_leds_set_flash_rate(leds, led, 0); in bcm63138_leds_brightness_set()
140 bcm63138_leds_set_bright(leds, led, value); in bcm63138_leds_brightness_set()
148 struct bcm63138_leds *leds = led->leds; in bcm63138_leds_blink_set() local
183 guard(spinlock_irqsave)(&leds->lock); in bcm63138_leds_blink_set()
185 bcm63138_leds_enable_led(leds, led, BCM63138_MAX_BRIGHTNESS); in bcm63138_leds_blink_set()
186 bcm63138_leds_set_flash_rate(leds, led, value); in bcm63138_leds_blink_set()
195 static void bcm63138_leds_create_led(struct bcm63138_leds *leds, in bcm63138_leds_create_led() argument
201 struct device *dev = leds->dev; in bcm63138_leds_create_led()
213 led->leds = leds; in bcm63138_leds_create_led()
244 bcm63138_leds_update_bits(leds, BCM63138_PARALLEL_LED_POLARITY, bit, in bcm63138_leds_create_led()
246 bcm63138_leds_update_bits(leds, BCM63138_HW_LED_EN, bit, 0); in bcm63138_leds_create_led()
247 bcm63138_leds_set_flash_rate(leds, led, 0); in bcm63138_leds_create_led()
248 bcm63138_leds_enable_led(leds, led, led->cdev.brightness); in bcm63138_leds_create_led()
260 struct bcm63138_leds *leds; in bcm63138_leds_probe() local
263 leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL); in bcm63138_leds_probe()
264 if (!leds) in bcm63138_leds_probe()
267 leds->dev = dev; in bcm63138_leds_probe()
269 leds->base = devm_platform_ioremap_resource(pdev, 0); in bcm63138_leds_probe()
270 if (IS_ERR(leds->base)) in bcm63138_leds_probe()
271 return PTR_ERR(leds->base); in bcm63138_leds_probe()
273 spin_lock_init(&leds->lock); in bcm63138_leds_probe()
277 bcm63138_leds_write(leds, BCM63138_SERIAL_LED_SHIFT_SEL, in bcm63138_leds_probe()
281 bcm63138_leds_write(leds, BCM63138_GLB_CTRL, in bcm63138_leds_probe()
284 bcm63138_leds_write(leds, BCM63138_HW_LED_EN, 0); in bcm63138_leds_probe()
285 bcm63138_leds_write(leds, BCM63138_SERIAL_LED_POLARITY, 0); in bcm63138_leds_probe()
286 bcm63138_leds_write(leds, BCM63138_PARALLEL_LED_POLARITY, 0); in bcm63138_leds_probe()
289 bcm63138_leds_create_led(leds, child); in bcm63138_leds_probe()
296 { .compatible = "brcm,bcm63138-leds", },
303 .name = "leds-bcm63xxx",