From: Sebastian Reichel <sre@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
Mboumba Cedric Madianga <cedric.madianga@gmail.com>,
linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 3/7] power: supply: ab8500_fg: convert to IIO ADC
Date: Thu, 12 Jan 2017 04:03:20 +0100 [thread overview]
Message-ID: <20170112030320.yozvhsu2m4lmq2vo@earth> (raw)
In-Reply-To: <20170110234745.29691-4-linus.walleij@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3262 bytes --]
Hi,
On Wed, Jan 11, 2017 at 12:47:41AM +0100, Linus Walleij wrote:
> This switches the AB8500 fuel gauge driver to using
> the standard IIO ADC channel lookup and conversion routines.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-By: Sebastian Reichel <sre@kernel.org>
-- Sebastian
> drivers/power/supply/ab8500_fg.c | 23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
> index c569f82a0071..b26122e1da51 100644
> --- a/drivers/power/supply/ab8500_fg.c
> +++ b/drivers/power/supply/ab8500_fg.c
> @@ -32,7 +32,7 @@
> #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>
> +#include <linux/iio/consumer.h>
> #include <linux/kernel.h>
>
> #define MILLI_TO_MICRO 1000
> @@ -182,7 +182,7 @@ struct inst_curr_result_list {
> * @bat_cap: Structure for battery capacity specific parameters
> * @avg_cap: Average capacity filter
> * @parent: Pointer to the struct ab8500
> - * @gpadc: Pointer to the struct gpadc
> + * @main_bat_v: ADC channel for the main battery voltage
> * @bm: Platform specific battery management information
> * @fg_psy: Structure that holds the FG specific battery properties
> * @fg_wq: Work queue for running the FG algorithm
> @@ -224,7 +224,7 @@ struct ab8500_fg {
> struct ab8500_fg_battery_capacity bat_cap;
> struct ab8500_fg_avg_cap avg_cap;
> struct ab8500 *parent;
> - struct ab8500_gpadc *gpadc;
> + struct iio_channel *main_bat_v;
> struct abx500_bm_data *bm;
> struct power_supply *fg_psy;
> struct workqueue_struct *fg_wq;
> @@ -831,13 +831,13 @@ static void ab8500_fg_acc_cur_work(struct work_struct *work)
> */
> static int ab8500_fg_bat_voltage(struct ab8500_fg *di)
> {
> - int vbat;
> + int vbat, ret;
> static int prev;
>
> - vbat = ab8500_gpadc_convert(di->gpadc, MAIN_BAT_V);
> - if (vbat < 0) {
> + ret = iio_read_channel_processed(di->main_bat_v, &vbat);
> + if (ret < 0) {
> dev_err(di->dev,
> - "%s gpadc conversion failed, using previous value\n",
> + "%s ADC conversion failed, using previous value\n",
> __func__);
> return prev;
> }
> @@ -3072,7 +3072,14 @@ static int ab8500_fg_probe(struct platform_device *pdev)
> /* get parent data */
> di->dev = &pdev->dev;
> di->parent = dev_get_drvdata(pdev->dev.parent);
> - di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
> +
> + di->main_bat_v = devm_iio_channel_get(&pdev->dev, "main_bat_v");
> + if (IS_ERR(di->main_bat_v)) {
> + if (PTR_ERR(di->main_bat_v) == -ENODEV)
> + return -EPROBE_DEFER;
> + dev_err(&pdev->dev, "failed to get main battery ADC channel\n");
> + return PTR_ERR(di->main_bat_v);
> + }
>
> psy_cfg.supplied_to = supply_interface;
> psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-01-12 3:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 23:47 [PATCH 0/7] mfd/iio: move the AB8500 GPADC driver to IIO Linus Walleij
2017-01-10 23:47 ` [PATCH 2/7] power: supply: ab8500_charger: convert to IIO ADC Linus Walleij
2017-01-12 3:03 ` Sebastian Reichel
2017-01-14 14:56 ` Jonathan Cameron
2017-01-10 23:47 ` [PATCH 3/7] power: supply: ab8500_fg: " Linus Walleij
2017-01-12 3:03 ` Sebastian Reichel [this message]
2017-01-14 14:58 ` Jonathan Cameron
2017-01-10 23:47 ` [PATCH 4/7] hwmon: ab8500: " Linus Walleij
[not found] ` <20170110234745.29691-5-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-12 1:40 ` Guenter Roeck
[not found] ` <4d7c4364-3c09-5bd0-b073-651e31df5741-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-01-14 15:00 ` Jonathan Cameron
[not found] ` <20170110234745.29691-1-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-10 23:47 ` [PATCH 1/7] power: supply: ab8500_btemp: " Linus Walleij
[not found] ` <20170110234745.29691-2-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-12 3:02 ` Sebastian Reichel
2017-01-14 14:54 ` Jonathan Cameron
2017-01-12 6:13 ` kbuild test robot
2017-01-10 23:47 ` [PATCH 5/7] mfd: ab8500: augment DT bindings Linus Walleij
2017-01-13 14:55 ` Lee Jones
2017-01-10 23:47 ` [PATCH 6/7] mfd/iio: move the AB8500 GPADC to IIO Linus Walleij
[not found] ` <20170110234745.29691-7-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-13 14:56 ` Lee Jones
2017-01-10 23:47 ` [PATCH 7/7] ARM: dts: ux500: declare GPADC IIO ADC channels Linus Walleij
2017-01-12 3:04 ` [PATCH 0/7] mfd/iio: move the AB8500 GPADC driver to IIO Sebastian Reichel
2017-01-14 14:48 ` Jonathan Cameron
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=20170112030320.yozvhsu2m4lmq2vo@earth \
--to=sre@kernel.org \
--cc=cedric.madianga@gmail.com \
--cc=jic23@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
/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