xref: /rk3399_rockchip-uboot/drivers/misc/twl4030_led.c (revision ead39d7aa3ddccb2e374217aeab23bd65cedb762)
12c155130STom Rix /*
22c155130STom Rix  * Copyright (c) 2009 Wind River Systems, Inc.
32c155130STom Rix  * Tom Rix <Tom.Rix at windriver.com>
42c155130STom Rix  *
52c155130STom Rix  * This program is free software; you can redistribute it and/or
62c155130STom Rix  * modify it under the terms of the GNU General Public License as
72c155130STom Rix  * published by the Free Software Foundation; either version 2 of
82c155130STom Rix  * the License, or (at your option) any later version.
92c155130STom Rix  *
102c155130STom Rix  * This program is distributed in the hope that it will be useful,
112c155130STom Rix  * but WITHOUT ANY WARRANTY; without even the implied warranty of
122c155130STom Rix  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132c155130STom Rix  * GNU General Public License for more details.
142c155130STom Rix  *
152c155130STom Rix  * You should have received a copy of the GNU General Public License
162c155130STom Rix  * along with this program; if not, write to the Free Software
172c155130STom Rix  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
182c155130STom Rix  * MA 02111-1307 USA
192c155130STom Rix  *
202c155130STom Rix  * twl4030_led_init is from cpu/omap3/common.c, power_init_r
212c155130STom Rix  *
222c155130STom Rix  * (C) Copyright 2004-2008
232c155130STom Rix  * Texas Instruments, <www.ti.com>
242c155130STom Rix  *
252c155130STom Rix  * Author :
262c155130STom Rix  *	Sunil Kumar <sunilsaini05 at gmail.com>
272c155130STom Rix  *	Shashi Ranjan <shashiranjanmca05 at gmail.com>
282c155130STom Rix  *
292c155130STom Rix  * Derived from Beagle Board and 3430 SDP code by
302c155130STom Rix  *	Richard Woodruff <r-woodruff2 at ti.com>
312c155130STom Rix  *	Syed Mohammed Khasim <khasim at ti.com>
322c155130STom Rix  *
332c155130STom Rix  */
342c155130STom Rix 
352c155130STom Rix #include <twl4030.h>
362c155130STom Rix 
37*ead39d7aSGrazvydas Ignotas void twl4030_led_init(unsigned char ledon_mask)
382c155130STom Rix {
39*ead39d7aSGrazvydas Ignotas 	/* LEDs need to have corresponding PWMs enabled */
40*ead39d7aSGrazvydas Ignotas 	if (ledon_mask & TWL4030_LED_LEDEN_LEDAON)
41*ead39d7aSGrazvydas Ignotas 		ledon_mask |= TWL4030_LED_LEDEN_LEDAPWM;
42*ead39d7aSGrazvydas Ignotas 	if (ledon_mask & TWL4030_LED_LEDEN_LEDBON)
43*ead39d7aSGrazvydas Ignotas 		ledon_mask |= TWL4030_LED_LEDEN_LEDBPWM;
442c155130STom Rix 
45*ead39d7aSGrazvydas Ignotas 	twl4030_i2c_write_u8(TWL4030_CHIP_LED, ledon_mask,
462c155130STom Rix 			     TWL4030_LED_LEDEN);
472c155130STom Rix 
482c155130STom Rix }
49