Lines Matching refs:leds

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