[alsa-devel] Help on writing an ALSA ASoC Driver for WM8985
Hi all,
I'm new to ALSA ASoC and ALSA. I'd like get some advice where I can get more information about writing an ASoC driver. I've browsed the internet couples of days and I can only find links on ALSA driver api's and writing an ALSA driver for PCI devices.
It seems there is not much information on how to writing an ALSA ASoC driver. I'm stuck on the following questions: 1. describing those important structures, e.g. struct soc_enum, struct snd_kcontrol_new, struct snd_soc_dapm_widget; 2. what is/are the relationships among those important structures; 3. what is the differences between those controls for struct snd_kcontrol_new and struct snd_soc_dapm_widget; 4. Should those sinks, sources, paths be defined in the arrays of struct snd_dapm_widget; 5. How can I select those defined paths through ALSA user-mode library as I can't find any examples in those ALSA tutorials;
Indeed, I'm right now trying to write a WM8985 driver for my s3c6400 based platform based on the kernel source v2.6.21 from Samsung.
Thank you so much for your valuable advice and suggestions in advance.
Best Regards, LEUNG, Chi Tat Senior Software Engineer CCT Tech Advanced Products Limited 18/F, CCT Telecom Building, 11 Wo Shing Street Fo Tan, Shatin, N.T., Hong Kong Tel: +852 26005276 Fax: +852 26948660 Email: ctleung@cct.com.hk Website: http://www.cct-tech.com.hk
On Sun, May 24, 2009 at 11:31 PM, Leung Chi Tat ctleung@cct.com.hk wrote:
Hi all,
I'm new to ALSA ASoC and ALSA. I'd like get some advice where I can get more information about writing an ASoC driver. I've browsed the internet couples of days and I can only find links on ALSA driver api's and writing an ALSA driver for PCI devices.
It seems there is not much information on how to writing an ALSA ASoC driver. I'm stuck on the following questions: 1. describing those important structures, e.g. struct soc_enum, struct snd_kcontrol_new, struct snd_soc_dapm_widget; 2. what is/are the relationships among those important structures; 3. what is the differences between those controls for struct snd_kcontrol_new and struct snd_soc_dapm_widget; 4. Should those sinks, sources, paths be defined in the arrays of struct snd_dapm_widget; 5. How can I select those defined paths through ALSA user-mode library as I can't find any examples in those ALSA tutorials;
Indeed, I'm right now trying to write a WM8985 driver for my s3c6400 based platform based on the kernel source v2.6.21 from Samsung.
Look in sound/soc/codecs. There are implementations for many similar Wolfson chips. Just cut and paste them together to make the wm8985.
Thank you so much for your valuable advice and suggestions in advance.
Best Regards, LEUNG, Chi Tat Senior Software Engineer CCT Tech Advanced Products Limited 18/F, CCT Telecom Building, 11 Wo Shing Street Fo Tan, Shatin, N.T., Hong Kong Tel: +852 26005276 Fax: +852 26948660 Email: ctleung@cct.com.hk Website: http://www.cct-tech.com.hk
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Mon, May 25, 2009 at 11:31:48AM +0800, Leung Chi Tat wrote:
- describing those important structures, e.g. struct soc_enum, struct snd_kcontrol_new, struct snd_soc_dapm_widget;
An enum is used to define an enumerated ALSA control. A kcontrol is a generic ALSA control - there's nothing ASoC specific about it - and a DAPM widget is a thing for which there is power control.
- what is/are the relationships among those important structures;
- what is the differences between those controls for struct snd_kcontrol_new and struct snd_soc_dapm_widget;
It'd be easier to answer this if you had some more specific questions? In general the answer is that things only go into DAPM if they have some relevance to power - that is, if they're a thing for which there is power control or if they control the routing of audio through the chip (and therefore let the core decide which parts of the chip need to be powered on).
As has already been suggested the easiest thing is probably to look at other CODEC drivers and compare what their drivers do with the datasheets.
- Should those sinks, sources, paths be defined in the arrays of struct snd_dapm_widget;
Yes, all the things you have power control for should be there.
- How can I select those defined paths through ALSA user-mode library as I can't find any examples in those ALSA tutorials;
The controls are all visible as normal ALSA controls - there's nothing ASoC specific in the userspace API. Look with an application such as amixer or alsamixer to see what's there.
Indeed, I'm right now trying to write a WM8985 driver for my s3c6400 based platform based on the kernel source v2.6.21 from Samsung.
Note that this is rather old and there were a few issues in the example code with the way that the clocking was set up for the CPU - mostly due to direct access to the system clocking registers which could interfere with other drivers. It might be worth looking at the very latest linux-next tree where there's a mostly complete implementation of audio support.
participants (3)
-
Jon Smirl
-
Leung Chi Tat
-
Mark Brown