public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MFD cell structure and sharing of resources
@ 2010-12-10 15:37 Daniel Drake
  2010-12-10 16:34 ` Daniel Drake
  2010-12-16 10:35 ` Samuel Ortiz
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Drake @ 2010-12-10 15:37 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Paul Fox, Andres Salomon, linux-kernel

Hi Samuel,

I'm hoping you can give us your opinion on a design challenge we are facing.
You recently merged Andres's recent patches to convert cs5536 to a
MFD, with GPIO and MFGPT now as mfd cells.

We also have the olpc-xo1 driver specific to a specific laptop model,
providing power management functions, and this needs to use the cs5536
resources "acpi" and "pms".
https://patchwork.kernel.org/patch/278991/

At the same time, we are working on other improvements to olpc-xo1
(adding suspend/resume support). Due to review comments we are going
to rename this to olpc-xo1-pm and make it builtin only.

Then we are going to add a new driver, perhaps named olpc-xo1-sci,
which deals with things like power button input device, lid switch,
etc. This driver needs to use the "cs5536-acpi" resource which is also
used by olpc-xo1-pm.

So the question is: how can 2 drivers share this MFD resource?

We do not want to merge olpc-xo1-sci and olpc-xo1-pm, because
olpc-xo1-pm can only be builtin (but thankfully is small), and
olpc-xo1-sci will become a bit more bloated and we'd like to make that
modular (in the interests of generic distros).

A few options that spring to mind:

1. Adjust the list of mfd cells in drivers/mfd/cs5535-mfd so that
rather than being a list of resources, it is a list of drivers that
rely on the mfd driver. The entries would be: gpio, mfgpt,
olpc-xo1-pm, olpc-xo1-sci. olpc-xo1-pm would have the 2 resources it
needs (pms & acpi), and the acpi resource would be duplicated into
olpc-xo1-sci  too.

We'd then add a machine_is_olpc()  check inside cs5535-mfd so that the
OLPC-specific cells are only passed to mfd_add_devices on OLPC
laptops.

2. Continue with Andres' olpc-xo1-pm patch that makes that driver act
as a driver for both acpi & pms. When both resources are available, it
could probe an olpc-xo1-sci platform device as a child of itself,
having the ACPI resource shared on the platform_device level (similar
to how MFD shares resources via cells).

3. For olpc-xo1-pm and olpc-xo1-sci, forget about hooking into MFD and
go back to the route of looking for the appropriate device on the PCI
bus and accessing the regions that way.


Thoughts?

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-12-25 14:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 15:37 MFD cell structure and sharing of resources Daniel Drake
2010-12-10 16:34 ` Daniel Drake
2010-12-16 10:35 ` Samuel Ortiz
2010-12-16 15:38   ` Daniel Drake
2010-12-24 10:45     ` Samuel Ortiz
2010-12-25  6:48       ` Andres Salomon
2010-12-25 14:23         ` Mark Brown
2010-12-24 23:56     ` Andres Salomon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox