Your SlideShare is downloading. ×
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Audio Drivers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Audio Drivers

9,659

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,659
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Audio Drivers© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  • 2. What to Expect?Introduction to Linux Audio SubsystemAudio Vertical: Sound CoreAudio HorizontalPutting 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 InterfaceHeader: <linux/sound/core.h>Data Structure: struct snd_cardAPIs 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 InterfaceHeader: <linux/sound/pcm.h>Data Structure struct snd_pcm struct snd_pcm_opsAPIs 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_opsint (*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 InterfaceHeader: <linux/sound/control.h>Data Structure: struct snd_kcontrol_newAPIs 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 DriverStandard Audio Codec Mostly involves changing pin assignments as per the Board DesignNew 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 DriversALSA driver examples: sound/ arm/aaci.c soc/soc-*.c {core, pcm, utils}Codec driver examples: sound/ arm/aaci.c soc/codecs/twl4030.cBrowse & Discuss any © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  • 10. What all have we learnt?Introduction to Linux Audio SubsystemAudio Vertical ALSA Sound Core & its Programming I/fAudio Horizontal Audio Codec Driver Audio Controller DriverPutting 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.

×