SlideShare a Scribd company logo
1 of 12
© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Platform Device Drivers
2© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What to Expect?
W's of Platform Device Drivers
Registering a Platform Driver
Registering a Platform Device
Binding a platform driver to a device
Platform resources and platform data
Testing a simple platform driver
3© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
W's of Platform Device Drivers
Provides a mechanism to notify the kernel of
available hardware on the board
Mechanism to add the devices to the device
model of the kernel
Used for non-discoverable devices
Driver for the devices on the virtual 'platform' bus
4© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Components of Platform Device
Drivers
Two components
Platform Driver
Set of operations done on the device
Platform Device
Information about the device
Deemed to be connected to a virtual 'platform' bus
5© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Platform Bus Drivers Registration
platform_device.h
platform_driver structure defined as below:
struct platform_driver
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
void (*shutdown)(struct platform_device *);
int (*suspend)(struct platform_device *, pm_message_t state);
int (*resume)(struct platform_device *);
At minimum, probe() & remove needs to be supplied
int platform_driver_register(struct platform_driver *)
6© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Platform Device Registration
Defined by board specific file
platform_device.h
platform_device structure defined as below:
const char *name
int id
struct resource *resource
const struct platform_device_id *id_entry
int platform_device_register(struct platform_device
*pdev)
7© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Binding the Driver with Device
Mechanism for bus code to attach a driver to
device
id_table
struct platform_device_id
char name[PLATFORM_NAME_SIZE]
kernel_ulong_t driver_data
Name of driver, specified in the name field
8© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Specifying the Resource Info
For providing the information such as memory locations, IRQ numbers etc
struct resource my_resource [] = {
{
.start = RESOURCE_START_ADDRESS,
.end = RESOURCE_END_ADDRESS,
.flags = IORESOURCE_MEM
}
}
struct platform_device my_device = {
.name = DRIVER_NAME,
.num_resources = ARRAY_SIZE(my_resource),
.resources = my_resource,
}
9© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Platform Data
Mechanism to pass the generic device specific
information from Platform Device to the Platform Driver
Example – Passing GPIO information
int gpio_led = 53;
struct platform_device led_device {
name = DRIVER_NAME,
.dev = {
.platform_data = &gpio_led,
}
}
10© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Platform Driver With DTB
const struct of_device_id gpio_led_dt[] = {
{ .compatible = "my-led", },
{ }
};
of_property_read_u32(np, "led-number",
&gpio_number);
.of_match_table = of_match_ptr(gpio_led_dt);
11© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What all we Learnt?
W's of Platform Device Drivers
Registering a Platform Driver
Registering a Platform Device
Binding a platform driver to a device
Platform resources and platform data
Testing a simple platform driver
12© 2014-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Any Queries?

More Related Content

What's hot

Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
Houcheng Lin
 

What's hot (20)

Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device Drivers
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
Linux PCI device driver
Linux PCI device driverLinux PCI device driver
Linux PCI device driver
 
HKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting ReviewHKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting Review
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Linux dma engine
Linux dma engineLinux dma engine
Linux dma engine
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)
 
Spi drivers
Spi driversSpi drivers
Spi drivers
 
I2c drivers
I2c driversI2c drivers
I2c drivers
 
Character drivers
Character driversCharacter drivers
Character drivers
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 

Viewers also liked (18)

BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
Block Drivers
Block DriversBlock Drivers
Block Drivers
 
Interrupts
InterruptsInterrupts
Interrupts
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
File Systems
File SystemsFile Systems
File Systems
 
Kernel Programming
Kernel ProgrammingKernel Programming
Kernel Programming
 
Low-level Accesses
Low-level AccessesLow-level Accesses
Low-level Accesses
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Embedded C
Embedded CEmbedded C
Embedded C
 
References
ReferencesReferences
References
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 

Similar to Platform Drivers

Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Tom Diederich
 
Chapter 09 Operating Systems
Chapter 09 Operating SystemsChapter 09 Operating Systems
Chapter 09 Operating Systems
xtin101
 
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docxRunning head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
joellemurphey
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
Anil Kumar Pugalia
 

Similar to Platform Drivers (20)

APIs: The Bridge to IoT
APIs: The Bridge to IoT APIs: The Bridge to IoT
APIs: The Bridge to IoT
 
2015 06-api days-sf-apis-dbridge2iot-asanka
2015 06-api days-sf-apis-dbridge2iot-asanka2015 06-api days-sf-apis-dbridge2iot-asanka
2015 06-api days-sf-apis-dbridge2iot-asanka
 
Airline Reservation system(project report of six week training)-ppt
Airline Reservation system(project report of six week training)-pptAirline Reservation system(project report of six week training)-ppt
Airline Reservation system(project report of six week training)-ppt
 
17 demonstration server client system-v1.00_en
17 demonstration server client system-v1.00_en17 demonstration server client system-v1.00_en
17 demonstration server client system-v1.00_en
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Paper3x.PDF
Paper3x.PDFPaper3x.PDF
Paper3x.PDF
 
1. device onboarding
1. device onboarding1. device onboarding
1. device onboarding
 
EPiServer Deployment Tips & Tricks
EPiServer Deployment Tips & TricksEPiServer Deployment Tips & Tricks
EPiServer Deployment Tips & Tricks
 
Building Training Devices
Building Training DevicesBuilding Training Devices
Building Training Devices
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
 
