Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Audio Drivers

Related Books

Free with a 30 day trial from Scribd

See all

Audio Drivers

  1. 1. Audio Drivers© 2010 Anil Kumar Pugalia <> All Rights Reserved.
  2. 2. What to Expect?Introduction to Linux Audio SubsystemAudio Vertical: Sound CoreAudio HorizontalPutting them all together: Porting © 2010 Anil Kumar Pugalia <> 2 All Rights Reserved.
  3. 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 <> 3 All Rights Reserved.
  4. 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 <> 4 All Rights Reserved.
  5. 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 <> 5 All Rights Reserved.
  6. 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 <> 6 All Rights Reserved.
  7. 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 <> 7 All Rights Reserved.
  8. 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 <> 8 All Rights Reserved.
  9. 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 <> 9 All Rights Reserved.
  10. 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 <> 10 All Rights Reserved.
  11. 11. Any Queries?© 2010 Anil Kumar Pugalia <> 11 All Rights Reserved.
  • kollurisrinu

    May. 22, 2018
  • fantasyyenyen

    Oct. 23, 2014
  • yogeshtillu5

    Mar. 22, 2013
  • WenChungChiu

    Mar. 21, 2013


Total views


On Slideshare


From embeds


Number of embeds