1
linux/sound/soc/codecs/wm8741.h
Liam Girdwood f0fba2ad1b ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.

 struct snd_soc_codec    --->  struct snd_soc_codec (device data)
                          +->  struct snd_soc_codec_driver (driver data)

 struct snd_soc_platform --->  struct snd_soc_platform (device data)
                          +->  struct snd_soc_platform_driver (driver data)

 struct snd_soc_dai      --->  struct snd_soc_dai (device data)
                          +->  struct snd_soc_dai_driver (driver data)

 struct snd_soc_device   --->  deleted

This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.

The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.

This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.

Other notable multi-component changes:-

 * Stream operations now de-reference less structures.
 * close_delayed work() now runs on a DAI basis rather than looping all DAIs
   in a card.
 * PM suspend()/resume() operations can now handle N CODECs and Platforms
   per sound card.
 * Added soc_bind_dai_link() to bind the component devices to the sound card.
 * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
   DAI link components.
 * sysfs entries can now be registered per component per card.
 * snd_soc_new_pcms() functionailty rolled into dai_link_probe().
 * snd_soc_register_codec() now does all the codec list and mutex init.

This patch changes the probe() and remove() of the CODEC drivers as follows:-

 o Make CODEC driver a platform driver
 o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
 o Removed all static codec pointers (drivers now support > 1 codec dev)
 o snd_soc_register_pcms() now done by core.
 o snd_soc_register_dai() folded into snd_soc_register_codec().

CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>

Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>

TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>

MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>

i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-12 14:00:00 +01:00

212 lines
11 KiB
C

