mfd: samsung: Modify samsung mfd driver for common api
Subsystems (3)
PATCH v3 2/7 mfd: samsung: Modify samsung mfd driver for common api
Previous naming rule of samsung pmic start with s5m prefix. But It is changed by s2m.
To cover various samsung s2m and s5m series,
This patch modify function and variable name for common usage.
Signed-off-by Sangbeom Kim <[email protected]>
--- drivers/mfd/sec-core.c | 130 +++++++++++----------- drivers/mfd/sec-irq.c | 204 +++++++++++++++++----------------- drivers/regulator/s5m8767.c | 78 +++++++------- include/linux/mfd/samsung/s5m-core.h | 30 +++--- include/linux/mfd/samsung/s5m-pmic.h | 24 ++-- 5 files changed, 233 insertions(+), 233 deletions(-)
drivers/mfd/sec-core.c +65 -65
@@ -1,7 +1,7 @@/* -* s5m87xx.c +* sec-core.c * -* Copyright (c) 2011 Samsung Electronics Co., Ltd +* Copyright (c) 2012 Samsung Electronics Co., Ltd * http://www.samsung.com * * This program is free software; you can redistribute it and/or modify it
@@ -54,95 +54,95 @@ static struct mfd_cell s5m8767_devs[] = { }, }; -int s5m_reg_read (struct s5m87xx_dev *s5m87xx,u8 reg,void *dest) +int sec_reg_read (struct sec_pmic_dev *sec_pmic,u8 reg,void *dest) { -return regmap_read (s5m87xx->regmap, reg, dest); +return regmap_read (sec_pmic->regmap, reg, dest); } -EXPORT_SYMBOL_GPL (s5m_reg_read); +EXPORT_SYMBOL_GPL (sec_reg_read); -int s5m_bulk_read (struct s5m87xx_dev *s5m87xx,u8 reg,int count,u8 *buf) +int sec_bulk_read (struct sec_pmic_dev *sec_pmic,u8 reg,int count,u8 *buf) { -return regmap_bulk_read (s5m87xx->regmap, reg, buf, count); +return regmap_bulk_read (sec_pmic->regmap, reg, buf, count); } -EXPORT_SYMBOL_GPL (s5m_bulk_read); +EXPORT_SYMBOL_GPL (sec_bulk_read); -int s5m_reg_write (struct s5m87xx_dev *s5m87xx,u8 reg,u8 value) +int sec_reg_write (struct sec_pmic_dev *sec_pmic,u8 reg,u8 value) { -return regmap_write (s5m87xx->regmap, reg, value); +return regmap_write (sec_pmic->regmap, reg, value); } -EXPORT_SYMBOL_GPL (s5m_reg_write); +EXPORT_SYMBOL_GPL (sec_reg_write); -int s5m_bulk_write (struct s5m87xx_dev *s5m87xx,u8 reg,int count,u8 *buf) +int sec_bulk_write (struct sec_pmic_dev *sec_pmic,u8 reg,int count,u8 *buf) { -return regmap_raw_write (s5m87xx->regmap, reg, buf, count); +return regmap_raw_write (sec_pmic->regmap, reg, buf, count); } -EXPORT_SYMBOL_GPL (s5m_bulk_write); +EXPORT_SYMBOL_GPL (sec_bulk_write); -int s5m_reg_update (struct s5m87xx_dev *s5m87xx,u8 reg,u8 val,u8 mask) +int sec_reg_update (struct sec_pmic_dev *sec_pmic,u8 reg,u8 val,u8 mask) { -return regmap_update_bits (s5m87xx->regmap, reg, mask, val); +return regmap_update_bits (sec_pmic->regmap, reg, mask, val); } -EXPORT_SYMBOL_GPL (s5m_reg_update); +EXPORT_SYMBOL_GPL (sec_reg_update); -static struct regmap_config s5m_regmap_config = { +static struct regmap_config sec_regmap_config = { .reg_bits =8 , .val_bits =8 , }; -static int s5m87xx_i2c_probe (struct i2c_client *i2c, +static int sec_pmic_probe (struct i2c_client *i2c,const struct i2c_device_id *id) { -struct s5m_platform_data *pdata = i2c->dev.platform_data; -struct s5m87xx_dev *s5m87xx; +struct sec_platform_data *pdata = i2c->dev.platform_data; +struct sec_pmic_dev *sec_pmic;int ret; - s5m87xx =devm_kzalloc (&i2c->dev,sizeof (struct s5m87xx_dev ), + sec_pmic =devm_kzalloc (&i2c->dev,sizeof (struct sec_pmic_dev ),GFP_KERNEL ); -if (s5m87xx ==NULL ) +if (sec_pmic ==NULL )return -ENOMEM ; -i2c_set_clientdata (i2c, s5m87xx); - s5m87xx->dev = &i2c->dev; - s5m87xx->i2c = i2c; - s5m87xx->irq = i2c->irq; - s5m87xx->type = id->driver_data; +i2c_set_clientdata (i2c, sec_pmic); + sec_pmic->dev = &i2c->dev; + sec_pmic->i2c = i2c; + sec_pmic->irq = i2c->irq; + sec_pmic->type = id->driver_data;if (pdata) { - s5m87xx->device_type = pdata->device_type; - s5m87xx->ono = pdata->ono; - s5m87xx->irq_base = pdata->irq_base; - s5m87xx->wakeup = pdata->wakeup; + sec_pmic->device_type = pdata->device_type; + sec_pmic->ono = pdata->ono; + sec_pmic->irq_base = pdata->irq_base; + sec_pmic->wakeup = pdata->wakeup; } - s5m87xx->regmap =devm_regmap_init_i2c (i2c, &s5m_regmap_config); -if (IS_ERR (s5m87xx->regmap)) { - ret =PTR_ERR (s5m87xx->regmap); + sec_pmic->regmap =devm_regmap_init_i2c (i2c, &sec_regmap_config); +if (IS_ERR (sec_pmic->regmap)) { + ret =PTR_ERR (sec_pmic->regmap);dev_err (&i2c->dev,"Failed to allocate register map: %d\n" , ret);return ret; } - s5m87xx->rtc =i2c_new_dummy (i2c->adapter,RTC_I2C_ADDR ); -i2c_set_clientdata (s5m87xx->rtc, s5m87xx); + sec_pmic->rtc =i2c_new_dummy (i2c->adapter,RTC_I2C_ADDR ); +i2c_set_clientdata (sec_pmic->rtc, sec_pmic);if (pdata && pdata->cfg_pmic_irq) pdata->cfg_pmic_irq (); -s5m_irq_init (s5m87xx); +sec_irq_init (sec_pmic); -pm_runtime_set_active (s5m87xx->dev); +pm_runtime_set_active (sec_pmic->dev); -switch (s5m87xx->device_type) { +switch (sec_pmic->device_type) {case S5M8751X : - ret =mfd_add_devices (s5m87xx->dev,-1 , s5m8751_devs, + ret =mfd_add_devices (sec_pmic->dev,-1 , s5m8751_devs,ARRAY_SIZE (s5m8751_devs),NULL ,0 );break ;case S5M8763X : - ret =mfd_add_devices (s5m87xx->dev,-1 , s5m8763_devs, + ret =mfd_add_devices (sec_pmic->dev,-1 , s5m8763_devs,ARRAY_SIZE (s5m8763_devs),NULL ,0 );break ;case S5M8767X : - ret =mfd_add_devices (s5m87xx->dev,-1 , s5m8767_devs, + ret =mfd_add_devices (sec_pmic->dev,-1 , s5m8767_devs,ARRAY_SIZE (s5m8767_devs),NULL ,0 );break ;default :
@@ -156,50 +156,50 @@ static int s5m87xx_i2c_probe(struct i2c_client *i2c,return ret; err: -mfd_remove_devices (s5m87xx->dev); -s5m_irq_exit (s5m87xx); -i2c_unregister_device (s5m87xx->rtc); +mfd_remove_devices (sec_pmic->dev); +sec_irq_exit (sec_pmic); +i2c_unregister_device (sec_pmic->rtc);return ret; } -static int s5m87xx_i2c_remove (struct i2c_client *i2c) +static int sec_pmic_remove (struct i2c_client *i2c) { -struct s5m87xx_dev *s5m87xx =i2c_get_clientdata (i2c); +struct sec_pmic_dev *sec_pmic =i2c_get_clientdata (i2c); -mfd_remove_devices (s5m87xx->dev); -s5m_irq_exit (s5m87xx); -i2c_unregister_device (s5m87xx->rtc); +mfd_remove_devices (sec_pmic->dev); +sec_irq_exit (sec_pmic); +i2c_unregister_device (sec_pmic->rtc);return 0 ; } -static const struct i2c_device_id s5m87xx_i2c_id[] = { - {"s5m87xx" ,0 }, +static const struct i2c_device_id sec_pmic_id[] = { + {"sec_pmic" ,0 }, { } }; -MODULE_DEVICE_TABLE (i2c, s5m87xx_i2c_id); +MODULE_DEVICE_TABLE (i2c, sec_pmic_id); -static struct i2c_driver s5m87xx_i2c_driver = { +static struct i2c_driver sec_pmic_driver = { .driver = { - .name ="s5m87xx" , + .name ="sec_pmic" , .owner =THIS_MODULE , }, - .probe = s5m87xx_i2c_probe, - .remove = s5m87xx_i2c_remove, - .id_table = s5m87xx_i2c_id, + .probe = sec_pmic_probe, + .remove = sec_pmic_remove, + .id_table = sec_pmic_id, }; -static int __init s5m87xx_i2c_init (void ) +static int __init sec_pmic_init (void ) { -return i2c_add_driver (&s5m87xx_i2c_driver); +return i2c_add_driver (&sec_pmic_driver); } -subsys_initcall (s5m87xx_i2c_init); +subsys_initcall (sec_pmic_init); -static void __exit s5m87xx_i2c_exit(void) +static void __exit sec_pmic_exit(void) { -i2c_del_driver (&s5m87xx_i2c_driver); +i2c_del_driver (&sec_pmic_driver); } -module_exit (s5m87xx_i2c_exit); +module_exit (sec_pmic_exit);MODULE_AUTHOR ("Sangbeom Kim <[email protected]>" );MODULE_DESCRIPTION ("Core support for the S5M MFD" );
drivers/mfd/sec-irq.c +102 -102
430 lines not on this page · raw message
drivers/regulator/s5m8767.c +39 -39
236 lines not on this page · raw message
include/linux/mfd/samsung/s5m-core.h +15 -15
@@ -16,7 +16,7 @@#define NUM_IRQ_REGS 4 -enum s5m_device_type { +enum sec_device_type {S5M8751X ,S5M8763X ,S5M8767X ,
@@ -292,20 +292,20 @@ enum s5m8763_irq {#define S5M8763_ENRAMP (1 << 4)/** -* struct s5m87xx_dev - s5m87xx master device for sub-drivers +* struct sec_pmic_dev - sec_pmic master device for sub-drivers * @dev: master device of the chip (can be used to access platform data) * @i2c: i2c client private data for regulator * @rtc: i2c client private data for rtc * @iolock: mutex for serializing io access * @irqlock: mutex for buslock -* @irq_base: base IRQ number for s5m87xx, required for IRQs +* @irq_base: base IRQ number for sec_pmic, required for IRQs * @irq: generic IRQ number for s5m87xx * @ono: power onoff IRQ number for s5m87xx * @irq_masks_cur: currently active value * @irq_masks_cache: cached hardware value * @type: indicate which s5m87xx "variant" is used */ -struct s5m87xx_dev { +struct sec_pmic_dev {struct device *dev;struct regmap *regmap;struct i2c_client *i2c;
@@ -323,19 +323,19 @@ struct s5m87xx_dev {bool wakeup; }; -int s5m_irq_init (struct s5m87xx_dev *s5m87xx); -void s5m_irq_exit (struct s5m87xx_dev *s5m87xx); -int s5m_irq_resume (struct s5m87xx_dev *s5m87xx); +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); -extern int s5m_reg_read (struct s5m87xx_dev *s5m87xx,u8 reg,void *dest); -extern int s5m_bulk_read (struct s5m87xx_dev *s5m87xx,u8 reg,int count,u8 *buf); -extern int s5m_reg_write (struct s5m87xx_dev *s5m87xx,u8 reg,u8 value); -extern int s5m_bulk_write (struct s5m87xx_dev *s5m87xx,u8 reg,int count,u8 *buf); -extern int s5m_reg_update (struct s5m87xx_dev *s5m87xx,u8 reg,u8 val,u8 mask); +extern int sec_reg_read (struct sec_pmic_dev *sec_pmic,u8 reg,void *dest); +extern int sec_bulk_read (struct sec_pmic_dev *sec_pmic,u8 reg,int count,u8 *buf); +extern int sec_reg_write (struct sec_pmic_dev *sec_pmic,u8 reg,u8 value); +extern int sec_bulk_write (struct sec_pmic_dev *sec_pmic,u8 reg,int count,u8 *buf); +extern int sec_reg_update (struct sec_pmic_dev *sec_pmic,u8 reg,u8 val,u8 mask); -struct s5m_platform_data { -struct s5m_regulator_data *regulators; -struct s5m_opmode_data *opmode; +struct sec_platform_data { +struct sec_regulator_data *regulators; +struct sec_opmode_data *opmode;int device_type;int num_regulators;
include/linux/mfd/samsung/s5m-pmic.h +12 -12
@@ -94,7 +94,7 @@ enum s5m8763_regulators {* @id: regulator id * @initdata: regulator init data (contraints, supplies, ...) */ -struct s5m_regulator_data { +struct sec_regulator_data {int id;struct regulator_init_data *initdata; };
@@ -104,26 +104,26 @@ struct s5m_regulator_data {* @id: regulator id * @mode: regulator operation mode */ -struct s5m_opmode_data { +struct sec_opmode_data {int id;int mode; };/* -* s5m regulator operation mode -* S5M_OPMODE_OFF Regulator always OFF -* S5M_OPMODE_ON Regulator always ON -* S5M_OPMODE_LOWPOWER Regulator is on in low-power mode -* S5M_OPMODE_SUSPEND Regulator is changed by PWREN pin +* 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 s5m_opmode { -S5M_OPMODE_OFF , -S5M_OPMODE_ON , -S5M_OPMODE_LOWPOWER , -S5M_OPMODE_SUSPEND , +enum sec_opmode { +SEC_OPMODE_OFF , +SEC_OPMODE_ON , +SEC_OPMODE_LOWPOWER , +SEC_OPMODE_SUSPEND , };#endif /* __LINUX_MFD_S5M_PMIC_H */
Signature · 1 line
1.7.1