#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),
SLEEP_INIT(PSO4, 0x29),
SLEEP_INIT(LDORTC1, 0x2A),
};
+*/
static inline int __ricoh619_read(struct i2c_client *client,
u8 reg, uint8_t *val)
{
}
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);
return -EIO;
}
-
static void ricoh619_gpio_init(struct ricoh619 *ricoh619,
struct ricoh619_platform_data *pdata)
{
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));
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)
{
ricoh619_remove_subdevs(ricoh619);
return ret;
}
-
+#endif
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/seq_file.h>
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) {
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);
}
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);
/* 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 */
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)
{
return ocv;
}
-
+#if 0
static int set_Rlow(struct ricoh619_battery_info *info)
{
int err;
/**
**/
+
static int ricoh619_Check_OCV_Offset(struct ricoh619_battery_info *info)
{
int ocv_table[11]; // HEX value
return 0;
}
-
+#endif
static int reset_FG_process(struct ricoh619_battery_info *info)
{
int err;
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;
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 */
{
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__);
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)){
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;
return ret;
}
-
+#endif
/* battery voltage is get from Fuel gauge */
static int measure_vbatt_FG(struct ricoh619_battery_info *info, int *data)
{
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);
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;
/* 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):
#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);
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);
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);
{
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);
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");
}
return NULL;
}
-
+#if 0
static int ricoh619_regulator_preinit(struct device *parent,
struct ricoh619_regulator *ri,
struct ricoh619_regulator_platform_data *ricoh619_pdata)
return ret;
}
-
+#endif
static inline int ricoh619_cache_regulator_register(struct device *parent,
struct ricoh619_regulator *ri)
{
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 *
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)) {
}
// 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;
return err;
}
-
+*/
// 0-12hour, 1-24hour
static int ricoh619_rtc_hour_mode_set(struct device *dev, int mode)
{
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;
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
{
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:
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)
/* ==================================== */
struct ricoh619_pwrkey_platform_data {
int irq;
- unsigned long delay_ms;
+ unsigned delay_ms;
};
extern int ricoh619_pwrkey_wakeup;
extern struct ricoh619 *g_ricoh619;
int irq;
int alarm_vol_mv;
int multiple;
- unsigned long monitor_time;
+ unsigned monitor_time;
struct ricoh619_battery_type_data type[BATTERY_TYPE_NUM];
};