linux/include/linux/mfd/wm831x/pdata.h
<<
>>
Prefs
   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
  13struct wm831x;
  14struct regulator_init_data;
  15
  16struct wm831x_backlight_pdata {
  17        int isink;     /** ISINK to use, 1 or 2 */
  18        int max_uA;    /** Maximum current to allow */
  19};
  20
  21struct 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
  28struct 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 */
  49struct wm831x_buckv_pdata {
  50        int dvs_gpio;        /** CPU GPIO to use for DVS switching */
  51        int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
  52        int dvs_init_state;  /** DVS state to expect on startup */
  53        int dvs_state_gpio;  /** CPU GPIO to use for monitoring status */
  54};
  55
  56/* Sources for status LED configuration.  Values are register values
  57 * plus 1 to allow for a zero default for preserve.
  58 */
  59enum wm831x_status_src {
  60        WM831X_STATUS_PRESERVE = 0,  /* Keep the current hardware setting */
  61        WM831X_STATUS_OTP = 1,
  62        WM831X_STATUS_POWER = 2,
  63        WM831X_STATUS_CHARGER = 3,
  64        WM831X_STATUS_MANUAL = 4,
  65};
  66
  67struct wm831x_status_pdata {
  68        enum wm831x_status_src default_src;
  69        const char *name;
  70        const char *default_trigger;
  71};
  72
  73struct wm831x_touch_pdata {
  74        int fivewire;          /** 1 for five wire mode, 0 for 4 wire */
  75        int isel;              /** Current for pen down (uA) */
  76        int rpu;               /** Pen down sensitivity resistor divider */
  77        int pressure;          /** Report pressure (boolean) */
  78        unsigned int data_irq; /** Touch data ready IRQ */
  79        int data_irqf;         /** IRQ flags for data ready IRQ */
  80        unsigned int pd_irq;   /** Touch pendown detect IRQ */
  81        int pd_irqf;           /** IRQ flags for pen down IRQ */
  82};
  83
  84enum wm831x_watchdog_action {
  85        WM831X_WDOG_NONE = 0,
  86        WM831X_WDOG_INTERRUPT = 1,
  87        WM831X_WDOG_RESET = 2,
  88        WM831X_WDOG_WAKE = 3,
  89};
  90
  91struct wm831x_watchdog_pdata {
  92        enum wm831x_watchdog_action primary, secondary;
  93        int update_gpio;
  94        unsigned int software:1;
  95};
  96
  97#define WM831X_MAX_STATUS 2
  98#define WM831X_MAX_DCDC   4
  99#define WM831X_MAX_EPE    2
 100#define WM831X_MAX_LDO    11
 101#define WM831X_MAX_ISINK  2
 102
 103#define WM831X_GPIO_CONFIGURE 0x10000
 104#define WM831X_GPIO_NUM 16
 105
 106struct wm831x_pdata {
 107        /** Used to distinguish multiple WM831x chips */
 108        int wm831x_num;
 109
 110        /** Called before subdevices are set up */
 111        int (*pre_init)(struct wm831x *wm831x);
 112        /** Called after subdevices are set up */
 113        int (*post_init)(struct wm831x *wm831x);
 114
 115        /** Put the /IRQ line into CMOS mode */
 116        bool irq_cmos;
 117
 118        /** Disable the touchscreen */
 119        bool disable_touch;
 120
 121        /** The driver should initiate a power off sequence during shutdown */
 122        bool soft_shutdown;
 123
 124        int irq_base;
 125        int gpio_base;
 126        int gpio_defaults[WM831X_GPIO_NUM];
 127        struct wm831x_backlight_pdata *backlight;
 128        struct wm831x_backup_pdata *backup;
 129        struct wm831x_battery_pdata *battery;
 130        struct wm831x_touch_pdata *touch;
 131        struct wm831x_watchdog_pdata *watchdog;
 132
 133        /** LED1 = 0 and so on */
 134        struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
 135        /** DCDC1 = 0 and so on */
 136        struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
 137        /** EPE1 = 0 and so on */
 138        struct regulator_init_data *epe[WM831X_MAX_EPE];
 139        /** LDO1 = 0 and so on */
 140        struct regulator_init_data *ldo[WM831X_MAX_LDO];
 141        /** ISINK1 = 0 and so on*/
 142        struct regulator_init_data *isink[WM831X_MAX_ISINK];
 143};
 144
 145#endif
 146