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 | |
| 21 | struct wm831x_backup_pdata { |
| 22 | int charger_enable; |
| 23 | int no_constant_voltage; /** Disable constant voltage charging */ |
| 24 | int vlim; /** Voltage limit in milivolts */ |
| 25 | int ilim; /** Current limit in microamps */ |
| 26 | }; |
| 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 | /* Sources for status LED configuration. Values are register values |
| 40 | * plus 1 to allow for a zero default for preserve. |
| 41 | */ |
| 42 | enum wm831x_status_src { |
| 43 | WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */ |
| 44 | WM831X_STATUS_OTP = 1, |
| 45 | WM831X_STATUS_POWER = 2, |
| 46 | WM831X_STATUS_CHARGER = 3, |
| 47 | WM831X_STATUS_MANUAL = 4, |
| 48 | }; |
| 49 | |
| 50 | struct wm831x_status_pdata { |
| 51 | enum wm831x_status_src default_src; |
| 52 | const char *name; |
| 53 | const char *default_trigger; |
| 54 | }; |
| 55 | |
| 56 | struct wm831x_touch_pdata { |
| 57 | int fivewire; /** 1 for five wire mode, 0 for 4 wire */ |
| 58 | int isel; /** Current for pen down (uA) */ |
| 59 | int rpu; /** Pen down sensitivity resistor divider */ |
| 60 | int pressure; /** Report pressure (boolean) */ |
| 61 | int data_irq; /** Touch data ready IRQ */ |
| 62 | }; |
| 63 | |
| 64 | enum wm831x_watchdog_action { |
| 65 | WM831X_WDOG_NONE = 0, |
| 66 | WM831X_WDOG_INTERRUPT = 1, |
| 67 | WM831X_WDOG_RESET = 2, |
| 68 | WM831X_WDOG_WAKE = 3, |
| 69 | }; |
| 70 | |
| 71 | struct wm831x_watchdog_pdata { |
| 72 | enum wm831x_watchdog_action primary, secondary; |
| 73 | int update_gpio; |
| 74 | unsigned int software:1; |
| 75 | }; |
| 76 | |
| 77 | #define WM831X_MAX_STATUS 2 |
| 78 | #define WM831X_MAX_DCDC 4 |
| 79 | #define WM831X_MAX_EPE 2 |
| 80 | #define WM831X_MAX_LDO 11 |
| 81 | #define WM831X_MAX_ISINK 2 |
| 82 | |
| 83 | struct wm831x_pdata { |
| 84 | /** Called before subdevices are set up */ |
| 85 | int (*pre_init)(struct wm831x *wm831x); |
| 86 | /** Called after subdevices are set up */ |
| 87 | int (*post_init)(struct wm831x *wm831x); |
| 88 | |
| 89 | int gpio_base; |
| 90 | struct wm831x_backup_pdata *backup; |
| 91 | struct wm831x_battery_pdata *battery; |
| 92 | struct wm831x_touch_pdata *touch; |
| 93 | struct wm831x_watchdog_pdata *watchdog; |
| 94 | |
| 95 | /** LED1 = 0 and so on */ |
| 96 | struct wm831x_status_pdata *status[WM831X_MAX_STATUS]; |
| 97 | /** DCDC1 = 0 and so on */ |
| 98 | struct regulator_init_data *dcdc[WM831X_MAX_DCDC]; |
| 99 | /** EPE1 = 0 and so on */ |
| 100 | struct regulator_init_data *epe[WM831X_MAX_EPE]; |
| 101 | /** LDO1 = 0 and so on */ |
| 102 | struct regulator_init_data *ldo[WM831X_MAX_LDO]; |
| 103 | /** ISINK1 = 0 and so on*/ |
| 104 | struct regulator_init_data *isink[WM831X_MAX_ISINK]; |
| 105 | }; |
| 106 | |
| 107 | #endif |