SlideShare a Scribd company logo
1 of 11
Audio Drivers



© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>
               All Rights Reserved.
What to Expect?
Introduction to Linux' Audio Subsystem
Audio Vertical: Sound Core
Audio Horizontal
Putting them all together: Porting




        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   2
                       All Rights Reserved.
Audio Subsystem
   ALSA conforming Apps            User Space          OSS conforming Apps
(aplay, arecord, mplayer, ...)                         (rawplay, rawrec, ...)


     /dev/snd/pcmCXDYz,
                                   /proc/asound            /dev/dsp, /dev/adsp,
      /dev/snd/controlCX,
                                 /sys/class/sound         /dev/mixer, /dev/audio
        /dev/snd/timer
                                                           OSS Emulation Layer
                                                      (snd_pcm_oss, snd_mixer_oss)

                            ALSA (Sound) Core

              Control                                  Data
                          Audio Codec Driver
                 I2C     Audio Controller Driver
                                Kernel Space
                                                        I2S
                                 Hardware Space
                                                                        MIC
              Audio Controller                    Audio Codec
                                                                        Speaker
                    © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>                3
                                   All Rights Reserved.
ALSA Sound Card Interface
Header: <linux/sound/core.h>
Data Structure: struct snd_card
APIs
  int snd_card_create(int idx, const char *id,
  struct module *module, int extra_size, struct
  snd_card **card_ret);
  int snd_card_register(struct snd_card *card);
  int snd_card_free(struct snd_card *card);
       Inverse of both the above
            © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   4
                           All Rights Reserved.
ALSA PCM Interface
Header: <linux/sound/pcm.h>
Data Structure
  struct snd_pcm
  struct snd_pcm_ops
APIs
  int snd_pcm_new(struct snd_card *card, const char *id, int device,
  int playback_count, int capture_count, struct snd_pcm **rpcm);
  void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct
  snd_pcm_ops *ops);
  int snd_pcm_lib_malloc_pages(struct snd_pcm_substream
  *substream, size_t size); // Typically used in hw_params
  int snd_pcm_lib_free_pages(struct snd_pcm_substream
  *substream); // Typically used in hw_free

              © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>        5
                             All Rights Reserved.
struct pcm_ops
int (*open)(struct snd_pcm_substream *substream);
int (*close)(struct snd_pcm_substream *substream);
int (*ioctl) /* Miscellaneous controls */
  (struct snd_pcm_substream * substream, unsigned int cmd, void *arg);
int (*hw_params) /* Set h/w params & allocate the buffer */
  (struct snd_pcm_substream *substream, struct snd_pcm_hw_params
  *params);
int (*hw_free) /* Free the buffer */
  (struct snd_pcm_substream *substream);
int (*prepare) /* Set audio parameters for transfer */
  (struct snd_pcm_substream *substream);
int (*trigger) /* Trigger the transfer */
  (struct snd_pcm_substream *substream, int cmd);
               © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>         6
                              All Rights Reserved.
ALSA Sound Card Interface
Header: <linux/sound/control.h>
Data Structure: struct snd_kcontrol_new
APIs
  int snd_ctl_add(struct snd_card * card, struct
  snd_kcontrol * kcontrol);
  int snd_ctl_remove(struct snd_card * card,
  struct snd_kcontrol * kcontrol);



         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   7
                        All Rights Reserved.
Porting a Audio Driver
Standard Audio Codec
 Mostly involves changing pin assignments as
 per the Board Design
New Audio Codec
 Complete Driver as per the preceeding
 discussions, need to be implemented




       © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   8
                      All Rights Reserved.
Browse some Audio Drivers
ALSA driver examples: sound/
 arm/aaci.c
 soc/soc-*.c {core, pcm, utils}
Codec driver examples: sound/
 arm/aaci.c
 soc/codecs/twl4030.c
Browse & Discuss any


        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   9
                       All Rights Reserved.
What all have we learnt?
Introduction to Linux' Audio Subsystem
Audio Vertical
  ALSA Sound Core & its Programming I/f
