[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=Wk1QV6oKhVML6eu74cnSYAXPGBuY54D3vLcxqZAjHb8w@mail.gmail.com>
Date: Tue, 26 Aug 2014 10:19:48 -0700
From: Doug Anderson <dianders@...omium.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Lee Jones <lee.jones@...aro.org>, Chris Zhong <zyw@...k-chips.com>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Liam Girdwood <lgirdwood@...il.com>,
"broonie@...nel.org" <broonie@...nel.org>,
Alessandro Zummo <a.zummo@...ertech.it>,
Mike Turquette <mturquette@...aro.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
rtc-linux@...glegroups.com, Grant Likely <grant.likely@...aro.org>,
Lin Huang <hl@...k-chips.com>,
Tao Huang <huangtao@...k-chips.com>,
Eddie Cai <cf@...k-chips.com>,
zhangqing <zhangqing@...k-chips.com>, xxx <xxx@...k-chips.com>,
Heiko Stübner <heiko@...ech.de>,
Olof Johansson <olof@...om.net>,
Sonny Rao <sonnyrao@...omium.org>,
Dmitry Torokhov <dtor@...omium.org>,
Javier Martinez Canillas <javier.martinez@...labora.co.uk>,
Kever Yang <kever.yang@...k-chips.com>
Subject: Re: [PATCH v2 2/5] MFD: RK808: Add new mfd driver for RK808
Hi,
On Tue, Aug 26, 2014 at 9:28 AM, Dmitry Torokhov
<dmitry.torokhov@...il.com> wrote:
> Hi Lee,
>
> On Tue, Aug 26, 2014 at 10:22:05AM +0100, Lee Jones wrote:
>> On Mon, 25 Aug 2014, Chris Zhong wrote:
>> > On 08/20/2014 05:21 PM, Lee Jones wrote:
>> > >On Wed, 20 Aug 2014, Chris Zhong wrote:
>> > >
>> > >>The RK808 chip is a power management IC for multimedia and handheld
>> > >>devices. It contains the following components:
>> > >>
>> > >>- Regulators
>> > >>- RTC
>> > >>
>> > >>The rk808 core driver is registered as a platform driver and provides
>> > >>communication through I2C with the host device for the different
>> > >>components.
>> > >>
>> > >>Signed-off-by: Chris Zhong <zyw@...k-chips.com>
>> > >>---
>>
>> [...]
>>
>> > >>+ rk808->pdata = pdata;
>> > >Remove pdata from 'struct rk808'. You can obtain it from dev.
>> >
>> > Can I keep this pdata in rk808, because it is used in the regulator driver.
>> > The one obtain from dev maybe empty.
>>
>> If the one in dev is empty, you should populate that instead.
>
> No, drivers should not populate platform data in devices - they do not
> own it (unlike drvdata). Platform data should be read-only so that if
> one would unbind and then try to re-bind the driver we'd end up in
> exactly same state as before.
>
> For DT systems we should be allocating platform data separately and make
> sure we clean up after ourselves.
Given Dmitry's advice it seems like Chris's old code (allocate pdata
and store it in the driver's private structures) was correct. That
also seems to match what I've seen other drivers do.
Of course what Chris ended up doing was basically saying that "device
tree" is required for rk808 and that you can't pass data into the
driver using pdata (at least in v6 you can't specify
"rockchip,system-power-controller" unless you're using device tree).
To me that doesn't seem terrible. ...though he should probably finish
what he started by:
* Moving "struct rk808_board" so it's private to the regulator .c file
* Don't even pretend you can get stuff from dev_get_platdata() in
rk808-regulator.c
* Add a dependency on "OF" in the Kconfig for rk808.
-Doug
--
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