ASoC: Initial WM8958 audio configuration
Subsystems (4)
PATCH 1/4 ASoC: Initial WM8958 audio configuration
The WM8958 is a WM8994 derivative. This patch merely ensures that some revision specific configuration for WM8994 is not enabled on WM8994, additional patches will add support for the new features introduced on the WM8958.
--- sound/soc/codecs/wm8994.c | 110 +++++++++++++++++++++++++++++++-------------- 1 files changed, 76 insertions(+), 34 deletions(-)
sound/soc/codecs/wm8994.c +76 -34
@@ -1535,6 +1535,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,static int wm8994_set_bias_level (struct snd_soc_codec *codec,enum snd_soc_bias_level level) { +struct wm8994 *control = codec->control_data;struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);switch (level) {
@@ -1551,7 +1552,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,if (codec->dapm.bias_level ==SND_SOC_BIAS_OFF ) {/* Tweak DC servo and DSP configuration for * improved performance. */ -if (wm8994->revision <4 ) { +if (control->type ==WM8994 && wm8994->revision <4 ) {/* Tweak DC servo and DSP configuration for * improved performance. */ snd_soc_write (codec,0x102 ,0x3 );
@@ -2264,8 +2265,12 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, {struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_micdet *micdet; +struct wm8994 *control = codec->control_data;int reg; +if (control->type !=WM8994 ) +return -EINVAL ; +switch (micbias) {case 1 : micdet = &wm8994->micdet[0 ];
@@ -2334,11 +2339,13 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)static int wm8994_codec_probe (struct snd_soc_codec *codec) { +struct wm8994 *control;struct wm8994_priv *wm8994;struct snd_soc_dapm_context *dapm = &codec->dapm;int ret, i; codec->control_data =dev_get_drvdata (codec->dev->parent); + control = codec->control_data; wm8994 =kzalloc (sizeof (struct wm8994_priv ),GFP_KERNEL );if (wm8994 ==NULL )
@@ -2369,41 +2376,67 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)/* Set revision-specific configuration */ wm8994->revision =snd_soc_read (codec,WM8994_CHIP_REVISION ); -switch (wm8994->revision) { -case 2 : -case 3 : - wm8994->hubs.dcs_codes =-5 ; - wm8994->hubs.hp_startup_mode =1 ; +switch (control->type) { +case WM8994 : +switch (wm8994->revision) { +case 2 : +case 3 : + wm8994->hubs.dcs_codes =-5 ; + wm8994->hubs.hp_startup_mode =1 ; + wm8994->hubs.dcs_readback_mode =1 ; +break ; +default : + wm8994->hubs.dcs_readback_mode =1 ; +break ; + } + +case WM8958 : wm8994->hubs.dcs_readback_mode =1 ;break ; +default : - wm8994->hubs.dcs_readback_mode =1 ;break ; } - ret =wm8994_request_irq (codec->control_data,WM8994_IRQ_MIC1_DET , - wm8994_mic_irq,"Mic 1 detect" , wm8994); -if (ret !=0 ) -dev_warn (codec->dev, -"Failed to request Mic1 detect IRQ: %d\n" , ret); - - ret =wm8994_request_irq (codec->control_data,WM8994_IRQ_MIC1_SHRT , - wm8994_mic_irq,"Mic 1 short" , wm8994); -if (ret !=0 ) -dev_warn (codec->dev, -"Failed to request Mic1 short IRQ: %d\n" , ret); - - ret =wm8994_request_irq (codec->control_data,WM8994_IRQ_MIC2_DET , - wm8994_mic_irq,"Mic 2 detect" , wm8994); -if (ret !=0 ) -dev_warn (codec->dev, -"Failed to request Mic2 detect IRQ: %d\n" , ret); - - ret =wm8994_request_irq (codec->control_data,WM8994_IRQ_MIC2_SHRT , - wm8994_mic_irq,"Mic 2 short" , wm8994); -if (ret !=0 ) -dev_warn (codec->dev, -"Failed to request Mic2 short IRQ: %d\n" , ret); +switch (control->type) { +case WM8994 : + ret =wm8994_request_irq (codec->control_data, +WM8994_IRQ_MIC1_DET , + wm8994_mic_irq,"Mic 1 detect" , + wm8994); +if (ret !=0 ) +dev_warn (codec->dev, +"Failed to request Mic1 detect IRQ: %d\n" , + ret); + + ret =wm8994_request_irq (codec->control_data, +WM8994_IRQ_MIC1_SHRT , + wm8994_mic_irq,"Mic 1 short" , + wm8994); +if (ret !=0 ) +dev_warn (codec->dev, +"Failed to request Mic1 short IRQ: %d\n" , + ret); + + ret =wm8994_request_irq (codec->control_data, +WM8994_IRQ_MIC2_DET , + wm8994_mic_irq,"Mic 2 detect" , + wm8994); +if (ret !=0 ) +dev_warn (codec->dev, +"Failed to request Mic2 detect IRQ: %d\n" , + ret); + + ret =wm8994_request_irq (codec->control_data, +WM8994_IRQ_MIC2_SHRT , + wm8994_mic_irq,"Mic 2 short" , + wm8994); +if (ret !=0 ) +dev_warn (codec->dev, +"Failed to request Mic2 short IRQ: %d\n" , + ret); +break ; + }/* Remember if AIFnLRCLK is configured as a GPIO. This should be * configured on init - if a system wants to do this dynamically
@@ -2496,13 +2529,22 @@ err:static int wm8994_codec_remove (struct snd_soc_codec *codec) {struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec); +struct wm8994 *control = codec->control_data;wm8994_set_bias_level (codec,SND_SOC_BIAS_OFF ); -wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC2_SHRT , wm8994); -wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC2_DET , wm8994); -wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC1_SHRT , wm8994); -wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC1_DET , wm8994); +switch (control->type) { +case WM8994 : +wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC2_SHRT , + wm8994); +wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC2_DET , + wm8994); +wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC1_SHRT , + wm8994); +wm8994_free_irq (codec->control_data,WM8994_IRQ_MIC1_DET , + wm8994); +break ; + }kfree (wm8994->retune_mobile_texts);kfree (wm8994->drc_texts);kfree (wm8994);
Signature · 1 line
1.7.1
PATCH 2/4 ASoC: Implement support for enhanced AIF3 on WM8958
Additional audio routing options are available on the WM8958 audio interface 3. Add support for these.
--- include/linux/mfd/wm8994/registers.h | 67 ++++++++++++++ sound/soc/codecs/wm8994.c | 166 ++++++++++++++++++++++++++++++++-- 2 files changed, 224 insertions(+), 9 deletions(-)
include/linux/mfd/wm8994/registers.h +67 -0
@@ -109,6 +109,10 @@#define WM8994_AIF2DAC_LRCLK 0x315#define WM8994_AIF2DAC_DATA 0x316#define WM8994_AIF2ADC_DATA 0x317 +#define WM8958_AIF3_CONTROL_1 0x320 +#define WM8958_AIF3_CONTROL_2 0x321 +#define WM8958_AIF3DAC_DATA 0x322 +#define WM8958_AIF3ADC_DATA 0x323#define WM8994_AIF1_ADC1_LEFT_VOLUME 0x400#define WM8994_AIF1_ADC1_RIGHT_VOLUME 0x401#define WM8994_AIF1_DAC1_LEFT_VOLUME 0x402
@@ -992,6 +996,12 @@/* * R6 (0x06) - Power Management (6) */ +#define WM8958_AIF3ADC_SRC_MASK 0x0600/* AIF3ADC_SRC - [10:9] */ +#define WM8958_AIF3ADC_SRC_SHIFT 9/* AIF3ADC_SRC - [10:9] */ +#define WM8958_AIF3ADC_SRC_WIDTH 2/* AIF3ADC_SRC - [10:9] */ +#define WM8958_AIF2DAC_SRC_MASK 0x0180/* AIF2DAC_SRC - [8:7] */ +#define WM8958_AIF2DAC_SRC_SHIFT 7/* AIF2DAC_SRC - [8:7] */ +#define WM8958_AIF2DAC_SRC_WIDTH 2/* AIF2DAC_SRC - [8:7] */ #define WM8994_AIF3_TRI 0x0020/* AIF3_TRI */ #define WM8994_AIF3_TRI_MASK 0x0020/* AIF3_TRI */ #define WM8994_AIF3_TRI_SHIFT 5/* AIF3_TRI */
@@ -2553,6 +2563,63 @@#define WM8994_AIF2ADCR_DAT_INV_WIDTH 1/* AIF2ADCR_DAT_INV */ /* +* R800 (0x320) - AIF3 Control (1) +*/ +#define WM8958_AIF3_LRCLK_INV 0x0080/* AIF3_LRCLK_INV */ +#define WM8958_AIF3_LRCLK_INV_MASK 0x0080/* AIF3_LRCLK_INV */ +#define WM8958_AIF3_LRCLK_INV_SHIFT 7/* AIF3_LRCLK_INV */ +#define WM8958_AIF3_LRCLK_INV_WIDTH 1/* AIF3_LRCLK_INV */ +#define WM8958_AIF3_WL_MASK 0x0060/* AIF3_WL - [6:5] */ +#define WM8958_AIF3_WL_SHIFT 5/* AIF3_WL - [6:5] */ +#define WM8958_AIF3_WL_WIDTH 2/* AIF3_WL - [6:5] */ +#define WM8958_AIF3_FMT_MASK 0x0018/* AIF3_FMT - [4:3] */ +#define WM8958_AIF3_FMT_SHIFT 3/* AIF3_FMT - [4:3] */ +#define WM8958_AIF3_FMT_WIDTH 2/* AIF3_FMT - [4:3] */ + +/* +* R801 (0x321) - AIF3 Control (2) +*/ +#define WM8958_AIF3DAC_BOOST_MASK 0x0C00/* AIF3DAC_BOOST - [11:10] */ +#define WM8958_AIF3DAC_BOOST_SHIFT 10/* AIF3DAC_BOOST - [11:10] */ +#define WM8958_AIF3DAC_BOOST_WIDTH 2/* AIF3DAC_BOOST - [11:10] */ +#define WM8958_AIF3DAC_COMP 0x0010/* AIF3DAC_COMP */ +#define WM8958_AIF3DAC_COMP_MASK 0x0010/* AIF3DAC_COMP */ +#define WM8958_AIF3DAC_COMP_SHIFT 4/* AIF3DAC_COMP */ +#define WM8958_AIF3DAC_COMP_WIDTH 1/* AIF3DAC_COMP */ +#define WM8958_AIF3DAC_COMPMODE 0x0008/* AIF3DAC_COMPMODE */ +#define WM8958_AIF3DAC_COMPMODE_MASK 0x0008/* AIF3DAC_COMPMODE */ +#define WM8958_AIF3DAC_COMPMODE_SHIFT 3/* AIF3DAC_COMPMODE */ +#define WM8958_AIF3DAC_COMPMODE_WIDTH 1/* AIF3DAC_COMPMODE */ +#define WM8958_AIF3ADC_COMP 0x0004/* AIF3ADC_COMP */ +#define WM8958_AIF3ADC_COMP_MASK 0x0004/* AIF3ADC_COMP */ +#define WM8958_AIF3ADC_COMP_SHIFT 2/* AIF3ADC_COMP */ +#define WM8958_AIF3ADC_COMP_WIDTH 1/* AIF3ADC_COMP */ +#define WM8958_AIF3ADC_COMPMODE 0x0002/* AIF3ADC_COMPMODE */ +#define WM8958_AIF3ADC_COMPMODE_MASK 0x0002/* AIF3ADC_COMPMODE */ +#define WM8958_AIF3ADC_COMPMODE_SHIFT 1/* AIF3ADC_COMPMODE */ +#define WM8958_AIF3ADC_COMPMODE_WIDTH 1/* AIF3ADC_COMPMODE */ +#define WM8958_AIF3_LOOPBACK 0x0001/* AIF3_LOOPBACK */ +#define WM8958_AIF3_LOOPBACK_MASK 0x0001/* AIF3_LOOPBACK */ +#define WM8958_AIF3_LOOPBACK_SHIFT 0/* AIF3_LOOPBACK */ +#define WM8958_AIF3_LOOPBACK_WIDTH 1/* AIF3_LOOPBACK */ + +/* +* R802 (0x322) - AIF3DAC Data +*/ +#define WM8958_AIF3DAC_DAT_INV 0x0001/* AIF3DAC_DAT_INV */ +#define WM8958_AIF3DAC_DAT_INV_MASK 0x0001/* AIF3DAC_DAT_INV */ +#define WM8958_AIF3DAC_DAT_INV_SHIFT 0/* AIF3DAC_DAT_INV */ +#define WM8958_AIF3DAC_DAT_INV_WIDTH 1/* AIF3DAC_DAT_INV */ + +/* +* R803 (0x323) - AIF3ADC Data +*/ +#define WM8958_AIF3ADC_DAT_INV 0x0001/* AIF3ADC_DAT_INV */ +#define WM8958_AIF3ADC_DAT_INV_MASK 0x0001/* AIF3ADC_DAT_INV */ +#define WM8958_AIF3ADC_DAT_INV_SHIFT 0/* AIF3ADC_DAT_INV */ +#define WM8958_AIF3ADC_DAT_INV_WIDTH 1/* AIF3ADC_DAT_INV */ + +/* * R1024 (0x400) - AIF1 ADC1 Left Volume */ #define WM8994_AIF1ADC1_VU 0x0100/* AIF1ADC1_VU */
sound/soc/codecs/wm8994.c +157 -9
252 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 3/4 ASoC: Add WM8958 Multi-band compressor support
In reply to Mark BrownThe WM8958 features a multi-band compressor which can be enabled on any of the AIF inputs. The MBC allows different gains to be applied to differnt audio bands, providing an improvement in perceived loudness of the signal by avoiding overdriving the output transducers. This patch enables support for the MBC.
--- include/linux/mfd/wm8994/registers.h | 115 ++++++++++++++++++++ sound/soc/codecs/wm8994.c | 198 +++++++++++++++++++++++++++++++-- 2 files changed, 301 insertions(+), 12 deletions(-)
include/linux/mfd/wm8994/registers.h +115 -0
@@ -246,6 +246,15 @@#define WM8994_INTERRUPT_STATUS_2_MASK 0x739#define WM8994_INTERRUPT_CONTROL 0x740#define WM8994_IRQ_DEBOUNCE 0x748 +#define WM8958_DSP2_PROGRAM 0x900 +#define WM8958_DSP2_CONFIG 0x901 +#define WM8958_DSP2_MAGICNUM 0xA00 +#define WM8958_DSP2_RELEASEYEAR 0xA01 +#define WM8958_DSP2_RELEASEMONTHDAY 0xA02 +#define WM8958_DSP2_RELEASETIME 0xA03 +#define WM8958_DSP2_VERMAJMIN 0xA04 +#define WM8958_DSP2_VERBUILD 0xA05 +#define WM8958_DSP2_EXECCONTROL 0xA0D#define WM8994_WRITE_SEQUENCER_0 0x3000#define WM8994_WRITE_SEQUENCER_1 0x3001#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -2079,6 +2088,14 @@/* * R520 (0x208) - Clocking (1) */ +#define WM8958_DSP2CLK_ENA 0x4000/* DSP2CLK_ENA */ +#define WM8958_DSP2CLK_ENA_MASK 0x4000/* DSP2CLK_ENA */ +#define WM8958_DSP2CLK_ENA_SHIFT 14/* DSP2CLK_ENA */ +#define WM8958_DSP2CLK_ENA_WIDTH 1/* DSP2CLK_ENA */ +#define WM8958_DSP2CLK_SRC 0x1000/* DSP2CLK_SRC */ +#define WM8958_DSP2CLK_SRC_MASK 0x1000/* DSP2CLK_SRC */ +#define WM8958_DSP2CLK_SRC_SHIFT 12/* DSP2CLK_SRC */ +#define WM8958_DSP2CLK_SRC_WIDTH 1/* DSP2CLK_SRC */ #define WM8994_TOCLK_ENA 0x0010/* TOCLK_ENA */ #define WM8994_TOCLK_ENA_MASK 0x0010/* TOCLK_ENA */ #define WM8994_TOCLK_ENA_SHIFT 4/* TOCLK_ENA */
@@ -4356,4 +4373,102 @@#define WM8994_TEMP_SHUT_DB_SHIFT 0/* TEMP_SHUT_DB */ #define WM8994_TEMP_SHUT_DB_WIDTH 1/* TEMP_SHUT_DB */ +/* +* R2304 (0x900) - DSP2_Program +*/ +#define WM8958_DSP2_ENA 0x0001/* DSP2_ENA */ +#define WM8958_DSP2_ENA_MASK 0x0001/* DSP2_ENA */ +#define WM8958_DSP2_ENA_SHIFT 0/* DSP2_ENA */ +#define WM8958_DSP2_ENA_WIDTH 1/* DSP2_ENA */ + +/* +* R2305 (0x901) - DSP2_Config +*/ +#define WM8958_MBC_SEL_MASK 0x0030/* MBC_SEL - [5:4] */ +#define WM8958_MBC_SEL_SHIFT 4/* MBC_SEL - [5:4] */ +#define WM8958_MBC_SEL_WIDTH 2/* MBC_SEL - [5:4] */ +#define WM8958_MBC_ENA 0x0001/* MBC_ENA */ +#define WM8958_MBC_ENA_MASK 0x0001/* MBC_ENA */ +#define WM8958_MBC_ENA_SHIFT 0/* MBC_ENA */ +#define WM8958_MBC_ENA_WIDTH 1/* MBC_ENA */ + +/* +* R2560 (0xA00) - DSP2_MagicNum +*/ +#define WM8958_DSP2_MAGIC_NUM_MASK 0xFFFF/* DSP2_MAGIC_NUM - [15:0] */ +#define WM8958_DSP2_MAGIC_NUM_SHIFT 0/* DSP2_MAGIC_NUM - [15:0] */ +#define WM8958_DSP2_MAGIC_NUM_WIDTH 16/* DSP2_MAGIC_NUM - [15:0] */ + +/* +* R2561 (0xA01) - DSP2_ReleaseYear +*/ +#define WM8958_DSP2_RELEASE_YEAR_MASK 0xFFFF/* DSP2_RELEASE_YEAR - [15:0] */ +#define WM8958_DSP2_RELEASE_YEAR_SHIFT 0/* DSP2_RELEASE_YEAR - [15:0] */ +#define WM8958_DSP2_RELEASE_YEAR_WIDTH 16/* DSP2_RELEASE_YEAR - [15:0] */ + +/* +* R2562 (0xA02) - DSP2_ReleaseMonthDay +*/ +#define WM8958_DSP2_RELEASE_MONTH_MASK 0xFF00/* DSP2_RELEASE_MONTH - [15:8] */ +#define WM8958_DSP2_RELEASE_MONTH_SHIFT 8/* DSP2_RELEASE_MONTH - [15:8] */ +#define WM8958_DSP2_RELEASE_MONTH_WIDTH 8/* DSP2_RELEASE_MONTH - [15:8] */ +#define WM8958_DSP2_RELEASE_DAY_MASK 0x00FF/* DSP2_RELEASE_DAY - [7:0] */ +#define WM8958_DSP2_RELEASE_DAY_SHIFT 0/* DSP2_RELEASE_DAY - [7:0] */ +#define WM8958_DSP2_RELEASE_DAY_WIDTH 8/* DSP2_RELEASE_DAY - [7:0] */ + +/* +* R2563 (0xA03) - DSP2_ReleaseTime +*/ +#define WM8958_DSP2_RELEASE_HOURS_MASK 0xFF00/* DSP2_RELEASE_HOURS - [15:8] */ +#define WM8958_DSP2_RELEASE_HOURS_SHIFT 8/* DSP2_RELEASE_HOURS - [15:8] */ +#define WM8958_DSP2_RELEASE_HOURS_WIDTH 8/* DSP2_RELEASE_HOURS - [15:8] */ +#define WM8958_DSP2_RELEASE_MINS_MASK 0x00FF/* DSP2_RELEASE_MINS - [7:0] */ +#define WM8958_DSP2_RELEASE_MINS_SHIFT 0/* DSP2_RELEASE_MINS - [7:0] */ +#define WM8958_DSP2_RELEASE_MINS_WIDTH 8/* DSP2_RELEASE_MINS - [7:0] */ + +/* +* R2564 (0xA04) - DSP2_VerMajMin +*/ +#define WM8958_DSP2_MAJOR_VER_MASK 0xFF00/* DSP2_MAJOR_VER - [15:8] */ +#define WM8958_DSP2_MAJOR_VER_SHIFT 8/* DSP2_MAJOR_VER - [15:8] */ +#define WM8958_DSP2_MAJOR_VER_WIDTH 8/* DSP2_MAJOR_VER - [15:8] */ +#define WM8958_DSP2_MINOR_VER_MASK 0x00FF/* DSP2_MINOR_VER - [7:0] */ +#define WM8958_DSP2_MINOR_VER_SHIFT 0/* DSP2_MINOR_VER - [7:0] */ +#define WM8958_DSP2_MINOR_VER_WIDTH 8/* DSP2_MINOR_VER - [7:0] */ + +/* +* R2565 (0xA05) - DSP2_VerBuild +*/ +#define WM8958_DSP2_BUILD_VER_MASK 0xFFFF/* DSP2_BUILD_VER - [15:0] */ +#define WM8958_DSP2_BUILD_VER_SHIFT 0/* DSP2_BUILD_VER - [15:0] */ +#define WM8958_DSP2_BUILD_VER_WIDTH 16/* DSP2_BUILD_VER - [15:0] */ + +/* +* R2573 (0xA0D) - DSP2_ExecControl +*/ +#define WM8958_DSP2_STOPC 0x0020/* DSP2_STOPC */ +#define WM8958_DSP2_STOPC_MASK 0x0020/* DSP2_STOPC */ +#define WM8958_DSP2_STOPC_SHIFT 5/* DSP2_STOPC */ +#define WM8958_DSP2_STOPC_WIDTH 1/* DSP2_STOPC */ +#define WM8958_DSP2_STOPS 0x0010/* DSP2_STOPS */ +#define WM8958_DSP2_STOPS_MASK 0x0010/* DSP2_STOPS */ +#define WM8958_DSP2_STOPS_SHIFT 4/* DSP2_STOPS */ +#define WM8958_DSP2_STOPS_WIDTH 1/* DSP2_STOPS */ +#define WM8958_DSP2_STOPI 0x0008/* DSP2_STOPI */ +#define WM8958_DSP2_STOPI_MASK 0x0008/* DSP2_STOPI */ +#define WM8958_DSP2_STOPI_SHIFT 3/* DSP2_STOPI */ +#define WM8958_DSP2_STOPI_WIDTH 1/* DSP2_STOPI */ +#define WM8958_DSP2_STOP 0x0004/* DSP2_STOP */ +#define WM8958_DSP2_STOP_MASK 0x0004/* DSP2_STOP */ +#define WM8958_DSP2_STOP_SHIFT 2/* DSP2_STOP */ +#define WM8958_DSP2_STOP_WIDTH 1/* DSP2_STOP */ +#define WM8958_DSP2_RUNR 0x0002/* DSP2_RUNR */ +#define WM8958_DSP2_RUNR_MASK 0x0002/* DSP2_RUNR */ +#define WM8958_DSP2_RUNR_SHIFT 1/* DSP2_RUNR */ +#define WM8958_DSP2_RUNR_WIDTH 1/* DSP2_RUNR */ +#define WM8958_DSP2_RUN 0x0001/* DSP2_RUN */ +#define WM8958_DSP2_RUN_MASK 0x0001/* DSP2_RUN */ +#define WM8958_DSP2_RUN_SHIFT 0/* DSP2_RUN */ +#define WM8958_DSP2_RUN_WIDTH 1/* DSP2_RUN */ +#endif
sound/soc/codecs/wm8994.c +186 -12
239 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 4/4 ASoC: Add WM8958 microphone detection support
In reply to Mark BrownThe WM8958 contains an advanced accessory detection feature which allows detection of up to seven different impedence levels on the microphone bias output, including detection of video outputs. Since some of the more involved accessory interfaces may involve noticable interactions with external components a simple detection scheme is provided by default with the option to provide custom handling of accessory detect.
--- include/linux/mfd/wm8994/registers.h | 43 ++++++++++ sound/soc/codecs/wm8994.c | 150 ++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm8994.h | 4 + 3 files changed, 197 insertions(+), 0 deletions(-)
include/linux/mfd/wm8994/registers.h +43 -0
@@ -70,6 +70,9 @@#define WM8994_DC_SERVO_4 0x57#define WM8994_DC_SERVO_READBACK 0x58#define WM8994_ANALOGUE_HP_1 0x60 +#define WM8958_MIC_DETECT_1 0xD0 +#define WM8958_MIC_DETECT_2 0xD1 +#define WM8958_MIC_DETECT_3 0xD2#define WM8994_CHIP_REVISION 0x100#define WM8994_CONTROL_INTERFACE 0x101#define WM8994_WRITE_SEQUENCER_CTRL_1 0x110
@@ -1971,6 +1974,46 @@#define WM8994_HPOUT1R_DLY_WIDTH 1/* HPOUT1R_DLY */ /* +* R208 (0xD0) - Mic Detect 1 +*/ +#define WM8958_MICD_BIAS_STARTTIME_MASK 0xF000/* MICD_BIAS_STARTTIME - [15:12] */ +#define WM8958_MICD_BIAS_STARTTIME_SHIFT 12/* MICD_BIAS_STARTTIME - [15:12] */ +#define WM8958_MICD_BIAS_STARTTIME_WIDTH 4/* MICD_BIAS_STARTTIME - [15:12] */ +#define WM8958_MICD_RATE_MASK 0x0F00/* MICD_RATE - [11:8] */ +#define WM8958_MICD_RATE_SHIFT 8/* MICD_RATE - [11:8] */ +#define WM8958_MICD_RATE_WIDTH 4/* MICD_RATE - [11:8] */ +#define WM8958_MICD_DBTIME 0x0002/* MICD_DBTIME */ +#define WM8958_MICD_DBTIME_MASK 0x0002/* MICD_DBTIME */ +#define WM8958_MICD_DBTIME_SHIFT 1/* MICD_DBTIME */ +#define WM8958_MICD_DBTIME_WIDTH 1/* MICD_DBTIME */ +#define WM8958_MICD_ENA 0x0001/* MICD_ENA */ +#define WM8958_MICD_ENA_MASK 0x0001/* MICD_ENA */ +#define WM8958_MICD_ENA_SHIFT 0/* MICD_ENA */ +#define WM8958_MICD_ENA_WIDTH 1/* MICD_ENA */ + +/* +* R209 (0xD1) - Mic Detect 2 +*/ +#define WM8958_MICD_LVL_SEL_MASK 0x00FF/* MICD_LVL_SEL - [7:0] */ +#define WM8958_MICD_LVL_SEL_SHIFT 0/* MICD_LVL_SEL - [7:0] */ +#define WM8958_MICD_LVL_SEL_WIDTH 8/* MICD_LVL_SEL - [7:0] */ + +/* +* R210 (0xD2) - Mic Detect 3 +*/ +#define WM8958_MICD_LVL_MASK 0x07FC/* MICD_LVL - [10:2] */ +#define WM8958_MICD_LVL_SHIFT 2/* MICD_LVL - [10:2] */ +#define WM8958_MICD_LVL_WIDTH 9/* MICD_LVL - [10:2] */ +#define WM8958_MICD_VALID 0x0002/* MICD_VALID */ +#define WM8958_MICD_VALID_MASK 0x0002/* MICD_VALID */ +#define WM8958_MICD_VALID_SHIFT 1/* MICD_VALID */ +#define WM8958_MICD_VALID_WIDTH 1/* MICD_VALID */ +#define WM8958_MICD_STS 0x0001/* MICD_STS */ +#define WM8958_MICD_STS_MASK 0x0001/* MICD_STS */ +#define WM8958_MICD_STS_SHIFT 0/* MICD_STS */ +#define WM8958_MICD_STS_WIDTH 1/* MICD_STS */ + +/* * R256 (0x100) - Chip Revision */ #define WM8994_CHIP_REV_MASK 0x000F/* CHIP_REV - [3:0] */
sound/soc/codecs/wm8994.c +150 -0
186 lines not on this page · raw message
sound/soc/codecs/wm8994.h +4 -0
@@ -28,8 +28,12 @@#define WM8994_FLL_SRC_LRCLK 3#define WM8994_FLL_SRC_BCLK 4 +typedef void (*wm8958_micdet_cb )(u16 status,void *data); +int wm8994_mic_detect (struct snd_soc_codec *codec,struct snd_soc_jack *jack,int micbias,int det,int shrt); +int wm8958_mic_detect (struct snd_soc_codec *codec,struct snd_soc_jack *jack, +wm8958_micdet_cb cb,void *cb_data);#define WM8994_CACHE_SIZE 1570
Signature · 1 line
1.7.1
Quoted 6 lines · Mark Brown
The WM8958 is a WM8994 derivative. This patch merely ensures that some revision specific configuration for WM8994 is not enabled on WM8994, additional patches will add support for the new features introduced on the WM8958.
Signed-off-by Mark Brown <[email protected]>
All
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk