From bfef393620b39a98eb2c6bea263f6a20592be7ee Mon Sep 17 00:00:00 2001 From: sirmordred Date: Thu, 4 Jun 2015 01:14:40 +0300 Subject: [PATCH] drivers: Convert all vreg.c consumer to regulator API --- .../input/touchscreen/ancora/melfas_mcs8000.c | 16 ++-- drivers/media/video/msm/s5k4ecgx.c | 28 +++---- drivers/media/video/msm/sr030pc30.c | 78 +++++++++---------- drivers/misc/samsung_vibrator.c | 22 +++--- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/drivers/input/touchscreen/ancora/melfas_mcs8000.c b/drivers/input/touchscreen/ancora/melfas_mcs8000.c index 27a33f35f15..69b6efd7599 100644 --- a/drivers/input/touchscreen/ancora/melfas_mcs8000.c +++ b/drivers/input/touchscreen/ancora/melfas_mcs8000.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -65,7 +65,7 @@ #define TS_READ_VERSION_ADDR 0x63 static int debug_level = 5; -static struct vreg *vreg_ldo2; +static struct regulator *vreg_ldo2; #define debugprintk(level,x...) if(debug_level>=level) printk(x) @@ -589,7 +589,7 @@ static ssize_t touch_led_control(struct device *dev, struct device_attribute *at #endif if(data == 1 && led_state == TKEY_LED_OFF) { - rc = vreg_enable(vreg_ldo2); + rc = regulator_enable(vreg_ldo2); if (rc) { pr_err("%s: LDO2 vreg enable failed (%d)\n", @@ -599,7 +599,7 @@ static ssize_t touch_led_control(struct device *dev, struct device_attribute *at led_state = TKEY_LED_ON; } else if(data == 2 && led_state == TKEY_LED_ON) { - rc = vreg_disable(vreg_ldo2); + rc = regulator_disable(vreg_ldo2); if (rc) { pr_err("%s: LDO2 vreg disable failed (%d)\n", @@ -2176,14 +2176,14 @@ int melfas_mcs8000_ts_probe(struct i2c_client *client, // KEYLED vdd - vreg_ldo2 = vreg_get(NULL, "xo_out"); + vreg_ldo2 = regulator_get(NULL, "xo_out"); if (IS_ERR(vreg_ldo2)) { rc = PTR_ERR(vreg_ldo2); pr_err("%s: LDO2 vreg get failed (%d)\n", __func__, rc); } - rc = vreg_set_level(vreg_ldo2, 3300); + rc = regulator_set_voltage(vreg_ldo2, 3300000 ,3300000); if (rc) { pr_err("%s: LDO2 vreg set level failed (%d)\n", __func__, rc); @@ -2384,7 +2384,7 @@ int melfas_mcs8000_ts_suspend(pm_message_t mesg) mcsdl_vdd_off(); if(led_state == TKEY_LED_ON) { - rc = vreg_disable(vreg_ldo2); + rc = regulator_disable(vreg_ldo2); printk("touch_led_control : ts_suspend forced off! rc = %d \n", rc); @@ -2423,7 +2423,7 @@ int melfas_mcs8000_ts_resume() enable_irq(melfas_mcs8000_ts->client->irq); if(led_state == TKEY_LED_FORCEDOFF) { - rc = vreg_enable(vreg_ldo2); + rc = regulator_enable(vreg_ldo2); printk("%s TKEY_LED_FORCEDOFF rc = %d \n", __func__,rc); diff --git a/drivers/media/video/msm/s5k4ecgx.c b/drivers/media/video/msm/s5k4ecgx.c index f6ea1851ef5..842efa091fc 100644 --- a/drivers/media/video/msm/s5k4ecgx.c +++ b/drivers/media/video/msm/s5k4ecgx.c @@ -41,7 +41,7 @@ #endif #include -#include +#include #include #define SENSOR_DEBUG (0) @@ -2202,21 +2202,21 @@ void cam_pw(int status) void s5k4ecgx_set_power(int status) { unsigned int mclk_cfg; - struct vreg *vreg_ldo20, *vreg_ldo11; + struct regulator *vreg_ldo20, *vreg_ldo11; - vreg_ldo20 = vreg_get(NULL, "gp13"); + vreg_ldo20 = regulator_get(NULL, "gp13"); if(!vreg_ldo20){ printk("[S5K4ECGX]%s: VREG L20 get failed\n", __func__); } - if(vreg_set_level(vreg_ldo20, 1800)){ + if(regulator_set_voltage(vreg_ldo20, 1800000 ,1800000)){ printk("[S5K4ECGX]%s: vreg_set_level failed\n", __func__); } - vreg_ldo11 = vreg_get(NULL, "gp2"); + vreg_ldo11 = regulator_get(NULL, "gp2"); if (!vreg_ldo11) { printk("[S5K4ECGX]%s: VREG L11 get failed\n", __func__); } - if (vreg_set_level(vreg_ldo11, 2800)) { + if (regulator_set_voltage(vreg_ldo11, 2800000 ,2800000)) { printk("[S5K4ECGX]%s: vreg_set_level failed\n", __func__); } @@ -2235,10 +2235,10 @@ void s5k4ecgx_set_power(int status) gpio_set_value(31, 0); // CAM_VT_nSTBY gpio_set_value(132, 0); // CAM_VT_nRST - if (vreg_enable(vreg_ldo20)) { + if (regulator_enable(vreg_ldo20)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_enable failed\n", __func__); } - if (vreg_enable(vreg_ldo11)) { + if (regulator_enable(vreg_ldo11)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_enable failed\n", __func__); } mdelay(1); @@ -2322,11 +2322,11 @@ void s5k4ecgx_set_power(int status) lp8720_i2c_write(0x08, 0x16); mdelay(1); - if (vreg_enable(vreg_ldo20)) { //LDO20 powers both VDDIO 1.8V and 1.3M Core 1.8V + if (regulator_enable(vreg_ldo20)) { //LDO20 powers both VDDIO 1.8V and 1.3M Core 1.8V printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_enable failed\n", __func__); } mdelay(1); - if (vreg_enable(vreg_ldo11)) { //AVDD 2.8V + if (regulator_enable(vreg_ldo11)) { //AVDD 2.8V printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_enable failed\n", __func__); } @@ -2384,10 +2384,10 @@ void s5k4ecgx_set_power(int status) lp8720_i2c_write(0x08, 0x00); gpio_set_value(2, 0); // lp8720 disable - if (vreg_disable(vreg_ldo11)) { + if (regulator_disable(vreg_ldo11)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_disable failed\n", __func__); } - if (vreg_disable(vreg_ldo20)) { + if (regulator_disable(vreg_ldo20)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_disable failed\n", __func__); } @@ -2467,11 +2467,11 @@ void s5k4ecgx_set_power(int status) mdelay(1); //Entering shutdown mode - if (vreg_disable(vreg_ldo11)) { //Power down VDDIO 1.8V and 1.3Mcore 1.8V + if (regulator_disable(vreg_ldo11)) { //Power down VDDIO 1.8V and 1.3Mcore 1.8V printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_disable failed\n", __func__); } mdelay(1); - if (vreg_disable(vreg_ldo20)) { //Power down AVDD 2.8V + if (regulator_disable(vreg_ldo20)) { //Power down AVDD 2.8V printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![S5K4ECGX]%s: reg_disable failed\n", __func__); } mdelay(1); diff --git a/drivers/media/video/msm/sr030pc30.c b/drivers/media/video/msm/sr030pc30.c index f339c43569f..5e4562dc240 100644 --- a/drivers/media/video/msm/sr030pc30.c +++ b/drivers/media/video/msm/sr030pc30.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #ifdef CONFIG_SENSOR_SR030PC30_T679 #include "sr030pc30_T679.h" @@ -451,8 +451,8 @@ static int sr030pc30_regs_table_write(char *name) static void sr030pc30_set_power_rev00( int onoff) { unsigned int mclk_cfg; - struct vreg *vreg_ldo20; - vreg_ldo20 = vreg_get(NULL, "gp13"); + struct regulator *vreg_ldo20; + vreg_ldo20 = regulator_get(NULL, "gp13"); mclk_cfg = GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); if(!vreg_ldo20){ @@ -461,7 +461,7 @@ static void sr030pc30_set_power_rev00( int onoff) CAMDRV_DEBUG("(vreg_set_level(vreg_ldo20, 1800 \n"); - if(vreg_set_level(vreg_ldo20, 1800)){ + if(regulator_set_voltage(vreg_ldo20, 1800000 ,1800000)){ CAMDRV_DEBUG("[SR030PC30]%s: vreg_set_level failed\n", __func__); } if(onoff == 1) //POWER ON @@ -508,7 +508,7 @@ static void sr030pc30_set_power_rev00( int onoff) lp8720_i2c_write(0x08, 0x36); mdelay(1); - if(vreg_enable(vreg_ldo20)){ + if(regulator_enable(vreg_ldo20)){ printk("[SR030PC30]%s: reg_enable failed\n", __func__); } @@ -592,7 +592,7 @@ static void sr030pc30_set_power_rev00( int onoff) /* LP8720 enable */ lp8720_i2c_write(0x08, 0x00); - if(vreg_disable(vreg_ldo20)){ + if(regulator_disable(vreg_ldo20)){ CAMDRV_DEBUG("[SR030PC30]%s: reg_enable failed\n", __func__); } @@ -620,47 +620,47 @@ static void sr030pc30_set_power_rev00( int onoff) static void sr030pc30_set_power_rev01( int onoff) { unsigned int mclk_cfg; - struct vreg *vreg_cam_out8_vddio; - struct vreg *vreg_cam_out9_vdda; - struct vreg *vreg_cam_out10_vddreg; - struct vreg *vreg_cam_out17_af; - struct vreg *vreg_cam_gp15_vddreg; - - vreg_cam_out8_vddio = vreg_get(NULL, "gp13"); - vreg_cam_out9_vdda = vreg_get(NULL, "wlan2"); - vreg_cam_out10_vddreg = vreg_get(NULL, "gp2"); - vreg_cam_out17_af = vreg_get(NULL, "wlan"); - vreg_cam_gp15_vddreg = vreg_get(NULL, "gp15"); + struct regulator *vreg_cam_out8_vddio; + struct regulator *vreg_cam_out9_vdda; + struct regulator *vreg_cam_out10_vddreg; + struct regulator *vreg_cam_out17_af; + struct regulator *vreg_cam_gp15_vddreg; + + vreg_cam_out8_vddio = regulator_get(NULL, "gp13"); + vreg_cam_out9_vdda = regulator_get(NULL, "wlan2"); + vreg_cam_out10_vddreg = regulator_get(NULL, "gp2"); + vreg_cam_out17_af = regulator_get(NULL, "wlan"); + vreg_cam_gp15_vddreg = regulator_get(NULL, "gp15"); mclk_cfg = GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); if(onoff== 1) //POWER ON { CAMDRV_DEBUG("[START] SUB Camera Sensor POWER ON Sequence \n"); - vreg_set_level(vreg_cam_out17_af, 2800); // VDDAF 2.8V - vreg_set_level(vreg_cam_out9_vdda, 2800); // VDDA 2.8V - vreg_set_level(vreg_cam_out10_vddreg, 1800); // VGA Core 1.8V - vreg_set_level(vreg_cam_out8_vddio, 1800); // VDDIO 1.8V - vreg_set_level(vreg_cam_gp15_vddreg, 1200); // Mega Core VDD 1.2V + regulator_set_voltage(vreg_cam_out17_af, 2800000 ,2800000); // VDDAF 2.8V + regulator_set_level(vreg_cam_out9_vdda, 2800000 ,2800000); // VDDA 2.8V + regulator_set_level(vreg_cam_out10_vddreg, 1800000 ,1800000); // VGA Core 1.8V + regulator_set_level(vreg_cam_out8_vddio, 1800000 ,1800000); // VDDIO 1.8V + regulator_set_level(vreg_cam_gp15_vddreg, 1200000 ,1200000); // Mega Core VDD 1.2V gpio_tlmm_config(GPIO_CFG(0, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA) , GPIO_CFG_DISABLE); gpio_tlmm_config(GPIO_CFG(1, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA) , GPIO_CFG_DISABLE); mdelay(20); CAMDRV_DEBUG("Sensor AVDD 2.8V On \n"); - vreg_enable(vreg_cam_out9_vdda); + regulator_enable(vreg_cam_out9_vdda); CAMDRV_DEBUG("VT Sensor Core VDD_REG 1.8V On \n"); - vreg_enable(vreg_cam_out10_vddreg); + regulator_enable(vreg_cam_out10_vddreg); udelay(20); CAMDRV_DEBUG("Main Sensor Core VDD 1.2V On \n"); - vreg_enable(vreg_cam_gp15_vddreg); + regulator_enable(vreg_cam_gp15_vddreg); udelay(15); CAMDRV_DEBUG("Sensor I/O VDDIO 1.8V On \n"); - vreg_enable(vreg_cam_out8_vddio); + regulator_enable(vreg_cam_out8_vddio); mdelay(30); CAMDRV_DEBUG("I2C Enable \n"); @@ -734,16 +734,16 @@ static void sr030pc30_set_power_rev01( int onoff) mdelay(1); CAMDRV_DEBUG("Sensor I/O VDDIO 1.8V OFF \n"); - vreg_disable(vreg_cam_out8_vddio); + regulator_disable(vreg_cam_out8_vddio); CAMDRV_DEBUG("VT Sensor Core VDD_REG 1.8V OFF \n"); - vreg_disable(vreg_cam_out10_vddreg); + regulator_disable(vreg_cam_out10_vddreg); CAMDRV_DEBUG("Sensor AVDD 2.8V OFF \n"); - vreg_disable(vreg_cam_out9_vdda); + regulator_disable(vreg_cam_out9_vdda); CAMDRV_DEBUG("Main Sensor Core VDD 1.2V OFF \n"); - vreg_disable(vreg_cam_gp15_vddreg); + regulator_disable(vreg_cam_gp15_vddreg); CAMDRV_DEBUG("I2C Disable \n"); gpio_tlmm_config(GPIO_CFG(0, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA) , GPIO_CFG_DISABLE); @@ -771,21 +771,21 @@ static void sr030pc30_set_power(int onoff) void sr030pc30_set_power(int onoff) { unsigned int mclk_cfg; - struct vreg *vreg_ldo20, *vreg_ldo11; + struct regulator *vreg_ldo20, *vreg_ldo11; - vreg_ldo20 = vreg_get(NULL, "gp13"); + vreg_ldo20 = regulator_get(NULL, "gp13"); if (!vreg_ldo20) { printk("[S5K4ECGX]%s: VREG L20 get failed\n", __func__); } - if (vreg_set_level(vreg_ldo20, 1800)) { + if (regulator_set_voltage(vreg_ldo20, 1800000 ,1800000)) { printk("[S5K4ECGX]%s: vreg_set_level failed\n", __func__); } - vreg_ldo11 = vreg_get(NULL, "gp2"); + vreg_ldo11 = regulator_get(NULL, "gp2"); if (!vreg_ldo11) { printk("[S5K4ECGX]%s: VREG L11 get failed\n", __func__); } - if (vreg_set_level(vreg_ldo11, 2800)) { + if (regulator_set_voltage(vreg_ldo11, 2800000 ,2800000)) { printk("[S5K4ECGX]%s: vreg_set_level failed\n", __func__); } @@ -805,10 +805,10 @@ void sr030pc30_set_power(int onoff) gpio_set_value(CAM_FLASH_ENSET, 0); gpio_set_value(CAM_FLASH_FLEN, 0); - if (vreg_enable(vreg_ldo20)) { + if (regulator_enable(vreg_ldo20)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![SR030PC300]%s: reg_enable failed\n", __func__); } - if (vreg_enable(vreg_ldo11)) { + if (regulator_enable(vreg_ldo11)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![SR030PC300]%s: reg_enable failed\n", __func__); } mdelay(1); @@ -840,10 +840,10 @@ void sr030pc30_set_power(int onoff) gpio_set_value(31, 0); // VGA_STBY mdelay(1); - if (vreg_disable(vreg_ldo11)) { + if (regulator_disable(vreg_ldo11)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![SR030PC300]%s: reg_disable failed\n", __func__); } - if (vreg_disable(vreg_ldo20)) { + if (regulator_disable(vreg_ldo20)) { printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![SR030PC300]%s: reg_disable failed\n", __func__); } mdelay(1); diff --git a/drivers/misc/samsung_vibrator.c b/drivers/misc/samsung_vibrator.c index 35476ac5c3d..086c52dd592 100644 --- a/drivers/misc/samsung_vibrator.c +++ b/drivers/misc/samsung_vibrator.c @@ -11,10 +11,10 @@ #include #include -#include +#include static struct hrtimer vibe_timer; -static struct vreg *vreg_vib = NULL; +static struct regulator *vreg_vib = NULL; static int is_vibe_on = 0; @@ -63,7 +63,7 @@ static void set_pmic_vibrator(int on) { if (on) { #if defined(CONFIG_MACH_ANCORA) || defined(CONFIG_MACH_APACHE) - rc = vreg_enable(vreg_vib); + rc = regulator_enable(vreg_vib); if (rc) { pr_err("%s: vreg_enable failed \n", __func__); } @@ -74,7 +74,7 @@ static void set_pmic_vibrator(int on) { } else if (board_hw_revision>= 2 ) { - rc = vreg_enable(vreg_vib); + rc = regulator_enable(vreg_vib); if (rc) { pr_err("%s: vreg_enable failed \n", __func__); } @@ -84,7 +84,7 @@ static void set_pmic_vibrator(int on) { } else { if(is_vibe_on) { #if defined(CONFIG_MACH_ANCORA) || defined(CONFIG_MACH_APACHE) - rc = vreg_disable(vreg_vib); + rc = regulator_disable(vreg_vib); if (rc) { pr_err("%s: vreg_disable failed \n", __func__); } @@ -92,7 +92,7 @@ static void set_pmic_vibrator(int on) { if(board_hw_revision == 1) { gpio_set_value(VIB_ON, VIBRATION_OFF); } else if ( board_hw_revision>= 2 ) { - rc = vreg_disable(vreg_vib); + rc = regulator_disable(vreg_vib); if (rc) { pr_err("%s: vreg_disable failed \n", __func__); } @@ -182,29 +182,29 @@ static int __devinit msm_vibrator_probe(struct platform_device *pdev) { pr_info("[VIB] msm_vibrator_probe \n"); #if defined(CONFIG_MACH_ANCORA) || defined(CONFIG_MACH_APACHE) - vreg_vib = vreg_get(NULL, "wlan2"); + vreg_vib = regulator_get(NULL, "wlan2"); if (IS_ERR(vreg_vib)) { pr_err("%s: wlan2 vreg get failed (%ld)", __func__, PTR_ERR(vreg_vib)); } - rc = vreg_set_level(vreg_vib, 3300); + rc = regulator_set_voltage(vreg_vib, 3300000 ,3300000); if (rc) { pr_err("%s: vreg_set_level failed \n", __func__); } #elif defined(CONFIG_MACH_ANCORA_TMO) - rc = vreg_set_level(vreg_vib, 3000); + rc = regulator_set_voltage(vreg_vib, 3000000 ,3000000); if (rc) { pr_err("%s: vreg_set_level failed \n", __func__); } if(board_hw_revision>= 2) { - vreg_vib = vreg_get(NULL, "gp4"); + vreg_vib = regulator_get(NULL, "gp4"); if (IS_ERR(vreg_vib)) { pr_err("%s: gp4 vreg get failed (%ld)", __func__, PTR_ERR(vreg_vib)); } - rc = vreg_set_level(vreg_vib, 3300); + rc = regulator_set_voltage(vreg_vib, 3300000 ,3300000); if (rc) { pr_err("%s: vreg_set_level failed \n", __func__); }