1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x 4 * 5 * Copyright 2009 Wolfson Microelectronics PLC. 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 */ 9 10 #ifndef __MFD_WM831X_PDATA_H__ 11 #define __MFD_WM831X_PDATA_H__ 12 13 struct wm831x; 14 struct regulator_init_data; 15 16 struct wm831x_backlight_pdata { 17 int isink; /** ISINK to use, 1 or 2 */ 18 int max_uA; /** Maximum current to allow */ 19 }; 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 millivolts */ 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 /** 40 * Configuration for the WM831x DC-DC BuckWise convertors. This 41 * should be passed as driver_data in the regulator_init_data. 42 * 43 * Currently all the configuration is for the fast DVS switching 44 * support of the devices. This allows MFPs on the device to be 45 * configured as an input to switch between two output voltages, 46 * allowing voltage transitions without the expense of an access over 47 * I2C or SPI buses. 48 */ 49 struct wm831x_buckv_pdata { 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 55 /* Sources for status LED configuration. Values are register values 56 * plus 1 to allow for a zero default for preserve. 57 */ 58 enum wm831x_status_src { 59 WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */ 60 WM831X_STATUS_OTP = 1, 61 WM831X_STATUS_POWER = 2, 62 WM831X_STATUS_CHARGER = 3, 63 WM831X_STATUS_MANUAL = 4, 64 }; 65 66 struct wm831x_status_pdata { 67 enum wm831x_status_src default_src; 68 const char *name; 69 const char *default_trigger; 70 }; 71 72 struct wm831x_touch_pdata { 73 int fivewire; /** 1 for five wire mode, 0 for 4 wire */ 74 int isel; /** Current for pen down (uA) */ 75 int rpu; /** Pen down sensitivity resistor divider */ 76 int pressure; /** Report pressure (boolean) */ 77 unsigned int data_irq; /** Touch data ready IRQ */ 78 int data_irqf; /** IRQ flags for data ready IRQ */ 79 unsigned int pd_irq; /** Touch pendown detect IRQ */ 80 int pd_irqf; /** IRQ flags for pen down IRQ */ 81 }; 82 83 enum wm831x_watchdog_action { 84 WM831X_WDOG_NONE = 0, 85 WM831X_WDOG_INTERRUPT = 1, 86 WM831X_WDOG_RESET = 2, 87 WM831X_WDOG_WAKE = 3, 88 }; 89 90 struct wm831x_watchdog_pdata { 91 enum wm831x_watchdog_action primary, secondary; 92 unsigned int software:1; 93 }; 94 95 #define WM831X_MAX_STATUS 2 96 #define WM831X_MAX_DCDC 4 97 #define WM831X_MAX_EPE 2 98 #define WM831X_MAX_LDO 11 99 #define WM831X_MAX_ISINK 2 100 101 #define WM831X_GPIO_CONFIGURE 0x10000 102 #define WM831X_GPIO_NUM 16 103 104 struct wm831x_pdata { 105 /** Used to distinguish multiple WM831x chips */ 106 int wm831x_num; 107 108 /** Called before subdevices are set up */ 109 int (*pre_init)(struct wm831x *wm831x); 110 /** Called after subdevices are set up */ 111 int (*post_init)(struct wm831x *wm831x); 112 113 /** Put the /IRQ line into CMOS mode */ 114 bool irq_cmos; 115 116 /** Disable the touchscreen */ 117 bool disable_touch; 118 119 /** The driver should initiate a power off sequence during shutdown */ 120 bool soft_shutdown; 121 122 int irq_base; 123 int gpio_base; 124 int gpio_defaults[WM831X_GPIO_NUM]; 125 struct wm831x_backlight_pdata *backlight; 126 struct wm831x_backup_pdata *backup; 127 struct wm831x_battery_pdata *battery; 128 struct wm831x_touch_pdata *touch; 129 struct wm831x_watchdog_pdata *watchdog; 130 131 /** LED1 = 0 and so on */ 132 struct wm831x_status_pdata *status[WM831X_MAX_STATUS]; 133 /** DCDC1 = 0 and so on */ 134 struct regulator_init_data *dcdc[WM831X_MAX_DCDC]; 135 /** EPE1 = 0 and so on */ 136 struct regulator_init_data *epe[WM831X_MAX_EPE]; 137 /** LDO1 = 0 and so on */ 138 struct regulator_init_data *ldo[WM831X_MAX_LDO]; 139 /** ISINK1 = 0 and so on*/ 140 struct regulator_init_data *isink[WM831X_MAX_ISINK]; 141 }; 142 143 #endif 144
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.