Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 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 | |
| 15 | #ifndef __MFD_WM831X_PDATA_H__ |
| 16 | #define __MFD_WM831X_PDATA_H__ |
| 17 | |
| 18 | struct wm831x; |
| 19 | struct regulator_init_data; |
| 20 | |
Mark Brown | 63aed85 | 2009-07-27 14:45:55 +0100 | [diff] [blame] | 21 | struct wm831x_backlight_pdata { |
| 22 | int isink; /** ISINK to use, 1 or 2 */ |
| 23 | int max_uA; /** Maximum current to allow */ |
| 24 | }; |
| 25 | |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 26 | struct wm831x_backup_pdata { |
| 27 | int charger_enable; |
| 28 | int no_constant_voltage; /** Disable constant voltage charging */ |
Thomas Weber | 91fe4d5 | 2012-02-17 17:46:21 +0100 | [diff] [blame^] | 29 | int vlim; /** Voltage limit in millivolts */ |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 30 | int ilim; /** Current limit in microamps */ |
| 31 | }; |
| 32 | |
| 33 | struct wm831x_battery_pdata { |
| 34 | int enable; /** Enable charging */ |
| 35 | int fast_enable; /** Enable fast charging */ |
| 36 | int off_mask; /** Mask OFF while charging */ |
| 37 | int trickle_ilim; /** Trickle charge current limit, in mA */ |
| 38 | int vsel; /** Target voltage, in mV */ |
| 39 | int eoc_iterm; /** End of trickle charge current, in mA */ |
| 40 | int fast_ilim; /** Fast charge current limit, in mA */ |
| 41 | int timeout; /** Charge cycle timeout, in minutes */ |
| 42 | }; |
| 43 | |
Mark Brown | e24a04c | 2009-09-22 08:47:11 -0700 | [diff] [blame] | 44 | /** |
| 45 | * Configuration for the WM831x DC-DC BuckWise convertors. This |
| 46 | * should be passed as driver_data in the regulator_init_data. |
| 47 | * |
| 48 | * Currently all the configuration is for the fast DVS switching |
| 49 | * support of the devices. This allows MFPs on the device to be |
| 50 | * configured as an input to switch between two output voltages, |
| 51 | * allowing voltage transitions without the expense of an access over |
| 52 | * I2C or SPI buses. |
| 53 | */ |
| 54 | struct wm831x_buckv_pdata { |
| 55 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ |
| 56 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ |
| 57 | int dvs_init_state; /** DVS state to expect on startup */ |
| 58 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ |
| 59 | }; |
| 60 | |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 61 | /* Sources for status LED configuration. Values are register values |
| 62 | * plus 1 to allow for a zero default for preserve. |
| 63 | */ |
| 64 | enum wm831x_status_src { |
| 65 | WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */ |
| 66 | WM831X_STATUS_OTP = 1, |
| 67 | WM831X_STATUS_POWER = 2, |
| 68 | WM831X_STATUS_CHARGER = 3, |
| 69 | WM831X_STATUS_MANUAL = 4, |
| 70 | }; |
| 71 | |
| 72 | struct wm831x_status_pdata { |
| 73 | enum wm831x_status_src default_src; |
| 74 | const char *name; |
| 75 | const char *default_trigger; |
| 76 | }; |
| 77 | |
| 78 | struct wm831x_touch_pdata { |
| 79 | int fivewire; /** 1 for five wire mode, 0 for 4 wire */ |
| 80 | int isel; /** Current for pen down (uA) */ |
| 81 | int rpu; /** Pen down sensitivity resistor divider */ |
| 82 | int pressure; /** Report pressure (boolean) */ |
Mark Brown | 00cfa73 | 2011-01-30 12:31:30 -0800 | [diff] [blame] | 83 | unsigned int data_irq; /** Touch data ready IRQ */ |
Mark Brown | acad985 | 2011-04-27 23:08:51 -0700 | [diff] [blame] | 84 | int data_irqf; /** IRQ flags for data ready IRQ */ |
Mark Brown | 00cfa73 | 2011-01-30 12:31:30 -0800 | [diff] [blame] | 85 | unsigned int pd_irq; /** Touch pendown detect IRQ */ |
Mark Brown | acad985 | 2011-04-27 23:08:51 -0700 | [diff] [blame] | 86 | int pd_irqf; /** IRQ flags for pen down IRQ */ |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | enum wm831x_watchdog_action { |
| 90 | WM831X_WDOG_NONE = 0, |
| 91 | WM831X_WDOG_INTERRUPT = 1, |
| 92 | WM831X_WDOG_RESET = 2, |
| 93 | WM831X_WDOG_WAKE = 3, |
| 94 | }; |
| 95 | |
| 96 | struct wm831x_watchdog_pdata { |
| 97 | enum wm831x_watchdog_action primary, secondary; |
| 98 | int update_gpio; |
| 99 | unsigned int software:1; |
| 100 | }; |
| 101 | |
| 102 | #define WM831X_MAX_STATUS 2 |
| 103 | #define WM831X_MAX_DCDC 4 |
| 104 | #define WM831X_MAX_EPE 2 |
| 105 | #define WM831X_MAX_LDO 11 |
| 106 | #define WM831X_MAX_ISINK 2 |
| 107 | |
Mark Brown | 0b14c22 | 2011-04-04 11:04:42 +0900 | [diff] [blame] | 108 | #define WM831X_GPIO_CONFIGURE 0x10000 |
| 109 | #define WM831X_GPIO_NUM 16 |
| 110 | |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 111 | struct wm831x_pdata { |
Mark Brown | 93619c2 | 2011-03-01 20:12:46 +0000 | [diff] [blame] | 112 | /** Used to distinguish multiple WM831x chips */ |
| 113 | int wm831x_num; |
| 114 | |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 115 | /** Called before subdevices are set up */ |
| 116 | int (*pre_init)(struct wm831x *wm831x); |
| 117 | /** Called after subdevices are set up */ |
| 118 | int (*post_init)(struct wm831x *wm831x); |
| 119 | |
Mark Brown | b103e0b3 | 2011-01-21 13:26:46 +0000 | [diff] [blame] | 120 | /** Put the /IRQ line into CMOS mode */ |
| 121 | bool irq_cmos; |
| 122 | |
Mark Brown | 266a5e0 | 2011-06-02 19:18:49 +0100 | [diff] [blame] | 123 | /** Disable the touchscreen */ |
| 124 | bool disable_touch; |
| 125 | |
Mark Brown | 523d9cf | 2011-09-15 18:54:53 +0200 | [diff] [blame] | 126 | /** The driver should initiate a power off sequence during shutdown */ |
| 127 | bool soft_shutdown; |
| 128 | |
Mark Brown | 5fb4d38 | 2009-11-11 16:10:22 +0000 | [diff] [blame] | 129 | int irq_base; |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 130 | int gpio_base; |
Mark Brown | 0b14c22 | 2011-04-04 11:04:42 +0900 | [diff] [blame] | 131 | int gpio_defaults[WM831X_GPIO_NUM]; |
Mark Brown | 63aed85 | 2009-07-27 14:45:55 +0100 | [diff] [blame] | 132 | struct wm831x_backlight_pdata *backlight; |
Mark Brown | d2bedfe | 2009-07-27 14:45:52 +0100 | [diff] [blame] | 133 | struct wm831x_backup_pdata *backup; |
| 134 | struct wm831x_battery_pdata *battery; |
| 135 | struct wm831x_touch_pdata *touch; |
| 136 | struct wm831x_watchdog_pdata *watchdog; |
| 137 | |
| 138 | /** LED1 = 0 and so on */ |
| 139 | struct wm831x_status_pdata *status[WM831X_MAX_STATUS]; |
| 140 | /** DCDC1 = 0 and so on */ |
| 141 | struct regulator_init_data *dcdc[WM831X_MAX_DCDC]; |
| 142 | /** EPE1 = 0 and so on */ |
| 143 | struct regulator_init_data *epe[WM831X_MAX_EPE]; |
| 144 | /** LDO1 = 0 and so on */ |
| 145 | struct regulator_init_data *ldo[WM831X_MAX_LDO]; |
| 146 | /** ISINK1 = 0 and so on*/ |
| 147 | struct regulator_init_data *isink[WM831X_MAX_ISINK]; |
| 148 | }; |
| 149 | |
| 150 | #endif |