Marvell EBU thermal sensor consolidation
Get series with b4
b4 am 20130321094221.GA2469@localhostVersions newest first
- v1 Latest0 of 16 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 16 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/16] Marvell EBU thermal sensor consolidation
Hi Andrew,
Quoted 23 lines · Andrew Lunn
Quoted 6 lines · Ezequiel Garcia
This patchset is my first attempt at adding basic thermal sensor support on Armada 370 and Armada XP.
Given Armada 370/XP and the other Marvell SoC with thermal support, namely Kirkwood and Dove, have fairly similar thermal devices it made sense to integrate all of them into a single driver: mvebu-thermal.
I went this way to start with, merging Dove, Kirkwood and something which nearly worked for 370. But then i looked at the code, at how little is actually shared, and went back to separate drivers.
Kirkwood has no control registers, so needs a special case in the probe. The bit location of the temperate value moves around in the register. Each SoC needs its own initialization sequence.
Each SoC needs its ownis_valid()function.
Each Soc needs its own formula to convert to milli centigrad.I've never seen the datasheets for 370/XP, just a list of registers for
370. But i get the impression it has two temperate sensors, so should export two values?
Quoted 7 lines
Also, kirkwood will never be built into the same kernel as Dove/370/XP. So we end up with "bloat" in the driver, or at least a collection of #ifdefs.
In the end, i decided it was simpler and cleaner to just have separate drivers. This is something which we should think about and discuss.
Thanks for your comments.
I had the same concerns about a single driver against many; after trying this approach I was convinced by the diffstat:
13 files changed, 395 insertions(+), 393 deletions(-)
So we have almost no LoC increase and two new SoCs are supported.
The alternative would mean to have one driver for Armada 370 and yet another one for Armada XP, with some common boilerplate in each driver and only the differences you mention: a different initialization and a different conversion formula.
The initialization is solved my means of a function pointer, and the conversion is just a switch.
FWIW, the is_valid() is actually the same on Kirkwood and 370.
I debated myself a lot before unifying the drivers: in the end it seemed a proper solution: less maintainance, less configuration options, happier hackers :)
What do you think?
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com