Chapter 09 Operating Systems
Chapter 09 Operating SystemsChapter 09 Operating Systems
Chapter 09 Operating Systems
 
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docxRunning head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
Running head AVIATION MAINTENANCE SYSTEM DEFICIENCY1Aviation.docx
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
Bootloaders
BootloadersBootloaders
Bootloaders
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
Ruby Driver Explained: DataStax Webinar May 5th 2015
Ruby Driver Explained: DataStax Webinar May 5th 2015Ruby Driver Explained: DataStax Webinar May 5th 2015
Ruby Driver Explained: DataStax Webinar May 5th 2015
 
eEnabled Aircraft Software CORENA Case Study
eEnabled Aircraft Software CORENA Case StudyeEnabled Aircraft Software CORENA Case Study
eEnabled Aircraft Software CORENA Case Study
 
Service Assurance Constructs for Achieving Network Transformation by Sunku Ra...
Service Assurance Constructs for Achieving Network Transformation by Sunku Ra...Service Assurance Constructs for Achieving Network Transformation by Sunku Ra...
Service Assurance Constructs for Achieving Network Transformation by Sunku Ra...
 
Service Assurance Constructs for Achieving Network Transformation - Sunku Ran...
Service Assurance Constructs for Achieving Network Transformation - Sunku Ran...Service Assurance Constructs for Achieving Network Transformation - Sunku Ran...
Service Assurance Constructs for Achieving Network Transformation - Sunku Ran...
 

More from SysPlay eLearning Academy for You

More from SysPlay eLearning Academy for You (14)

Linux Internals Part - 3
Linux Internals Part - 3Linux Internals Part - 3
Linux Internals Part - 3
 
Linux Internals Part - 2
Linux Internals Part - 2Linux Internals Part - 2
Linux Internals Part - 2
 
Linux Internals Part - 1
Linux Internals Part - 1Linux Internals Part - 1
Linux Internals Part - 1
 
Kernel Timing Management
Kernel Timing ManagementKernel Timing Management
Kernel Timing Management
 
Understanding the BBB
Understanding the BBBUnderstanding the BBB
Understanding the BBB
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
 
Linux DMA Engine
Linux DMA EngineLinux DMA Engine
Linux DMA Engine
 
Cache Management
Cache ManagementCache Management
Cache Management
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
Introduction to BeagleBone Black
Introduction to BeagleBone BlackIntroduction to BeagleBone Black
Introduction to BeagleBone Black
 
Introduction to BeagleBoard-xM
Introduction to BeagleBoard-xMIntroduction to BeagleBoard-xM
Introduction to BeagleBoard-xM
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
Linux System
Linux SystemLinux System
Linux System
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 

Platform Drivers

  • 1. © 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Platform Device Drivers
  • 2. 2© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? W's of Platform Device Drivers Registering a Platform Driver Registering a Platform Device Binding a platform driver to a device Platform resources and platform data Testing a simple platform driver
  • 3. 3© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. W's of Platform Device Drivers Provides a mechanism to notify the kernel of available hardware on the board Mechanism to add the devices to the device model of the kernel Used for non-discoverable devices Driver for the devices on the virtual 'platform' bus
  • 4. 4© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Components of Platform Device Drivers Two components Platform Driver Set of operations done on the device Platform Device Information about the device Deemed to be connected to a virtual 'platform' bus
  • 5. 5© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Platform Bus Drivers Registration platform_device.h platform_driver structure defined as below: struct platform_driver int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); void (*shutdown)(struct platform_device *); int (*suspend)(struct platform_device *, pm_message_t state); int (*resume)(struct platform_device *); At minimum, probe() & remove needs to be supplied int platform_driver_register(struct platform_driver *)
  • 6. 6© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Platform Device Registration Defined by board specific file platform_device.h platform_device structure defined as below: const char *name int id struct resource *resource const struct platform_device_id *id_entry int platform_device_register(struct platform_device *pdev)
  • 7. 7© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Binding the Driver with Device Mechanism for bus code to attach a driver to device id_table struct platform_device_id char name[PLATFORM_NAME_SIZE] kernel_ulong_t driver_data Name of driver, specified in the name field
  • 8. 8© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Specifying the Resource Info For providing the information such as memory locations, IRQ numbers etc struct resource my_resource [] = { { .start = RESOURCE_START_ADDRESS, .end = RESOURCE_END_ADDRESS, .flags = IORESOURCE_MEM } } struct platform_device my_device = { .name = DRIVER_NAME, .num_resources = ARRAY_SIZE(my_resource), .resources = my_resource, }
  • 9. 9© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Platform Data Mechanism to pass the generic device specific information from Platform Device to the Platform Driver Example – Passing GPIO information int gpio_led = 53; struct platform_device led_device { name = DRIVER_NAME, .dev = { .platform_data = &gpio_led, } }
  • 10. 10© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Platform Driver With DTB const struct of_device_id gpio_led_dt[] = { { .compatible = "my-led", }, { } }; of_property_read_u32(np, "led-number", &gpio_number); .of_match_table = of_match_ptr(gpio_led_dt);
  • 11. 11© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What all we Learnt? W's of Platform Device Drivers Registering a Platform Driver Registering a Platform Device Binding a platform driver to a device Platform resources and platform data Testing a simple platform driver
  • 12. 12© 2014-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?