Merge branches 'topic/dmic' and 'topic/qcom' of git://git.kernel.org/pub/scm/linux...
authorMark Brown <broonie@kernel.org>
Mon, 21 Aug 2017 18:31:51 +0000 (19:31 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 21 Aug 2017 18:31:51 +0000 (19:31 +0100)
sound/soc/codecs/msm8916-wcd-analog.c
sound/soc/codecs/msm8916-wcd-digital.c
sound/soc/qcom/apq8016_sbc.c
sound/soc/qcom/lpass-platform.c
sound/soc/qcom/storm.c

index 4cc52cecf3b705815c7ac36bf13ad1d522a809d9..1454f54f097708c9a475dd8d351e3e36694a16a2 100644 (file)
@@ -536,6 +536,9 @@ static int pm8916_wcd_analog_probe(struct snd_soc_codec *codec)
                snd_soc_write(codec, wcd_reg_defaults_2_0[reg].reg,
                              wcd_reg_defaults_2_0[reg].def);
 
+       snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL,
+                           RST_CTL_DIG_SW_RST_N_MASK,
+                           RST_CTL_DIG_SW_RST_N_REMOVE_RESET);
        return 0;
 }
 
@@ -543,6 +546,9 @@ static int pm8916_wcd_analog_remove(struct snd_soc_codec *codec)
 {
        struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(codec->dev);
 
+       snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL,
+                           RST_CTL_DIG_SW_RST_N_MASK, 0);
+
        return regulator_bulk_disable(ARRAY_SIZE(priv->supplies),
                                      priv->supplies);
 }
@@ -736,28 +742,6 @@ static struct regmap *pm8916_get_regmap(struct device *dev)
        return dev_get_regmap(dev->parent, NULL);
 }
 
-static int pm8916_wcd_analog_startup(struct snd_pcm_substream *substream,
-                                     struct snd_soc_dai *dai)
-{
-       snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL,
-                           RST_CTL_DIG_SW_RST_N_MASK,
-                           RST_CTL_DIG_SW_RST_N_REMOVE_RESET);
-
-       return 0;
-}
-
-static void pm8916_wcd_analog_shutdown(struct snd_pcm_substream *substream,
-                                        struct snd_soc_dai *dai)
-{
-       snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL,
-                           RST_CTL_DIG_SW_RST_N_MASK, 0);
-}
-
-static struct snd_soc_dai_ops pm8916_wcd_analog_dai_ops = {
-       .startup = pm8916_wcd_analog_startup,
-       .shutdown = pm8916_wcd_analog_shutdown,
-};
-
 static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
        [0] = {
               .name = "pm8916_wcd_analog_pdm_rx",
@@ -769,7 +753,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
                            .channels_min = 1,
                            .channels_max = 3,
                            },
-              .ops = &pm8916_wcd_analog_dai_ops,
               },
        [1] = {
               .name = "pm8916_wcd_analog_pdm_tx",
@@ -781,7 +764,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
                           .channels_min = 1,
                           .channels_max = 4,
                           },
-              .ops = &pm8916_wcd_analog_dai_ops,
               },
 };
 
