Lines Matching refs:leds

7 #include <linux/leds.h>
54 struct bcm63138_leds *leds;
64 static void bcm63138_leds_write(struct bcm63138_leds *leds, unsigned int reg,
67 writel(data, leds->base + reg);
70 static unsigned long bcm63138_leds_read(struct bcm63138_leds *leds,
73 return readl(leds->base + reg);
76 static void bcm63138_leds_update_bits(struct bcm63138_leds *leds,
81 bcm63138_leds_write(leds, reg, (bcm63138_leds_read(leds, reg) & ~mask) | (val & mask));
88 static void bcm63138_leds_set_flash_rate(struct bcm63138_leds *leds,
95 bcm63138_leds_update_bits(leds, BCM63138_FLASH_RATE_CTRL1 + reg_offset,
99 static void bcm63138_leds_set_bright(struct bcm63138_leds *leds,
106 bcm63138_leds_update_bits(leds, BCM63138_BRIGHT_CTRL1 + reg_offset,
110 static void bcm63138_leds_enable_led(struct bcm63138_leds *leds,
116 bcm63138_leds_update_bits(leds, BCM63138_SW_DATA, bit, value ? bit : 0);
127 struct bcm63138_leds *leds = led->leds;
130 spin_lock_irqsave(&leds->lock, flags);
132 bcm63138_leds_enable_led(leds, led, value);
134 bcm63138_leds_set_flash_rate(leds, led, 0);
136 bcm63138_leds_set_bright(leds, led, value);
138 spin_unlock_irqrestore(&leds->lock, flags);
146 struct bcm63138_leds *leds = led->leds;
182 spin_lock_irqsave(&leds->lock, flags);
184 bcm63138_leds_enable_led(leds, led, BCM63138_MAX_BRIGHTNESS);
185 bcm63138_leds_set_flash_rate(leds, led, value);
187 spin_unlock_irqrestore(&leds->lock, flags);
196 static void bcm63138_leds_create_led(struct bcm63138_leds *leds,
202 struct device *dev = leds->dev;
214 led->leds = leds;
245 bcm63138_leds_update_bits(leds, BCM63138_PARALLEL_LED_POLARITY, bit,
247 bcm63138_leds_update_bits(leds, BCM63138_HW_LED_EN, bit, 0);
248 bcm63138_leds_set_flash_rate(leds, led, 0);
249 bcm63138_leds_enable_led(leds, led, led->cdev.brightness);
261 struct bcm63138_leds *leds;
264 leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL);
265 if (!leds)
268 leds->dev = dev;
270 leds->base = devm_platform_ioremap_resource(pdev, 0);
271 if (IS_ERR(leds->base))
272 return PTR_ERR(leds->base);
274 spin_lock_init(&leds->lock);
276 bcm63138_leds_write(leds, BCM63138_GLB_CTRL,
279 bcm63138_leds_write(leds, BCM63138_HW_LED_EN, 0);
280 bcm63138_leds_write(leds, BCM63138_SERIAL_LED_POLARITY, 0);
281 bcm63138_leds_write(leds, BCM63138_PARALLEL_LED_POLARITY, 0);
284 bcm63138_leds_create_led(leds, child);
291 { .compatible = "brcm,bcm63138-leds", },
298 .name = "leds-bcm63xxx",