Skip to content

Commit

Permalink
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/perex/alsa

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa: (299 commits)
  [ALSA] version 1.0.16rc2
  [ALSA] hda: fix Mic in as output
  [ALSA] emu10k1 - Another EMU0404 Board ID
  [ALSA] emu10k1 - Fix kthread handling at resume
  [ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.
  [ALSA] emu10k1 - Use enum for emu_model types
  [ALSA] emu10k1 - Don't create emu1010 controls for non-emu boards
  [ALSA] emu10k1 - 1616(M) cardbus improvements
  [ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404.
  [ALSA] emu10k1: Add comments regarding E-Mu ins and outs.
  [ALSA] oxygen: revert SPI clock frequency change for AK4396/WM8785
  [ALSA] es1938 - improve capture hw pointer reads
  [ALSA] HDA-Intel - Add support for Intel SCH
  [ALSA] hda: Add GPIO mute support to STAC9205
  [ALSA] hda-codec - Add Dell T3400 support
  [ALSA] hda-codec - Add model for HP DV9553EG laptop
  [ALSA] hda-codec - Control SPDIF as slave
  [ALSA] hda_intel: ALSA HD Audio patch for Intel ICH10 DeviceID's
  [ALSA] Fix Oops with PCM OSS sync
  [ALSA] hda-codec - Add speaker automute to ALC262 HP models
  ...
  • Loading branch information
Linus Torvalds committed Jan 31, 2008
2 parents fcc3ff4 + 2ecba4f commit e1a9c98
Show file tree
Hide file tree
Showing 460 changed files with 24,536 additions and 9,985 deletions.
210 changes: 150 additions & 60 deletions Documentation/sound/alsa/ALSA-Configuration.txt

Large diffs are not rendered by default.

923 changes: 458 additions & 465 deletions Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Documentation/sound/alsa/soc/DAI.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ASoC currently supports the three main Digital Audio Interfaces (DAI) found on
SoC controllers and portable audio CODECS today, namely AC97, I2S and PCM.
SoC controllers and portable audio CODECs today, namely AC97, I2S and PCM.


AC97
Expand All @@ -25,7 +25,7 @@ left/right clock (LRC) synchronise the link. I2S is flexible in that either the
controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock
usually varies depending on the sample rate and the master system clock
(SYSCLK). LRCLK is the same as the sample rate. A few devices support separate
ADC and DAC LRCLK's, this allows for simultaneous capture and playback at
ADC and DAC LRCLKs, this allows for simultaneous capture and playback at
different sample rates.

I2S has several different operating modes:-
Expand All @@ -35,7 +35,7 @@ I2S has several different operating modes:-

o Left Justified - MSB is transmitted on transition of LRC.

o Right Justified - MSB is transmitted sample size BCLK's before LRC
o Right Justified - MSB is transmitted sample size BCLKs before LRC
transition.

PCM
Expand Down
10 changes: 5 additions & 5 deletions Documentation/sound/alsa/soc/clocking.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ or SYSCLK). This audio master clock can be derived from a number of sources
(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
audio playback and capture sample rates.

Some master clocks (e.g. PLL's and CPU based clocks) are configurable in that
Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that
their speed can be altered by software (depending on the system use and to save
power). Other master clocks are fixed at a set frequency (i.e. crystals).

Expand Down Expand Up @@ -41,11 +41,11 @@ BCLK = LRC * x
BCLK = LRC * Channels * Word Size

This relationship depends on the codec or SoC CPU in particular. In general
it's best to configure BCLK to the lowest possible speed (depending on your
rate, number of channels and wordsize) to save on power.
it is best to configure BCLK to the lowest possible speed (depending on your
rate, number of channels and word size) to save on power.

It's also desirable to use the codec (if possible) to drive (or master) the
audio clocks as it's usually gives more accurate sample rates than the CPU.
It is also desirable to use the codec (if possible) to drive (or master) the
audio clocks as it usually gives more accurate sample rates than the CPU.



53 changes: 27 additions & 26 deletions Documentation/sound/alsa/soc/codec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ code should be added to the platform and machine drivers respectively.
Each codec driver *must* provide the following features:-

1) Codec DAI and PCM configuration
2) Codec control IO - using I2C, 3 Wire(SPI) or both API's
2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs
3) Mixers and audio controls
4) Codec audio operations

Expand All @@ -19,16 +19,16 @@ Optionally, codec drivers can also provide:-
6) DAPM event handler.
7) DAC Digital mute control.

It's probably best to use this guide in conjunction with the existing codec
Its probably best to use this guide in conjunction with the existing codec
driver code in sound/soc/codecs/

ASoC Codec driver breakdown
===========================

1 - Codec DAI and PCM configuration
-----------------------------------
Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and
PCM's capabilities and operations. This struct is exported so that it can be
Each codec driver must have a struct snd_soc_codec_dai to define its DAI and
PCM capabilities and operations. This struct is exported so that it can be
registered with the core by your machine driver.

