leds-lp5521.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * LP5521 LED chip driver.
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. *
  6. * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. */
  22. #ifndef __LINUX_LP5521_H
  23. #define __LINUX_LP5521_H
  24. /* See Documentation/leds/leds-lp5521.txt */
  25. struct lp5521_led_config {
  26. char *name;
  27. u8 chan_nr;
  28. u8 led_current; /* mA x10, 0 if led is not connected */
  29. u8 max_current;
  30. };
  31. #define LP5521_CLOCK_AUTO 0
  32. #define LP5521_CLOCK_INT 1
  33. #define LP5521_CLOCK_EXT 2
  34. /* Bits in CONFIG register */
  35. #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
  36. #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
  37. #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
  38. #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
  39. #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
  40. #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
  41. #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
  42. #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
  43. #define LP5521_CLK_INT 1 /* Internal clock */
  44. #define LP5521_CLK_AUTO 2 /* Automatic clock selection */
  45. struct lp5521_platform_data {
  46. struct lp5521_led_config *led_config;
  47. u8 num_channels;
  48. u8 clock_mode;
  49. int (*setup_resources)(void);
  50. void (*release_resources)(void);
  51. void (*enable)(bool state);
  52. const char *label;
  53. u8 update_config;
  54. };
  55. #endif /* __LINUX_LP5521_H */