blob: 11ef9f203521e5c07f331daf4e460bbb3bee5d38 [file] [log] [blame]
Deepa Dinamanief31e952012-02-10 10:34:07 -08001/*
Duy Truongf3ac7b32013-02-13 01:07:28 -08002 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
Deepa Dinamanief31e952012-02-10 10:34:07 -08003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
Duy Truongf3ac7b32013-02-13 01:07:28 -080013 * * Neither the name of The Linux Foundation nor the names of its
Deepa Dinamanief31e952012-02-10 10:34:07 -080014 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
Deepa Dinamani0bb64ff2011-12-06 10:45:44 -080030#include<dev/pm8921_leds.h>
31#include<dev/pm8921.h>
32
33void led_tests()
34{
35uint32_t duty_us, period_us;
36
37 /* 50% Duty cycle */
38 duty_us = 500000;
39 period_us = 1000000;
40
41 /* Configure PM8921_ID_LED_0 from PWM2*/
42 pm8921_config_led_current(PM8921_ID_LED_0, 2, PWM2, 1);
43
44 /* PWM2 for PM8921_ID_LED_0 is LPG 5
45 * Configure and enable lpg5
46 */
47 pm_set_pwm_config(5, duty_us, period_us, &pmic);
48 pm_pwm_channel_enable(5, &pmic);
49
50 /* Configure and enable lpg0 for panel backlight*/
51 pm_set_pwm_config(0, duty_us, period_us, &pmic);
52 pm_pwm_channel_enable(0, &pmic);
53
54 mdelay(10000);
55
56 /* Configure PM8921_ID_LED_1 also from PWM2*/
57 pm8921_config_led_current(PM8921_ID_LED_1, 2, PWM2, 1);
58 mdelay(10000);
59
60 /* Disable PM8921_ID_LED_0 */
61 pm8921_config_led_current(PM8921_ID_LED_0, 2, 2, 0);
62
63 /* Turn on GPIO 24 through LPG 0
64 * Will be reconfigured during display_init
65 */
66 panel_backlight_on_pwm();
67
68 mdelay(10000);
69
70 /* Disable PM8921_ID_LED_1 */
71 pm8921_config_led_current(PM8921_ID_LED_1, 2, 2, 0);
72}