2006-10-26 08:03:01

by Ivan Korzakow

[permalink] [raw]
Subject: Sysfs architecture question

Hi,

I'm writing a driver for a smart card reader integrated in a
processor. The hardware have two interfaces (two "buses") to which you
can connect a number of analog adaptors. Each analog adaptors can have
multiple smartcard slots. I'd like to know if the architecture I've
chosen for the sysfs is good, most of all regarding power management.

I first created a platform device that represents the whole
controller, in which I define all the resources needed by the driver.
I also define a platform device_driver for this device.
Under it are two devices that represent the two interfaces of the
hardware. I also created a new sc_bus type, to which these three
devices are linked.
For each analog adaptor I create a device_driver entry, and the
associated device which is a child of my sc_bus device.
Finally, to each analog adaptor device can be attached a number of
smart card slots, represented by a device structure.
Here is an example of what you can see in /sys/device/platform (only
folders appear):
...
|-- sc_controller
| |-- sc_bus0
| | |-- analog_adaptor0
| | | `-- sc_slot0
| | |-- analog_adaptor1
| | | |-- sc_slot1
| | | `-- sc_slot2
| |-- sc_bus1
...

So, my questions are:
Is the whole architecture correct ? Is it good to have the sc_bus
under the sc_controller ?
I have some difficulties to understand how power management works. I'd
like to be able to suspend/resume every slots (stop transfers, etc)
and every buses (stop clocks) by suspending/resuming the
sc_controller. Is that possible and how ?

Thanks in advance for your remarks and ideas.

Ivan