From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: robh@kernel.org, mark.rutland@arm.com, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@networkimprov.net
Subject: Re: [PATCH v3 4/4] power: tps65217_charger: add support for NTC type, voltage and current charge
Date: Thu, 8 Jun 2017 18:11:37 +0200 [thread overview]
Message-ID: <20170608161137.7kxkriaryr5m323h@earth> (raw)
In-Reply-To: <20170526110413.24836-4-enric.balletbo@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 2494 bytes --]
Hi Enric,
On Fri, May 26, 2017 at 01:04:13PM +0200, Enric Balletbo i Serra wrote:
> Allow the possibility to configure the charge and the current voltage of
> the charger and also the NTC type for battery temperature measurement.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> Changes since v2:
> - Requested by Sebastian Reichel
> - Use the simple-battery framework
> - Use device_property_read_u32 instead of of_property_read_u32
> Changes since v1:
> - None
>
> drivers/power/supply/tps65217_charger.c | 194 ++++++++++++++++++++++++++++++--
> include/linux/mfd/tps65217.h | 2 +
> 2 files changed, 188 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/power/supply/tps65217_charger.c b/drivers/power/supply/tps65217_charger.c
> index 1f52340..5939e77 100644
> --- a/drivers/power/supply/tps65217_charger.c
> +++ b/drivers/power/supply/tps65217_charger.c
>
> [...]
>
> +#ifdef CONFIG_OF
You can drop the #ifdef CONFIG_OF. device_properties can also be
added via ACPI or boardcode and power_supply_get_battery_info is
always available (but will return -EINVAL values for !OF at the
moment).
> +static struct tps65217_charger_platform_data *tps65217_charger_pdata_init(
> + struct tps65217_charger *charger)
> +{
> + struct tps65217_charger_platform_data *pdata;
> + struct power_supply_battery_info info = {};
> + int ret;
> +
> + pdata = devm_kzalloc(charger->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return ERR_PTR(-ENOMEM);
> +
> + /*
> + * If battery info is not supplied just ignore and program default
> + * values.
> + */
> + power_supply_get_battery_info(charger->psy, &info);
> +
> + if (info.charge_voltage_uv > 0)
> + pdata->charge_voltage_uv = info.charge_voltage_uv;
> + else
> + pdata->charge_voltage_uv = 4100000;
> +
> + if (info.charge_current_ua > 0)
> + pdata->charge_current_ua = info.charge_current_ua;
> + else
> + pdata->charge_current_ua = 500000;
> +
> + ret = device_property_read_u32(charger->dev, "ti,ntc-type",
> + &pdata->ntc_type);
> + if (ret)
> + pdata->ntc_type = 1; /* 10k (curve 2, B = 3480) */
> +
> + return pdata;
> +}
> +#else /* CONFIG_OF */
> +static struct tps65217_charger_platform_data *tps65217_charger_pdata_init(
> + struct tps65217_charger *charger)
> +{
> + return NULL;
> +}
> +#endif /* CONFIG_OF */
> +
> [...]
>
Otherwise looks fine to me.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-08 16:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 11:04 [PATCH v3 1/4] dt-bindings: power: supply: add battery charge voltage/current Enric Balletbo i Serra
2017-05-26 11:04 ` [PATCH v3 2/4] power: supply: core: add charging voltage/current battery info Enric Balletbo i Serra
2017-05-26 21:22 ` Liam Breck
2017-05-27 20:12 ` Enric Balletbo Serra
2017-05-26 11:04 ` [PATCH v3 3/4] dt-bindings: power: tps65217_charger: add NTC type for battery temperature measurement Enric Balletbo i Serra
2017-05-26 21:26 ` Liam Breck
2017-05-27 20:14 ` Enric Balletbo Serra
2017-05-26 11:04 ` [PATCH v3 4/4] power: tps65217_charger: add support for NTC type, voltage and current charge Enric Balletbo i Serra
2017-05-26 22:31 ` Liam Breck
2017-06-08 16:11 ` Sebastian Reichel [this message]
2017-05-26 21:20 ` [PATCH v3 1/4] dt-bindings: power: supply: add battery charge voltage/current Liam Breck
2017-05-27 20:11 ` Enric Balletbo Serra
2017-06-01 7:01 ` Liam Breck
2017-06-01 8:18 ` Enric Balletbo Serra
2017-06-01 10:25 ` Liam Breck
2017-06-01 10:32 ` Enric Balletbo Serra
2017-05-31 18:50 ` Rob Herring
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=20170608161137.7kxkriaryr5m323h@earth \
--to=sebastian.reichel@collabora.co.uk \
--cc=devicetree@vger.kernel.org \
--cc=enric.balletbo@collabora.com \
--cc=kernel@networkimprov.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh@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).