pdata.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x
  3. *
  4. * Copyright 2009 Wolfson Microelectronics PLC.
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. #ifndef __MFD_WM831X_PDATA_H__
  15. #define __MFD_WM831X_PDATA_H__
  16. struct wm831x;
  17. struct regulator_init_data;
  18. struct wm831x_backlight_pdata {
  19. int isink; /** ISINK to use, 1 or 2 */
  20. int max_uA; /** Maximum current to allow */
  21. };
  22. struct wm831x_backup_pdata {
  23. int charger_enable;
  24. int no_constant_voltage; /** Disable constant voltage charging */
  25. int vlim; /** Voltage limit in milivolts */
  26. int ilim; /** Current limit in microamps */
  27. };
  28. struct wm831x_battery_pdata {
  29. int enable; /** Enable charging */
  30. int fast_enable; /** Enable fast charging */
  31. int off_mask; /** Mask OFF while charging */
  32. int trickle_ilim; /** Trickle charge current limit, in mA */
  33. int vsel; /** Target voltage, in mV */
  34. int eoc_iterm; /** End of trickle charge current, in mA */
  35. int fast_ilim; /** Fast charge current limit, in mA */
  36. int timeout; /** Charge cycle timeout, in minutes */
  37. };
  38. /* Sources for status LED configuration. Values are register values
  39. * plus 1 to allow for a zero default for preserve.
  40. */
  41. enum wm831x_status_src {
  42. WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
  43. WM831X_STATUS_OTP = 1,
  44. WM831X_STATUS_POWER = 2,
  45. WM831X_STATUS_CHARGER = 3,
  46. WM831X_STATUS_MANUAL = 4,
  47. };
  48. struct wm831x_status_pdata {
  49. enum wm831x_status_src default_src;
  50. const char *name;
  51. const char *default_trigger;
  52. };
  53. struct wm831x_touch_pdata {
  54. int fivewire; /** 1 for five wire mode, 0 for 4 wire */
  55. int isel; /** Current for pen down (uA) */
  56. int rpu; /** Pen down sensitivity resistor divider */
  57. int pressure; /** Report pressure (boolean) */
  58. int data_irq; /** Touch data ready IRQ */
  59. };
  60. enum wm831x_watchdog_action {
  61. WM831X_WDOG_NONE = 0,
  62. WM831X_WDOG_INTERRUPT = 1,
  63. WM831X_WDOG_RESET = 2,
  64. WM831X_WDOG_WAKE = 3,
  65. };
  66. struct wm831x_watchdog_pdata {
  67. enum wm831x_watchdog_action primary, secondary;
  68. int update_gpio;
  69. unsigned int software:1;
  70. };
  71. #define WM831X_MAX_STATUS 2
  72. #define WM831X_MAX_DCDC 4
  73. #define WM831X_MAX_EPE 2
  74. #define WM831X_MAX_LDO 11
  75. #define WM831X_MAX_ISINK 2
  76. struct wm831x_pdata {
  77. /** Called before subdevices are set up */
  78. int (*pre_init)(struct wm831x *wm831x);
  79. /** Called after subdevices are set up */
  80. int (*post_init)(struct wm831x *wm831x);
  81. int irq_base;
  82. int gpio_base;
  83. struct wm831x_backlight_pdata *backlight;
  84. struct wm831x_backup_pdata *backup;
  85. struct wm831x_battery_pdata *battery;
  86. struct wm831x_touch_pdata *touch;
  87. struct wm831x_watchdog_pdata *watchdog;
  88. /** LED1 = 0 and so on */
  89. struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
  90. /** DCDC1 = 0 and so on */
  91. struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
  92. /** EPE1 = 0 and so on */
  93. struct regulator_init_data *epe[WM831X_MAX_EPE];
  94. /** LDO1 = 0 and so on */
  95. struct regulator_init_data *ldo[WM831X_MAX_LDO];
  96. /** ISINK1 = 0 and so on*/
  97. struct regulator_init_data *isink[WM831X_MAX_ISINK];
  98. };
  99. #endif