From: Francesco Lavra <francescolavra.fl@gmail.com>
To: "Rajanikanth H.V" <rajanikanth.hv@stericsson.com>
Cc: lee.jones@linaro.org, arnd@arndb.de, anton.vorontsov@linaro.org,
linus.walleij@stericsson.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org,
patches@linaro.org, STEricsson_nomadik_linux@list.st.com
Subject: Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge
Date: Sat, 27 Oct 2012 17:07:20 +0200 [thread overview]
Message-ID: <508BF8A8.9090206@gmail.com> (raw)
In-Reply-To: <1351146654-9110-2-git-send-email-rajanikanth.hv@stericsson.com>
On 10/25/2012 08:30 AM, Rajanikanth H.V wrote:
> From: "Rajanikanth H.V" <rajanikanth.hv@stericsson.com>
>
> - This patch adds device tree support for fuelgauge driver
> - optimize bm devices platform_data usage and of_probe(...)
> Note: of_probe() routine for battery managed devices is made
> common across all bm drivers.
> - test status:
> - interrupt numbers assigned differs between legacy and FDT mode.
>
> Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
[...]
> diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
> new file mode 100644
> index 0000000..28eaf35
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
> @@ -0,0 +1,58 @@
> +=== AB8500 Fuel Gauge Driver ===
> +
> +AB8500 is a mixed signal multimedia and power management
> +device comprising: power and energy-management-module,
> +wall-charger, usb-charger, audio codec, general purpose adc,
> +tvout, clock management and sim card interface.
> +
> +Fuelgauge support is part of energy-management-modules, other
> +components of this module are:
> +main-charger, usb-combo-charger and battery-temperature-monitoring.
> +
> +The properties below describes the node for fuelgauge driver.
> +
> +Required Properties:
> +- compatible = This shall be: "stericsson,ab8500-fg"
> +- battery = Shall be battery specific information
> + Example:
> + ab8500_fg {
> + compatible = "stericsson,ab8500-fg";
> + battery = <&ab8500_battery>;
> + };
> +
> +dependent node:
> + ab8500_battery: ab8500_battery {
> + };
> + This node will provide information on 'thermistor interface' and
> + 'battery technology type' used.
> +
> +Properties of this node are:
> +thermistor-on-batctrl:
> + A boolean value indicating thermistor interface to battery
> +
> + Note:
> + 'btemp' and 'batctrl' are the pins interfaced for battery temperature
> + measurement, 'btemp' signal is used when NTC(negative temperature
> + coefficient) resister is interfaced external to battery whereas
> + 'batctrl' pin is used when NTC resister is internal to battery.
> +
> + Example:
> + ab8500_battery: ab8500_battery {
> + thermistor-on-batctrl;
> + };
> + indiactes: NTC resister is internal to battery, 'batctrl' is used
s/indiactes/indicates
[...]
> +int __devinit
> +bmdevs_of_probe(struct device *dev,
> + struct device_node *np,
> + struct abx500_bm_data **battery)
> +{
> + struct abx500_battery_type *btype;
> + struct device_node *np_bat_supply;
> + struct abx500_bm_data *bat;
> + const char *bat_tech;
> + int i, thermistor;
> +
> + *battery = &ab8500_bm_data;
> +
> + /* get phandle to 'battery-info' node */
> + np_bat_supply = of_parse_phandle(np, "battery", 0);
> + if (!np_bat_supply) {
> + dev_err(dev, "missing property battery\n");
> + return -EINVAL;
> + }
> + if (of_property_read_bool(np_bat_supply,
> + "thermistor-on-batctrl"))
> + thermistor = NTC_INTERNAL;
> + else
> + thermistor = NTC_EXTERNAL;
> +
> + bat = *battery;
> + if (thermistor == NTC_EXTERNAL) {
> + bat->n_btypes = 4;
> + bat->bat_type = bat_type_ext_thermistor;
> + bat->adc_therm = ABx500_ADC_THERM_BATTEMP;
> + }
> + bat_tech = of_get_property(np_bat_supply,
> + "stericsson,battery-type", NULL);
> + if (!bat_tech)
> + dev_warn(dev, "missing property battery-name/type\n");
> +
> + if (strncmp(bat_tech, "LION", 4) == 0) {
What if bat_tech is NULL?
[...]
> diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
> index bf02225..e117920 100644
> --- a/drivers/power/ab8500_fg.c
> +++ b/drivers/power/ab8500_fg.c
> @@ -22,15 +22,16 @@
> #include <linux/platform_device.h>
> #include <linux/power_supply.h>
> #include <linux/kobject.h>
> -#include <linux/mfd/abx500/ab8500.h>
> -#include <linux/mfd/abx500.h>
> #include <linux/slab.h>
> -#include <linux/mfd/abx500/ab8500-bm.h>
> #include <linux/delay.h>
> -#include <linux/mfd/abx500/ab8500-gpadc.h>
> -#include <linux/mfd/abx500.h>
> #include <linux/time.h>
> +#include <linux/of.h>
> #include <linux/completion.h>
> +#include <linux/mfd/core.h>
> +#include <linux/mfd/abx500.h>
> +#include <linux/mfd/abx500/ab8500.h>
> +#include <linux/mfd/abx500/ab8500-bm.h>
> +#include <linux/mfd/abx500/ab8500-gpadc.h>
>
> #define MILLI_TO_MICRO 1000
> #define FG_LSB_IN_MA 1627
> @@ -212,7 +213,6 @@ struct ab8500_fg {
> struct ab8500_fg_avg_cap avg_cap;
> struct ab8500 *parent;
> struct ab8500_gpadc *gpadc;
> - struct abx500_fg_platform_data *pdata;
pdata should be removed from the description of the struct members as well.
--
Francesco
next parent reply other threads:[~2012-10-27 15:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1351146654-9110-1-git-send-email-rajanikanth.hv@stericsson.com>
[not found] ` <1351146654-9110-2-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-27 15:07 ` Francesco Lavra [this message]
2012-10-27 16:00 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth HV
2012-10-27 16:18 ` Francesco Lavra
[not found] ` <1351146654-9110-3-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-27 15:08 ` [PATCH 2/4] mfd: ab8500: add devicetree support for btemp Francesco Lavra
[not found] ` <1351146654-9110-4-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-27 15:10 ` [PATCH 3/4] mfd: ab8500: add devicetree support for charger Francesco Lavra
[not found] ` <1351146654-9110-5-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-27 15:11 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Francesco Lavra
2012-11-22 18:43 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-11-22 18:43 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-22 20:08 ` Anton Vorontsov
2012-11-23 9:50 ` Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2012-10-31 15:40 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-01 15:15 ` Francesco Lavra
2012-11-07 18:45 ` Rajanikanth H V
2012-11-10 16:53 ` Francesco Lavra
2012-11-15 11:34 ` Rajanikanth HV
[not found] <1349064513-31301-1-git-send-email-rajanikanth.hv@stericsson.com>
[not found] ` <1349064513-31301-2-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-01 9:49 ` Lee Jones
2012-10-01 9:59 ` Rajanikanth HV
2012-10-01 10:36 ` Lee Jones
2012-10-01 10:22 ` Lee Jones
2012-10-06 14:01 ` Francesco Lavra
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=508BF8A8.9090206@gmail.com \
--to=francescolavra.fl@gmail.com \
--cc=STEricsson_nomadik_linux@list.st.com \
--cc=anton.vorontsov@linaro.org \
--cc=arnd@arndb.de \
--cc=lee.jones@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=rajanikanth.hv@stericsson.com \
/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).