From: hxy Date: Sat, 4 Sep 2010 14:38:09 +0000 (+0800) Subject: modify change charge current X-Git-Tag: firefly_0821_release~11185 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=522973813997b2477d1cdc8a2d80330a26e2df38;p=firefly-linux-kernel-4.4.55.git modify change charge current --- diff --git a/arch/arm/configs/rk2818_raho_defconfig b/arch/arm/configs/rk2818_raho_defconfig old mode 100755 new mode 100644 index 9cddd7853af5..a85969b199dc --- a/arch/arm/configs/rk2818_raho_defconfig +++ b/arch/arm/configs/rk2818_raho_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.32.9 -# Fri Sep 3 20:53:52 2010 +# Sat Sep 4 20:01:16 2010 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -936,6 +936,7 @@ CONFIG_REGULATOR_DEBUG=y # CONFIG_REGULATOR_LP3971 is not set # CONFIG_REGULATOR_TPS65023 is not set # CONFIG_REGULATOR_TPS6507X is not set +CONFIG_RK2818_REGULATOR_CHARGE=y CONFIG_RK2818_REGULATOR_LP8725=y CONFIG_MEDIA_SUPPORT=y diff --git a/drivers/power/rk2818_battery.c b/drivers/power/rk2818_battery.c index 8f01bee09760..f8af0c0450c8 100644 --- a/drivers/power/rk2818_battery.c +++ b/drivers/power/rk2818_battery.c @@ -100,6 +100,7 @@ int gBatVoltageLevel = VOLTAGE_MID_LEVEL; int gBatUseStatus = BAT_LOADER_STATUS; static struct regulator *pChargeregulator; +int gVbuscharge = 0; extern int dwc_vbus_status(void); extern int get_msc_connect_flag(void); @@ -145,6 +146,7 @@ typedef enum { static int rk2818_get_charge_status(void) { + struct regulator * rdev = pChargeregulator; //DBG("gAdcValue[CHN_USB_ADC]=%d\n",gAdcValue[CHN_USB_ADC]); if(gAdcValue[CHN_USB_ADC] > 250) //about 0.5V { @@ -152,12 +154,23 @@ static int rk2818_get_charge_status(void) } else if((1 == dwc_vbus_status())&& (0 == get_msc_connect_flag())) { - regulator_set_current_limit(pChargeregulator,0,1200000); + if(gVbuscharge !=1) +{ + if(rdev== pChargeregulator ) + regulator_set_current_limit(rdev,0,1200000); +} + gVbuscharge = 1; return 1; } else { - regulator_set_current_limit(pChargeregulator,0,475000); + if(gVbuscharge !=0 ) +{ + if(rdev== pChargeregulator ) + regulator_set_current_limit(rdev,0,475000); +} + gVbuscharge = 0; + return 0; } } diff --git a/drivers/regulator/charge-regulator.c b/drivers/regulator/charge-regulator.c index e5448627722f..d3c11dd9d23a 100644 --- a/drivers/regulator/charge-regulator.c +++ b/drivers/regulator/charge-regulator.c @@ -74,11 +74,10 @@ static int charge_get_current(struct regulator_dev *dev) static int charge_set_current(struct regulator_dev *dev, int min_uA, int max_uA) { - printk("enter charge_set_current , max_uA = %d\n",max_uA); + DBG("enter charge_set_current , max_uA = %d\n",max_uA); struct charge_platform_data *pdata = rdev_get_drvdata(dev); const int *current_map = charge_current_map; int max_mA = max_uA / 1000; - printk("charge_set_current:pdata->gpio_charge=%d\n",pdata->gpio_charge); if ( max_mA == current_map[0] ) gpio_direction_output(pdata->gpio_charge, GPIO_HIGH); else @@ -110,14 +109,9 @@ static int __devinit charge_regulator_probe(struct platform_device *pdev) struct charge_platform_data *pdata = pdev->dev.platform_data; struct regulator_dev *rdev; int ret ; -printk(KERN_INFO "enter charge regulator\n"); -#if 0 - rdev = regulator_register(&chargeregulator, &pdev->dev, - pdev->dev.platform_data, pdata); -#else + rdev = regulator_register(&chargeregulator, &pdev->dev, pdata->init_data, pdata); -#endif if (IS_ERR(rdev)) { dev_dbg(&pdev->dev, "couldn't register regulator\n"); return PTR_ERR(rdev);