A platform Subsystem
1. Description of the platform device
struct Platform_device {
const char* name; Device Name
IntID -1
struct Devicedev; General Equipment Description
U32num_resources; Number of resources
struct resource* resource;//Resources
If the match succeeds in the id_table of driver, Id_entry will record the id_table match.
const struct Platform_device_id*id_entry;
/* Arch Specific additions */
struct pdev_archdataarchdata;//private data for platform devices
};
2. Description of the platform driver
struct Platform_driver {
Int (*probe) (struct platform_device *); Call when the driver matches the device
Int (*remove) (struct platform_device *);//The drive is disconnected from the device when called
struct Device_driver driver;//General driver description
const struct PLATFORM_DEVICE_ID *id_table;//support device
};
struct Device_driver
{
Const Char*name; Drive name
struct Module*owner;//this_module
...
}
3. Register platform Driver
int Platform_driver_register (struct platform_driver *drv);
4. Registration platform Set up
int Platform_device_register (struct platform_device *pdev);
5. Platform device and platform driver matching process
[1] Through the name of the device with the driving id_table + drive name
[2] Match success
[1] In device record matching drive
[2] Calling the probe function provided by the driver
Linux-powered platform devices