leds-an30259a.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef _LEDS_AN30259A_H
  15. #define _LEDS_AN30259A_H
  16. #include <linux/ioctl.h>
  17. #include <linux/types.h>
  18. #define LED_LIGHT_OFF 0
  19. #define LED_LIGHT_ON 1
  20. #define LED_LIGHT_PULSE 2
  21. #define LED_LIGHT_SLOPE 3
  22. /*
  23. * This struct gets passed to the ioctl call.
  24. * If only one of struct gets passed to the ioctl then it is assumed to define
  25. * the behavior for all 3 color components: R, G and B.
  26. * If 3 structs are passed, then each one is assumed to describe a single color:
  27. * R first, then G, then B.
  28. *
  29. * Requesting a color value of 0 is equivalent to requesting LED_LIGHT_OFF
  30. *
  31. * If only describing a single color (ie passing a single struct), then
  32. * start_delay will get ignored
  33. *
  34. * Other parameters may get ignored depending on the requested state:
  35. * LIGHT_ON only requires color
  36. * LIGHT_PULSE requires color, time_on and time_off
  37. *
  38. * Total time for time_slope_up_1 + time_slope_up_2 + time_on as well as for
  39. * time_slope_down_1 + time_slope_down_2 + time_off will be rounded up to the
  40. * nearest .5 seconds.
  41. *
  42. * Each of the time_slope_* values will get rounded up to the nearest multiple
  43. * of 4ms up to 7680ms
  44. */
  45. struct an30259_led_conf {
  46. const char *name;
  47. int brightness;
  48. int max_brightness;
  49. int flags;
  50. };
  51. struct an30259a_pr_control {
  52. /* LED color in RGB format */
  53. __u32 color;
  54. /* see defines above */
  55. __u32 state;
  56. /* initial delay in ms */
  57. __u16 start_delay;
  58. /* time to reach mid_brightness_up from off in ms */
  59. __u16 time_slope_up_1;
  60. /* time to reach color from mid_brightness_up in ms */
  61. __u16 time_slope_up_2;
  62. /* time at max brightness in ms */
  63. __u16 time_on;
  64. /* time to reach mid_brightness_down from max brightness in ms */
  65. __u16 time_slope_down_1;
  66. /* time to reach off from mid_brightness_down in ms */
  67. __u16 time_slope_down_2;
  68. /* time off in ms */
  69. __u16 time_off;
  70. /* mid point brightness in 1/128 increments of color */
  71. __u8 mid_brightness;
  72. } __packed;
  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. extern struct class *sec_class;
  77. #endif /* _LEDS_AN30259A_H */