pdata.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 millivolts */
  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. /**
  39. * Configuration for the WM831x DC-DC BuckWise convertors. This
  40. * should be passed as driver_data in the regulator_init_data.
  41. *
  42. * Currently all the configuration is for the fast DVS switching
  43. * support of the devices. This allows MFPs on the device to be
  44. * configured as an input to switch between two output voltages,
  45. * allowing voltage transitions without the expense of an access over
  46. * I2C or SPI buses.
  47. */
  48. struct wm831x_buckv_pdata {
  49. int dvs_gpio; /** CPU GPIO to use for DVS switching */
  50. int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
  51. int dvs_init_state; /** DVS state to expect on startup */
  52. int dvs_state_gpio; /** CPU GPIO to use for monitoring status */
  53. };
  54. /* Sources for status LED configuration. Values are register values
  55. * plus 1 to allow for a zero default for preserve.
  56. */
  57. enum wm831x_status_src {
  58. WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
  59. WM831X_STATUS_OTP = 1,
  60. WM831X_STATUS_POWER = 2,
  61. WM831X_STATUS_CHARGER = 3,
  62. WM831X_STATUS_MANUAL = 4,
  63. };
  64. struct wm831x_status_pdata {
  65. enum wm831x_status_src default_src;
  66. const char *name;
  67. const char *default_trigger;
  68. };
  69. struct wm831x_touch_pdata {
  70. int fivewire; /** 1 for five wire mode, 0 for 4 wire */
  71. int isel; /** Current for pen down (uA) */
  72. int rpu; /** Pen down sensitivity resistor divider */
  73. int pressure; /** Report pressure (boolean) */
  74. unsigned int data_irq; /** Touch data ready IRQ */
  75. int data_irqf; /** IRQ flags for data ready IRQ */
  76. unsigned int pd_irq; /** Touch pendown detect IRQ */
  77. int pd_irqf; /** IRQ flags for pen down IRQ */
  78. };
  79. enum wm831x_watchdog_action {
  80. WM831X_WDOG_NONE = 0,
  81. WM831X_WDOG_INTERRUPT = 1,
  82. WM831X_WDOG_RESET = 2,
  83. WM831X_WDOG_WAKE = 3,
  84. };
  85. struct wm831x_watchdog_pdata {
  86. enum wm831x_watchdog_action primary, secondary;
  87. int update_gpio;
  88. unsigned int software:1;
  89. };
  90. #define WM831X_MAX_STATUS 2
  91. #define WM831X_MAX_DCDC 4
  92. #define WM831X_MAX_EPE 2
  93. #define WM831X_MAX_LDO 11
  94. #define WM831X_MAX_ISINK 2
  95. #define WM831X_GPIO_CONFIGURE 0x10000
  96. #define WM831X_GPIO_NUM 16
  97. struct wm831x_pdata {
  98. /** Used to distinguish multiple WM831x chips */
  99. int wm831x_num;
  100. /** Called before subdevices are set up */
  101. int (*pre_init)(struct wm831x *wm831x);
  102. /** Called after subdevices are set up */
  103. int (*post_init)(struct wm831x *wm831x);
  104. /** Put the /IRQ line into CMOS mode */
  105. bool irq_cmos;
  106. /** Disable the touchscreen */
  107. bool disable_touch;
  108. /** The driver should initiate a power off sequence during shutdown */
  109. bool soft_shutdown;
  110. int irq_base;
  111. int gpio_base;
  112. int gpio_defaults[WM831X_GPIO_NUM];
  113. struct wm831x_backlight_pdata *backlight;
  114. struct wm831x_backup_pdata *backup;
  115. struct wm831x_battery_pdata *battery;
  116. struct wm831x_touch_pdata *touch;
  117. struct wm831x_watchdog_pdata *watchdog;
  118. /** LED1 = 0 and so on */
  119. struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
  120. /** DCDC1 = 0 and so on */
  121. struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
  122. /** EPE1 = 0 and so on */
  123. struct regulator_init_data *epe[WM831X_MAX_EPE];
  124. /** LDO1 = 0 and so on */
  125. struct regulator_init_data *ldo[WM831X_MAX_LDO];
  126. /** ISINK1 = 0 and so on*/
  127. struct regulator_init_data *isink[WM831X_MAX_ISINK];
  128. };
  129. #endif