Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A

3 messages, 2 authors, 2016-01-20 · open the first message on its own page

Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A

From: Peter Korsgaard <peter@korsgaard.com>
Date: 2016-01-14 11:43:08

quoted
quoted
quoted
quoted
"Yang," == Yang, Wenyou [off-list ref] writes:
Hi,
quoted
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
 >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
 >>> driver, but only register the regulator sub device?)
 >> 
 >> > Yes, the regulator part of the act8945a is identical to act8865.
 >> 
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
 >> device driver is a platform_driver driver, it is not easy to use  > it.
 >> 
 >> But the mfd driver could support the act8865 variant as well (by only registering
 >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing
 > act8865 driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both
act8865-regulator.c and act8954-regulator.c doing 95% the same. This can
either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.

-- 
Venlig hilsen,
Peter Korsgaard 

RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A

From: Yang, Wenyou <hidden>
Date: 2016-01-14 12:46:13

Hi Peter,
-----Original Message-----
From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
Sent: 2016?1?14? 19:43
To: Yang, Wenyou <redacted>
Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
Rob Herring [off-list ref]; Pawel Moll [off-list ref]; Mark
Rutland [off-list ref]; Ian Campbell [off-list ref];
Kumar Gala [off-list ref]; Krzysztof Kozlowski
[off-list ref]; devicetree at vger.kernel.org; Ferre, Nicolas
[off-list ref]; linux-kernel at vger.kernel.org; Javier Martinez
Canillas [off-list ref]; Lee Jones [off-list ref]; linux-arm-
kernel at lists.infradead.org
Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
ACT8945A
quoted
quoted
quoted
quoted
quoted
"Yang," == Yang, Wenyou [off-list ref] writes:
Hi,
quoted
quoted
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
regulator part of the act8945a is identical to act8865.
 >>
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
  >> device driver is a platform_driver driver, it is not easy to use  > it.
 >>
 >> But the mfd driver could support the act8865 variant as well (by only
registering  >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing  > act8865
driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
and act8954-regulator.c doing 95% the same. This can either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.
Thank you for so detail information, I will do as you said.


Thanks & Best Regards,
Wenyou Yang

RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A

From: Yang, Wenyou <hidden>
Date: 2016-01-20 07:38:31

Hi Peter,
-----Original Message-----
From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
Sent: 2016?1?14? 19:43
To: Yang, Wenyou <redacted>
Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
Rob Herring [off-list ref]; Pawel Moll [off-list ref]; Mark
Rutland [off-list ref]; Ian Campbell [off-list ref];
Kumar Gala [off-list ref]; Krzysztof Kozlowski
[off-list ref]; devicetree at vger.kernel.org; Ferre, Nicolas
[off-list ref]; linux-kernel at vger.kernel.org; Javier Martinez
Canillas [off-list ref]; Lee Jones [off-list ref]; linux-arm-
kernel at lists.infradead.org
Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
ACT8945A
quoted
quoted
quoted
quoted
quoted
"Yang," == Yang, Wenyou [off-list ref] writes:
Hi,
quoted
quoted
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
regulator part of the act8945a is identical to act8865.
 >>
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
  >> device driver is a platform_driver driver, it is not easy to use  > it.
 >>
 >> But the mfd driver could support the act8865 variant as well (by only
registering  >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing  > act8865
driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
and act8954-regulator.c doing 95% the same. This can either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.
After think twice, I think this will complicates the act8865-regulator driver.

Moreover, after following up the Mark's advice, a lot redundant code is removed from act8945a-regulater driver. It is very simple now.

So I think it is better to keep a separate act8945a-regulator driver.

Thank you for detailed description.


Best Regards,
Wenyou Yang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help