e.g.
Expand Down Expand Up @@ -67,18 +67,18 @@ EXPORT_SYMBOL_GPL(wm8731_dai);

2 - Codec control IO
--------------------
The codec can usually be controlled via an I2C or SPI style interface (AC97
combines control with data in the DAI). The codec drivers will have to provide
functions to read and write the codec registers along with supplying a register
cache:-
The codec can usually be controlled via an I2C or SPI style interface
(AC97 combines control with data in the DAI). The codec drivers provide
functions to read and write the codec registers along with supplying a
register cache:-

/* IO control data and register cache */
void *control_data; /* codec control (i2c/3wire) data */
void *reg_cache;
void *control_data; /* codec control (i2c/3wire) data */
void *reg_cache;

Codec read/write should do any data formatting and call the hardware read write
below to perform the IO. These functions are called by the core and alsa when
performing DAPM or changing the mixer:-
Codec read/write should do any data formatting and call the hardware
read write below to perform the IO. These functions are called by the
core and ALSA when performing DAPM or changing the mixer:-

unsigned int (*read)(struct snd_soc_codec *, unsigned int);
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
Expand Down Expand Up @@ -131,7 +131,7 @@ Defines a stereo enumerated control

4 - Codec Audio Operations
--------------------------
The codec driver also supports the following alsa operations:-
The codec driver also supports the following ALSA operations:-

/* SoC audio ops */
struct snd_soc_ops {
Expand All @@ -142,24 +142,24 @@ struct snd_soc_ops {
int (*prepare)(struct snd_pcm_substream *);
};

Please refer to the alsa driver PCM documentation for details.
Please refer to the ALSA driver PCM documentation for details.
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm


5 - DAPM description.
---------------------
The Dynamic Audio Power Management description describes the codec's power
components, their relationships and registers to the ASoC core. Please read
dapm.txt for details of building the description.
The Dynamic Audio Power Management description describes the codec power
components and their relationships and registers to the ASoC core.
Please read dapm.txt for details of building the description.

Please also see the examples in other codec drivers.


6 - DAPM event handler
----------------------
This function is a callback that handles codec domain PM calls and system
domain PM calls (e.g. suspend and resume). It's used to put the codec to sleep
when not in use.
domain PM calls (e.g. suspend and resume). It is used to put the codec
to sleep when not in use.

Power states:-

Expand All @@ -175,13 +175,14 @@ Power states:-
SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */


7 - Codec DAC digital mute control.
------------------------------------
Most codecs have a digital mute before the DAC's that can be used to minimise
any system noise. The mute stops any digital data from entering the DAC.
7 - Codec DAC digital mute control
----------------------------------
Most codecs have a digital mute before the DACs that can be used to
minimise any system noise. The mute stops any digital data from
entering the DAC.

A callback can be created that is called by the core for each codec DAI when the
mute is applied or freed.
A callback can be created that is called by the core for each codec DAI
when the mute is applied or freed.

i.e.

Expand Down
51 changes: 26 additions & 25 deletions Documentation/sound/alsa/soc/dapm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Dynamic Audio Power Management for Portable Devices
1. Description
==============

Dynamic Audio Power Management (DAPM) is designed to allow portable Linux devices
to use the minimum amount of power within the audio subsystem at all times. It
is independent of other kernel PM and as such, can easily co-exist with the
other PM systems.
Dynamic Audio Power Management (DAPM) is designed to allow portable
Linux devices to use the minimum amount of power within the audio
subsystem at all times. It is independent of other kernel PM and as
such, can easily co-exist with the other PM systems.

DAPM is also completely transparent to all user space applications as all power
switching is done within the ASoC core. No code changes or recompiling are
required for user space applications. DAPM makes power switching decisions based
upon any audio stream (capture/playback) activity and audio mixer settings
within the device.
DAPM is also completely transparent to all user space applications as
all power switching is done within the ASoC core. No code changes or
recompiling are required for user space applications. DAPM makes power
switching decisions based upon any audio stream (capture/playback)
activity and audio mixer settings within the device.

DAPM spans the whole machine. It covers power control within the entire audio
subsystem, this includes internal codec power blocks and machine level power
systems.
DAPM spans the whole machine. It covers power control within the entire
audio subsystem, this includes internal codec power blocks and machine
level power systems.

There are 4 power domains within DAPM

Expand All @@ -34,7 +34,7 @@ There are 4 power domains within DAPM
Automatically set when mixer and mux settings are changed by the user.
e.g. alsamixer, amixer.

4. Stream domain - DAC's and ADC's.
4. Stream domain - DACs and ADCs.
Enabled and disabled when stream playback/capture is started and
stopped respectively. e.g. aplay, arecord.

Expand All @@ -51,7 +51,7 @@ widgets hereafter.
Audio DAPM widgets fall into a number of types:-

o Mixer - Mixes several analog signals into a single analog signal.
o Mux - An analog switch that outputs only 1 of it's inputs.
o Mux - An analog switch that outputs only one of many inputs.
o PGA - A programmable gain amplifier or attenuation widget.
o ADC - Analog to Digital Converter
o DAC - Digital to Analog Converter
Expand All @@ -78,14 +78,14 @@ parameters for stream name and kcontrols.
2.1 Stream Domain Widgets
-------------------------

Stream Widgets relate to the stream power domain and only consist of ADC's
(analog to digital converters) and DAC's (digital to analog converters).
Stream Widgets relate to the stream power domain and only consist of ADCs
(analog to digital converters) and DACs (digital to analog converters).

Stream widgets have the following format:-

SND_SOC_DAPM_DAC(name, stream name, reg, shift, invert),

NOTE: the stream name must match the corresponding stream name in your codecs
NOTE: the stream name must match the corresponding stream name in your codec
snd_soc_codec_dai.

e.g. stream widgets for HiFi playback and capture
Expand All @@ -97,7 +97,7 @@ SND_SOC_DAPM_ADC("HiFi ADC", "HiFi Capture", REG, 2, 1),
2.2 Path Domain Widgets
-----------------------

Path domain widgets have a ability to control or effect the audio signal or
Path domain widgets have a ability to control or affect the audio signal or
audio paths within the audio subsystem. They have the following form:-

SND_SOC_DAPM_PGA(name, reg, shift, invert, controls, num_controls)
Expand Down Expand Up @@ -149,7 +149,7 @@ SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias),
2.4 Codec Domain
----------------

