2018-08-08 00:11:22 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2012-07-11 20:07:16 +08:00
|
|
|
/*
|
2018-08-08 00:11:22 +08:00
|
|
|
* Copyright (c) 2011 Samsung Electronics Co., Ltd
|
2012-07-11 20:07:16 +08:00
|
|
|
* http://www.samsung.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LINUX_MFD_SEC_CORE_H
|
|
|
|
#define __LINUX_MFD_SEC_CORE_H
|
|
|
|
|
2014-07-15 19:02:51 +08:00
|
|
|
/* Macros to represent minimum voltages for LDO/BUCK */
|
|
|
|
#define MIN_3000_MV 3000000
|
|
|
|
#define MIN_2500_MV 2500000
|
|
|
|
#define MIN_2000_MV 2000000
|
|
|
|
#define MIN_1800_MV 1800000
|
|
|
|
#define MIN_1500_MV 1500000
|
|
|
|
#define MIN_1400_MV 1400000
|
|
|
|
#define MIN_1000_MV 1000000
|
|
|
|
|
|
|
|
#define MIN_900_MV 900000
|
|
|
|
#define MIN_850_MV 850000
|
|
|
|
#define MIN_800_MV 800000
|
|
|
|
#define MIN_750_MV 750000
|
2019-06-29 19:44:46 +08:00
|
|
|
#define MIN_650_MV 650000
|
2014-07-15 19:02:51 +08:00
|
|
|
#define MIN_600_MV 600000
|
2014-11-18 16:59:40 +08:00
|
|
|
#define MIN_500_MV 500000
|
2014-07-15 19:02:51 +08:00
|
|
|
|
2016-04-18 21:33:10 +08:00
|
|
|
/* Ramp delay in uV/us */
|
|
|
|
#define RAMP_DELAY_12_MVUS 12000
|
|
|
|
|
2014-07-15 19:02:51 +08:00
|
|
|
/* Macros to represent steps for LDO/BUCK */
|
|
|
|
#define STEP_50_MV 50000
|
|
|
|
#define STEP_25_MV 25000
|
|
|
|
#define STEP_12_5_MV 12500
|
|
|
|
#define STEP_6_25_MV 6250
|
|
|
|
|
2018-05-14 16:06:32 +08:00
|
|
|
struct gpio_desc;
|
|
|
|
|
2012-07-11 20:07:16 +08:00
|
|
|
enum sec_device_type {
|
|
|
|
S5M8751X,
|
|
|
|
S5M8763X,
|
|
|
|
S5M8767X,
|
2014-03-14 19:51:57 +08:00
|
|
|
S2MPA01,
|
2012-07-11 20:07:55 +08:00
|
|
|
S2MPS11X,
|
2014-11-18 16:59:39 +08:00
|
|
|
S2MPS13X,
|
2014-02-28 18:41:44 +08:00
|
|
|
S2MPS14X,
|
2015-11-20 18:37:51 +08:00
|
|
|
S2MPS15X,
|
2014-06-25 15:14:44 +08:00
|
|
|
S2MPU02,
|
2012-07-11 20:07:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2014-04-24 16:05:38 +08:00
|
|
|
* struct sec_pmic_dev - s2m/s5m master device for sub-drivers
|
|
|
|
* @dev: Master device of the chip
|
|
|
|
* @pdata: Platform data populated with data from DTS
|
|
|
|
* or board files
|
|
|
|
* @regmap_pmic: Regmap associated with PMIC's I2C address
|
|
|
|
* @i2c: I2C client of the main driver
|
|
|
|
* @device_type: Type of device, matches enum sec_device_type
|
|
|
|
* @irq_base: Base IRQ number for device, required for IRQs
|
|
|
|
* @irq: Generic IRQ number for device
|
|
|
|
* @irq_data: Runtime data structure for IRQ controller
|
|
|
|
* @wakeup: Whether or not this is a wakeup device
|
2012-07-11 20:07:16 +08:00
|
|
|
*/
|
|
|
|
struct sec_pmic_dev {
|
|
|
|
struct device *dev;
|
2013-02-04 07:49:47 +08:00
|
|
|
struct sec_platform_data *pdata;
|
2013-12-13 09:12:31 +08:00
|
|
|
struct regmap *regmap_pmic;
|
2012-07-11 20:07:16 +08:00
|
|
|
struct i2c_client *i2c;
|
|
|
|
|
2014-04-23 22:13:05 +08:00
|
|
|
unsigned long device_type;
|
2012-07-11 20:07:16 +08:00
|
|
|
int irq_base;
|
|
|
|
int irq;
|
2012-07-11 20:08:11 +08:00
|
|
|
struct regmap_irq_chip_data *irq_data;
|
|
|
|
|
2012-07-11 20:07:16 +08:00
|
|
|
bool wakeup;
|
|
|
|
};
|
|
|
|
|
|
|
|
int sec_irq_init(struct sec_pmic_dev *sec_pmic);
|
|
|
|
void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
|
|
|
|
int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
|
|
|
|
|
|
|
|
struct sec_platform_data {
|
|
|
|
struct sec_regulator_data *regulators;
|
|
|
|
struct sec_opmode_data *opmode;
|
|
|
|
int device_type;
|
|
|
|
int num_regulators;
|
|
|
|
|
|
|
|
int irq_base;
|
|
|
|
int (*cfg_pmic_irq)(void);
|
|
|
|
|
|
|
|
bool wakeup;
|
|
|
|
bool buck_voltage_lock;
|
|
|
|
|
|
|
|
int buck_gpios[3];
|
|
|
|
int buck_ds[3];
|
2013-02-04 07:49:47 +08:00
|
|
|
unsigned int buck2_voltage[8];
|
2012-07-11 20:07:16 +08:00
|
|
|
bool buck2_gpiodvs;
|
2013-02-04 07:49:47 +08:00
|
|
|
unsigned int buck3_voltage[8];
|
2012-07-11 20:07:16 +08:00
|
|
|
bool buck3_gpiodvs;
|
2013-02-04 07:49:47 +08:00
|
|
|
unsigned int buck4_voltage[8];
|
2012-07-11 20:07:16 +08:00
|
|
|
bool buck4_gpiodvs;
|
|
|
|
|
|
|
|
int buck_set1;
|
|
|
|
int buck_set2;
|
|
|
|
int buck_set3;
|
|
|
|
int buck2_enable;
|
|
|
|
int buck3_enable;
|
|
|
|
int buck4_enable;
|
|
|
|
int buck_default_idx;
|
|
|
|
int buck2_default_idx;
|
|
|
|
int buck3_default_idx;
|
|
|
|
int buck4_default_idx;
|
|
|
|
|
2014-03-14 19:51:57 +08:00
|
|
|
int buck_ramp_delay;
|
2012-07-11 20:07:55 +08:00
|
|
|
|
|
|
|
int buck2_ramp_delay;
|
|
|
|
int buck34_ramp_delay;
|
|
|
|
int buck5_ramp_delay;
|
|
|
|
int buck16_ramp_delay;
|
|
|
|
int buck7810_ramp_delay;
|
|
|
|
int buck9_ramp_delay;
|
2014-03-14 19:51:57 +08:00
|
|
|
int buck24_ramp_delay;
|
|
|
|
int buck3_ramp_delay;
|
|
|
|
int buck7_ramp_delay;
|
|
|
|
int buck8910_ramp_delay;
|
|
|
|
|
|
|
|
bool buck1_ramp_enable;
|
|
|
|
bool buck2_ramp_enable;
|
|
|
|
bool buck3_ramp_enable;
|
|
|
|
bool buck4_ramp_enable;
|
2012-07-11 20:07:55 +08:00
|
|
|
bool buck6_ramp_enable;
|
2012-07-11 20:07:16 +08:00
|
|
|
|
|
|
|
int buck2_init;
|
|
|
|
int buck3_init;
|
|
|
|
int buck4_init;
|
2015-09-14 20:12:45 +08:00
|
|
|
/* Whether or not manually set PWRHOLD to low during shutdown. */
|
|
|
|
bool manual_poweroff;
|
2015-10-07 08:44:41 +08:00
|
|
|
/* Disable the WRSTBI (buck voltage warm reset) when probing? */
|
|
|
|
bool disable_wrstbi;
|
2012-07-11 20:07:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sec_regulator_data - regulator data
|
|
|
|
* @id: regulator id
|
|
|
|
* @initdata: regulator init data (contraints, supplies, ...)
|
|
|
|
*/
|
|
|
|
struct sec_regulator_data {
|
|
|
|
int id;
|
|
|
|
struct regulator_init_data *initdata;
|
2014-01-24 21:37:57 +08:00
|
|
|
struct device_node *reg_node;
|
2018-05-14 16:06:32 +08:00
|
|
|
struct gpio_desc *ext_control_gpiod;
|
2012-07-11 20:07:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sec_opmode_data - regulator operation mode data
|
|
|
|
* @id: regulator id
|
|
|
|
* @mode: regulator operation mode
|
|
|
|
*/
|
|
|
|
struct sec_opmode_data {
|
|
|
|
int id;
|
2013-02-04 07:49:47 +08:00
|
|
|
unsigned int mode;
|
2012-07-11 20:07:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* samsung regulator operation mode
|
|
|
|
* SEC_OPMODE_OFF Regulator always OFF
|
|
|
|
* SEC_OPMODE_ON Regulator always ON
|
|
|
|
* SEC_OPMODE_LOWPOWER Regulator is on in low-power mode
|
|
|
|
* SEC_OPMODE_SUSPEND Regulator is changed by PWREN pin
|
|
|
|
* If PWREN is high, regulator is on
|
|
|
|
* If PWREN is low, regulator is off
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum sec_opmode {
|
|
|
|
SEC_OPMODE_OFF,
|
|
|
|
SEC_OPMODE_ON,
|
|
|
|
SEC_OPMODE_LOWPOWER,
|
|
|
|
SEC_OPMODE_SUSPEND,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __LINUX_MFD_SEC_CORE_H */
|