Commit 7d864b90 authored by Vincent Zvikaramba's avatar Vincent Zvikaramba

Revert "drivers: Remove j5 current limit"

This reverts commit 9c6cc7c5.

Change-Id: I94e19afbf53463095afc8c4cffd159fc83e50db1
parent f0f14c37
......@@ -72,10 +72,8 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="j5_battery_data.h"
CONFIG_SAMSUNG_LPM_MODE=y
CONFIG_FUELGAUGE_SM5703=y
CONFIG_BATTERY_SWELLING=y
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1200
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1000
CONFIG_PREVENT_SOC_JUMP=y
CONFIG_SW_SELF_DISCHARGING=y
CONFIG_CHARGER_SM5703_DUALPATH=y
# DUAL SIM / SINGLE SIM Detection
CONFIG_CHECK_SIMSLOT_COUNT=y
......
......@@ -72,10 +72,8 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="j5_battery_data.h"
CONFIG_SAMSUNG_LPM_MODE=y
CONFIG_FUELGAUGE_SM5703=y
CONFIG_BATTERY_SWELLING=y
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1200
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1000
CONFIG_PREVENT_SOC_JUMP=y
CONFIG_SW_SELF_DISCHARGING=y
CONFIG_CHARGER_SM5703_DUALPATH=y
# DUAL SIM / SINGLE SIM Detection
CONFIG_CHECK_SIMSLOT_COUNT=y
......
......@@ -77,10 +77,8 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="j5_battery_data.h"
CONFIG_SAMSUNG_LPM_MODE=y
CONFIG_FUELGAUGE_SM5703=y
CONFIG_BATTERY_SWELLING=y
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1200
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1000
CONFIG_PREVENT_SOC_JUMP=y
CONFIG_SW_SELF_DISCHARGING=y
CONFIG_CHARGER_SM5703_DUALPATH=y
# DUAL SIM / SINGLE SIM Detection
CONFIG_CHECK_SIMSLOT_COUNT=y
......
......@@ -93,7 +93,7 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="j5x_battery_data.h"
CONFIG_SAMSUNG_LPM_MODE=y
CONFIG_FUELGAUGE_SM5703=y
CONFIG_BATTERY_SWELLING=y
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1200
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=700
CONFIG_PREVENT_SOC_JUMP=y
CONFIG_SW_SELF_DISCHARGING=y
CONFIG_CHARGER_SM5703_DUALPATH=y
......
......@@ -63,7 +63,7 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="o7_battery_data.h"
CONFIG_SAMSUNG_LPM_MODE=y
CONFIG_FUELGAUGE_SM5703=y
CONFIG_BATTERY_SWELLING=y
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=1200
CONFIG_SIOP_CHARGING_LIMIT_CURRENT=700
CONFIG_PREVENT_SOC_JUMP=y
CONFIG_CHARGER_SM5703_SOFT_START_CHARGING=y
CONFIG_CHARGER_SM5703_DUALPATH=y
......
This diff is collapsed.
......@@ -584,6 +584,9 @@ static int sm5703_fled_flash(struct sm_fled_info *fled_info, int turn_way)
{
int ret = 0;
sm5703_fled_info_t *info = (sm5703_fled_info_t *)fled_info;
#if (defined(CONFIG_SEC_J5_PROJECT) || defined(CONFIG_SEC_J5N_PROJECT)) && !defined(CONFIG_MACH_J5LTE_CHN_CMCC) /* only for J5 LDO1 noise */
int limit_current;
#endif
SM5703_FLED_INFO("Start : E\n");
SM5703_FLED_INFO("%s, info->boost = %d\n",__FUNCTION__,info->boost);
......@@ -605,6 +608,18 @@ static int sm5703_fled_flash(struct sm_fled_info *fled_info, int turn_way)
sm5703_assign_bits(info->i2c_client,SM5703_FLEDCNTL1,SM5703_FLEDEN_MASK,SM5703_FLEDEN_FLASH_MODE);
break;
case FLASHLIGHT_MODE_TORCH:
#if (defined(CONFIG_SEC_J5_PROJECT) || defined(CONFIG_SEC_J5N_PROJECT)) && !defined(CONFIG_MACH_J5LTE_CHN_CMCC) /* only for J5 LDO1 noise */
limit_current = sm5703_reg_read(info->i2c_client,SM5703_VBUSCNTL);
SM5703_FLED_INFO("%s, change limit_current %d\n",__FUNCTION__,limit_current);
if(0x6 >= limit_current && limit_current >= 0x0)/* 100mA ~ 400mA : Topoff(Max 200mA) + Torch(170mA) current at present*/
{
sm5703_reg_write(info->i2c_client,SM5703_VBUSCNTL,0x08); /* change limit current to 500mA for topoff current */
SM5703_FLED_INFO("%s, change vbuslimit to 500mA\n",__FUNCTION__);
}
else
SM5703_FLED_INFO("%s, non change vbuslimit \n",__FUNCTION__);
#endif
sm5703_assign_bits(info->i2c_client,SM5703_FLEDCNTL1,SM5703_FLEDEN_MASK,SM5703_FLEDEN_MOVIE_MODE);
test = sm5703_reg_read(info->i2c_client,SM5703_FLEDCNTL4);
SM5703_FLED_ERR("<sm5703_fled_flash>Torch mode Register Settings 0x%x \n",test);
......@@ -631,6 +646,18 @@ static int sm5703_fled_flash(struct sm_fled_info *fled_info, int turn_way)
gpio_free(led_irq_gpio2);
break;
case FLASHLIGHT_MODE_TORCH:
#if (defined(CONFIG_SEC_J5_PROJECT) || defined(CONFIG_SEC_J5N_PROJECT)) && !defined(CONFIG_MACH_J5LTE_CHN_CMCC) /* only for J5 LDO1 noise */
limit_current = sm5703_reg_read(info->i2c_client,SM5703_VBUSCNTL);
SM5703_FLED_INFO("%s, change limit_current %d\n",__FUNCTION__,limit_current);
if(0x6 >= limit_current && limit_current >= 0x0)/* 100mA ~ 400mA : Topoff(Max 200mA) + Torch(170mA) current at present, Don't set this range over 500mA */
{
sm5703_reg_write(info->i2c_client,SM5703_VBUSCNTL,0x08); /* change limit current to 500mA for topoff current */
SM5703_FLED_INFO("%s, change vbuslimit to 500mA\n",__FUNCTION__);
}
else
SM5703_FLED_INFO("%s, non change vbuslimit \n",__FUNCTION__);
#endif
sm5703_assign_bits(info->i2c_client,SM5703_FLEDCNTL1,SM5703_FLEDEN_MASK,SM5703_FLEDEN_EXTERNAL);
gpio_request(led_irq_gpio1, NULL);
gpio_request(led_irq_gpio2, NULL);
......
......@@ -20,6 +20,9 @@
#include <linux/of.h>
#include <linux/regulator/of_regulator.h>
#include <linux/battery/charger/sm5703_charger.h>
#if (defined(CONFIG_SEC_J5_PROJECT) || defined(CONFIG_SEC_J5N_PROJECT)) && !defined(CONFIG_MACH_J5LTE_CHN_CMCC) /* only for J5 LDO1 noise */
#include <linux/battery/sec_charger.h>
#endif
#define ALIAS_NAME "sm5703-regulator"
......@@ -334,6 +337,53 @@ static int sm5703_usbldo_regulator_get_voltage(struct regulator_dev *rdev)
#endif //(LINUX_VERSION_CODE<KERNEL_VERSION(2,6,39))
#if (defined(CONFIG_SEC_J5_PROJECT) || defined(CONFIG_SEC_J5N_PROJECT)) && !defined(CONFIG_MACH_J5LTE_CHN_CMCC) /* only for J5 LDO1 noise */
static int sm5703_regulator_enable(struct regulator_dev *rdev)
{
struct sm5703_regulator_info *info = rdev_get_drvdata(rdev);
int ret;
union power_supply_propval value;
pr_info("%s Enable regulator %s\n", ALIAS_NAME, rdev->desc->name);
pr_info("%s desc.id = %d\n", __func__,info->desc.id);
ret = sm5703_set_bits(info->i2c, info->enable_reg, info->enable_bit);
if (info->desc.id == SM5703_ID_LDO1)
{
value.intval = 5;
psy_do_property("sm5703-charger", set,
POWER_SUPPLY_PROP_INPUT_CURRENT_MAX, value);
pr_info("%s %s input current",rdev->desc->name, __func__);
}
pr_info("%s %s %s ret (%d)", ALIAS_NAME, rdev->desc->name, __func__, ret);
return ret;
}
static int sm5703_regulator_disable(struct regulator_dev *rdev)
{
struct sm5703_regulator_info *info = rdev_get_drvdata(rdev);
int ret;
union power_supply_propval value;
pr_info("%s Disable regulator %s\n", ALIAS_NAME, rdev->desc->name);
pr_info("%s desc.id = %d\n", __func__,info->desc.id);
ret = sm5703_clr_bits(info->i2c, info->enable_reg, info->enable_bit);
if (info->desc.id == SM5703_ID_LDO1)
{
value.intval = 6;
psy_do_property("sm5703-charger", set,
POWER_SUPPLY_PROP_INPUT_CURRENT_MAX, value);
pr_info("%s %s input current",rdev->desc->name, __func__);
}
pr_info("%s %s ret (%d)", ALIAS_NAME, __func__, ret);
return ret;
}
#else
static int sm5703_regulator_enable(struct regulator_dev *rdev)
{
struct sm5703_regulator_info *info = rdev_get_drvdata(rdev);
......@@ -358,6 +408,7 @@ static int sm5703_regulator_disable(struct regulator_dev *rdev)
return ret;
}
#endif
static int sm5703_regulator_is_enabled(struct regulator_dev *rdev)
{
struct sm5703_regulator_info *info = rdev_get_drvdata(rdev);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment