Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Copyright (c) 2011 Samsung Electronics Co., Ltd
0004  *              http://www.samsung.com
0005  */
0006 
0007 #ifndef __LINUX_MFD_SEC_CORE_H
0008 #define __LINUX_MFD_SEC_CORE_H
0009 
0010 /* Macros to represent minimum voltages for LDO/BUCK */
0011 #define MIN_3000_MV     3000000
0012 #define MIN_2500_MV     2500000
0013 #define MIN_2000_MV     2000000
0014 #define MIN_1800_MV     1800000
0015 #define MIN_1500_MV     1500000
0016 #define MIN_1400_MV     1400000
0017 #define MIN_1000_MV     1000000
0018 
0019 #define MIN_900_MV      900000
0020 #define MIN_850_MV      850000
0021 #define MIN_800_MV      800000
0022 #define MIN_750_MV      750000
0023 #define MIN_650_MV      650000
0024 #define MIN_600_MV      600000
0025 #define MIN_500_MV      500000
0026 
0027 /* Ramp delay in uV/us */
0028 #define RAMP_DELAY_12_MVUS  12000
0029 
0030 /* Macros to represent steps for LDO/BUCK */
0031 #define STEP_50_MV      50000
0032 #define STEP_25_MV      25000
0033 #define STEP_12_5_MV        12500
0034 #define STEP_6_25_MV        6250
0035 
0036 struct gpio_desc;
0037 
0038 enum sec_device_type {
0039     S5M8751X,
0040     S5M8763X,
0041     S5M8767X,
0042     S2MPA01,
0043     S2MPS11X,
0044     S2MPS13X,
0045     S2MPS14X,
0046     S2MPS15X,
0047     S2MPU02,
0048 };
0049 
0050 /**
0051  * struct sec_pmic_dev - s2m/s5m master device for sub-drivers
0052  * @dev:        Master device of the chip
0053  * @pdata:      Platform data populated with data from DTS
0054  *          or board files
0055  * @regmap_pmic:    Regmap associated with PMIC's I2C address
0056  * @i2c:        I2C client of the main driver
0057  * @device_type:    Type of device, matches enum sec_device_type
0058  * @irq_base:       Base IRQ number for device, required for IRQs
0059  * @irq:        Generic IRQ number for device
0060  * @irq_data:       Runtime data structure for IRQ controller
0061  * @wakeup:     Whether or not this is a wakeup device
0062  */
0063 struct sec_pmic_dev {
0064     struct device *dev;
0065     struct sec_platform_data *pdata;
0066     struct regmap *regmap_pmic;
0067     struct i2c_client *i2c;
0068 
0069     unsigned long device_type;
0070     int irq;
0071     struct regmap_irq_chip_data *irq_data;
0072 };
0073 
0074 int sec_irq_init(struct sec_pmic_dev *sec_pmic);
0075 void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
0076 int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
0077 
0078 struct sec_platform_data {
0079     struct sec_regulator_data   *regulators;
0080     struct sec_opmode_data      *opmode;
0081     int             num_regulators;
0082 
0083     int             buck_gpios[3];
0084     int             buck_ds[3];
0085     unsigned int            buck2_voltage[8];
0086     bool                buck2_gpiodvs;
0087     unsigned int            buck3_voltage[8];
0088     bool                buck3_gpiodvs;
0089     unsigned int            buck4_voltage[8];
0090     bool                buck4_gpiodvs;
0091 
0092     int             buck_default_idx;
0093     int             buck_ramp_delay;
0094 
0095     bool                buck2_ramp_enable;
0096     bool                buck3_ramp_enable;
0097     bool                buck4_ramp_enable;
0098 
0099     int             buck2_init;
0100     int             buck3_init;
0101     int             buck4_init;
0102     /* Whether or not manually set PWRHOLD to low during shutdown. */
0103     bool                manual_poweroff;
0104     /* Disable the WRSTBI (buck voltage warm reset) when probing? */
0105     bool                disable_wrstbi;
0106 };
0107 
0108 /**
0109  * sec_regulator_data - regulator data
0110  * @id: regulator id
0111  * @initdata: regulator init data (contraints, supplies, ...)
0112  */
0113 struct sec_regulator_data {
0114     int             id;
0115     struct regulator_init_data  *initdata;
0116     struct device_node      *reg_node;
0117     struct gpio_desc        *ext_control_gpiod;
0118 };
0119 
0120 /*
0121  * sec_opmode_data - regulator operation mode data
0122  * @id: regulator id
0123  * @mode: regulator operation mode
0124  */
0125 struct sec_opmode_data {
0126     int id;
0127     unsigned int mode;
0128 };
0129 
0130 /*
0131  * samsung regulator operation mode
0132  * SEC_OPMODE_OFF   Regulator always OFF
0133  * SEC_OPMODE_ON    Regulator always ON
0134  * SEC_OPMODE_LOWPOWER  Regulator is on in low-power mode
0135  * SEC_OPMODE_SUSPEND   Regulator is changed by PWREN pin
0136  *          If PWREN is high, regulator is on
0137  *          If PWREN is low, regulator is off
0138  */
0139 
0140 enum sec_opmode {
0141     SEC_OPMODE_OFF,
0142     SEC_OPMODE_ON,
0143     SEC_OPMODE_LOWPOWER,
0144     SEC_OPMODE_SUSPEND,
0145 };
0146 
0147 #endif /*  __LINUX_MFD_SEC_CORE_H */