linux/include/linux/mfd/samsung/core.h
<<
>>
Prefs
   1/*
   2 * core.h
   3 *
   4 * copyright (c) 2011 Samsung Electronics Co., Ltd
   5 *              http://www.samsung.com
   6 *
   7 *  This program is free software; you can redistribute  it and/or modify it
   8 *  under  the terms of  the GNU General  Public License as published by the
   9 *  Free Software Foundation;  either version 2 of the  License, or (at your
  10 *  option) any later version.
  11 *
  12 */
  13
  14#ifndef __LINUX_MFD_SEC_CORE_H
  15#define __LINUX_MFD_SEC_CORE_H
  16
  17/* Macros to represent minimum voltages for LDO/BUCK */
  18#define MIN_3000_MV             3000000
  19#define MIN_2500_MV             2500000
  20#define MIN_2000_MV             2000000
  21#define MIN_1800_MV             1800000
  22#define MIN_1500_MV             1500000
  23#define MIN_1400_MV             1400000
  24#define MIN_1000_MV             1000000
  25
  26#define MIN_900_MV              900000
  27#define MIN_850_MV              850000
  28#define MIN_800_MV              800000
  29#define MIN_750_MV              750000
  30#define MIN_600_MV              600000
  31#define MIN_500_MV              500000
  32
  33/* Macros to represent steps for LDO/BUCK */
  34#define STEP_50_MV              50000
  35#define STEP_25_MV              25000
  36#define STEP_12_5_MV            12500
  37#define STEP_6_25_MV            6250
  38
  39enum sec_device_type {
  40        S5M8751X,
  41        S5M8763X,
  42        S5M8767X,
  43        S2MPA01,
  44        S2MPS11X,
  45        S2MPS13X,
  46        S2MPS14X,
  47        S2MPU02,
  48};
  49
  50/**
  51 * struct sec_pmic_dev - s2m/s5m master device for sub-drivers
  52 * @dev:                Master device of the chip
  53 * @pdata:              Platform data populated with data from DTS
  54 *                      or board files
  55 * @regmap_pmic:        Regmap associated with PMIC's I2C address
  56 * @i2c:                I2C client of the main driver
  57 * @device_type:        Type of device, matches enum sec_device_type
  58 * @irq_base:           Base IRQ number for device, required for IRQs
  59 * @irq:                Generic IRQ number for device
  60 * @irq_data:           Runtime data structure for IRQ controller
  61 * @ono:                Power onoff IRQ number for s5m87xx
  62 * @wakeup:             Whether or not this is a wakeup device
  63 * @wtsr_smpl:          Whether or not to enable in RTC driver the Watchdog
  64 *                      Timer Software Reset (registers set to default value
  65 *                      after PWRHOLD falling) and Sudden Momentary Power Loss
  66 *                      (PMIC will enter power on sequence after short drop in
  67 *                      VBATT voltage).
  68 */
  69struct sec_pmic_dev {
  70        struct device *dev;
  71        struct sec_platform_data *pdata;
  72        struct regmap *regmap_pmic;
  73        struct i2c_client *i2c;
  74
  75        unsigned long device_type;
  76        int irq_base;
  77        int irq;
  78        struct regmap_irq_chip_data *irq_data;
  79
  80        int ono;
  81        bool wakeup;
  82        bool wtsr_smpl;
  83};
  84
  85int sec_irq_init(struct sec_pmic_dev *sec_pmic);
  86void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
  87int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
  88
  89struct sec_platform_data {
  90        struct sec_regulator_data       *regulators;
  91        struct sec_opmode_data          *opmode;
  92        int                             device_type;
  93        int                             num_regulators;
  94
  95        int                             irq_base;
  96        int                             (*cfg_pmic_irq)(void);
  97
  98        int                             ono;
  99        bool                            wakeup;
 100        bool                            buck_voltage_lock;
 101
 102        int                             buck_gpios[3];
 103        int                             buck_ds[3];
 104        unsigned int                    buck2_voltage[8];
 105        bool                            buck2_gpiodvs;
 106        unsigned int                    buck3_voltage[8];
 107        bool                            buck3_gpiodvs;
 108        unsigned int                    buck4_voltage[8];
 109        bool                            buck4_gpiodvs;
 110
 111        int                             buck_set1;
 112        int                             buck_set2;
 113        int                             buck_set3;
 114        int                             buck2_enable;
 115        int                             buck3_enable;
 116        int                             buck4_enable;
 117        int                             buck_default_idx;
 118        int                             buck2_default_idx;
 119        int                             buck3_default_idx;
 120        int                             buck4_default_idx;
 121
 122        int                             buck_ramp_delay;
 123
 124        int                             buck2_ramp_delay;
 125        int                             buck34_ramp_delay;
 126        int                             buck5_ramp_delay;
 127        int                             buck16_ramp_delay;
 128        int                             buck7810_ramp_delay;
 129        int                             buck9_ramp_delay;
 130        int                             buck24_ramp_delay;
 131        int                             buck3_ramp_delay;
 132        int                             buck7_ramp_delay;
 133        int                             buck8910_ramp_delay;
 134
 135        bool                            buck1_ramp_enable;
 136        bool                            buck2_ramp_enable;
 137        bool                            buck3_ramp_enable;
 138        bool                            buck4_ramp_enable;
 139        bool                            buck6_ramp_enable;
 140
 141        int                             buck2_init;
 142        int                             buck3_init;
 143        int                             buck4_init;
 144};
 145
 146/**
 147 * sec_regulator_data - regulator data
 148 * @id: regulator id
 149 * @initdata: regulator init data (contraints, supplies, ...)
 150 */
 151struct sec_regulator_data {
 152        int                             id;
 153        struct regulator_init_data      *initdata;
 154        struct device_node              *reg_node;
 155        int                             ext_control_gpio;
 156};
 157
 158/*
 159 * sec_opmode_data - regulator operation mode data
 160 * @id: regulator id
 161 * @mode: regulator operation mode
 162 */
 163struct sec_opmode_data {
 164        int id;
 165        unsigned int mode;
 166};
 167
 168/*
 169 * samsung regulator operation mode
 170 * SEC_OPMODE_OFF       Regulator always OFF
 171 * SEC_OPMODE_ON        Regulator always ON
 172 * SEC_OPMODE_LOWPOWER  Regulator is on in low-power mode
 173 * SEC_OPMODE_SUSPEND   Regulator is changed by PWREN pin
 174 *                      If PWREN is high, regulator is on
 175 *                      If PWREN is low, regulator is off
 176 */
 177
 178enum sec_opmode {
 179        SEC_OPMODE_OFF,
 180        SEC_OPMODE_ON,
 181        SEC_OPMODE_LOWPOWER,
 182        SEC_OPMODE_SUSPEND,
 183};
 184
 185#endif /*  __LINUX_MFD_SEC_CORE_H */
 186