Audio Horizontal
  Audio Codec Driver
  Audio Controller Driver
Putting them all together: Porting


         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   10
                        All Rights Reserved.
Any Queries?




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   11
               All Rights Reserved.

More Related Content

What's hot

Quickboot on i.MX6
Quickboot on i.MX6Quickboot on i.MX6
Quickboot on i.MX6Gary Bisson
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardAnne Nicolas
 
Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)fefe7270
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom BoardPatrick Bellasi
 
linux device driver
linux device driverlinux device driver
linux device driverRahul Batra
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Opersys inc.
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)fefe7270
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 

What's hot (20)

Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
Quickboot on i.MX6
Quickboot on i.MX6Quickboot on i.MX6
Quickboot on i.MX6
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)
 
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)
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom Board
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 

Viewers also liked (14)

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
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
Block Drivers
Block DriversBlock Drivers
Block Drivers
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
Platform Drivers
Platform DriversPlatform Drivers
Platform Drivers
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
Interrupts
InterruptsInterrupts
Interrupts
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 

Similar to Audio Drivers

Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversAnil Kumar Pugalia
 
my Windows 7 info
my Windows 7 infomy Windows 7 info
my Windows 7 infoisky guard
 
SBC6020 SAM9G20 based Single Board Computer
SBC6020 SAM9G20 based Single Board ComputerSBC6020 SAM9G20 based Single Board Computer
SBC6020 SAM9G20 based Single Board Computeryclinda666
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Electronics Engineer Portfolio
Electronics Engineer PortfolioElectronics Engineer Portfolio
Electronics Engineer PortfolioAnupama Sujith
 
Industry’s performance leading ultra low-power dsp solution
Industry’s performance leading ultra low-power dsp solutionIndustry’s performance leading ultra low-power dsp solution
Industry’s performance leading ultra low-power dsp solutionAnalog Devices, Inc.
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 
Nios2 and ip core
Nios2 and ip coreNios2 and ip core
Nios2 and ip coreanishgoel
 
Motherboard and its components
Motherboard and its componentsMotherboard and its components
Motherboard and its componentskshirsagarmrk
 
Track F- Designing the kiler soc - sonics
Track F- Designing the kiler soc - sonicsTrack F- Designing the kiler soc - sonics
Track F- Designing the kiler soc - sonicschiportal
 
Asterisk - el futuro es REST
Asterisk - el futuro es RESTAsterisk - el futuro es REST
Asterisk - el futuro es RESTOpenDireito
 
System_on_Chip_SOC.ppt
System_on_Chip_SOC.pptSystem_on_Chip_SOC.ppt
System_on_Chip_SOC.pptzahixdd
 

Similar to Audio Drivers (20)

Embedded I/O Management
Embedded I/O ManagementEmbedded I/O Management
Embedded I/O Management
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
Choosing the right processor
Choosing the right processorChoosing the right processor
Choosing the right processor
 
my Windows 7 info
my Windows 7 infomy Windows 7 info
my Windows 7 info
 
SBC6020 SAM9G20 based Single Board Computer
SBC6020 SAM9G20 based Single Board ComputerSBC6020 SAM9G20 based Single Board Computer
SBC6020 SAM9G20 based Single Board Computer
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Electronics Engineer Portfolio
Electronics Engineer PortfolioElectronics Engineer Portfolio
Electronics Engineer Portfolio
 
Industry’s performance leading ultra low-power dsp solution
Industry’s performance leading ultra low-power dsp solutionIndustry’s performance leading ultra low-power dsp solution
Industry’s performance leading ultra low-power dsp solution
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
AXONIM Devices presentation
AXONIM Devices presentationAXONIM Devices presentation
AXONIM Devices presentation
 
Nios2 and ip core
Nios2 and ip coreNios2 and ip core
Nios2 and ip core
 
Motherboard and its components
Motherboard and its componentsMotherboard and its components
Motherboard and its components
 
Arduino
ArduinoArduino
Arduino
 
Track F- Designing the kiler soc - sonics
Track F- Designing the kiler soc - sonicsTrack F- Designing the kiler soc - sonics
Track F- Designing the kiler soc - sonics
 
