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

linux device driver
linux device driverlinux device driver
linux device driverRahul Batra
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24Varun Mahajan
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerSherif Mousa
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
Linux Porting
Linux PortingLinux Porting
Linux PortingChamp Yen
 
LCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLinaro
 

What's hot (20)

linux device driver
linux device driverlinux device driver
linux device driver
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Character drivers
Character driversCharacter drivers
Character drivers
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Linux I2C
Linux I2CLinux I2C
Linux I2C
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
LCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLCA13: Power State Coordination Interface
LCA13: Power State Coordination Interface
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 

Viewers also liked (16)

BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
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
 
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

APIs: The Bridge to IoT
APIs: The Bridge to IoT APIs: The Bridge to IoT
APIs: The Bridge to IoT WSO2
 
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-asankaAsanka Abeysinghe
 
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)-pptPunjab technical University
 
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_enconfidencial
 
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 Systemsxtin101
 
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.docxjoellemurphey
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded SystemsAnil Kumar Pugalia
 
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 2015DataStax
 
eEnabled Aircraft Software CORENA Case Study
eEnabled Aircraft Software CORENA Case StudyeEnabled Aircraft Software CORENA Case Study
eEnabled Aircraft Software CORENA Case StudyFlatirons Solutions®
 
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...Liz Warner
 
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...Liz Warner
 

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
 
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 - 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...
 
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...
 
1. device onboarding pdf
1. device onboarding pdf1. device onboarding pdf
1. device onboarding pdf
 

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

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

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?