/*
* wm8741.h -- WM8423 ASoC driver
*
* Copyright 2010 Wolfson Microelectronics, plc
*
* Author: Ian Lartey <ian@opensource.wolfsonmicro.com>
*
* Based on wm8753.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _WM8741_H
#define _WM8741_H
/*
* Register values.
*/
#define WM8741_DACLLSB_ATTENUATION 0x00
#define WM8741_DACLMSB_ATTENUATION 0x01
#define WM8741_DACRLSB_ATTENUATION 0x02
#define WM8741_DACRMSB_ATTENUATION 0x03
#define WM8741_VOLUME_CONTROL 0x04
#define WM8741_FORMAT_CONTROL 0x05
#define WM8741_FILTER_CONTROL 0x06
#define WM8741_MODE_CONTROL_1 0x07
#define WM8741_MODE_CONTROL_2 0x08
#define WM8741_RESET 0x09
#define WM8741_ADDITIONAL_CONTROL_1 0x20
#define WM8741_REGISTER_COUNT 11
#define WM8741_MAX_REGISTER 0x20
/*
* Field Definitions.
*/
/*
* R0 (0x00) - DACLLSB_ATTENUATION
*/
#define WM8741_UPDATELL 0x0020 /* UPDATELL */
#define WM8741_UPDATELL_MASK 0x0020 /* UPDATELL */
#define WM8741_UPDATELL_SHIFT 5 /* UPDATELL */
#define WM8741_UPDATELL_WIDTH 1 /* UPDATELL */
#define WM8741_LAT_4_0_MASK 0x001F /* LAT[4:0] - [4:0] */
#define WM8741_LAT_4_0_SHIFT 0 /* LAT[4:0] - [4:0] */
#define WM8741_LAT_4_0_WIDTH 5 /* LAT[4:0] - [4:0] */
/*
* R1 (0x01) - DACLMSB_ATTENUATION
*/
#define WM8741_UPDATELM 0x0020 /* UPDATELM */
#define WM8741_UPDATELM_MASK 0x0020 /* UPDATELM */
#define WM8741_UPDATELM_SHIFT 5 /* UPDATELM */
#define WM8741_UPDATELM_WIDTH 1 /* UPDATELM */
#define WM8741_LAT_9_5_0_MASK 0x001F /* LAT[9:5] - [4:0] */
#define WM8741_LAT_9_5_0_SHIFT 0 /* LAT[9:5] - [4:0] */
#define WM8741_LAT_9_5_0_WIDTH 5 /* LAT[9:5] - [4:0] */
/*
* R2 (0x02) - DACRLSB_ATTENUATION
*/
#define WM8741_UPDATERL 0x0020 /* UPDATERL */
#define WM8741_UPDATERL_MASK 0x0020 /* UPDATERL */
#define WM8741_UPDATERL_SHIFT 5 /* UPDATERL */
#define WM8741_UPDATERL_WIDTH 1 /* UPDATERL */
#define WM8741_RAT_4_0_MASK 0x001F /* RAT[4:0] - [4:0] */
#define WM8741_RAT_4_0_SHIFT 0 /* RAT[4:0] - [4:0] */
#define WM8741_RAT_4_0_WIDTH 5 /* RAT[4:0] - [4:0] */
/*
* R3 (0x03) - DACRMSB_ATTENUATION
*/
#define WM8741_UPDATERM 0x0020 /* UPDATERM */
#define WM8741_UPDATERM_MASK 0x0020 /* UPDATERM */
#define WM8741_UPDATERM_SHIFT 5 /* UPDATERM */
#define WM8741_UPDATERM_WIDTH 1 /* UPDATERM */
#define WM8741_RAT_9_5_0_MASK 0x001F /* RAT[9:5] - [4:0] */
#define WM8741_RAT_9_5_0_SHIFT 0 /* RAT[9:5] - [4:0] */
#define WM8741_RAT_9_5_0_WIDTH 5 /* RAT[9:5] - [4:0] */
/*
* R4 (0x04) - VOLUME_CONTROL
*/
#define WM8741_AMUTE 0x0080 /* AMUTE */
#define WM8741_AMUTE_MASK 0x0080 /* AMUTE */
#define WM8741_AMUTE_SHIFT 7 /* AMUTE */
#define WM8741_AMUTE_WIDTH 1 /* AMUTE */
#define WM8741_ZFLAG_MASK 0x0060 /* ZFLAG - [6:5] */
#define WM8741_ZFLAG_SHIFT 5 /* ZFLAG - [6:5] */
#define WM8741_ZFLAG_WIDTH 2 /* ZFLAG - [6:5] */
#define WM8741_IZD 0x0010 /* IZD */
#define WM8741_IZD_MASK 0x0010 /* IZD */
#define WM8741_IZD_SHIFT 4 /* IZD */
#define WM8741_IZD_WIDTH 1 /* IZD */
#define WM8741_SOFT 0x0008 /* SOFT MUTE */
#define WM8741_SOFT_MASK 0x0008 /* SOFT MUTE */
#define WM8741_SOFT_SHIFT 3 /* SOFT MUTE */
#define WM8741_SOFT_WIDTH 1 /* SOFT MUTE */
#define WM8741_ATC 0x0004 /* ATC */
#define WM8741_ATC_MASK 0x0004 /* ATC */
#define WM8741_ATC_SHIFT 2 /* ATC */
#define WM8741_ATC_WIDTH 1 /* ATC */
#define WM8741_ATT2DB 0x0002 /* ATT2DB */
#define WM8741_ATT2DB_MASK 0x0002 /* ATT2DB */
#define WM8741_ATT2DB_SHIFT 1 /* ATT2DB */
#define WM8741_ATT2DB_WIDTH 1 /* ATT2DB */
#define WM8741_VOL_RAMP 0x0001 /* VOL_RAMP */
#define WM8741_VOL_RAMP_MASK 0x0001 /* VOL_RAMP */
#define WM8741_VOL_RAMP_SHIFT 0 /* VOL_RAMP */
#define WM8741_VOL_RAMP_WIDTH 1 /* VOL_RAMP */
/*
* R5 (0x05) - FORMAT_CONTROL
*/
#define WM8741_PWDN 0x0080 /* PWDN */
#define WM8741_PWDN_MASK 0x0080 /* PWDN */
#define WM8741_PWDN_SHIFT 7 /* PWDN */
#define WM8741_PWDN_WIDTH 1 /* PWDN */
#define WM8741_REV 0x0040 /* REV */
#define WM8741_REV_MASK 0x0040 /* REV */
#define WM8741_REV_SHIFT 6 /* REV */
#define WM8741_REV_WIDTH 1 /* REV */
#define WM8741_BCP 0x0020 /* BCP */
#define WM8741_BCP_MASK 0x0020 /* BCP */
#define WM8741_BCP_SHIFT 5 /* BCP */
#define WM8741_BCP_WIDTH 1 /* BCP */
#define WM8741_LRP 0x0010 /* LRP */
#define WM8741_LRP_MASK 0x0010 /* LRP */
#define WM8741_LRP_SHIFT 4 /* LRP */
#define WM8741_LRP_WIDTH 1 /* LRP */
#define WM8741_FMT_MASK 0x000C /* FMT - [3:2] */
#define WM8741_FMT_SHIFT 2 /* FMT - [3:2] */
#define WM8741_FMT_WIDTH 2 /* FMT - [3:2] */
#define WM8741_IWL_MASK 0x0003 /* IWL - [1:0] */
#define WM8741_IWL_SHIFT 0 /* IWL - [1:0] */
#define WM8741_IWL_WIDTH 2 /* IWL - [1:0] */
/*
* R6 (0x06) - FILTER_CONTROL
*/
#define WM8741_ZFLAG_HI 0x0080 /* ZFLAG_HI */
#define WM8741_ZFLAG_HI_MASK 0x0080 /* ZFLAG_HI */
#define WM8741_ZFLAG_HI_SHIFT 7 /* ZFLAG_HI */
#define WM8741_ZFLAG_HI_WIDTH 1 /* ZFLAG_HI */
#define WM8741_DEEMPH_MASK 0x0060 /* DEEMPH - [6:5] */
#define WM8741_DEEMPH_SHIFT 5 /* DEEMPH - [6:5] */
#define WM8741_DEEMPH_WIDTH 2 /* DEEMPH - [6:5] */
#define WM8741_DSDFILT_MASK 0x0018 /* DSDFILT - [4:3] */
#define WM8741_DSDFILT_SHIFT 3 /* DSDFILT - [4:3] */
#define WM8741_DSDFILT_WIDTH 2 /* DSDFILT - [4:3] */
#define WM8741_FIRSEL_MASK 0x0007 /* FIRSEL - [2:0] */
#define WM8741_FIRSEL_SHIFT 0 /* FIRSEL - [2:0] */
#define WM8741_FIRSEL_WIDTH 3 /* FIRSEL - [2:0] */
/*
* R7 (0x07) - MODE_CONTROL_1
*/
#define WM8741_MODE8X 0x0080 /* MODE8X */
#define WM8741_MODE8X_MASK 0x0080 /* MODE8X */
#define WM8741_MODE8X_SHIFT 7 /* MODE8X */
#define WM8741_MODE8X_WIDTH 1 /* MODE8X */
#define WM8741_OSR_MASK 0x0060 /* OSR - [6:5] */
#define WM8741_OSR_SHIFT 5 /* OSR - [6:5] */
#define WM8741_OSR_WIDTH 2 /* OSR - [6:5] */
#define WM8741_SR_MASK 0x001C /* SR - [4:2] */
#define WM8741_SR_SHIFT 2 /* SR - [4:2] */
#define WM8741_SR_WIDTH 3 /* SR - [4:2] */
#define WM8741_MODESEL_MASK 0x0003 /* MODESEL - [1:0] */
#define WM8741_MODESEL_SHIFT 0 /* MODESEL - [1:0] */
#define WM8741_MODESEL_WIDTH 2 /* MODESEL - [1:0] */
/*
* R8 (0x08) - MODE_CONTROL_2
*/
#define WM8741_DSD_GAIN 0x0040 /* DSD_GAIN */
#define WM8741_DSD_GAIN_MASK 0x0040 /* DSD_GAIN */
#define WM8741_DSD_GAIN_SHIFT 6 /* DSD_GAIN */
#define WM8741_DSD_GAIN_WIDTH 1 /* DSD_GAIN */
#define WM8741_SDOUT 0x0020 /* SDOUT */
#define WM8741_SDOUT_MASK 0x0020 /* SDOUT */
#define WM8741_SDOUT_SHIFT 5 /* SDOUT */
#define WM8741_SDOUT_WIDTH 1 /* SDOUT */
#define WM8741_DOUT 0x0010 /* DOUT */
#define WM8741_DOUT_MASK 0x0010 /* DOUT */
#define WM8741_DOUT_SHIFT 4 /* DOUT */
#define WM8741_DOUT_WIDTH 1 /* DOUT */
#define WM8741_DIFF_MASK 0x000C /* DIFF - [3:2] */
#define WM8741_DIFF_SHIFT 2 /* DIFF - [3:2] */
#define WM8741_DIFF_WIDTH 2 /* DIFF - [3:2] */
#define WM8741_DITHER_MASK 0x0003 /* DITHER - [1:0] */
#define WM8741_DITHER_SHIFT 0 /* DITHER - [1:0] */
#define WM8741_DITHER_WIDTH 2 /* DITHER - [1:0] */
/*
* R32 (0x20) - ADDITONAL_CONTROL_1
*/
#define WM8741_DSD_LEVEL 0x0002 /* DSD_LEVEL */
#define WM8741_DSD_LEVEL_MASK 0x0002 /* DSD_LEVEL */
#define WM8741_DSD_LEVEL_SHIFT 1 /* DSD_LEVEL */
#define WM8741_DSD_LEVEL_WIDTH 1 /* DSD_LEVEL */
#define WM8741_DSD_NO_NOTCH 0x0001 /* DSD_NO_NOTCH */
#define WM8741_DSD_NO_NOTCH_MASK 0x0001 /* DSD_NO_NOTCH */
#define WM8741_DSD_NO_NOTCH_SHIFT 0 /* DSD_NO_NOTCH */
#define WM8741_DSD_NO_NOTCH_WIDTH 1 /* DSD_NO_NOTCH */
#define WM8741_SYSCLK 0
#endif