Asterisk - el futuro es REST
Asterisk - el futuro es RESTAsterisk - el futuro es REST
Asterisk - el futuro es REST
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Resume
ResumeResume
Resume
 
Craneboard
CraneboardCraneboard
Craneboard
 
Embedded Storage Management
Embedded Storage ManagementEmbedded Storage Management
Embedded Storage Management
 
System_on_Chip_SOC.ppt
System_on_Chip_SOC.pptSystem_on_Chip_SOC.ppt
System_on_Chip_SOC.ppt
 

More from Anil Kumar Pugalia (20)

File System Modules
File System ModulesFile System Modules
File System Modules
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
References
ReferencesReferences
References
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Power of vi
Power of viPower of vi
Power of vi
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
"make" system
"make" system"make" system
"make" system
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
RPM Building
RPM BuildingRPM Building
RPM Building
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
System Calls
System CallsSystem Calls
System Calls
 
Timers
TimersTimers
Timers
 

Recently uploaded

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Audio Drivers

  • 1. Audio Drivers © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  • 2. What to Expect? Introduction to Linux' Audio Subsystem Audio Vertical: Sound Core Audio Horizontal Putting them all together: Porting © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 2 All Rights Reserved.
  • 3. Audio Subsystem ALSA conforming Apps User Space OSS conforming Apps (aplay, arecord, mplayer, ...) (rawplay, rawrec, ...) /dev/snd/pcmCXDYz, /proc/asound /dev/dsp, /dev/adsp, /dev/snd/controlCX, /sys/class/sound /dev/mixer, /dev/audio /dev/snd/timer OSS Emulation Layer (snd_pcm_oss, snd_mixer_oss) ALSA (Sound) Core Control Data Audio Codec Driver I2C Audio Controller Driver Kernel Space I2S Hardware Space MIC Audio Controller Audio Codec Speaker © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
  • 4. ALSA Sound Card Interface Header: <linux/sound/core.h> Data Structure: struct snd_card APIs int snd_card_create(int idx, const char *id, struct module *module, int extra_size, struct snd_card **card_ret); int snd_card_register(struct snd_card *card); int snd_card_free(struct snd_card *card); Inverse of both the above © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
  • 5. ALSA PCM Interface Header: <linux/sound/pcm.h> Data Structure struct snd_pcm struct snd_pcm_ops APIs int snd_pcm_new(struct snd_card *card, const char *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); // Typically used in hw_params int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); // Typically used in hw_free © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
  • 6. struct pcm_ops int (*open)(struct snd_pcm_substream *substream); int (*close)(struct snd_pcm_substream *substream); int (*ioctl) /* Miscellaneous controls */ (struct snd_pcm_substream * substream, unsigned int cmd, void *arg); int (*hw_params) /* Set h/w params & allocate the buffer */ (struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); int (*hw_free) /* Free the buffer */ (struct snd_pcm_substream *substream); int (*prepare) /* Set audio parameters for transfer */ (struct snd_pcm_substream *substream); int (*trigger) /* Trigger the transfer */ (struct snd_pcm_substream *substream, int cmd); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
  • 7. ALSA Sound Card Interface Header: <linux/sound/control.h> Data Structure: struct snd_kcontrol_new APIs int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
  • 8. Porting a Audio Driver Standard Audio Codec Mostly involves changing pin assignments as per the Board Design New Audio Codec Complete Driver as per the preceeding discussions, need to be implemented © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
  • 9. Browse some Audio Drivers ALSA driver examples: sound/ arm/aaci.c soc/soc-*.c {core, pcm, utils} Codec driver examples: sound/ arm/aaci.c soc/codecs/twl4030.c Browse & Discuss any © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  • 10. What all have we learnt? Introduction to Linux' Audio Subsystem Audio Vertical ALSA Sound Core & its Programming I/f Audio Horizontal Audio Codec Driver Audio Controller Driver Putting them all together: Porting © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
  • 11. Any Queries? © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.