index 43a915c725a0ae7defe358204059f8510e460da7..66df8f810f0d740772a62d965466358012d91d4f 100644 (file)
@@ -218,6 +218,8 @@ static const char *const rx_mix1_text[] = {
 static const char *const dec_mux_text[] = {
        "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
 };
+
+static const char *const cic_mux_text[] = { "AMIC", "DMIC" };
 static const char *const rx_mix2_text[] = { "ZERO", "IIR1", "IIR2" };
 static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" };
 
@@ -256,11 +258,21 @@ static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
 static const struct soc_enum dec2_mux_enum = SOC_ENUM_SINGLE(
                                LPASS_CDC_CONN_TX_B1_CTL, 3, 6, dec_mux_text);
 
+/* CIC */
+static const struct soc_enum cic1_mux_enum = SOC_ENUM_SINGLE(
+                               LPASS_CDC_TX1_MUX_CTL, 0, 2, cic_mux_text);
+static const struct soc_enum cic2_mux_enum = SOC_ENUM_SINGLE(
+                               LPASS_CDC_TX2_MUX_CTL, 0, 2, cic_mux_text);
+
 /* RDAC2 MUX */
 static const struct snd_kcontrol_new dec1_mux = SOC_DAPM_ENUM(
                                "DEC1 MUX Mux", dec1_mux_enum);
 static const struct snd_kcontrol_new dec2_mux = SOC_DAPM_ENUM(
                                "DEC2 MUX Mux", dec2_mux_enum);
+static const struct snd_kcontrol_new cic1_mux = SOC_DAPM_ENUM(
+                               "CIC1 MUX Mux", cic1_mux_enum);
+static const struct snd_kcontrol_new cic2_mux = SOC_DAPM_ENUM(
+                               "CIC2 MUX Mux", cic2_mux_enum);
 static const struct snd_kcontrol_new rx_mix1_inp1_mux = SOC_DAPM_ENUM(
                                "RX1 MIX1 INP1 Mux", rx_mix1_inp_enum[0]);
 static const struct snd_kcontrol_new rx_mix1_inp2_mux = SOC_DAPM_ENUM(
@@ -500,6 +512,8 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
        SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
                         &rx3_mix1_inp3_mux),
 
+       SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
+       SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
        /* TX */
        SND_SOC_DAPM_MIXER("ADC1", SND_SOC_NOPM, 0, 0, NULL, 0),
        SND_SOC_DAPM_MIXER("ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -536,6 +550,8 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
        /* Connectivity Clock */
        SND_SOC_DAPM_SUPPLY_S("CDC_CONN", -2, LPASS_CDC_CLK_OTHR_CTL, 2, 0,
                              NULL, 0),
+       SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+       SND_SOC_DAPM_MIC("Digital Mic2", NULL),
 
 };
 
@@ -655,6 +671,11 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = {
        {"AIF1 Capture", NULL, "I2S TX2"},
        {"AIF1 Capture", NULL, "I2S TX3"},
 
+       {"CIC1 MUX", "DMIC", "DEC1 MUX"},
+       {"CIC1 MUX", "AMIC", "DEC1 MUX"},
+       {"CIC2 MUX", "DMIC", "DEC2 MUX"},
+       {"CIC2 MUX", "AMIC", "DEC2 MUX"},
+
        /* Decimator Inputs */
        {"DEC1 MUX", "DMIC1", "DMIC1"},
        {"DEC1 MUX", "DMIC2", "DMIC2"},
@@ -673,8 +694,8 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = {
        {"DMIC1", NULL, "DMIC_CLK"},
        {"DMIC2", NULL, "DMIC_CLK"},
 
-       {"I2S TX1", NULL, "DEC1 MUX"},
-       {"I2S TX2", NULL, "DEC2 MUX"},
+       {"I2S TX1", NULL, "CIC1 MUX"},
+       {"I2S TX2", NULL, "CIC2 MUX"},
 
        {"I2S TX1", NULL, "TX_I2S_CLK"},
        {"I2S TX2", NULL, "TX_I2S_CLK"},
index d084d746829988f5e76c3131e894e3e74e1ff786..96a079d9f6979cc87eacaa66c1d0176eefc1edf4 100644 (file)
@@ -34,13 +34,16 @@ struct apq8016_sbc_data {
 #define MIC_CTRL_QUA_WS_SLAVE_SEL_10   BIT(17)
 #define MIC_CTRL_TLMM_SCLK_EN          BIT(1)
 #define        SPKR_CTL_PRI_WS_SLAVE_SEL_11    (BIT(17) | BIT(16))
+#define DEFAULT_MCLK_RATE              9600000
 
 static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+       struct snd_soc_codec *codec;
+       struct snd_soc_dai_link *dai_link = rtd->dai_link;
        struct snd_soc_card *card = rtd->card;
        struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card);
-       int rval = 0;
+       int i, rval;
 
        switch (cpu_dai->id) {
        case MI2S_PRIMARY:
@@ -63,12 +66,24 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 
        default:
                dev_err(card->dev, "unsupported cpu dai configuration\n");
-               rval = -EINVAL;
-               break;
+               return -EINVAL;
+
+       }
 
+       for (i = 0 ; i < dai_link->num_codecs; i++) {
+               struct snd_soc_dai *dai = rtd->codec_dais[i];
+
+               codec = dai->codec;
+               /* Set default mclk for internal codec */
+               rval = snd_soc_codec_set_sysclk(codec, 0, 0, DEFAULT_MCLK_RATE,
+                                      SND_SOC_CLOCK_IN);
+               if (rval != 0 && rval != -ENOTSUPP) {
+                       dev_warn(card->dev, "Failed to set mclk: %d\n", rval);
+                       return rval;
+               }
        }
 
-       return rval;
+       return 0;
 }
 
 static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
@@ -191,7 +206,6 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev)
        if (IS_ERR(data->spkr_iomux))
                return PTR_ERR(data->spkr_iomux);
 
-       platform_set_drvdata(pdev, data);
        snd_soc_card_set_drvdata(card, data);
 
        return devm_snd_soc_register_card(&pdev->dev, card);
index 7aabf08de3d4aeca35bc9e2b2a8297eb814d3c1d..e1945e1772cda976a1a9c689c5f36c750e5a3ff2 100644 (file)
@@ -32,7 +32,7 @@ struct lpass_pcm_data {
 #define LPASS_PLATFORM_BUFFER_SIZE     (16 * 1024)
 #define LPASS_PLATFORM_PERIODS         2
 
-static struct snd_pcm_hardware lpass_platform_pcm_hardware = {
+static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
        .info                   =       SNDRV_PCM_INFO_MMAP |
                                        SNDRV_PCM_INFO_MMAP_VALID |
                                        SNDRV_PCM_INFO_INTERLEAVED |
@@ -557,7 +557,7 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm)
        }
 }
 
-static struct snd_soc_platform_driver lpass_platform_driver = {
+static const struct snd_soc_platform_driver lpass_platform_driver = {
        .pcm_new        = lpass_platform_pcm_new,
        .pcm_free       = lpass_platform_pcm_free,
        .ops            = &lpass_platform_pcm_ops,
index c5207af1410485f32e664c2c640f1411683fcd9e..a9fa972466ad155fd4b681bdb530bd953b13e55a 100644 (file)
@@ -99,7 +99,6 @@ static int storm_platform_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        card->dev = &pdev->dev;
-       platform_set_drvdata(pdev, card);
 
        ret = snd_soc_of_parse_card_name(card, "qcom,model");
        if (ret) {