2009-07-27 21:45:52 +08:00
|
|
|
/*
|
|
|
|
* include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x
|
|
|
|
*
|
|
|
|
* Copyright 2009 Wolfson Microelectronics PLC.
|
|
|
|
*
|
|
|
|
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MFD_WM831X_PDATA_H__
|
|
|
|
#define __MFD_WM831X_PDATA_H__
|
|
|
|
|
|
|
|
struct wm831x;
|
|
|
|
struct regulator_init_data;
|
|
|
|
|
2009-07-27 21:45:55 +08:00
|
|
|
struct wm831x_backlight_pdata {
|
|
|
|
int isink; /** ISINK to use, 1 or 2 */
|
|
|
|
int max_uA; /** Maximum current to allow */
|
|
|
|
};
|
|
|
|
|
2009-07-27 21:45:52 +08:00
|
|
|
struct wm831x_backup_pdata {
|
|
|
|
int charger_enable;
|
|
|
|
int no_constant_voltage; /** Disable constant voltage charging */
|
|
|
|
int vlim; /** Voltage limit in milivolts */
|
|
|
|
int ilim; /** Current limit in microamps */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wm831x_battery_pdata {
|
|
|
|
int enable; /** Enable charging */
|
|
|
|
int fast_enable; /** Enable fast charging */
|
|
|
|
int off_mask; /** Mask OFF while charging */
|
|
|
|
int trickle_ilim; /** Trickle charge current limit, in mA */
|
|
|
|
int vsel; /** Target voltage, in mV */
|
|
|
|
int eoc_iterm; /** End of trickle charge current, in mA */
|
|
|
|
int fast_ilim; /** Fast charge current limit, in mA */
|
|
|
|
int timeout; /** Charge cycle timeout, in minutes */
|
|
|
|
};
|
|
|
|
|
2009-09-22 23:47:11 +08:00
|
|
|
/**
|
|
|
|
* Configuration for the WM831x DC-DC BuckWise convertors. This
|
|
|
|
* should be passed as driver_data in the regulator_init_data.
|
|
|
|
*
|
|
|
|
* Currently all the configuration is for the fast DVS switching
|
|
|
|
* support of the devices. This allows MFPs on the device to be
|
|
|
|
* configured as an input to switch between two output voltages,
|
|
|
|
* allowing voltage transitions without the expense of an access over
|
|
|
|
* I2C or SPI buses.
|
|
|
|
*/
|
|
|
|
struct wm831x_buckv_pdata {
|
|
|
|
int dvs_gpio; /** CPU GPIO to use for DVS switching */
|
|
|
|
int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
|
|
|
|
int dvs_init_state; /** DVS state to expect on startup */
|
|
|
|
int dvs_state_gpio; /** CPU GPIO to use for monitoring status */
|
|
|
|
};
|
|
|
|
|
2009-07-27 21:45:52 +08:00
|
|
|
/* Sources for status LED configuration. Values are register values
|
|
|
|
* plus 1 to allow for a zero default for preserve.
|
|
|
|
*/
|
|
|
|
enum wm831x_status_src {
|
|
|
|
WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
|
|
|
|
WM831X_STATUS_OTP = 1,
|
|
|
|
WM831X_STATUS_POWER = 2,
|
|
|
|
WM831X_STATUS_CHARGER = 3,
|
|
|
|
WM831X_STATUS_MANUAL = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wm831x_status_pdata {
|
|
|
|
enum wm831x_status_src default_src;
|
|
|
|
const char *name;
|
|
|
|
const char *default_trigger;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wm831x_touch_pdata {
|
|
|
|
int fivewire; /** 1 for five wire mode, 0 for 4 wire */
|
|
|
|
int isel; /** Current for pen down (uA) */
|
|
|
|
int rpu; /** Pen down sensitivity resistor divider */
|
|
|
|
int pressure; /** Report pressure (boolean) */
|
2011-01-31 04:31:30 +08:00
|
|
|
unsigned int data_irq; /** Touch data ready IRQ */
|
2011-04-28 14:08:51 +08:00
|
|
|
int data_irqf; /** IRQ flags for data ready IRQ */
|
2011-01-31 04:31:30 +08:00
|
|
|
unsigned int pd_irq; /** Touch pendown detect IRQ */
|
2011-04-28 14:08:51 +08:00
|
|
|
int pd_irqf; /** IRQ flags for pen down IRQ */
|
2009-07-27 21:45:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum wm831x_watchdog_action {
|
|
|
|
WM831X_WDOG_NONE = 0,
|
|
|
|
WM831X_WDOG_INTERRUPT = 1,
|
|
|
|
WM831X_WDOG_RESET = 2,
|
|
|
|
WM831X_WDOG_WAKE = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wm831x_watchdog_pdata {
|
|
|
|
enum wm831x_watchdog_action primary, secondary;
|
|
|
|
int update_gpio;
|
|
|
|
unsigned int software:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define WM831X_MAX_STATUS 2
|
|
|
|
#define WM831X_MAX_DCDC 4
|
|
|
|
#define WM831X_MAX_EPE 2
|
|
|
|
#define WM831X_MAX_LDO 11
|
|
|
|
#define WM831X_MAX_ISINK 2
|
|
|
|
|
2011-04-04 10:04:42 +08:00
|
|
|
#define WM831X_GPIO_CONFIGURE 0x10000
|
|
|
|
#define WM831X_GPIO_NUM 16
|
|
|
|
|
2009-07-27 21:45:52 +08:00
|
|
|
struct wm831x_pdata {
|
2011-03-02 04:12:46 +08:00
|
|
|
/** Used to distinguish multiple WM831x chips */
|
|
|
|
int wm831x_num;
|
|
|
|
|
2009-07-27 21:45:52 +08:00
|
|
|
/** Called before subdevices are set up */
|
|
|
|
int (*pre_init)(struct wm831x *wm831x);
|
|
|
|
/** Called after subdevices are set up */
|
|
|
|
int (*post_init)(struct wm831x *wm831x);
|
|
|
|
|
2011-01-21 21:26:46 +08:00
|
|
|
/** Put the /IRQ line into CMOS mode */
|
|
|
|
bool irq_cmos;
|
|
|
|
|
2009-11-12 00:10:22 +08:00
|
|
|
int irq_base;
|
2009-07-27 21:45:52 +08:00
|
|
|
int gpio_base;
|
2011-04-04 10:04:42 +08:00
|
|
|
int gpio_defaults[WM831X_GPIO_NUM];
|
2009-07-27 21:45:55 +08:00
|
|
|
struct wm831x_backlight_pdata *backlight;
|
2009-07-27 21:45:52 +08:00
|
|
|
struct wm831x_backup_pdata *backup;
|
|
|
|
struct wm831x_battery_pdata *battery;
|
|
|
|
struct wm831x_touch_pdata *touch;
|
|
|
|
struct wm831x_watchdog_pdata *watchdog;
|
|
|
|
|
|
|
|
/** LED1 = 0 and so on */
|
|
|
|
struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
|
|
|
|
/** DCDC1 = 0 and so on */
|
|
|
|
struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
|
|
|
|
/** EPE1 = 0 and so on */
|
|
|
|
struct regulator_init_data *epe[WM831X_MAX_EPE];
|
|
|
|
/** LDO1 = 0 and so on */
|
|
|
|
struct regulator_init_data *ldo[WM831X_MAX_LDO];
|
|
|
|
/** ISINK1 = 0 and so on*/
|
|
|
|
struct regulator_init_data *isink[WM831X_MAX_ISINK];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|