From: "Krzysztof Kozłowski" <k.kozlowski@samsung.com>
To: Jonghwa Lee <jonghwa3.lee@samsung.com>, linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, sre@kernel.org, dbaryshkov@gmail.com,
dwmw2@infradead.org, anton@enomsg.org, pavel@ucw.cz,
myungjoo.ham@samsung.com, cw00.choi@samsung.com
Subject: Re: [PATCH 01/10] power: charger-manager: Use thermal subsystem interface only to get temperature.
Date: Thu, 30 Oct 2014 14:11:35 +0100 [thread overview]
Message-ID: <54523907.4030609@samsung.com> (raw)
In-Reply-To: <1414672996-28355-2-git-send-email-jonghwa3.lee@samsung.com>
On 30.10.2014 13:43, Jonghwa Lee wrote:
> It drops the way of using power_supply interface to reference battery's
> temperature. Then it tries to use thermal subsystem's only. This makes driver
> more simple and also can remove ifdeferies.
>
> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
> ---
> drivers/power/Kconfig | 1 +
> drivers/power/charger-manager.c | 113 ++++++++-------------------------
> include/linux/power/charger-manager.h | 3 +-
> 3 files changed, 28 insertions(+), 89 deletions(-)
>
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 8ff2511..115d153 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -317,6 +317,7 @@ config CHARGER_MANAGER
> bool "Battery charger manager for multiple chargers"
> depends on REGULATOR
> select EXTCON
> + select THERMAL
I think both of "select" here could be dangerous. Select should rather
be used for non-visible errors. Just use "depends on".
> help
> Say Y to enable charger-manager support, which allows multiple
> chargers attached to a battery and multiple batteries attached to a
> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
> index 22246b9..b4b101c 100644
> --- a/drivers/power/charger-manager.c
> +++ b/drivers/power/charger-manager.c
> @@ -28,13 +28,6 @@
> #include <linux/of.h>
> #include <linux/thermal.h>
>
> -/*
> - * Default termperature threshold for charging.
> - * Every temperature units are in tenth of centigrade.
> - */
> -#define CM_DEFAULT_RECHARGE_TEMP_DIFF 50
> -#define CM_DEFAULT_CHARGE_TEMP_MAX 500
> -
> static const char * const default_event_names[] = {
> [CM_EVENT_UNKNOWN] = "Unknown",
> [CM_EVENT_BATT_FULL] = "Battery Full",
> @@ -572,40 +565,18 @@ static int check_charging_duration(struct charger_manager *cm)
> return ret;
> }
>
> -static int cm_get_battery_temperature_by_psy(struct charger_manager *cm,
> - int *temp)
> -{
> - struct power_supply *fuel_gauge;
> -
> - fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
> - if (!fuel_gauge)
> - return -ENODEV;
> -
> - return fuel_gauge->get_property(fuel_gauge,
> - POWER_SUPPLY_PROP_TEMP,
> - (union power_supply_propval *)temp);
> -}
> -
> static int cm_get_battery_temperature(struct charger_manager *cm,
> int *temp)
> {
> int ret;
>
> - if (!cm->desc->measure_battery_temp)
> + if (!cm->tzd_batt)
> return -ENODEV;
>
> -#ifdef CONFIG_THERMAL
> - if (cm->tzd_batt) {
> - ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp);
> - if (!ret)
> - /* Calibrate temperature unit */
> - *temp /= 100;
> - } else
> -#endif
> - {
> - /* if-else continued from CONFIG_THERMAL */
> - ret = cm_get_battery_temperature_by_psy(cm, temp);
> - }
> + ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp);
> + if (!ret)
> + /* Calibrate temperature unit */
> + *temp /= 100;
>
> return ret;
> }
> @@ -623,7 +594,7 @@ static int cm_check_thermal_status(struct charger_manager *cm)
> * occur hazadous result. We have to handle it
> * depending on battery type.
> */
> - dev_err(cm->dev, "Failed to get battery temperature\n");
> + dev_dbg(cm->dev, "Failed to get battery temperature\n");
A valuable change but not strictly related to the commit. Additionally
that is a user-visible change. Could you split it to separate patch?
Best regards,
Krzysztof
next prev parent reply other threads:[~2014-10-30 13:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 12:43 [PATCH V2 0/10] Improve charger manager driver for optimized operation Jonghwa Lee
2014-10-30 12:43 ` [PATCH 01/10] power: charger-manager: Use thermal subsystem interface only to get temperature Jonghwa Lee
2014-10-30 13:11 ` Krzysztof Kozłowski [this message]
2014-10-31 2:25 ` jonghwa3.lee
2014-10-30 12:43 ` [PATCH 02/10] power: charger-manager: Use power_supply_changed() not private uevent Jonghwa Lee
2014-10-30 12:43 ` [PATCH 03/10] power: charger-manager: Remove deprecated function, cm_notify_event() Jonghwa Lee
2014-10-30 12:43 ` [PATCH 04/10] power: charger-manager: Fix to use CHARGE_NOW/FULL property correctly Jonghwa Lee
2014-10-30 12:43 ` [PATCH 05/10] power: charger-manager: Concentrate scattered power_supply_changed() calls Jonghwa Lee
2014-10-30 12:43 ` [PATCH 06/10] power: charger-manager: Get external power souce information only from EXTCON Jonghwa Lee
2014-10-30 12:43 ` [PATCH 07/10] power: charger-manager: Make chraging decision focusing on battery status Jonghwa Lee
2014-10-30 12:43 ` [PATCH 08/10] power: charger-manager: Not to start charging directly in cable nofitication Jonghwa Lee
2014-10-30 12:43 ` [PATCH 09/10] power: charger-manager: Support different polling mode for sleep state Jonghwa Lee
2014-10-30 12:43 ` [PATCH 10/10] power: charger-manager: Support to change polling rate in runtime Jonghwa Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54523907.4030609@samsung.com \
--to=k.kozlowski@samsung.com \
--cc=anton@enomsg.org \
--cc=cw00.choi@samsung.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jonghwa3.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=pavel@ucw.cz \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).