The Codec power domain has no widgets and is handled by the codecs DAPM event
The codec power domain has no widgets and is handled by the codecs DAPM event
handler. This handler is called when the codec powerstate is changed wrt to any
stream event or by kernel PM events.

Expand All @@ -158,8 +158,8 @@ stream event or by kernel PM events.
-------------------

Sometimes widgets exist in the codec or machine audio map that don't have any
corresponding register bit for power control. In this case it's necessary to
create a virtual widget - a widget with no control bits e.g.
corresponding soft power control. In this case it is necessary to create
a virtual widget - a widget with no control bits e.g.

SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0),

Expand All @@ -172,13 +172,14 @@ subsystem individually with a call to snd_soc_dapm_new_control().
3. Codec Widget Interconnections
================================

Widgets are connected to each other within the codec and machine by audio
paths (called interconnections). Each interconnection must be defined in order
to create a map of all audio paths between widgets.
Widgets are connected to each other within the codec and machine by audio paths
(called interconnections). Each interconnection must be defined in order to
create a map of all audio paths between widgets.

This is easiest with a diagram of the codec (and schematic of the machine audio
system), as it requires joining widgets together via their audio signal paths.

i.e. from the WM8731 codec's output mixer (wm8731.c)
e.g., from the WM8731 output mixer (wm8731.c)

The WM8731 output mixer has 3 inputs (sources)

Expand Down
12 changes: 6 additions & 6 deletions Documentation/sound/alsa/soc/machine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct snd_soc_machine {
int (*remove)(struct platform_device *pdev);

/* the pre and post PM functions are used to do any PM work before and
* after the codec and DAI's do any PM work. */
* after the codec and DAIs do any PM work. */
int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
int (*resume_pre)(struct platform_device *pdev);
Expand All @@ -38,7 +38,7 @@ probe/remove are optional. Do any machine specific probe here.
suspend()/resume()
------------------
The machine driver has pre and post versions of suspend and resume to take care
of any machine audio tasks that have to be done before or after the codec, DAI's
of any machine audio tasks that have to be done before or after the codec, DAIs
and DMA is suspended and resumed. Optional.


Expand All @@ -49,10 +49,10 @@ The machine specific audio operations can be set here. Again this is optional.

Machine DAI Configuration
-------------------------
The machine DAI configuration glues all the codec and CPU DAI's together. It can
The machine DAI configuration glues all the codec and CPU DAIs together. It can
also be used to set up the DAI system clock and for any machine related DAI
initialisation e.g. the machine audio map can be connected to the codec audio
map, unconnnected codec pins can be set as such. Please see corgi.c, spitz.c
map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c
for examples.

struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
Expand All @@ -67,7 +67,7 @@ static struct snd_soc_dai_link corgi_dai = {
.ops = &corgi_ops,
};

struct snd_soc_machine then sets up the machine with it's DAI's. e.g.
struct snd_soc_machine then sets up the machine with it's DAIs. e.g.

/* corgi audio machine driver */
static struct snd_soc_machine snd_soc_machine_corgi = {
Expand Down Expand Up @@ -110,4 +110,4 @@ details.
Machine Controls
----------------

Machine specific audio mixer controls can be added in the dai init function.
Machine specific audio mixer controls can be added in the DAI init function.
Loading

0 comments on commit e1a9c98

Please sign in to comment.