Dealing with platform devices
Before we start writing platform drivers, this section will teach you how and where to instantiate platform devices. Only after that will we delve into the platform driver implementation. Platform device instantiation in the Linux kernel has existed for a long time and has been improved all over the kernel versions, and we will discuss the specificities of each instantiation method in this section.
Allocating and registering platform devices
Since there is no way for platform devices to make themselves known to the system, they must be populated manually and registered with the system along with their resources and private data. In the early platform core days, platform devices were declared in the board file, arch/arm/mach-*
(which is arch/arm/mach-imx/mach-imx6q.c
for i.MX6), and made known to the kernel with platform_device_add()
or platform_device_register()
, depending on how each platform device has been allocated.
This leads us to conclude...