[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1404387957.21377.9.camel@AMDC1943>
Date: Thu, 03 Jul 2014 13:45:57 +0200
From: Krzysztof Kozlowski <k.kozlowski@...sung.com>
To: Mark Rutland <mark.rutland@....com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Lee Jones <lee.jones@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <Pawel.Moll@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Jenny Tc <jenny.tc@...el.com>
Subject: Re: [RESEND PATCH 3/5] charger: max14577: Configure battery-dependent
settings from DTS
On czw, 2014-07-03 at 12:36 +0100, Mark Rutland wrote:
> 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@...sung.com>
> > Cc: Kyungmin Park <kyungmin.park@...sung.com>
> > Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
> > Cc: David Woodhouse <dwmw2@...radead.org>
> > Cc: Jenny Tc <jenny.tc@...el.com>
> > Acked-by: Lee Jones <lee.jones@...aro.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.
Sure, thanks for feedback. I'll fix this and re-spin.
Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists