From 75e9568f06ca7fcadda9cef34193cbf32ea66588 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Thu, 12 Jun 2014 15:33:37 +0800 Subject: [PATCH] rk3288:pmic:ricoh619:modify some warnings --- drivers/mfd/ricoh619.c | 17 +++++------ drivers/power/ricoh619-battery.c | 42 ++++++++++++++++---------- drivers/regulator/ricoh619-regulator.c | 20 ++++++------ drivers/rtc/rtc-ricoh619.c | 18 +++++------ include/linux/mfd/ricoh619.h | 2 +- include/linux/power/ricoh619_battery.h | 2 +- 6 files changed, 54 insertions(+), 47 deletions(-) mode change 100644 => 100755 drivers/regulator/ricoh619-regulator.c diff --git a/drivers/mfd/ricoh619.c b/drivers/mfd/ricoh619.c index 2afdc7f49eed..e4e04dcddb1c 100755 --- a/drivers/mfd/ricoh619.c +++ b/drivers/mfd/ricoh619.c @@ -67,7 +67,7 @@ static struct mfd_cell ricoh619s[] = { #define SLEEP_INIT(_id, _reg) \ [RICOH619_DS_##_id] = {.reg_add = _reg} - +/* static struct sleep_control_data sleep_data[] = { SLEEP_INIT(DC1, 0x16), SLEEP_INIT(DC2, 0x17), @@ -91,6 +91,7 @@ static struct sleep_control_data sleep_data[] = { SLEEP_INIT(PSO4, 0x29), SLEEP_INIT(LDORTC1, 0x2A), }; +*/ static inline int __ricoh619_read(struct i2c_client *client, u8 reg, uint8_t *val) { @@ -463,6 +464,7 @@ static void ricoh619_power_off(void) } EXPORT_SYMBOL_GPL(ricoh619_power_off); +#if 0 static int ricoh619_gpio_get(struct gpio_chip *gc, unsigned offset) { struct ricoh619 *ricoh619 = container_of(gc, struct ricoh619, gpio_chip); @@ -516,7 +518,6 @@ static int ricoh619_gpio_to_irq(struct gpio_chip *gc, unsigned off) return -EIO; } - static void ricoh619_gpio_init(struct ricoh619 *ricoh619, struct ricoh619_platform_data *pdata) { @@ -589,7 +590,7 @@ static void ricoh619_gpio_init(struct ricoh619 *ricoh619, if (ret) dev_warn(ricoh619->dev, "GPIO registration failed: %d\n", ret); } - +#endif static int ricoh619_remove_subdev(struct device *dev, void *unused) { platform_device_unregister(to_platform_device(dev)); @@ -601,7 +602,7 @@ static int ricoh619_remove_subdevs(struct ricoh619 *ricoh619) return device_for_each_child(ricoh619->dev, NULL, ricoh619_remove_subdev); } - +#if 0 static int ricoh619_add_subdevs(struct ricoh619 *ricoh619, struct ricoh619_platform_data *pdata) { @@ -627,7 +628,7 @@ failed: ricoh619_remove_subdevs(ricoh619); return ret; } - +#endif #ifdef CONFIG_DEBUG_FS #include #include @@ -729,8 +730,7 @@ static void __init ricoh619_debuginit(struct ricoh619 *ricoh) static struct ricoh619_platform_data *ricoh619_parse_dt(struct ricoh619 *ricoh619) { struct ricoh619_platform_data *pdata; - struct device_node *regs,*ricoh619_pmic_np; - int i, count; + struct device_node *ricoh619_pmic_np; ricoh619_pmic_np = of_node_get(ricoh619->dev->of_node); if (!ricoh619_pmic_np) { @@ -785,7 +785,6 @@ static void ricoh619_noe_init(struct ricoh619 *ricoh) static int ricoh619_pre_init(struct ricoh619 *ricoh619) { int ret=0; - u8 val; printk("%s,line=%d\n", __func__,__LINE__); /* ret = ricoh619_read(ricoh619->dev,0x09,&val); @@ -922,9 +921,9 @@ static int ricoh619_i2c_suspend(struct i2c_client *client, pm_message_t state) } static int ricoh619_i2c_resume(struct i2c_client *client) { + /* uint8_t reg_val; int ret; - /* ret = __ricoh619_read(client, RICOH619_INT_IR_SYS, ®_val); if(ricoh619_pwr_key_reg & 0x01) { //If PWR_KEY wakeup //printk("PMU: %s: PWR_KEY Wakeup %08x\n",__func__,ricoh619_pwr_key_reg); diff --git a/drivers/power/ricoh619-battery.c b/drivers/power/ricoh619-battery.c index d44d3a0bb7f8..012ab6b52b6b 100755 --- a/drivers/power/ricoh619-battery.c +++ b/drivers/power/ricoh619-battery.c @@ -45,7 +45,7 @@ /* define for function */ #define ENABLE_FUEL_GAUGE_FUNCTION #define ENABLE_LOW_BATTERY_DETECTION -#define ENABLE_FACTORY_MODE +//#define ENABLE_FACTORY_MODE #define DISABLE_CHARGER_TIMER /* #define ENABLE_FG_KEEP_ON_MODE */ /* #define ENABLE_OCV_TABLE_CALIB */ @@ -296,7 +296,7 @@ static int get_battery_temp(struct ricoh619_battery_info *info); static int get_battery_temp_2(struct ricoh619_battery_info *info); static int check_jeita_status(struct ricoh619_battery_info *info, bool *is_jeita_updated); static void ricoh619_scaling_OCV_table(struct ricoh619_battery_info *info, int cutoff_vol, int full_vol, int *start_per, int *end_per); -static int ricoh619_Check_OCV_Offset(struct ricoh619_battery_info *info); +//static int ricoh619_Check_OCV_Offset(struct ricoh619_battery_info *info); static int calc_ocv(struct ricoh619_battery_info *info) { @@ -313,7 +313,7 @@ static int calc_ocv(struct ricoh619_battery_info *info) return ocv; } - +#if 0 static int set_Rlow(struct ricoh619_battery_info *info) { int err; @@ -420,6 +420,7 @@ static int Set_back_ocv_table(struct ricoh619_battery_info *info) /** **/ + static int ricoh619_Check_OCV_Offset(struct ricoh619_battery_info *info) { int ocv_table[11]; // HEX value @@ -476,7 +477,7 @@ static int ricoh619_Check_OCV_Offset(struct ricoh619_battery_info *info) return 0; } - +#endif static int reset_FG_process(struct ricoh619_battery_info *info) { int err; @@ -723,7 +724,7 @@ static int get_target_use_cap(struct ricoh619_battery_info *info) int i,j; int ocv_table[11]; int temp; - int Target_Cutoff_Vol = 0; +// int Target_Cutoff_Vol = 0; int Ocv_ZeroPer_now; int Ibat_now; int fa_cap,use_cap; @@ -733,10 +734,10 @@ static int get_target_use_cap(struct ricoh619_battery_info *info) int CC_OnePer_step; int Ibat_min; - int Ocv_now; +// int Ocv_now; int Ocv_now_table; - int soc_per; - int use_cap_now; +// int soc_per; +// int use_cap_now; int Rsys_now; /* get const value */ @@ -3179,7 +3180,7 @@ static void charger_irq_work(struct work_struct *work) { struct ricoh619_battery_info *info = container_of(work, struct ricoh619_battery_info, irq_work); - int ret = 0,i; + int ret = 0; uint8_t reg_val; RICOH_FG_DBG("PMU:%s In\n", __func__); @@ -3193,6 +3194,7 @@ static void charger_irq_work(struct work_struct *work) ricoh619_read(info->dev->parent, CHGSTATE_REG, ®_val); if (reg_val & 0x40) { /* USE ADP */ #ifdef SUPPORT_USB_CONNECT_TO_ADP + int i; for(i =0;i<60;i++){ RICOH_FG_DBG("PMU:%s usb det dwc_otg_check_dpdm =%d\n", __func__,dwc_otg_check_dpdm(0)); if(2 == dwc_otg_check_dpdm(0)){ @@ -3807,7 +3809,7 @@ out: new_temp = get_battery_temp(info); return new_temp; } - +#if 0 static int get_time_to_empty(struct ricoh619_battery_info *info) { int ret = 0; @@ -3841,7 +3843,7 @@ static int get_time_to_full(struct ricoh619_battery_info *info) return ret; } - +#endif /* battery voltage is get from Fuel gauge */ static int measure_vbatt_FG(struct ricoh619_battery_info *info, int *data) { @@ -4028,16 +4030,18 @@ static int ricoh619_batt_get_prop(struct power_supply *psy, return ret; } #ifdef SUPPORT_USB_CONNECT_TO_ADP - if (psy->type == POWER_SUPPLY_TYPE_MAINS) + if (psy->type == POWER_SUPPLY_TYPE_MAINS){ if((2 == dwc_otg_check_dpdm(0)) && (status & 0x40)) val->intval =1; else val->intval =0; - else if (psy->type == POWER_SUPPLY_TYPE_USB) + } + else if (psy->type == POWER_SUPPLY_TYPE_USB){ if((1 == dwc_otg_check_dpdm(0)) && (status & 0x40)) val->intval =1; else val->intval =0; + } #else if (psy->type == POWER_SUPPLY_TYPE_MAINS) val->intval = (status & 0x40 ? 1 : 0); @@ -4223,7 +4227,6 @@ ricoh619_battery_dt_init(struct platform_device *pdev) struct device_node *nproot = pdev->dev.parent->of_node; struct device_node *np; struct ricoh619_battery_platform_data *pdata; - int temp; if (!nproot) return pdev->dev.platform_data; @@ -4243,7 +4246,7 @@ ricoh619_battery_dt_init(struct platform_device *pdev) /* check rage of b,.attery type */ type_n = Battery_Type(); - RICOH_FG_DBG("%s type_n=%d,temp is %d\n", __func__, type_n,temp); + RICOH_FG_DBG("%s type_n=%d\n", __func__, type_n); switch (type_n) { case (0): @@ -4584,7 +4587,9 @@ static int ricoh619_battery_remove(struct platform_device *pdev) #ifdef RICOH619_VADP_DROP_WORK cancel_delayed_work(&info->vadp_drop_work); #endif +#ifdef ENABLE_FACTORY_MODE cancel_delayed_work(&info->factory_mode_work); +#endif cancel_delayed_work(&info->jeita_work); cancel_delayed_work(&info->charge_complete_ready); @@ -4594,12 +4599,15 @@ static int ricoh619_battery_remove(struct platform_device *pdev) flush_workqueue(info->monitor_wqueue); flush_workqueue(info->workqueue); flush_workqueue(info->usb_workqueue); +#ifdef ENABLE_FACTORY_MODE flush_workqueue(info->factory_mode_wqueue); - +#endif destroy_workqueue(info->monitor_wqueue); destroy_workqueue(info->workqueue); destroy_workqueue(info->usb_workqueue); +#ifdef ENABLE_FACTORY_MODE destroy_workqueue(info->factory_mode_wqueue); +#endif power_supply_unregister(&info->battery); kfree(info); @@ -4728,7 +4736,9 @@ static int ricoh619_battery_suspend(struct device *dev) cancel_delayed_work(&info->low_battery_work); #endif cancel_delayed_work(&info->charge_complete_ready); +#ifdef ENABLE_FACTORY_MODE cancel_delayed_work(&info->factory_mode_work); +#endif cancel_delayed_work(&info->jeita_work); #ifdef RICOH619_VADP_DROP_WORK cancel_delayed_work(&info->vadp_drop_work); diff --git a/drivers/regulator/ricoh619-regulator.c b/drivers/regulator/ricoh619-regulator.c old mode 100644 new mode 100755 index b840ce9ae19c..4efadc34e25d --- a/drivers/regulator/ricoh619-regulator.c +++ b/drivers/regulator/ricoh619-regulator.c @@ -77,14 +77,14 @@ static inline struct device *to_ricoh619_dev(struct regulator_dev *rdev) { return rdev_get_dev(rdev)->parent->parent; } - +/* static int ricoh619_regulator_enable_time(struct regulator_dev *rdev) { struct ricoh619_regulator *ri = rdev_get_drvdata(rdev); return ri->delay; } - +*/ static int ricoh619_reg_is_enabled(struct regulator_dev *rdev) { struct ricoh619_regulator *ri = rdev_get_drvdata(rdev); @@ -363,7 +363,6 @@ static int ricoh619_reg_suspend_enable(struct regulator_dev *rdev) struct ricoh619_regulator *ri = rdev_get_drvdata(rdev); struct device *parent = to_ricoh619_dev(rdev); int ret; - u8 vout_val; ret = ricoh619_set_bits(parent, (0x16 + ri->id), (0xf << 0)); if (ret < 0) { dev_err(&rdev->dev, "Error in updating the STATE register\n"); @@ -515,7 +514,7 @@ static inline struct ricoh619_regulator *find_regulator_info(int id) } return NULL; } - +#if 0 static int ricoh619_regulator_preinit(struct device *parent, struct ricoh619_regulator *ri, struct ricoh619_regulator_platform_data *ricoh619_pdata) @@ -550,7 +549,7 @@ static int ricoh619_regulator_preinit(struct device *parent, return ret; } - +#endif static inline int ricoh619_cache_regulator_register(struct device *parent, struct ricoh619_regulator *ri) { @@ -615,7 +614,6 @@ static int ricoh619_regulator_probe(struct platform_device *pdev) struct ricoh619_regulator *ri = NULL; struct regulator_dev *rdev; struct regulator_config config = { }; - struct regulator_init_data *pdata_regulator = dev_get_platdata(&pdev->dev); int err,id=0; rdev = devm_kzalloc(&pdev->dev, RICOH619_NUM_REGULATOR * @@ -637,12 +635,12 @@ static int ricoh619_regulator_probe(struct platform_device *pdev) config.dev = &pdev->dev; config.driver_data = ri; - if (ricoh619_regulator_matches) - config.of_node = ricoh619_regulator_matches[id].of_node; + config.of_node = ricoh619_regulator_matches[id].of_node; - if (ricoh619_regulator_dt_init(pdev, &config, id)) - if (pdata_regulator) - config.init_data = &pdata_regulator; + err = ricoh619_regulator_dt_init(pdev, &config, id); + if (err < 0) { + dev_err(&pdev->dev, "failed to regulator dt init\n"); + } rdev = regulator_register(&ri->desc, &config); if (IS_ERR_OR_NULL(rdev)) { diff --git a/drivers/rtc/rtc-ricoh619.c b/drivers/rtc/rtc-ricoh619.c index b70507aa4b6a..9b16f28f2835 100755 --- a/drivers/rtc/rtc-ricoh619.c +++ b/drivers/rtc/rtc-ricoh619.c @@ -201,7 +201,8 @@ static int ricoh619_rtc_Pon_get_clr(struct device *dev, uint8_t *Pon_f) } // 0-12hour, 1-24hour -static int ricoh619_rtc_hour_mode_get(struct device *dev, int *mode) +/* +static int ricoh619_rtc_hour_mode_get(struct device *dev, uint8_t *mode) { int err; @@ -216,7 +217,7 @@ static int ricoh619_rtc_hour_mode_get(struct device *dev, int *mode) return err; } - +*/ // 0-12hour, 1-24hour static int ricoh619_rtc_hour_mode_set(struct device *dev, int mode) { @@ -325,7 +326,6 @@ static int ricoh619_rtc_set_time(struct device *dev, struct rtc_time *tm) static int ricoh619_rtc_alarm_is_enabled(struct device *dev, uint8_t *enabled) { - struct ricoh619_rtc *rtc = dev_get_drvdata(dev); int err; uint8_t reg_data; @@ -362,13 +362,13 @@ static int ricoh619_rtc_alarm_enable(struct device *dev, unsigned int enabled) err = ricoh619_read_regs(dev, rtc_ctrl1, 1,®_data); if(err < 0) { - dev_err(dev->parent, "read rtc_ctrl1 error 0x%lx\n", err); + dev_err(dev->parent, "read rtc_ctrl1 error =%d\n", err); goto ERR; } reg_data |= 0x40;// set DALE err = ricoh619_write_regs(dev, rtc_ctrl1, 1,®_data); if(dev < 0) - dev_err(dev->parent, "write rtc_ctrl1 error 0x%lx\n", err); + dev_err(dev->parent, "write rtc_ctrl1 error =%d\n", err); } else { @@ -376,13 +376,13 @@ static int ricoh619_rtc_alarm_enable(struct device *dev, unsigned int enabled) err = ricoh619_read_regs(dev, rtc_ctrl1, 1,®_data); if(err < 0) { - dev_err(dev->parent, "read rtc_ctrl1 error 0x%lx\n", err); + dev_err(dev->parent, "read rtc_ctrl1 error =%d\n", err); goto ERR; } reg_data &= 0xbf;// clear DALE err = ricoh619_write_regs(dev, rtc_ctrl1, 1,®_data); if(dev < 0) - dev_err(dev->parent, "write rtc_ctrl1 error 0x%lx\n", err); + dev_err(dev->parent, "write rtc_ctrl1 error =%d\n", err); } ERR: @@ -422,14 +422,14 @@ static int ricoh619_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) err = ricoh619_read_regs(dev, rtc_alarm_y_sec, sizeof(buff), buff); if(err <0) { - dev_err(dev->parent, "RTC: %s *** read rtc_alarm timer error 0x%lx\n", __func__, err); + dev_err(dev->parent, "RTC: %s *** read rtc_alarm timer error =%d\n", __func__, err); return err; } err = ricoh619_read_regs(dev, rtc_ctrl1, 1,&enabled_flag); if(err<0) { - dev_err(dev->parent, "RTC: %s *** read rtc_enable flag error 0x%lx\n", __func__, err); + dev_err(dev->parent, "RTC: %s *** read rtc_enable flag error =%d\n", __func__, err); return err; } if(enabled_flag & 0x40) diff --git a/include/linux/mfd/ricoh619.h b/include/linux/mfd/ricoh619.h index 1a711975717c..8dae94cfc3a7 100755 --- a/include/linux/mfd/ricoh619.h +++ b/include/linux/mfd/ricoh619.h @@ -344,7 +344,7 @@ struct ricoh619_platform_data { /* ==================================== */ struct ricoh619_pwrkey_platform_data { int irq; - unsigned long delay_ms; + unsigned delay_ms; }; extern int ricoh619_pwrkey_wakeup; extern struct ricoh619 *g_ricoh619; diff --git a/include/linux/power/ricoh619_battery.h b/include/linux/power/ricoh619_battery.h index ec8c4fa8ec59..01b85a414e02 100755 --- a/include/linux/power/ricoh619_battery.h +++ b/include/linux/power/ricoh619_battery.h @@ -143,7 +143,7 @@ struct ricoh619_battery_platform_data { int irq; int alarm_vol_mv; int multiple; - unsigned long monitor_time; + unsigned monitor_time; struct ricoh619_battery_type_data type[BATTERY_TYPE_NUM]; }; -- 2.34.1