xref: /rk3399_rockchip-uboot/drivers/misc/twl4030_led.c (revision 326ea986ac150acdc7656d57fca647db80b50158)
12c155130STom Rix /*
22c155130STom Rix  * Copyright (c) 2009 Wind River Systems, Inc.
32c155130STom Rix  * Tom Rix <Tom.Rix at windriver.com>
42c155130STom Rix  *
5*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
62c155130STom Rix  *
72c155130STom Rix  * twl4030_led_init is from cpu/omap3/common.c, power_init_r
82c155130STom Rix  *
92c155130STom Rix  * (C) Copyright 2004-2008
102c155130STom Rix  * Texas Instruments, <www.ti.com>
112c155130STom Rix  *
122c155130STom Rix  * Author :
132c155130STom Rix  *	Sunil Kumar <sunilsaini05 at gmail.com>
142c155130STom Rix  *	Shashi Ranjan <shashiranjanmca05 at gmail.com>
152c155130STom Rix  *
162c155130STom Rix  * Derived from Beagle Board and 3430 SDP code by
172c155130STom Rix  *	Richard Woodruff <r-woodruff2 at ti.com>
182c155130STom Rix  *	Syed Mohammed Khasim <khasim at ti.com>
192c155130STom Rix  */
202c155130STom Rix 
212c155130STom Rix #include <twl4030.h>
222c155130STom Rix 
twl4030_led_init(unsigned char ledon_mask)23ead39d7aSGrazvydas Ignotas void twl4030_led_init(unsigned char ledon_mask)
242c155130STom Rix {
25ead39d7aSGrazvydas Ignotas 	/* LEDs need to have corresponding PWMs enabled */
26ead39d7aSGrazvydas Ignotas 	if (ledon_mask & TWL4030_LED_LEDEN_LEDAON)
27ead39d7aSGrazvydas Ignotas 		ledon_mask |= TWL4030_LED_LEDEN_LEDAPWM;
28ead39d7aSGrazvydas Ignotas 	if (ledon_mask & TWL4030_LED_LEDEN_LEDBON)
29ead39d7aSGrazvydas Ignotas 		ledon_mask |= TWL4030_LED_LEDEN_LEDBPWM;
302c155130STom Rix 
310208aaf6SNishanth Menon 	twl4030_i2c_write_u8(TWL4030_CHIP_LED, TWL4030_LED_LEDEN,
320208aaf6SNishanth Menon 			     ledon_mask);
332c155130STom Rix 
342c155130STom Rix }
35