From 53e3030b4ba10ef50bbae2c7bd344fcb10539299 Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Mon, 9 Jun 2014 11:31:43 +0800 Subject: ASoC: atmel_wm8904: switch to CCF Signed-off-by: Bo Shen Signed-off-by: Mark Brown diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c index b4e3690..4052268 100644 --- a/sound/soc/atmel/atmel_wm8904.c +++ b/sound/soc/atmel/atmel_wm8904.c @@ -18,10 +18,6 @@ #include "../codecs/wm8904.h" #include "atmel_ssc_dai.h" -#define MCLK_RATE 32768 - -static struct clk *mclk; - static const struct snd_soc_dapm_widget atmel_asoc_wm8904_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Mic", NULL), @@ -61,26 +57,6 @@ static struct snd_soc_ops atmel_asoc_wm8904_ops = { .hw_params = atmel_asoc_wm8904_hw_params, }; -static int atmel_set_bias_level(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, - enum snd_soc_bias_level level) -{ - if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { - switch (level) { - case SND_SOC_BIAS_PREPARE: - clk_prepare_enable(mclk); - break; - case SND_SOC_BIAS_OFF: - clk_disable_unprepare(mclk); - break; - default: - break; - } - } - - return 0; -}; - static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = { .name = "WM8904", .stream_name = "WM8904 PCM", @@ -94,7 +70,6 @@ static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = { static struct snd_soc_card atmel_asoc_wm8904_card = { .name = "atmel_asoc_wm8904", .owner = THIS_MODULE, - .set_bias_level = atmel_set_bias_level, .dai_link = &atmel_asoc_wm8904_dailink, .num_links = 1, .dapm_widgets = atmel_asoc_wm8904_dapm_widgets, @@ -153,7 +128,6 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev) { struct snd_soc_card *card = &atmel_asoc_wm8904_card; struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink; - struct clk *clk_src; int id, ret; card->dev = &pdev->dev; @@ -170,30 +144,6 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev) return ret; } - mclk = clk_get(NULL, "pck0"); - if (IS_ERR(mclk)) { - dev_err(&pdev->dev, "failed to get pck0\n"); - ret = PTR_ERR(mclk); - goto err_set_audio; - } - - clk_src = clk_get(NULL, "clk32k"); - if (IS_ERR(clk_src)) { - dev_err(&pdev->dev, "failed to get clk32k\n"); - ret = PTR_ERR(clk_src); - goto err_set_audio; - } - - ret = clk_set_parent(mclk, clk_src); - clk_put(clk_src); - if (ret != 0) { - dev_err(&pdev->dev, "failed to set MCLK parent\n"); - goto err_set_audio; - } - - dev_info(&pdev->dev, "setting pck0 to %dHz\n", MCLK_RATE); - clk_set_rate(mclk, MCLK_RATE); - ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed\n"); -- cgit v0.10.2 From c4027faf1dcfc325663464b3f97847358b172c0b Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Wed, 11 Jun 2014 18:14:39 +0800 Subject: ASoC: atmel-ssc: distinguish whether SSC supports fslen ext Add compatible string to distinguish whether SSC supports frame sync length extension. Signed-off-by: Bo Shen Acked-by: Nicolas Ferre Signed-off-by: Mark Brown diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 22de137..60843a2 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -83,10 +83,17 @@ EXPORT_SYMBOL(ssc_free); static struct atmel_ssc_platform_data at91rm9200_config = { .use_dma = 0, + .has_fslen_ext = 0, +}; + +static struct atmel_ssc_platform_data at91sam9rl_config = { + .use_dma = 0, + .has_fslen_ext = 1, }; static struct atmel_ssc_platform_data at91sam9g45_config = { .use_dma = 1, + .has_fslen_ext = 1, }; static const struct platform_device_id atmel_ssc_devtypes[] = { @@ -94,6 +101,9 @@ static const struct platform_device_id atmel_ssc_devtypes[] = { .name = "at91rm9200_ssc", .driver_data = (unsigned long) &at91rm9200_config, }, { + .name = "at91sam9rl_ssc", + .driver_data = (unsigned long) &at91sam9rl_config, + }, { .name = "at91sam9g45_ssc", .driver_data = (unsigned long) &at91sam9g45_config, }, { @@ -107,6 +117,9 @@ static const struct of_device_id atmel_ssc_dt_ids[] = { .compatible = "atmel,at91rm9200-ssc", .data = &at91rm9200_config, }, { + .compatible = "atmel,at91sam9rl-ssc", + .data = &at91sam9rl_config, + }, { .compatible = "atmel,at91sam9g45-ssc", .data = &at91sam9g45_config, }, { diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index 571a12e..e8dd408 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h @@ -7,6 +7,7 @@ struct atmel_ssc_platform_data { int use_dma; + int has_fslen_ext; }; struct ssc_device { -- cgit v0.10.2 From dfaf535665faa4b5aba4b59633f6b724a467c96e Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Wed, 11 Jun 2014 18:14:40 +0800 Subject: ASoC: atmel_ssc_dai: enable fslen extension feature When SSC work as master, it will generate the frame sync signal. On old SoCs, it only supports frame sync length less or equal to 16bits, on newer SoCs, it supports frame sync length extension, which can support frame size larger than 16 bits. So, add this to make it supports playback 24/32 bits audio clips. Signed-off-by: Bo Shen Acked-by: Nicolas Ferre Signed-off-by: Mark Brown diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index e8dd408..7c0f654 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h @@ -72,6 +72,12 @@ void ssc_free(struct ssc_device *ssc); #define SSC_RFMR_DATNB_OFFSET 8 #define SSC_RFMR_FSEDGE_SIZE 1 #define SSC_RFMR_FSEDGE_OFFSET 24 +/* + * The FSLEN_EXT exist on at91sam9rl, at91sam9g10, + * at91sam9g20, and at91sam9g45 and newer SoCs + */ +#define SSC_RFMR_FSLEN_EXT_SIZE 4 +#define SSC_RFMR_FSLEN_EXT_OFFSET 28 #define SSC_RFMR_FSLEN_SIZE 4 #define SSC_RFMR_FSLEN_OFFSET 16 #define SSC_RFMR_FSOS_SIZE 4 @@ -110,6 +116,12 @@ void ssc_free(struct ssc_device *ssc); #define SSC_TFMR_FSDEN_OFFSET 23 #define SSC_TFMR_FSEDGE_SIZE 1 #define SSC_TFMR_FSEDGE_OFFSET 24 +/* + * The FSLEN_EXT exist on at91sam9rl, at91sam9g10, + * at91sam9g20, and at91sam9g45 and newer SoCs + */ +#define SSC_TFMR_FSLEN_EXT_SIZE 4 +#define SSC_TFMR_FSLEN_EXT_OFFSET 28 #define SSC_TFMR_FSLEN_SIZE 4 #define SSC_TFMR_FSLEN_OFFSET 16 #define SSC_TFMR_FSOS_SIZE 3 diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index de433cfd..f403f39 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -347,6 +347,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, u32 tfmr, rfmr, tcmr, rcmr; int start_event; int ret; + int fslen, fslen_ext; /* * Currently, there is only one set of dma params for @@ -388,18 +389,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, } /* - * The SSC only supports up to 16-bit samples in I2S format, due - * to the size of the Frame Mode Register FSLEN field. - */ - if ((ssc_p->daifmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S - && bits > 16) { - printk(KERN_WARNING - "atmel_ssc_dai: sample size %d " - "is too large for I2S\n", bits); - return -EINVAL; - } - - /* * Compute SSC register settings. */ switch (ssc_p->daifmt @@ -413,6 +402,17 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, * from the MCK divider, and the BCLK signal * is output on the SSC TK line. */ + + if (bits > 16 && !ssc->pdata->has_fslen_ext) { + dev_err(dai->dev, + "sample size %d is too large for SSC device\n", + bits); + return -EINVAL; + } + + fslen_ext = (bits - 1) / 16; + fslen = (bits - 1) % 16; + rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) | SSC_BF(RCMR_STTDLY, START_DELAY) | SSC_BF(RCMR_START, SSC_START_FALLING_RF) @@ -420,9 +420,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | SSC_BF(RCMR_CKS, SSC_CKS_DIV); - rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) + rfmr = SSC_BF(RFMR_FSLEN_EXT, fslen_ext) + | SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | SSC_BF(RFMR_FSOS, SSC_FSOS_NEGATIVE) - | SSC_BF(RFMR_FSLEN, (bits - 1)) + | SSC_BF(RFMR_FSLEN, fslen) | SSC_BF(RFMR_DATNB, (channels - 1)) | SSC_BIT(RFMR_MSBF) | SSC_BF(RFMR_LOOP, 0) @@ -435,10 +436,11 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | SSC_BF(TCMR_CKO, SSC_CKO_CONTINUOUS) | SSC_BF(TCMR_CKS, SSC_CKS_DIV); - tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) + tfmr = SSC_BF(TFMR_FSLEN_EXT, fslen_ext) + | SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | SSC_BF(TFMR_FSDEN, 0) | SSC_BF(TFMR_FSOS, SSC_FSOS_NEGATIVE) - | SSC_BF(TFMR_FSLEN, (bits - 1)) + | SSC_BF(TFMR_FSLEN, fslen) | SSC_BF(TFMR_DATNB, (channels - 1)) | SSC_BIT(TFMR_MSBF) | SSC_BF(TFMR_DATDEF, 0) -- cgit v0.10.2 From bb17bc78885b6b2e53d46041605a7ed08c5274c2 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 1 Jul 2014 09:59:31 +0530 Subject: ASoC: twl4030: Remove unused variable 'status' is not used in the function. Remove it. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 69e12a3..6ab1570 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -344,17 +344,16 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable) { struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); - int status = -1; if (enable) { twl4030->apll_enabled++; if (twl4030->apll_enabled == 1) - status = twl4030_audio_enable_resource( + twl4030_audio_enable_resource( TWL4030_AUDIO_RES_APLL); } else { twl4030->apll_enabled--; if (!twl4030->apll_enabled) - status = twl4030_audio_disable_resource( + twl4030_audio_disable_resource( TWL4030_AUDIO_RES_APLL); } } -- cgit v0.10.2 From d1498b13ae8cdd0353a405089609825d306b8036 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 1 Jul 2014 09:59:32 +0530 Subject: ASoC: wm8350: Remove unused variable 'irq' is not used in the function. Remove it. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 392285e..d9e634c 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1341,21 +1341,18 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, { struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); struct wm8350 *wm8350 = priv->wm8350; - int irq; int ena; switch (which) { case WM8350_JDL: priv->hpl.jack = jack; priv->hpl.report = report; - irq = WM8350_IRQ_CODEC_JCK_DET_L; ena = WM8350_JDL_ENA; break; case WM8350_JDR: priv->hpr.jack = jack; priv->hpr.report = report; - irq = WM8350_IRQ_CODEC_JCK_DET_R; ena = WM8350_JDR_ENA; break; -- cgit v0.10.2 From 63d36f8814e2837fe8658542bc724659b152324d Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 1 Jul 2014 09:59:33 +0530 Subject: ASoC: wm8996: Remove unused variable 'ret' is not used in the function. Remove it. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 6926633..622f925 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -620,15 +620,12 @@ static int bg_event(struct snd_soc_dapm_widget *w, static int cp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - int ret = 0; - switch (event) { case SND_SOC_DAPM_POST_PMU: msleep(5); break; default: WARN(1, "Invalid event %d\n", event); - ret = -EINVAL; } return 0; -- cgit v0.10.2 From a046558719770f94d8660f77654ce9cc712ffe54 Mon Sep 17 00:00:00 2001 From: Brian Austin Date: Thu, 17 Jul 2014 13:16:55 -0500 Subject: ASoC: Fix SOC_DOUBLE_R_SX_TLV volume mixer arguments Remove unnecessary bit shifts. Correct min value to match datasheet. Num steps = number of steps between min and max. Reported-by: Ryan Harvey Signed-off-by: Ryan Harvey Signed-off-by: Brian Austin Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 071fc77..969167d 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -399,15 +399,15 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { CS42L52_MASTERB_VOL, 0, 0x34, 0xE4, hl_tlv), SOC_DOUBLE_R_SX_TLV("Headphone Volume", CS42L52_HPA_VOL, - CS42L52_HPB_VOL, 0, 0x34, 0xCC, hpd_tlv), + CS42L52_HPB_VOL, 0, 0x34, 0xC0, hpd_tlv), SOC_ENUM("Headphone Analog Gain", hp_gain_enum), SOC_DOUBLE_R_SX_TLV("Speaker Volume", CS42L52_SPKA_VOL, - CS42L52_SPKB_VOL, 0, 0x1, 0xff, hl_tlv), + CS42L52_SPKB_VOL, 0, 0x40, 0xC0, hl_tlv), SOC_DOUBLE_R_SX_TLV("Bypass Volume", CS42L52_PASSTHRUA_VOL, - CS42L52_PASSTHRUB_VOL, 6, 0x18, 0x90, pga_tlv), + CS42L52_PASSTHRUB_VOL, 0, 0x88, 0x90, pga_tlv), SOC_DOUBLE("Bypass Mute", CS42L52_MISC_CTL, 4, 5, 1, 0), @@ -417,10 +417,10 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { SOC_ENUM("MIC Bias Level", mic_bias_level_enum), SOC_DOUBLE_R_SX_TLV("ADC Volume", CS42L52_ADCA_VOL, - CS42L52_ADCB_VOL, 7, 0x80, 0xA0, ipd_tlv), + CS42L52_ADCB_VOL, 0, 0xA0, 0x78, ipd_tlv), SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume", CS42L52_ADCA_MIXER_VOL, CS42L52_ADCB_MIXER_VOL, - 6, 0x7f, 0x19, ipd_tlv), + 0, 0x19, 0x7F, ipd_tlv), SOC_DOUBLE("ADC Switch", CS42L52_ADC_MISC_CTL, 0, 1, 1, 0), @@ -428,11 +428,11 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { CS42L52_ADCB_MIXER_VOL, 7, 1, 1), SOC_DOUBLE_R_SX_TLV("PGA Volume", CS42L52_PGAA_CTL, - CS42L52_PGAB_CTL, 0, 0x28, 0x30, pga_tlv), + CS42L52_PGAB_CTL, 0, 0x28, 0x24, pga_tlv), SOC_DOUBLE_R_SX_TLV("PCM Mixer Volume", CS42L52_PCMA_MIXER_VOL, CS42L52_PCMB_MIXER_VOL, - 0, 0x7f, 0x19, mix_tlv), + 0, 0x19, 0x7f, mix_tlv), SOC_DOUBLE_R("PCM Mixer Switch", CS42L52_PCMA_MIXER_VOL, CS42L52_PCMB_MIXER_VOL, 7, 1, 1), diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index 8e68ef5..24fbffe 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c @@ -421,15 +421,15 @@ static const struct soc_enum ng_delay_enum = static const struct snd_kcontrol_new cs42l56_snd_controls[] = { SOC_DOUBLE_R_SX_TLV("Master Volume", CS42L56_MASTER_A_VOLUME, - CS42L56_MASTER_B_VOLUME, 0, 0x34, 0xfd, adv_tlv), + CS42L56_MASTER_B_VOLUME, 0, 0x34, 0xE4, adv_tlv), SOC_DOUBLE("Master Mute Switch", CS42L56_DSP_MUTE_CTL, 0, 1, 1, 1), SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume", CS42L56_ADCA_MIX_VOLUME, - CS42L56_ADCB_MIX_VOLUME, 0, 0x88, 0xa9, hl_tlv), + CS42L56_ADCB_MIX_VOLUME, 0, 0x88, 0x90, hl_tlv), SOC_DOUBLE("ADC Mixer Mute Switch", CS42L56_DSP_MUTE_CTL, 6, 7, 1, 1), SOC_DOUBLE_R_SX_TLV("PCM Mixer Volume", CS42L56_PCMA_MIX_VOLUME, - CS42L56_PCMB_MIX_VOLUME, 0, 0x88, 0xa9, hl_tlv), + CS42L56_PCMB_MIX_VOLUME, 0, 0x88, 0x90, hl_tlv), SOC_DOUBLE("PCM Mixer Mute Switch", CS42L56_DSP_MUTE_CTL, 4, 5, 1, 1), SOC_SINGLE_TLV("Analog Advisory Volume", @@ -438,16 +438,16 @@ static const struct snd_kcontrol_new cs42l56_snd_controls[] = { CS42L56_DIGINPUT_ADV_VOLUME, 0, 0x00, 1, adv_tlv), SOC_DOUBLE_R_SX_TLV("PGA Volume", CS42L56_PGAA_MUX_VOLUME, - CS42L56_PGAB_MUX_VOLUME, 0, 0x34, 0xfd, pga_tlv), + CS42L56_PGAB_MUX_VOLUME, 0, 0x34, 0x24, pga_tlv), SOC_DOUBLE_R_TLV("ADC Volume", CS42L56_ADCA_ATTENUATOR, CS42L56_ADCB_ATTENUATOR, 0, 0x00, 1, adc_tlv), SOC_DOUBLE("ADC Mute Switch", CS42L56_MISC_ADC_CTL, 2, 3, 1, 1), SOC_DOUBLE("ADC Boost Switch", CS42L56_GAIN_BIAS_CTL, 3, 2, 1, 1), SOC_DOUBLE_R_SX_TLV("Headphone Volume", CS42L56_HPA_VOLUME, - CS42L56_HPB_VOLUME, 0, 0x44, 0x55, hl_tlv), + CS42L56_HPB_VOLUME, 0, 0x84, 0x48, hl_tlv), SOC_DOUBLE_R_SX_TLV("LineOut Volume", CS42L56_LOA_VOLUME, - CS42L56_LOB_VOLUME, 0, 0x44, 0x55, hl_tlv), + CS42L56_LOB_VOLUME, 0, 0x84, 0x48, hl_tlv), SOC_SINGLE_TLV("Bass Shelving Volume", CS42L56_TONE_CTL, 0, 0x00, 1, tone_tlv), diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index ae37179..8658194 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -401,7 +401,7 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = { CS42L73_LOBAVOL, 0, 0x41, 0x4B, hpaloa_tlv), SOC_DOUBLE_R_SX_TLV("Input PGA Analog Volume", CS42L73_MICAPREPGAAVOL, - CS42L73_MICBPREPGABVOL, 5, 0x34, + CS42L73_MICBPREPGABVOL, 0, 0x34, 0x24, micpga_tlv), SOC_DOUBLE_R("MIC Preamp Switch", CS42L73_MICAPREPGAAVOL, -- cgit v0.10.2