From: Mark Rutland <mark.rutland@arm.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Pawel Moll <Pawel.Moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Jenny Tc <jenny.tc@intel.com>
Subject: Re: [RESEND PATCH 3/5] charger: max14577: Configure battery-dependent settings from DTS
Date: Thu, 3 Jul 2014 12:36:45 +0100 [thread overview]
Message-ID: <20140703113645.GB28504@leverpostej> (raw)
In-Reply-To: <1404198121-22989-4-git-send-email-k.kozlowski@samsung.com>
On Tue, Jul 01, 2014 at 08:01:58AM +0100, Krzysztof Kozlowski wrote:
> Remove hard-coded values for:
> - Fast Charge current,
> - End Of Charge current,
> - Fast Charge timer,
> - Overvoltage Protection Threshold,
> - Battery Constant Voltage,
> and use DTS to configure them. This allows using the max14577 charger
> driver with different batteries.
>
> Now the charger driver requires valid configuration data from DTS. In
> case of wrong configuration data it fails during probe. Patch adds
> of_compatible to the charger mfd cell in MFD driver core.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Jenny Tc <jenny.tc@intel.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/mfd/max14577.c | 5 +-
> drivers/power/max14577_charger.c | 232 +++++++++++++++++++++++++++++++----
> include/linux/mfd/max14577-private.h | 16 +++
> include/linux/mfd/max14577.h | 8 ++
> 4 files changed, 233 insertions(+), 28 deletions(-)
[...]
> + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + dev_err(&pdev->dev, "Memory alloc for charger pdata failed\n");
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + ret = of_property_read_u32(np, "maxim,fast-charge-timer",
> + &pdata->fast_charge_timer);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + ret = of_property_read_u32(np, "maxim,constant-uvolt",
> + &pdata->constant_uvolt);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + ret = of_property_read_u32(np, "maxim,fast-charge-uamp",
> + &pdata->fast_charge_uamp);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + ret = of_property_read_u32(np, "maxim,eoc-uamp", &pdata->eoc_uamp);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + ret = of_property_read_u32(np, "maxim,ovp-uvolt", &pdata->ovp_uvolt);
> + if (ret)
> + return ERR_PTR(ret);
None of the fields being read into are u32 per the structure definition
below. Please use a u32 temporary variable or make the fields u32
values.
It would also be a good idea to print a warning as to _which_ field is
missing and/or invalid as that really helps someone writing a DTS to
figure out why the device isn't probing.
[...]
> +struct max14577_charger_platform_data {
> + unsigned int fast_charge_timer;
> + unsigned int constant_uvolt;
> + unsigned int fast_charge_uamp;
> + unsigned int eoc_uamp;
> + unsigned int ovp_uvolt;
> +};
Thanks,
Mark.
next prev parent reply other threads:[~2014-07-03 11:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 7:01 [RESEND PATCH 0/5] charger/mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
2014-07-01 7:01 ` [RESEND PATCH 1/5] charger: max14577: Add support for MAX77836 charger Krzysztof Kozlowski
2014-07-01 7:01 ` [RESEND PATCH 2/5] regulator/mfd: max14577: Export symbols for calculating charger current Krzysztof Kozlowski
2014-07-01 7:01 ` [RESEND PATCH 3/5] charger: max14577: Configure battery-dependent settings from DTS Krzysztof Kozlowski
2014-07-03 11:36 ` Mark Rutland [this message]
2014-07-03 11:45 ` Krzysztof Kozlowski
2014-07-01 7:01 ` [RESEND PATCH 4/5] power: max17040: Add ID for MAX77836 Fuel Gauge block Krzysztof Kozlowski
2014-07-01 7:02 ` [RESEND PATCH 5/5] devicetree: mfd: max14577: Add device tree bindings document Krzysztof Kozlowski
2014-07-03 11:32 ` Mark Rutland
2014-07-03 11:44 ` Krzysztof Kozlowski
2014-07-04 8:07 ` Mark Rutland
2014-07-04 8:13 ` Krzysztof Kozlowski
2014-07-01 7:40 ` [RESEND PATCH 0/5] charger/mfd: max14577: Add support for MAX77836 Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2014-05-26 7:47 [RESEND PATCH 0/5] charger/mfd: max14577: Part 2 of adding " Krzysztof Kozlowski
2014-05-26 7:47 ` [RESEND PATCH 3/5] charger: max14577: Configure battery-dependent settings from DTS Krzysztof Kozlowski
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=20140703113645.GB28504@leverpostej \
--to=mark.rutland@arm.com \
--cc=Pawel.Moll@arm.com \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jenny.tc@intel.com \
--cc=k.kozlowski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.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