xref: /openbmc/u-boot/drivers/misc/twl4030_led.c (revision 4e3349b6)
1 /*
2  * Copyright (c) 2009 Wind River Systems, Inc.
3  * Tom Rix <Tom.Rix at windriver.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA
19  *
20  * twl4030_led_init is from cpu/omap3/common.c, power_init_r
21  *
22  * (C) Copyright 2004-2008
23  * Texas Instruments, <www.ti.com>
24  *
25  * Author :
26  *	Sunil Kumar <sunilsaini05 at gmail.com>
27  *	Shashi Ranjan <shashiranjanmca05 at gmail.com>
28  *
29  * Derived from Beagle Board and 3430 SDP code by
30  *	Richard Woodruff <r-woodruff2 at ti.com>
31  *	Syed Mohammed Khasim <khasim at ti.com>
32  *
33  */
34 
35 #include <twl4030.h>
36 
37 void twl4030_led_init(unsigned char ledon_mask)
38 {
39 	/* LEDs need to have corresponding PWMs enabled */
40 	if (ledon_mask & TWL4030_LED_LEDEN_LEDAON)
41 		ledon_mask |= TWL4030_LED_LEDEN_LEDAPWM;
42 	if (ledon_mask & TWL4030_LED_LEDEN_LEDBON)
43 		ledon_mask |= TWL4030_LED_LEDEN_LEDBPWM;
44 
45 	twl4030_i2c_write_u8(TWL4030_CHIP_LED, ledon_mask,
46 			     TWL4030_LED_LEDEN);
47 
48 }
49