Home | History | Annotate | Download | only in linux
      1 /*
      2  * Copyright (C) 2011 Samsung Electronics Co. Ltd. All Rights Reserved.
      3  *
      4  * This software is licensed under the terms of the GNU General Public
      5  * License version 2, as published by the Free Software Foundation, and
      6  * may be copied, distributed, and modified under those terms.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  */
     14 
     15 #ifndef _LEDS_AN30259A_H
     16 #define _LEDS_AN30259A_H
     17 
     18 #include <linux/ioctl.h>
     19 #include <linux/types.h>
     20 
     21 #define LED_LIGHT_OFF	0
     22 #define LED_LIGHT_ON	1
     23 #define LED_LIGHT_PULSE	2
     24 #define LED_LIGHT_SLOPE	3
     25 
     26 /*
     27  * This struct gets passed to the ioctl call.
     28  * If only one of struct gets passed to the ioctl then it is assumed to define
     29  * the behavior for all 3 color components: R, G and B.
     30  * If 3 structs are passed, then each one is assumed to describe a single color:
     31  * R first, then G, then B.
     32  *
     33  * Requesting a color value of 0 is equivalent to requesting LED_LIGHT_OFF
     34  *
     35  * If only describing a single color (ie passing a single struct), then
     36  * start_delay will get ignored
     37  *
     38  * Other parameters may get ignored depending on the requested state:
     39  * LIGHT_ON only requires color
     40  * LIGHT_PULSE requires color, time_on and time_off
     41  *
     42  * Total time for time_slope_up_1 + time_slope_up_2 + time_on as well as for
     43  * time_slope_down_1 + time_slope_down_2 + time_off will be rounded up to the
     44  * nearest .5 seconds.
     45  *
     46  * Each of the time_slope_* values will get rounded up to the nearest multiple
     47  * of 4ms up to 7680ms
     48  */
     49 
     50 struct an30259a_pr_control {
     51 	/* LED color in RGB format */
     52 	__u32			color;
     53 	/* see defines above */
     54 	__u32			state;
     55 	/* initial delay in ms */
     56 	__u16			start_delay;
     57 	/* time to reach mid_brightness_up from off in ms */
     58 	__u16			time_slope_up_1;
     59 	/* time to reach color from mid_brightness_up in ms */
     60 	__u16			time_slope_up_2;
     61 	/* time at max brightness in ms */
     62 	__u16			time_on;
     63 	/* time to reach mid_brightness_down from max brightness in ms */
     64 	__u16			time_slope_down_1;
     65 	/* time to reach off from mid_brightness_down in ms */
     66 	__u16			time_slope_down_2;
     67 	/* time off in ms */
     68 	__u16			time_off;
     69 	/* mid point brightness in 1/128 increments of color */
     70 	__u8			mid_brightness;
     71 } __packed;
     72 
     73 #define AN30259A_PR_SET_LED	_IOW('S', 42, struct an30259a_pr_control)
     74 #define AN30259A_PR_SET_LEDS	_IOW('S', 43, struct an30259a_pr_control[3])
     75 #define AN30259A_PR_SET_IMAX	_IOW('S', 44, __u8)
     76 #endif						/* _LEDS_AN30259A_H */
     77