Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463574 > unrolled thread

[PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature"

Started byWenyou Yang <wenyou.yang@atmel.com>
First post2016-08-16 11:20 +0200
Last post2016-08-17 13:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature" Wenyou Yang <wenyou.yang@atmel.com> - 2016-08-16 11:20 +0200
    Re: [PATCH v5 1/7] power: act8945a_charger: Remove  "battery_temperature" Sebastian Reichel <sre@kernel.org> - 2016-08-17 13:40 +0200

#1463574 — [PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature"

FromWenyou Yang <wenyou.yang@atmel.com>
Date2016-08-16 11:20 +0200
Subject[PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature"
Message-ID<s6IHo-1dz-13@gated-at.bofh.it>
Remove "battery_temperature" member, it is redundant, it is the
hardware's responsibility to handle TH pin properly.
It is unnecessary to use the dt property to check if there is
a battery temperature monitor or not.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/power/supply/act8945a_charger.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/power/supply/act8945a_charger.c b/drivers/power/supply/act8945a_charger.c
index b5c00e4..72d39ba 100644
--- a/drivers/power/supply/act8945a_charger.c
+++ b/drivers/power/supply/act8945a_charger.c
@@ -76,7 +76,6 @@ static const char *act8945a_charger_manufacturer = "Active-semi";
 
 struct act8945a_charger {
 	struct regmap *regmap;
-	bool battery_temperature;
 };
 
 static int act8945a_get_charger_state(struct regmap *regmap, int *val)
@@ -138,8 +137,7 @@ static int act8945a_get_charge_type(struct regmap *regmap, int *val)
 	return 0;
 }
 
-static int act8945a_get_battery_health(struct act8945a_charger *charger,
-				       struct regmap *regmap, int *val)
+static int act8945a_get_battery_health(struct regmap *regmap, int *val)
 {
 	int ret;
 	unsigned int status;
@@ -148,7 +146,7 @@ static int act8945a_get_battery_health(struct act8945a_charger *charger,
 	if (ret < 0)
 		return ret;
 
-	if (charger->battery_temperature && !(status & APCH_STATUS_TEMPDAT))
+	if (status & APCH_STATUS_TEMPDAT)
 		*val = POWER_SUPPLY_HEALTH_OVERHEAT;
 	else if (!(status & APCH_STATUS_INDAT))
 		*val = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
@@ -188,8 +186,7 @@ static int act8945a_charger_get_property(struct power_supply *psy,
 		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
 		break;
 	case POWER_SUPPLY_PROP_HEALTH:
-		ret = act8945a_get_battery_health(charger,
-						  regmap, &val->intval);
+		ret = act8945a_get_battery_health(regmap, &val->intval);
 		break;
 	case POWER_SUPPLY_PROP_MODEL_NAME:
 		val->strval = act8945a_charger_model;
@@ -235,9 +232,6 @@ static int act8945a_charger_config(struct device *dev,
 		return -EINVAL;
 	}
 
-	charger->battery_temperature = of_property_read_bool(np,
-				"active-semi,check-battery-temperature");
-
 	chglev_pin = of_get_named_gpio_flags(np,
 				"active-semi,chglev-gpios", 0, &flags);
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1464526 — Re: [PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature"

FromSebastian Reichel <sre@kernel.org>
Date2016-08-17 13:40 +0200
SubjectRe: [PATCH v5 1/7] power: act8945a_charger: Remove "battery_temperature"
Message-ID<s77mp-pk-3@gated-at.bofh.it>
In reply to#1463574

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Tue, Aug 16, 2016 at 04:59:52PM +0800, Wenyou Yang wrote:
> [...]
>
> -static int act8945a_get_battery_health(struct act8945a_charger *charger,
> -				       struct regmap *regmap, int *val)
> +static int act8945a_get_battery_health(struct regmap *regmap, int *val)
>  {
>  	int ret;
>  	unsigned int status;
> @@ -148,7 +146,7 @@ static int act8945a_get_battery_health(struct act8945a_charger *charger,
>  	if (ret < 0)
>  		return ret;
>  
> -	if (charger->battery_temperature && !(status & APCH_STATUS_TEMPDAT))
> +	if (status & APCH_STATUS_TEMPDAT)

This incorrectly inverts the logic.

>  		*val = POWER_SUPPLY_HEALTH_OVERHEAT;
>  	else if (!(status & APCH_STATUS_INDAT))
>  		*val = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
> @@ -188,8 +186,7 @@ static int act8945a_charger_get_property(struct power_supply *psy,
>  		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
>  		break;
>  	case POWER_SUPPLY_PROP_HEALTH:
> -		ret = act8945a_get_battery_health(charger,
> -						  regmap, &val->intval);
> +		ret = act8945a_get_battery_health(regmap, &val->intval);
>  		break;
>  	case POWER_SUPPLY_PROP_MODEL_NAME:
>  		val->strval = act8945a_charger_model;
> @@ -235,9 +232,6 @@ static int act8945a_charger_config(struct device *dev,
>  		return -EINVAL;
>  	}
>  
> -	charger->battery_temperature = of_property_read_bool(np,
> -				"active-semi,check-battery-temperature");
> -
>  	chglev_pin = of_get_named_gpio_flags(np,
>  				"active-semi,chglev-gpios", 0, &flags);

-- Sebastian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web