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)
122 files changed:
Documentation/devicetree/bindings/sound/dmic.txt [new file with mode: 0644]
Documentation/devicetree/bindings/sound/rt274.txt [new file with mode: 0644]
sound/soc/codecs/88pm860x-codec.c
sound/soc/codecs/Kconfig
sound/soc/codecs/Makefile
sound/soc/codecs/ab8500-codec.c
sound/soc/codecs/ac97.c
sound/soc/codecs/ad1836.c
sound/soc/codecs/ad193x.c
sound/soc/codecs/ad1980.c
sound/soc/codecs/ad73311.c
sound/soc/codecs/adau1373.c
sound/soc/codecs/adau1701.c
sound/soc/codecs/adau1977.c
sound/soc/codecs/adav80x.c
sound/soc/codecs/ads117x.c
sound/soc/codecs/ak4104.c
sound/soc/codecs/ak4535.c
sound/soc/codecs/ak4554.c
sound/soc/codecs/ak4613.c
sound/soc/codecs/ak4641.c
sound/soc/codecs/ak4642.c
sound/soc/codecs/ak4671.c
sound/soc/codecs/ak5386.c
sound/soc/codecs/alc5623.c
sound/soc/codecs/bt-sco.c
sound/soc/codecs/cq93vc.c
sound/soc/codecs/cs35l33.c
sound/soc/codecs/cs35l34.c
sound/soc/codecs/cs35l35.c
sound/soc/codecs/cs4271.c
sound/soc/codecs/cs42l51.c
sound/soc/codecs/cs4349.c
sound/soc/codecs/cs47l24.c
sound/soc/codecs/cs53l30.c
sound/soc/codecs/cx20442.c
sound/soc/codecs/da7210.c
sound/soc/codecs/da7213.c
sound/soc/codecs/da7218.c
sound/soc/codecs/da7219.c
sound/soc/codecs/da732x.c
sound/soc/codecs/da9055.c
sound/soc/codecs/dmic.c
sound/soc/codecs/es7134.c
sound/soc/codecs/es8316.c
sound/soc/codecs/es8328.c
sound/soc/codecs/hdac_hdmi.c
sound/soc/codecs/hdmi-codec.c
sound/soc/codecs/ics43432.c
sound/soc/codecs/inno_rk3036.c
sound/soc/codecs/isabelle.c
sound/soc/codecs/jz4740.c
sound/soc/codecs/lm4857.c
sound/soc/codecs/lm49453.c
sound/soc/codecs/max9768.c
sound/soc/codecs/max98088.c
sound/soc/codecs/max98090.c
sound/soc/codecs/max98095.c
sound/soc/codecs/max98357a.c
sound/soc/codecs/max9850.c
sound/soc/codecs/max9860.c
sound/soc/codecs/max9867.c
sound/soc/codecs/max98926.c
sound/soc/codecs/mc13783.c
sound/soc/codecs/ml26124.c
sound/soc/codecs/msm8916-wcd-analog.c
sound/soc/codecs/msm8916-wcd-digital.c
sound/soc/codecs/nau8540.c
sound/soc/codecs/nau8810.c
sound/soc/codecs/nau8824.c
sound/soc/codecs/nau8825.c
sound/soc/codecs/pcm1681.c
sound/soc/codecs/pcm179x.c
sound/soc/codecs/pcm3008.c
sound/soc/codecs/pcm512x.c
sound/soc/codecs/rt274.c [new file with mode: 0644]
sound/soc/codecs/rt274.h [new file with mode: 0644]
sound/soc/codecs/rt286.c
sound/soc/codecs/rt298.c
sound/soc/codecs/rt5514-spi.c
sound/soc/codecs/rt5514.c
sound/soc/codecs/rt5616.c
sound/soc/codecs/rt5631.c
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5645.c
sound/soc/codecs/rt5651.c
sound/soc/codecs/rt5659.c
sound/soc/codecs/rt5660.c
sound/soc/codecs/rt5663.c
sound/soc/codecs/rt5665.c
sound/soc/codecs/rt5670.c
sound/soc/codecs/rt5677.c
sound/soc/codecs/sgtl5000.c
sound/soc/codecs/si476x.c
sound/soc/codecs/sirf-audio-codec.c
sound/soc/codecs/sn95031.c
sound/soc/codecs/spdif_receiver.c
sound/soc/codecs/spdif_transmitter.c
sound/soc/codecs/ssm2518.c
sound/soc/codecs/ssm2602.c
sound/soc/codecs/ssm4567.c
sound/soc/codecs/stac9766.c
sound/soc/codecs/tas2552.c
sound/soc/codecs/tas5086.c
sound/soc/codecs/tas5720.c
sound/soc/codecs/tlv320aic23.c
sound/soc/codecs/tlv320aic26.c
sound/soc/codecs/tlv320aic31xx.c
sound/soc/codecs/tlv320aic32x4.c
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/tlv320dac33.c
sound/soc/codecs/twl4030.c
sound/soc/codecs/twl6040.c
sound/soc/codecs/uda134x.c
sound/soc/codecs/uda1380.c
sound/soc/codecs/wl1273.c
sound/soc/codecs/wm5102.c
sound/soc/codecs/wm5110.c
sound/soc/codecs/zx_aud96p22.c
sound/soc/qcom/apq8016_sbc.c
sound/soc/qcom/lpass-platform.c
sound/soc/qcom/storm.c

diff --git a/Documentation/devicetree/bindings/sound/dmic.txt b/Documentation/devicetree/bindings/sound/dmic.txt
new file mode 100644 (file)
index 0000000..54c8ef6
--- /dev/null
@@ -0,0 +1,16 @@
+Device-Tree bindings for Digital microphone (DMIC) codec
+
+This device support generic PDM digital microphone.
+
+Required properties:
+       - compatible: should be "dmic-codec".
+
+Optional properties:
+       - dmicen-gpios: GPIO specifier for dmic to control start and stop
+
+Example node:
+
+       dmic_codec: dmic@0 {
+               compatible = "dmic-codec";
+               dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
+       };
diff --git a/Documentation/devicetree/bindings/sound/rt274.txt b/Documentation/devicetree/bindings/sound/rt274.txt
new file mode 100644 (file)
index 0000000..e9a6178
--- /dev/null
@@ -0,0 +1,33 @@
+RT274 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+- compatible : "realtek,rt274".
+
+- reg : The I2C address of the device.
+
+Optional properties:
+
+- interrupts : The CODEC's interrupt output.
+
+
+Pins on the device (for linking into audio routes) for RT274:
+
+  * DMIC1 Pin
+  * DMIC2 Pin
+  * MIC
+  * LINE1
+  * LINE2
+  * HPO Pin
+  * SPDIF
+  * LINE3
+
+Example:
+
+codec: rt274@1c {
+       compatible = "realtek,rt274";
+       reg = <0x1c>;
+       interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+};
index b013a4c62b6334dd44ae4b833aef9b6de35cfa21..848c5fe49bc7a46592c80086dd6a77974d0fd795 100644 (file)
@@ -1355,7 +1355,7 @@ static struct regmap *pm860x_get_regmap(struct device *dev)
        return pm860x->regmap;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
+static const struct snd_soc_codec_driver soc_codec_dev_pm860x = {
        .probe          = pm860x_probe,
        .remove         = pm860x_remove,
        .set_bias_level = pm860x_set_bias_level,
index 6c78b0b49b8145c24740d93c4174c059d91ddae9..aee9ef16dae62b91394fbcc56c7a22c9fda71b92 100644 (file)
@@ -71,7 +71,7 @@ config SND_SOC_ALL_CODECS
        select SND_SOC_DA732X if I2C
        select SND_SOC_DA9055 if I2C
        select SND_SOC_DIO2125
-       select SND_SOC_DMIC
+       select SND_SOC_DMIC if GPIOLIB
        select SND_SOC_ES8316 if I2C
        select SND_SOC_ES8328_SPI if SPI_MASTER
        select SND_SOC_ES8328_I2C if I2C
@@ -114,6 +114,7 @@ config SND_SOC_ALL_CODECS
        select SND_SOC_PCM5102A
        select SND_SOC_PCM512x_I2C if I2C
        select SND_SOC_PCM512x_SPI if SPI_MASTER
+       select SND_SOC_RT274 if I2C
        select SND_SOC_RT286 if I2C
        select SND_SOC_RT298 if I2C
        select SND_SOC_RT5514 if I2C
@@ -716,11 +717,17 @@ config SND_SOC_RL6231
 
 config SND_SOC_RL6347A
        tristate
+       default y if SND_SOC_RT274=y
        default y if SND_SOC_RT286=y
        default y if SND_SOC_RT298=y
+       default m if SND_SOC_RT274=m
        default m if SND_SOC_RT286=m
        default m if SND_SOC_RT298=m
 
+config SND_SOC_RT274
+       tristate
+       depends on I2C
+
 config SND_SOC_RT286
        tristate
        depends on I2C
index 1755a54e3dc9379668de08326ed14b724fe4e4da..a8a4b0797f4646672192748a3ea7fef2b5d73223 100644 (file)
@@ -113,6 +113,7 @@ snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
 snd-soc-pcm512x-spi-objs := pcm512x-spi.o
 snd-soc-rl6231-objs := rl6231.o
 snd-soc-rl6347a-objs := rl6347a.o
+snd-soc-rt274-objs := rt274.o
 snd-soc-rt286-objs := rt286.o
 snd-soc-rt298-objs := rt298.o
 snd-soc-rt5514-objs := rt5514.o
@@ -349,6 +350,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_I2C)   += snd-soc-pcm512x-i2c.o
 obj-$(CONFIG_SND_SOC_PCM512x_SPI)      += snd-soc-pcm512x-spi.o
 obj-$(CONFIG_SND_SOC_RL6231)   += snd-soc-rl6231.o
 obj-$(CONFIG_SND_SOC_RL6347A)  += snd-soc-rl6347a.o
+obj-$(CONFIG_SND_SOC_RT274)    += snd-soc-rt274.o
 obj-$(CONFIG_SND_SOC_RT286)    += snd-soc-rt286.o
 obj-$(CONFIG_SND_SOC_RT298)    += snd-soc-rt298.o
 obj-$(CONFIG_SND_SOC_RT5514)   += snd-soc-rt5514.o
index 312b2a11abb6a124ccf66778dec2ee7548f76486..006627b8c3a840d7823b74de64053dc281385435 100644 (file)
@@ -2523,7 +2523,7 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
        return status;
 }
 
-static struct snd_soc_codec_driver ab8500_codec_driver = {
+static const struct snd_soc_codec_driver ab8500_codec_driver = {
        .probe =                ab8500_codec_probe,
        .component_driver = {
                .controls =             ab8500_ctrls,
index f7f04c6be01e78402e6901fe14ed35fa7754921b..440b4ce543764be82f354e42fc45f6a5ad4b3c90 100644 (file)
@@ -112,7 +112,7 @@ static int ac97_soc_resume(struct snd_soc_codec *codec)
 #define ac97_soc_resume NULL
 #endif
 
-static struct snd_soc_codec_driver soc_codec_dev_ac97 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ac97 = {
        .probe =        ac97_soc_probe,
        .suspend =      ac97_soc_suspend,
        .resume =       ac97_soc_resume,
index a478239aadacca6815167c8d1ea8205f34aa035d..d0361caad09e08e51ba2f6f6e0bebc8905be85c9 100644 (file)
@@ -321,7 +321,7 @@ static int ad1836_remove(struct snd_soc_codec *codec)
                AD1836_ADC_SERFMT_MASK, 0);
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ad1836 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ad1836 = {
        .probe = ad1836_probe,
        .remove = ad1836_remove,
        .suspend = ad1836_suspend,
index d643557d89a74d753567ed75821ebb16a0477415..d10988eec0c10a236454dc146956d735e2ec98c6 100644 (file)
@@ -408,7 +408,7 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
+static const struct snd_soc_codec_driver soc_codec_dev_ad193x = {
        .probe = ad193x_codec_probe,
        .component_driver = {
                .controls               = ad193x_snd_controls,
index b7c1b9f4bf5f9d070e6daaa656a0059e644aff26..ce89bfb42094b4d678d9992bbd3c76e068914015 100644 (file)
@@ -295,7 +295,7 @@ static int ad1980_soc_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ad1980 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ad1980 = {
        .probe =        ad1980_soc_probe,
        .remove =       ad1980_soc_remove,
 
index 3e358a49442d2ded0af95b0ba8dccab006912806..d8d86a0fea605941a8f4295d3fd4cff88eec941b 100644 (file)
@@ -54,7 +54,7 @@ static struct snd_soc_dai_driver ad73311_dai = {
                .formats = SNDRV_PCM_FMTBIT_S16_LE, },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ad73311 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ad73311 = {
        .component_driver = {
                .dapm_widgets           = ad73311_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(ad73311_dapm_widgets),
index 8fa9045571ff44f7b9a698197d8d066e42695e64..a865945d776a4b08f88b0fdd2f1d40ea59c38a1c 100644 (file)
@@ -1458,7 +1458,7 @@ static const struct regmap_config adau1373_regmap_config = {
        .num_reg_defaults = ARRAY_SIZE(adau1373_reg_defaults),
 };
 
-static struct snd_soc_codec_driver adau1373_codec_driver = {
+static const struct snd_soc_codec_driver adau1373_codec_driver = {
        .probe =        adau1373_probe,
        .resume =       adau1373_resume,
        .set_bias_level = adau1373_set_bias_level,
index 3bad1bc8c00a3d93d74c6f419c96f30a479e4afb..805afac8146bbf52bf059df02f2d17a673aad3ae 100644 (file)
@@ -757,7 +757,7 @@ static int adau1701_resume(struct snd_soc_codec *codec)
 #define adau1701_suspend       NULL
 #endif /* CONFIG_PM */
 
-static struct snd_soc_codec_driver adau1701_codec_drv = {
+static const struct snd_soc_codec_driver adau1701_codec_drv = {
        .probe                  = adau1701_probe,
        .remove                 = adau1701_remove,
        .resume                 = adau1701_resume,
index b319db6a69f8dd073fe39a25998b0212cb5d94e2..3292816757656c1919c5c88cdeba6673fed59099 100644 (file)
@@ -867,7 +867,7 @@ static int adau1977_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver adau1977_codec_driver = {
+static const struct snd_soc_codec_driver adau1977_codec_driver = {
        .probe = adau1977_codec_probe,
        .set_bias_level = adau1977_set_bias_level,
        .set_sysclk = adau1977_set_sysclk,
index 6e793ebb588333c7ee39ee851ccb6c66ad746ad3..da7ca81f47cfb46f0a968cc6fcf908735593d115 100644 (file)
@@ -825,7 +825,7 @@ static int adav80x_resume(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver adav80x_codec_driver = {
+static const struct snd_soc_codec_driver adav80x_codec_driver = {
        .probe = adav80x_probe,
        .resume = adav80x_resume,
        .set_bias_level = adav80x_set_bias_level,
index 90c756d183b46168204839e56ae117694116a37c..b7f0057c023951457e3968588f8842ec46cdb491 100644 (file)
@@ -58,7 +58,7 @@ static struct snd_soc_dai_driver ads117x_dai = {
                .formats = ADS117X_FORMATS,},
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ads117x = {
+static const struct snd_soc_codec_driver soc_codec_dev_ads117x = {
        .component_driver = {
                .dapm_widgets           = ads117x_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(ads117x_dapm_widgets),
index 1a9d233c94d00f68f47fdc4313759666559140eb..dbb184118f2e47314c91501428cb8b46c97f7fbc 100644 (file)
@@ -242,7 +242,7 @@ static int ak4104_soc_resume(struct snd_soc_codec *codec)
 #define ak4104_soc_resume      NULL
 #endif /* CONFIG_PM */
 
-static struct snd_soc_codec_driver soc_codec_device_ak4104 = {
+static const struct snd_soc_codec_driver soc_codec_device_ak4104 = {
        .probe = ak4104_probe,
        .remove = ak4104_remove,
        .suspend = ak4104_soc_suspend,
index 66cfffde9a122e5369fb5f6561e730206cfbd6bd..e3c157dc88db3c796030159ae2487f1efb8e7a59 100644 (file)
@@ -390,7 +390,7 @@ static const struct regmap_config ak4535_regmap = {
        .num_reg_defaults = ARRAY_SIZE(ak4535_reg_defaults),
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
        .resume =       ak4535_resume,
        .set_bias_level = ak4535_set_bias_level,
        .suspend_bias_off = true,
index b92c548b9d299048964c63a1daf27351d773f624..0bb4fe5c122a4b17ac19b88df6e5ef0abeb1a837 100644 (file)
@@ -64,7 +64,7 @@ static struct snd_soc_dai_driver ak4554_dai = {
        .symmetric_rates = 1,
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4554 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4554 = {
        .component_driver = {
                .dapm_widgets           = ak4554_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(ak4554_dapm_widgets),
index 690edebf029eb53c213ace00c88e39b14c6b3d75..b95bb8b52e51214b6ecbfd8a83a8462e47aea6f3 100644 (file)
@@ -522,7 +522,7 @@ static int ak4613_resume(struct snd_soc_codec *codec)
        return regcache_sync(regmap);
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4613 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4613 = {
        .suspend                = ak4613_suspend,
        .resume                 = ak4613_resume,
        .set_bias_level         = ak4613_set_bias_level,
index ebdaf56c1d61336d96518f8e4e32aad603cab89c..60142ff32d4f28139bbddc585befed1c0e17532b 100644 (file)
@@ -524,7 +524,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = {
 },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
        .component_driver = {
                .controls               = ak4641_snd_controls,
                .num_controls           = ARRAY_SIZE(ak4641_snd_controls),
index 66de8a2013a6b1e5b2c54f9512a18e324ed3b81f..29530c567bd9dd41d09220966618931b7612142f 100644 (file)
@@ -550,7 +550,7 @@ static int ak4642_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
        .probe                  = ak4642_probe,
        .suspend                = ak4642_suspend,
        .resume                 = ak4642_resume,
index 6088afaabf62c56d63a0fea375761e4a247477b0..dcfdff56fc5a1efefaee683251b069285408ba07 100644 (file)
@@ -610,7 +610,7 @@ static struct snd_soc_dai_driver ak4671_dai = {
        .ops = &ak4671_dai_ops,
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_ak4671 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ak4671 = {
        .set_bias_level = ak4671_set_bias_level,
        .component_driver = {
                .controls               = ak4671_snd_controls,
index 0ef2df223336700ec1b55c70eb073b0960e2a18d..d0e16c03815cc89228a50f74284cddbf9dfa69cd 100644 (file)
@@ -69,7 +69,7 @@ static int ak5386_soc_resume(struct snd_soc_codec *codec)
 #define ak5386_soc_resume      NULL
 #endif /* CONFIG_PM */
 
-static struct snd_soc_codec_driver soc_codec_ak5386 = {
+static const struct snd_soc_codec_driver soc_codec_ak5386 = {
        .probe = ak5386_soc_probe,
        .remove = ak5386_soc_remove,
        .suspend = ak5386_soc_suspend,
index d2e3a3ef7499bce2d25009a811d9d94a26d4fee3..1db965a93632d8a52835ecf37d55c5963ee9bd4d 100644 (file)
@@ -951,7 +951,7 @@ static int alc5623_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_device_alc5623 = {
+static const struct snd_soc_codec_driver soc_codec_device_alc5623 = {
        .probe = alc5623_probe,
        .suspend = alc5623_suspend,
        .resume = alc5623_resume,
index 8014e697d5407d0b43f3bf03089a349c31e0b03a..806191addb44daedc0fbfca98bbabb0be4be8509 100644 (file)
@@ -62,7 +62,7 @@ static struct snd_soc_dai_driver bt_sco_dai[] = {
        }
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_bt_sco = {
+static const struct snd_soc_codec_driver soc_codec_dev_bt_sco = {
        .component_driver = {
                .dapm_widgets           = bt_sco_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(bt_sco_widgets),
index 7a2d9a2ee4276de62e659f1372224fa84e4cdc73..6ed2cc374768735f88092c0b4e92be720bfe0fce 100644 (file)
@@ -128,7 +128,7 @@ static struct regmap *cq93vc_get_regmap(struct device *dev)
        return davinci_vc->regmap;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_cq93vc = {
+static const struct snd_soc_codec_driver soc_codec_dev_cq93vc = {
        .set_bias_level = cq93vc_set_bias_level,
        .get_regmap = cq93vc_get_regmap,
        .component_driver = {
index 6df29fa30fb9d8d17216026b925fb8df1ba7dc3c..61d128b53e14c724037322d2b8cd3e300a5589d5 100644 (file)
@@ -831,7 +831,7 @@ static int cs35l33_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_cs35l33 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs35l33 = {
        .probe = cs35l33_probe,
 
        .set_bias_level = cs35l33_set_bias_level,
index 0a747c66cc6ccc593036775f51ae4eaa050cc850..15d712f4803ed34e97fa0af8e32fcc20f17cc196 100644 (file)
@@ -779,7 +779,7 @@ static int cs35l34_probe(struct snd_soc_codec *codec)
 }
 
 
-static struct snd_soc_codec_driver soc_codec_dev_cs35l34 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs35l34 = {
        .probe = cs35l34_probe,
 
        .component_driver = {
index f1ee184ecab2994424cdca4a6d9a1bbfd526bd5f..129978d1243ebcdd3a1558c1c0f1f0dd2056bdd7 100644 (file)
@@ -1079,7 +1079,7 @@ static int cs35l35_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_cs35l35 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs35l35 = {
        .probe = cs35l35_codec_probe,
        .set_sysclk = cs35l35_codec_set_sysclk,
        .component_driver = {
index d8824773dc29985bbed7f6f52d1646bdee41790b..49a80627af121d9f45d4adc6ffbd8530c553993a 100644 (file)
@@ -639,7 +639,7 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec)
        return 0;
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
        .probe                  = cs4271_codec_probe,
        .remove                 = cs4271_codec_remove,
        .suspend                = cs4271_soc_suspend,
index 96cfe38943cd44aa29885c76fbe48b4b8391d9a3..f8072f1897d4c47a7d91c9c6d00eedffd9ef2fba 100644 (file)
@@ -504,7 +504,7 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
+static const struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
        .probe = cs42l51_codec_probe,
 
        .component_driver = {
index 231ca935cdf3bdf22e7db0866a0dabfa61084e1e..0a749c79ef579bdd6bcf9688d6a24f784cfdc6db 100644 (file)
@@ -255,7 +255,7 @@ static struct snd_soc_dai_driver cs4349_dai = {
        .symmetric_rates = 1,
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_cs4349 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs4349 = {
        .component_driver = {
                .controls               = cs4349_snd_controls,
                .num_controls           = ARRAY_SIZE(cs4349_snd_controls),
index 47e6fddef92b8e7af04e88de54ba04f0409736f6..505dbc9d73cfe30cef585a9c8ba01e4aa5c2f711 100644 (file)
@@ -1183,7 +1183,7 @@ static struct regmap *cs47l24_get_regmap(struct device *dev)
        return priv->core.arizona->regmap;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
+static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
        .probe = cs47l24_codec_probe,
        .remove = cs47l24_codec_remove,
        .get_regmap = cs47l24_get_regmap,
@@ -1213,7 +1213,7 @@ static struct snd_compr_ops cs47l24_compr_ops = {
        .copy = wm_adsp_compr_copy,
 };
 
-static struct snd_soc_platform_driver cs47l24_compr_platform = {
+static const struct snd_soc_platform_driver cs47l24_compr_platform = {
        .compr_ops = &cs47l24_compr_ops,
 };
 
index 06933a5d0a75154fef952515b71bdda2a99050d9..da4ee56337787b0e99b177a98391cc5aef6b6816 100644 (file)
@@ -892,7 +892,7 @@ static int cs53l30_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver cs53l30_driver = {
+static const struct snd_soc_codec_driver cs53l30_driver = {
        .probe = cs53l30_codec_probe,
        .set_bias_level = cs53l30_set_bias_level,
        .idle_bias_off = true,
index 2c12471e42a68dd7ed865cd581a1f27728da85ee..46b1fbb66ebaaf2225f87dbe29305f3f8d0178b5 100644 (file)
@@ -398,7 +398,7 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
 
 static const u8 cx20442_reg;
 
-static struct snd_soc_codec_driver cx20442_codec_dev = {
+static const struct snd_soc_codec_driver cx20442_codec_dev = {
        .probe =        cx20442_codec_probe,
        .remove =       cx20442_codec_remove,
        .set_bias_level = cx20442_set_bias_level,
index 17053dfc94cf07cafea279351d8382db829add1b..1af443ccbc51531c2039a0e889909a1439635b3f 100644 (file)
@@ -1164,7 +1164,7 @@ static int da7210_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_da7210 = {
+static const struct snd_soc_codec_driver soc_codec_dev_da7210 = {
        .probe                  = da7210_probe,
 
        .component_driver = {
index c3e11897f8aee212215cb8969c13cbe866de2c71..cc0b2d2eaf151cc9a6666badc829d1157875c016 100644 (file)
@@ -1787,7 +1787,7 @@ static int da7213_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_da7213 = {
+static const struct snd_soc_codec_driver soc_codec_dev_da7213 = {
        .probe                  = da7213_probe,
        .set_bias_level         = da7213_set_bias_level,
 
index 6e1940eb0653c720c646710d057c11337a01fb70..b2d42ec1dcd9f7f75e98c04dd35c06351bf3ca7b 100644 (file)
@@ -3035,7 +3035,7 @@ static int da7218_resume(struct snd_soc_codec *codec)
 #define da7218_resume NULL
 #endif
 
-static struct snd_soc_codec_driver soc_codec_dev_da7218 = {
+static const struct snd_soc_codec_driver soc_codec_dev_da7218 = {
        .probe                  = da7218_probe,
        .remove                 = da7218_remove,
        .suspend                = da7218_suspend,
index f71d72c22bfc1b882a5045b2374110aee2eb1838..6f088536df32ea89014abffb112c4dfefe357fe0 100644 (file)
@@ -1891,7 +1891,7 @@ static int da7219_resume(struct snd_soc_codec *codec)
 #define da7219_resume NULL
 #endif
 
-static struct snd_soc_codec_driver soc_codec_dev_da7219 = {
+static const struct snd_soc_codec_driver soc_codec_dev_da7219 = {
        .probe                  = da7219_probe,
        .remove                 = da7219_remove,
        .suspend                = da7219_suspend,
index c1cc1c1c28f26d75a24ca0ee792c615996a06d66..83db4d23c90b9590eef0723562c50f52ce0c3ee2 100644 (file)
@@ -1499,7 +1499,7 @@ static int da732x_set_bias_level(struct snd_soc_codec *codec,
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_da732x = {
+static const struct snd_soc_codec_driver soc_codec_dev_da732x = {
        .set_bias_level         = da732x_set_bias_level,
        .component_driver = {
                .controls               = da732x_snd_controls,
index 4efb5f897a0c01943a6b977eb4e4eb269ee55336..bd7faaee5802e619ac25716f1faf7b261ea36fed 100644 (file)
@@ -1451,7 +1451,7 @@ static int da9055_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_da9055 = {
+static const struct snd_soc_codec_driver soc_codec_dev_da9055 = {
        .probe                  = da9055_probe,
        .set_bias_level         = da9055_set_bias_level,
 
index c82b9dc41e9a2b8ab2a3358ca96abc21dfd639cd..b88a1ee66f80135b55e7c211e4794a46e202232c 100644 (file)
@@ -19,6 +19,8 @@
  *
  */
 
+#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
 
+static int dmic_daiops_trigger(struct snd_pcm_substream *substream,
+               int cmd, struct snd_soc_dai *dai)
+{
+       struct gpio_desc *dmic_en = snd_soc_dai_get_drvdata(dai);
+
+       if (!dmic_en)
+               return 0;
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+       case SNDRV_PCM_TRIGGER_RESUME:
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+               gpiod_set_value(dmic_en, 1);
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+       case SNDRV_PCM_TRIGGER_SUSPEND:
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+               gpiod_set_value(dmic_en, 0);
+               break;
+       }
+
+       return 0;
+}
+
+static const struct snd_soc_dai_ops dmic_dai_ops = {
+       .trigger        = dmic_daiops_trigger,
+};
+
 static struct snd_soc_dai_driver dmic_dai = {
        .name = "dmic-hifi",
        .capture = {
@@ -38,8 +68,23 @@ static struct snd_soc_dai_driver dmic_dai = {
                        | SNDRV_PCM_FMTBIT_S24_LE
                        | SNDRV_PCM_FMTBIT_S16_LE,
        },
+       .ops    = &dmic_dai_ops,
 };
 
+static int dmic_codec_probe(struct snd_soc_codec *codec)
+{
+       struct gpio_desc *dmic_en;
+
+       dmic_en = devm_gpiod_get_optional(codec->dev,
+                                       "dmicen", GPIOD_OUT_LOW);
+       if (IS_ERR(dmic_en))
+               return PTR_ERR(dmic_en);
+
+       snd_soc_codec_set_drvdata(codec, dmic_en);
+
+       return 0;
+}
+
 static const struct snd_soc_dapm_widget dmic_dapm_widgets[] = {
        SND_SOC_DAPM_AIF_OUT("DMIC AIF", "Capture", 0,
                             SND_SOC_NOPM, 0, 0),
@@ -50,7 +95,8 @@ static const struct snd_soc_dapm_route intercon[] = {
        {"DMIC AIF", NULL, "DMic"},
 };
 
-static struct snd_soc_codec_driver soc_dmic = {
+static const struct snd_soc_codec_driver soc_dmic = {
+       .probe = dmic_codec_probe,
        .component_driver = {
                .dapm_widgets           = dmic_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(dmic_dapm_widgets),
@@ -73,9 +119,15 @@ static int dmic_dev_remove(struct platform_device *pdev)
 
 MODULE_ALIAS("platform:dmic-codec");
 
+static const struct of_device_id dmic_dev_match[] = {
+       {.compatible = "dmic-codec"},
+       {}
+};
+
 static struct platform_driver dmic_driver = {
        .driver = {
                .name = "dmic-codec",
+               .of_match_table = dmic_dev_match,
        },
        .probe = dmic_dev_probe,
        .remove = dmic_dev_remove,
index 25ede825d349a4aeefab9ef3899c328d8c8d6d31..3869025754d83ec3848b3b755f79c8c64eed533e 100644 (file)
@@ -69,7 +69,7 @@ static const struct snd_soc_dapm_route es7134_dapm_routes[] = {
        { "AOUTR", NULL, "DAC" },
 };
 
-static struct snd_soc_codec_driver es7134_codec_driver = {
+static const struct snd_soc_codec_driver es7134_codec_driver = {
        .component_driver = {
                .dapm_widgets           = es7134_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(es7134_dapm_widgets),
index ecc02449c569bd479d728aa929fc9093bf0a9fae..4f35af6a5d3acaf6eebc38421d43dd9e1c1ccaea 100644 (file)
@@ -554,7 +554,7 @@ static int es8316_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_es8316 = {
+static const struct snd_soc_codec_driver soc_codec_dev_es8316 = {
        .probe          = es8316_probe,
        .idle_bias_off  = true,
 
index ed7cc42d1ee2c16ece5306beb5f1aca7506dcaf5..bcdb8914ec16b992e26aecb718e430e6e0477e05 100644 (file)
@@ -830,7 +830,7 @@ const struct regmap_config es8328_regmap_config = {
 };
 EXPORT_SYMBOL_GPL(es8328_regmap_config);
 
-static struct snd_soc_codec_driver es8328_codec_driver = {
+static const struct snd_soc_codec_driver es8328_codec_driver = {
        .probe            = es8328_codec_probe,
        .suspend          = es8328_suspend,
        .resume           = es8328_resume,
index bc2e74ff3b2deddf653f1823329d22bf3449f8b6..e808f94bf8d11871dc1db8a182a429b32b04addc 100644 (file)
@@ -1360,7 +1360,7 @@ static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdac)
 
 }
 
-static struct snd_soc_dai_ops hdmi_dai_ops = {
+static const struct snd_soc_dai_ops hdmi_dai_ops = {
        .startup = hdac_hdmi_pcm_open,
        .shutdown = hdac_hdmi_pcm_close,
        .hw_params = hdac_hdmi_set_hw_params,
@@ -1858,7 +1858,7 @@ static void hdmi_codec_complete(struct device *dev)
 #define hdmi_codec_complete NULL
 #endif
 
-static struct snd_soc_codec_driver hdmi_hda_codec = {
+static const struct snd_soc_codec_driver hdmi_hda_codec = {
        .probe          = hdmi_codec_probe,
        .remove         = hdmi_codec_remove,
        .idle_bias_off  = true,
index 22ed0dc88f0a1d42b541d3efa66a863fe0b35eb6..d73d2c1ed8239d166a27f23161046d92a916571e 100644 (file)
@@ -326,7 +326,7 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
 static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc)
 {
        int i;
-       const unsigned long hdmi_codec_eld_spk_alloc_bits[] = {
+       static const unsigned long hdmi_codec_eld_spk_alloc_bits[] = {
                [0] = FL | FR, [1] = LFE, [2] = FC, [3] = RL | RR,
                [4] = RC, [5] = FLC | FRC, [6] = RLC | RRC,
        };
@@ -399,18 +399,6 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-
-static const struct snd_kcontrol_new hdmi_controls[] = {
-       {
-               .access = SNDRV_CTL_ELEM_ACCESS_READ |
-                         SNDRV_CTL_ELEM_ACCESS_VOLATILE,
-               .iface = SNDRV_CTL_ELEM_IFACE_PCM,
-               .name = "ELD",
-               .info = hdmi_eld_ctl_info,
-               .get = hdmi_eld_ctl_get,
-       },
-};
-
 static int hdmi_codec_new_stream(struct snd_pcm_substream *substream,
                                 struct snd_soc_dai *dai)
 {
@@ -668,6 +656,16 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
 {
        struct snd_soc_dai_driver *drv = dai->driver;
        struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
+       struct snd_kcontrol *kctl;
+       struct snd_kcontrol_new hdmi_eld_ctl = {
+               .access = SNDRV_CTL_ELEM_ACCESS_READ |
+                         SNDRV_CTL_ELEM_ACCESS_VOLATILE,
+               .iface  = SNDRV_CTL_ELEM_IFACE_PCM,
+               .name   = "ELD",
+               .info   = hdmi_eld_ctl_info,
+               .get    = hdmi_eld_ctl_get,
+               .device = rtd->pcm->device,
+       };
        int ret;
 
        dev_dbg(dai->dev, "%s()\n", __func__);
@@ -686,10 +684,15 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
        hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps;
        hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
 
-       return 0;
+       /* add ELD ctl with the device number corresponding to the PCM stream */
+       kctl = snd_ctl_new1(&hdmi_eld_ctl, dai->component);
+       if (!kctl)
+               return -ENOMEM;
+
+       return snd_ctl_add(rtd->card->snd_card, kctl);
 }
 
-static struct snd_soc_dai_driver hdmi_i2s_dai = {
+static const struct snd_soc_dai_driver hdmi_i2s_dai = {
        .name = "i2s-hifi",
        .id = DAI_ID_I2S,
        .playback = {
@@ -730,10 +733,8 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
        return ret;
 }
 
-static struct snd_soc_codec_driver hdmi_codec = {
+static const struct snd_soc_codec_driver hdmi_codec = {
        .component_driver = {
-               .controls               = hdmi_controls,
-               .num_controls           = ARRAY_SIZE(hdmi_controls),
                .dapm_widgets           = hdmi_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(hdmi_widgets),
                .dapm_routes            = hdmi_routes,
index dd850b93938d53737fe222e3e8c3b0dfee834280..651206273f3675bf519d0d05b4ca7313a4b504ff 100644 (file)
@@ -37,7 +37,7 @@ static struct snd_soc_dai_driver ics43432_dai = {
        },
 };
 
-static struct snd_soc_codec_driver ics43432_codec_driver = {
+static const struct snd_soc_codec_driver ics43432_codec_driver = {
 };
 
 static int ics43432_probe(struct platform_device *pdev)
index b918ba5c8ce5ce73acc35e843241b409113ea292..64b0be94bea32803e98f58dbe9fcfd4268031399 100644 (file)
@@ -376,7 +376,7 @@ static int rk3036_codec_set_bias_level(struct snd_soc_codec *codec,
        return 0;
 }
 
-static struct snd_soc_codec_driver rk3036_codec_driver = {
+static const struct snd_soc_codec_driver rk3036_codec_driver = {
        .probe                  = rk3036_codec_probe,
        .remove                 = rk3036_codec_remove,
        .set_bias_level         = rk3036_codec_set_bias_level,
index a4b0eded984aff2ce711fc70c84545ef3df02fcd..5ca99280ae0097bd59a36df4f6fc1c44ab8427fe 100644 (file)
@@ -1087,7 +1087,7 @@ static struct snd_soc_dai_driver isabelle_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_isabelle = {
+static const struct snd_soc_codec_driver soc_codec_dev_isabelle = {
        .set_bias_level = isabelle_set_bias_level,
        .component_driver = {
                .controls               = isabelle_snd_controls,
index 0290fab383da8864086e7e617051a15b65d3b1e7..6324ccdc8a5c556b00d3d80b81f8fe626743ca41 100644 (file)
@@ -293,7 +293,7 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = {
+static const struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = {
        .probe = jz4740_codec_dev_probe,
        .set_bias_level = jz4740_codec_set_bias_level,
        .suspend_bias_off = true,
index 558de1053f73ce52934747f50ef16a702e48a0a4..1e964079642adc5e53ad06e1bbd8fc72c7b62786 100644 (file)
@@ -100,7 +100,7 @@ static const struct snd_soc_dapm_route lm4857_routes[] = {
        { "EP", "Earpiece", "Mode" },
 };
 
-static struct snd_soc_component_driver lm4857_component_driver = {
+static const struct snd_soc_component_driver lm4857_component_driver = {
        .controls = lm4857_controls,
        .num_controls = ARRAY_SIZE(lm4857_controls),
        .dapm_widgets = lm4857_dapm_widgets,
index 8d413c2677ccad5287d06a41d33c586296056985..41e09d1287b8583479b4df23c3db83ddc465ef2e 100644 (file)
@@ -1389,7 +1389,7 @@ static struct snd_soc_dai_driver lm49453_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_lm49453 = {
+static const struct snd_soc_codec_driver soc_codec_dev_lm49453 = {
        .set_bias_level = lm49453_set_bias_level,
        .component_driver = {
                .controls               = lm49453_snd_controls,
index 5b82e26cd5d1ae506acebf9394629e03bfa73b12..7017c0389e73ccaad575350be8b9c1ddb72b8be1 100644 (file)
@@ -151,7 +151,7 @@ static int max9768_probe(struct snd_soc_component *component)
        return 0;
 }
 
-static struct snd_soc_component_driver max9768_component_driver = {
+static const struct snd_soc_component_driver max9768_component_driver = {
        .probe = max9768_probe,
        .controls = max9768_volume,
        .num_controls = ARRAY_SIZE(max9768_volume),
index 72f77455582eb4ad4f76c4b0cc1713c7c007177c..f0bb830874e59ab9c2b544e961143c0a4515c6ce 100644 (file)
@@ -1698,7 +1698,7 @@ static int max98088_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_max98088 = {
+static const struct snd_soc_codec_driver soc_codec_dev_max98088 = {
        .probe   = max98088_probe,
        .remove  = max98088_remove,
        .set_bias_level = max98088_set_bias_level,
index 66828480d484ca11912d8b163efe0c51445b155c..13bcfb1ef9b423ceb5fa2ae222340eccaed2ed69 100644 (file)
@@ -2499,7 +2499,7 @@ static void max98090_seq_notifier(struct snd_soc_dapm_context *dapm,
        }
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_max98090 = {
+static const struct snd_soc_codec_driver soc_codec_dev_max98090 = {
        .probe   = max98090_probe,
        .remove  = max98090_remove,
        .seq_notifier = max98090_seq_notifier,
index 6f8a757876ed9c758c2c4719c8d563f18b3e9983..5ead87d2ab1df95cfc8245a3b07aae5fb49b9f83 100644 (file)
@@ -2102,7 +2102,7 @@ static int max98095_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_max98095 = {
+static const struct snd_soc_codec_driver soc_codec_dev_max98095 = {
        .probe   = max98095_probe,
        .remove  = max98095_remove,
        .suspend = max98095_suspend,
index 6a6b68a4cb527fc389b61d6e70524f13f11b3b5a..426ed2dae6ca292bcfd08a283a5b0703717b78e6 100644 (file)
@@ -72,7 +72,7 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver max98357a_codec_driver = {
+static const struct snd_soc_codec_driver max98357a_codec_driver = {
        .probe                  = max98357a_codec_probe,
        .component_driver = {
                .dapm_widgets           = max98357a_dapm_widgets,
index 0610840733d1629d7fdd12f3dcdcf023681b3c42..a3dfc918c278bda4b41a972c204daa031baed106 100644 (file)
@@ -301,7 +301,7 @@ static int max9850_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_max9850 = {
+static const struct snd_soc_codec_driver soc_codec_dev_max9850 = {
        .probe =        max9850_probe,
        .set_bias_level = max9850_set_bias_level,
        .suspend_bias_off = true,
index 499bdbfd0a2d93e7fa88da23915027a53556b238..a2dc6a47f4664637bef5c302c18758d9b421c954 100644 (file)
@@ -534,7 +534,7 @@ static int max9860_set_bias_level(struct snd_soc_codec *codec,
        return 0;
 }
 
-static struct snd_soc_codec_driver max9860_codec_driver = {
+static const struct snd_soc_codec_driver max9860_codec_driver = {
        .set_bias_level = max9860_set_bias_level,
        .idle_bias_off = true,
 
index 2a40a69a7513817fe65753f774078f26e0aefec6..6c0c0d6e8f3cc835cf7728b572ebdd7b4854d728 100644 (file)
@@ -413,7 +413,7 @@ static int max9867_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver max9867_codec = {
+static const struct snd_soc_codec_driver max9867_codec = {
        .probe = max9867_probe,
        .component_driver = {
                .controls               = max9867_snd_controls,
index 1eff7e0b092e1f5773fc88f7110cb71e37d80e44..7a39bfb9e0f91be14f0eab1050f953626d0877f1 100644 (file)
@@ -496,7 +496,7 @@ static int max98926_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_max98926 = {
+static const struct snd_soc_codec_driver soc_codec_dev_max98926 = {
        .probe  = max98926_probe,
        .component_driver = {
                .controls               = max98926_snd_controls,
index 90562703dcfdb1eb8c3a76c87303457173c7a28b..4fd8d1dc4eefca8624f33819706de3fc79996eb1 100644 (file)
@@ -733,7 +733,7 @@ static struct regmap *mc13783_get_regmap(struct device *dev)
        return dev_get_regmap(dev->parent, NULL);
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_mc13783 = {
+static const struct snd_soc_codec_driver soc_codec_dev_mc13783 = {
        .probe          = mc13783_probe,
        .remove         = mc13783_remove,
        .get_regmap     = mc13783_get_regmap,
index 69e5e18880c53c35835b0bb8e5b5eb749c0c16b7..5cc960d8211e3c6f8608900456210fe715d3bac5 100644 (file)
@@ -537,7 +537,7 @@ static int ml26124_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ml26124 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ml26124 = {
        .probe =        ml26124_probe,
        .set_bias_level = ml26124_set_bias_level,
        .suspend_bias_off = true,
index f9a74ff2ce99a8a7820a8efaaf20be51bd109f71..1454f54f097708c9a475dd8d351e3e36694a16a2 100644 (file)
@@ -767,7 +767,7 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
               },
 };
 
-static struct snd_soc_codec_driver pm8916_wcd_analog = {
+static const struct snd_soc_codec_driver pm8916_wcd_analog = {
        .probe = pm8916_wcd_analog_probe,
        .remove = pm8916_wcd_analog_remove,
        .get_regmap = pm8916_get_regmap,
index 858a9fc1c0574422a5d46d59803dd3482597dee2..66df8f810f0d740772a62d965466358012d91d4f 100644 (file)
@@ -851,7 +851,7 @@ static struct snd_soc_dai_driver msm8916_wcd_digital_dai[] = {
               },
 };
 
-static struct snd_soc_codec_driver msm8916_wcd_digital = {
+static const struct snd_soc_codec_driver msm8916_wcd_digital = {
        .probe = msm8916_wcd_digital_codec_probe,
        .set_sysclk = msm8916_wcd_digital_codec_set_sysclk,
        .component_driver = {
index c8bcb1db966de689d2e95413e6c618e7e6b8ad0e..f9c9933acffb60ee50c9c7ec062e3cc278bedf60 100644 (file)
@@ -735,7 +735,7 @@ static int __maybe_unused nau8540_resume(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver nau8540_codec_driver = {
+static const struct snd_soc_codec_driver nau8540_codec_driver = {
        .set_sysclk = nau8540_set_sysclk,
        .set_pll = nau8540_set_pll,
        .suspend = nau8540_suspend,
index e45518629968b53ab01a044459a237f0ef1eb29f..c8e2451ae0a3700a52d111afaebb7482e53957d9 100644 (file)
@@ -808,7 +808,7 @@ static const struct regmap_config nau8810_regmap_config = {
        .num_reg_defaults = ARRAY_SIZE(nau8810_reg_defaults),
 };
 
-static struct snd_soc_codec_driver nau8810_codec_driver = {
+static const struct snd_soc_codec_driver nau8810_codec_driver = {
        .set_bias_level = nau8810_set_bias_level,
        .suspend_bias_off = true,
 
index 3a309b18035e7ab29f5762e8d8331be388ae187e..0240759f951c7ea22b06004aa0e26320bba224fa 100644 (file)
@@ -1469,7 +1469,7 @@ static int __maybe_unused nau8824_resume(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver nau8824_codec_driver = {
+static const struct snd_soc_codec_driver nau8824_codec_driver = {
        .probe = nau8824_codec_probe,
        .set_sysclk = nau8824_set_sysclk,
        .set_pll = nau8824_set_pll,
index 46a30eaa7ace095a39e011790e992bcb1a3f87c9..000aa79314fac9e7aeb9645f9a42fc2a90f43ce3 100644 (file)
@@ -2388,7 +2388,7 @@ static int __maybe_unused nau8825_resume(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver nau8825_codec_driver = {
+static const struct snd_soc_codec_driver nau8825_codec_driver = {
        .probe = nau8825_codec_probe,
        .remove = nau8825_codec_remove,
        .set_sysclk = nau8825_set_sysclk,
index 0b14efab6280dd88b7a72c7df84fb3625a15f650..c7e28dd2e8153bc359494bdd9cb87728dcb1d0a0 100644 (file)
@@ -288,7 +288,7 @@ static const struct regmap_config pcm1681_regmap = {
        .readable_reg           = pcm1681_accessible_reg,
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_pcm1681 = {
+static const struct snd_soc_codec_driver soc_codec_dev_pcm1681 = {
        .component_driver = {
                .controls               = pcm1681_controls,
                .num_controls           = ARRAY_SIZE(pcm1681_controls),
index b813a154ddd97e1c31f79e815a938db0538531e3..82a3d9db32cb87b84b78cb07d40b3a34a636a59e 100644 (file)
@@ -205,7 +205,7 @@ const struct regmap_config pcm179x_regmap_config = {
 };
 EXPORT_SYMBOL_GPL(pcm179x_regmap_config);
 
-static struct snd_soc_codec_driver soc_codec_dev_pcm179x = {
+static const struct snd_soc_codec_driver soc_codec_dev_pcm179x = {
        .component_driver = {
                .controls               = pcm179x_controls,
                .num_controls           = ARRAY_SIZE(pcm179x_controls),
index 708af05486f634012da081f78421b676b21d1f7c..e59d8ffb93bd65a2a6319aa3c24e7dc4d603a708 100644 (file)
@@ -98,7 +98,7 @@ static struct snd_soc_dai_driver pcm3008_dai = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_pcm3008 = {
+static const struct snd_soc_codec_driver soc_codec_dev_pcm3008 = {
        .component_driver = {
                .dapm_widgets           = pcm3008_dapm_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(pcm3008_dapm_widgets),
index 72b19e62f6267698aea45d2410d616d91c1825cb..f1005a31c709ff61e2292ec12928d08f73e6f136 100644 (file)
@@ -1344,7 +1344,7 @@ static struct snd_soc_dai_driver pcm512x_dai = {
        .ops = &pcm512x_dai_ops,
 };
 
-static struct snd_soc_codec_driver pcm512x_codec_driver = {
+static const struct snd_soc_codec_driver pcm512x_codec_driver = {
        .set_bias_level = pcm512x_set_bias_level,
        .idle_bias_off = true,
 
diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c
new file mode 100644 (file)
index 0000000..58cfe24
--- /dev/null
@@ -0,0 +1,1228 @@
+/*
+ * rt274.c  --  RT274 ALSA SoC audio codec driver
+ *
+ * Copyright 2017 Realtek Semiconductor Corp.
+ * Author: Bard Liao <bardliao@realtek.com>
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/pm.h>
+#include <linux/i2c.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/dmi.h>
+#include <linux/acpi.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/initval.h>
+#include <sound/tlv.h>
+#include <sound/jack.h>
+#include <linux/workqueue.h>
+
+#include "rl6347a.h"
+#include "rt274.h"
+
+#define RT274_VENDOR_ID 0x10ec0274
+
+struct rt274_priv {
+       struct reg_default *index_cache;
+       int index_cache_size;
+       struct regmap *regmap;
+       struct snd_soc_codec *codec;
+       struct i2c_client *i2c;
+       struct snd_soc_jack *jack;
+       struct delayed_work jack_detect_work;
+       int sys_clk;
+       int clk_id;
+       int fs;
+       bool master;
+};
+
+static const struct reg_default rt274_index_def[] = {
+       { 0x00, 0x1004 },
+       { 0x01, 0xaaaa },
+       { 0x02, 0x88aa },
+       { 0x03, 0x0002 },
+       { 0x04, 0xaa09 },
+       { 0x05, 0x0700 },
+       { 0x06, 0x6110 },
+       { 0x07, 0x0200 },
+       { 0x08, 0xa807 },
+       { 0x09, 0x0021 },
+       { 0x0a, 0x7770 },
+       { 0x0b, 0x7770 },
+       { 0x0c, 0x002b },
+       { 0x0d, 0x2420 },
+       { 0x0e, 0x65c0 },
+       { 0x0f, 0x7770 },
+       { 0x10, 0x0420 },
+       { 0x11, 0x7418 },
+       { 0x12, 0x6bd0 },
+       { 0x13, 0x645f },
+       { 0x14, 0x0400 },
+       { 0x15, 0x8ccc },
+       { 0x16, 0x4c50 },
+       { 0x17, 0xff00 },
+       { 0x18, 0x0003 },
+       { 0x19, 0x2c11 },
+       { 0x1a, 0x830b },
+       { 0x1b, 0x4e4b },
+       { 0x1c, 0x0000 },
+       { 0x1d, 0x0000 },
+       { 0x1e, 0x0000 },
+       { 0x1f, 0x0000 },
+       { 0x20, 0x51ff },
+       { 0x21, 0x8000 },
+       { 0x22, 0x8f00 },
+       { 0x23, 0x88f4 },
+       { 0x24, 0x0000 },
+       { 0x25, 0x0000 },
+       { 0x26, 0x0000 },
+       { 0x27, 0x0000 },
+       { 0x28, 0x0000 },
+       { 0x29, 0x3000 },
+       { 0x2a, 0x0000 },
+       { 0x2b, 0x0000 },
+       { 0x2c, 0x0f00 },
+       { 0x2d, 0x100f },
+       { 0x2e, 0x2902 },
+       { 0x2f, 0xe280 },
+       { 0x30, 0x1000 },
+       { 0x31, 0x8400 },
+       { 0x32, 0x5aaa },
+       { 0x33, 0x8420 },
+       { 0x34, 0xa20c },
+       { 0x35, 0x096a },
+       { 0x36, 0x5757 },
+       { 0x37, 0xfe05 },
+       { 0x38, 0x4901 },
+       { 0x39, 0x110a },
+       { 0x3a, 0x0010 },
+       { 0x3b, 0x60d9 },
+       { 0x3c, 0xf214 },
+       { 0x3d, 0xc2ba },
+       { 0x3e, 0xa928 },
+       { 0x3f, 0x0000 },
+       { 0x40, 0x9800 },
+       { 0x41, 0x0000 },
+       { 0x42, 0x2000 },
+       { 0x43, 0x3d90 },
+       { 0x44, 0x4900 },
+       { 0x45, 0x5289 },
+       { 0x46, 0x0004 },
+       { 0x47, 0xa47a },
+       { 0x48, 0xd049 },
+       { 0x49, 0x0049 },
+       { 0x4a, 0xa83b },
+       { 0x4b, 0x0777 },
+       { 0x4c, 0x065c },
+       { 0x4d, 0x7fff },
+       { 0x4e, 0x7fff },
+       { 0x4f, 0x0000 },
+       { 0x50, 0x0000 },
+       { 0x51, 0x0000 },
+       { 0x52, 0xbf5f },
+       { 0x53, 0x3320 },
+       { 0x54, 0xcc00 },
+       { 0x55, 0x0000 },
+       { 0x56, 0x3f00 },
+       { 0x57, 0x0000 },
+       { 0x58, 0x0000 },
+       { 0x59, 0x0000 },
+       { 0x5a, 0x1300 },
+       { 0x5b, 0x005f },
+       { 0x5c, 0x0000 },
+       { 0x5d, 0x1001 },
+       { 0x5e, 0x1000 },
+       { 0x5f, 0x0000 },
+       { 0x60, 0x5554 },
+       { 0x61, 0xffc0 },
+       { 0x62, 0xa000 },
+       { 0x63, 0xd010 },
+       { 0x64, 0x0000 },
+       { 0x65, 0x3fb1 },
+       { 0x66, 0x1881 },
+       { 0x67, 0xc810 },
+       { 0x68, 0x2000 },
+       { 0x69, 0xfff0 },
+       { 0x6a, 0x0300 },
+       { 0x6b, 0x5060 },
+       { 0x6c, 0x0000 },
+       { 0x6d, 0x0000 },
+       { 0x6e, 0x0c25 },
+       { 0x6f, 0x0c0b },
+       { 0x70, 0x8000 },
+       { 0x71, 0x4008 },
+       { 0x72, 0x0000 },
+       { 0x73, 0x0800 },
+       { 0x74, 0xa28f },
+       { 0x75, 0xa050 },
+       { 0x76, 0x7fe8 },
+       { 0x77, 0xdb8c },
+       { 0x78, 0x0000 },
+       { 0x79, 0x0000 },
+       { 0x7a, 0x2a96 },
+       { 0x7b, 0x800f },
+       { 0x7c, 0x0200 },
+       { 0x7d, 0x1600 },
+       { 0x7e, 0x0000 },
+       { 0x7f, 0x0000 },
+};
+#define INDEX_CACHE_SIZE ARRAY_SIZE(rt274_index_def)
+
+static const struct reg_default rt274_reg[] = {
+       { 0x00170500, 0x00000400 },
+       { 0x00220000, 0x00000031 },
+       { 0x00239000, 0x00000057 },
+       { 0x0023a000, 0x00000057 },
+       { 0x00270500, 0x00000400 },
+       { 0x00370500, 0x00000400 },
+       { 0x00870500, 0x00000400 },
+       { 0x00920000, 0x00000031 },
+       { 0x00935000, 0x00000097 },
+       { 0x00936000, 0x00000097 },
+       { 0x00970500, 0x00000400 },
+       { 0x00b37000, 0x00000400 },
+       { 0x00b37200, 0x00000400 },
+       { 0x00b37300, 0x00000400 },
+       { 0x00c37000, 0x00000400 },
+       { 0x00c37100, 0x00000400 },
+       { 0x01270500, 0x00000400 },
+       { 0x01370500, 0x00000400 },
+       { 0x01371f00, 0x411111f0 },
+       { 0x01937000, 0x00000000 },
+       { 0x01970500, 0x00000400 },
+       { 0x02050000, 0x0000001b },
+       { 0x02139000, 0x00000080 },
+       { 0x0213a000, 0x00000080 },
+       { 0x02170100, 0x00000001 },
+       { 0x02170500, 0x00000400 },
+       { 0x02170700, 0x00000000 },
+       { 0x02270100, 0x00000000 },
+       { 0x02370100, 0x00000000 },
+       { 0x01970700, 0x00000020 },
+       { 0x00830000, 0x00000097 },
+       { 0x00930000, 0x00000097 },
+       { 0x01270700, 0x00000000 },
+};
+
+static bool rt274_volatile_register(struct device *dev, unsigned int reg)
+{
+       switch (reg) {
+       case 0 ... 0xff:
+       case RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID):
+       case RT274_GET_HP_SENSE:
+       case RT274_GET_MIC_SENSE:
+       case RT274_PROC_COEF:
+       case VERB_CMD(AC_VERB_GET_EAPD_BTLENABLE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_EAPD_BTLENABLE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_DAC_OUT0, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_DAC_OUT1, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_ADC_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_ADC_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DAC_OUT0, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DAC_OUT1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_ADC_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_ADC_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DMIC1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DMIC2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_LINE1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_LINE2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_MIXER_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_MIXER_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_DMIC1, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_DMIC2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_LINE1, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_LINE2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_INLINE_CMD, 0):
+               return true;
+       default:
+               return false;
+       }
+
+
+}
+
+static bool rt274_readable_register(struct device *dev, unsigned int reg)
+{
+       switch (reg) {
+       case 0 ... 0xff:
+       case RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID):
+       case RT274_GET_HP_SENSE:
+       case RT274_GET_MIC_SENSE:
+       case RT274_SET_AUDIO_POWER:
+       case RT274_SET_HPO_POWER:
+       case RT274_SET_DMIC1_POWER:
+       case RT274_LOUT_MUX:
+       case RT274_HPO_MUX:
+       case RT274_ADC0_MUX:
+       case RT274_ADC1_MUX:
+       case RT274_SET_MIC:
+       case RT274_SET_PIN_HPO:
+       case RT274_SET_PIN_LOUT3:
+       case RT274_SET_PIN_DMIC1:
+       case RT274_SET_AMP_GAIN_HPO:
+       case RT274_SET_DMIC2_DEFAULT:
+       case RT274_DAC0L_GAIN:
+       case RT274_DAC0R_GAIN:
+       case RT274_DAC1L_GAIN:
+       case RT274_DAC1R_GAIN:
+       case RT274_ADCL_GAIN:
+       case RT274_ADCR_GAIN:
+       case RT274_MIC_GAIN:
+       case RT274_HPOL_GAIN:
+       case RT274_HPOR_GAIN:
+       case RT274_LOUTL_GAIN:
+       case RT274_LOUTR_GAIN:
+       case RT274_DAC_FORMAT:
+       case RT274_ADC_FORMAT:
+       case RT274_COEF_INDEX:
+       case RT274_PROC_COEF:
+       case RT274_SET_AMP_GAIN_ADC_IN1:
+       case RT274_SET_AMP_GAIN_ADC_IN2:
+       case RT274_SET_POWER(RT274_DAC_OUT0):
+       case RT274_SET_POWER(RT274_DAC_OUT1):
+       case RT274_SET_POWER(RT274_ADC_IN1):
+       case RT274_SET_POWER(RT274_ADC_IN2):
+       case RT274_SET_POWER(RT274_DMIC2):
+       case RT274_SET_POWER(RT274_MIC):
+       case VERB_CMD(AC_VERB_GET_EAPD_BTLENABLE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_EAPD_BTLENABLE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_DAC_OUT0, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_DAC_OUT1, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_ADC_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_STREAM_FORMAT, RT274_ADC_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DAC_OUT0, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DAC_OUT1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_ADC_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_ADC_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DMIC1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_DMIC2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_LINE1, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_LINE2, 0):
+       case VERB_CMD(AC_VERB_GET_AMP_GAIN_MUTE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_MIXER_IN1, 0):
+       case VERB_CMD(AC_VERB_GET_CONNECT_SEL, RT274_MIXER_IN2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_DMIC1, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_DMIC2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_LINE1, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_LINE2, 0):
+       case VERB_CMD(AC_VERB_GET_PIN_WIDGET_CONTROL, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_HP_OUT, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_MIC, 0):
+       case VERB_CMD(AC_VERB_GET_UNSOLICITED_RESPONSE, RT274_INLINE_CMD, 0):
+               return true;
+       default:
+               return false;
+       }
+}
+
+#ifdef CONFIG_PM
+static void rt274_index_sync(struct snd_soc_codec *codec)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+       int i;
+
+       for (i = 0; i < INDEX_CACHE_SIZE; i++) {
+               snd_soc_write(codec, rt274->index_cache[i].reg,
+                                 rt274->index_cache[i].def);
+       }
+}
+#endif
+
+static int rt274_jack_detect(struct rt274_priv *rt274, bool *hp, bool *mic)
+{
+       unsigned int buf;
+
+       *hp = false;
+       *mic = false;
+
+       if (!rt274->codec)
+               return -EINVAL;
+
+       regmap_read(rt274->regmap, RT274_GET_HP_SENSE, &buf);
+       *hp = buf & 0x80000000;
+       regmap_read(rt274->regmap, RT274_GET_MIC_SENSE, &buf);
+       *mic = buf & 0x80000000;
+
+       pr_debug("*hp = %d *mic = %d\n", *hp, *mic);
+
+       return 0;
+}
+
+static void rt274_jack_detect_work(struct work_struct *work)
+{
+       struct rt274_priv *rt274 =
+               container_of(work, struct rt274_priv, jack_detect_work.work);
+       int status = 0;
+       bool hp = false;
+       bool mic = false;
+
+       if (rt274_jack_detect(rt274, &hp, &mic) < 0)
+               return;
+
+       if (hp == true)
+               status |= SND_JACK_HEADPHONE;
+
+       if (mic == true)
+               status |= SND_JACK_MICROPHONE;
+
+       snd_soc_jack_report(rt274->jack, status,
+               SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
+}
+
+static irqreturn_t rt274_irq(int irq, void *data);
+
+static int rt274_mic_detect(struct snd_soc_codec *codec,
+       struct snd_soc_jack *jack,  void *data)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       if (jack == NULL) {
+               /* Disable jack detection */
+               regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
+                                       RT274_IRQ_EN, RT274_IRQ_DIS);
+
+               return 0;
+       }
+       rt274->jack = jack;
+
+       regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
+                               RT274_IRQ_EN, RT274_IRQ_EN);
+
+       /* Send an initial report */
+       rt274_irq(0, rt274);
+
+       return 0;
+}
+
+static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6350, 50, 0);
+static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0);
+
+static const struct snd_kcontrol_new rt274_snd_controls[] = {
+       SOC_DOUBLE_R_TLV("DAC0 Playback Volume", RT274_DAC0L_GAIN,
+                        RT274_DAC0R_GAIN, 0, 0x7f, 0, out_vol_tlv),
+       SOC_DOUBLE_R_TLV("DAC1 Playback Volume", RT274_DAC1L_GAIN,
+                        RT274_DAC1R_GAIN, 0, 0x7f, 0, out_vol_tlv),
+       SOC_DOUBLE_R_TLV("ADC0 Capture Volume", RT274_ADCL_GAIN,
+                           RT274_ADCR_GAIN, 0, 0x7f, 0, out_vol_tlv),
+       SOC_DOUBLE_R("ADC0 Capture Switch", RT274_ADCL_GAIN,
+                           RT274_ADCR_GAIN, RT274_MUTE_SFT, 1, 1),
+       SOC_SINGLE_TLV("AMIC Volume", RT274_MIC_GAIN,
+                           0, 0x3, 0, mic_vol_tlv),
+};
+
+static const struct snd_kcontrol_new hpol_enable_control =
+       SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT274_HPOL_GAIN,
+                       RT274_MUTE_SFT, 1, 1);
+
+static const struct snd_kcontrol_new hpor_enable_control =
+       SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT274_HPOR_GAIN,
+                       RT274_MUTE_SFT, 1, 1);
+
+static const struct snd_kcontrol_new loutl_enable_control =
+       SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT274_LOUTL_GAIN,
+                       RT274_MUTE_SFT, 1, 1);
+
+static const struct snd_kcontrol_new loutr_enable_control =
+       SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT274_LOUTR_GAIN,
+                       RT274_MUTE_SFT, 1, 1);
+
+/* ADC0 source */
+static const char * const rt274_adc_src[] = {
+       "Mic", "Line1", "Line2", "Dmic"
+};
+
+static SOC_ENUM_SINGLE_DECL(
+       rt274_adc0_enum, RT274_ADC0_MUX, RT274_ADC_SEL_SFT,
+       rt274_adc_src);
+
+static const struct snd_kcontrol_new rt274_adc0_mux =
+       SOC_DAPM_ENUM("ADC 0 source", rt274_adc0_enum);
+
+static SOC_ENUM_SINGLE_DECL(
+       rt274_adc1_enum, RT274_ADC1_MUX, RT274_ADC_SEL_SFT,
+       rt274_adc_src);
+
+static const struct snd_kcontrol_new rt274_adc1_mux =
+       SOC_DAPM_ENUM("ADC 1 source", rt274_adc1_enum);
+
+static const char * const rt274_dac_src[] = {
+       "DAC OUT0", "DAC OUT1"
+};
+/* HP-OUT source */
+static SOC_ENUM_SINGLE_DECL(rt274_hpo_enum, RT274_HPO_MUX,
+                               0, rt274_dac_src);
+
+static const struct snd_kcontrol_new rt274_hpo_mux =
+SOC_DAPM_ENUM("HPO source", rt274_hpo_enum);
+
+/* Line out source */
+static SOC_ENUM_SINGLE_DECL(rt274_lout_enum, RT274_LOUT_MUX,
+                               0, rt274_dac_src);
+
+static const struct snd_kcontrol_new rt274_lout_mux =
+SOC_DAPM_ENUM("LOUT source", rt274_lout_enum);
+
+static const struct snd_soc_dapm_widget rt274_dapm_widgets[] = {
+       /* Input Lines */
+       SND_SOC_DAPM_INPUT("DMIC1 Pin"),
+       SND_SOC_DAPM_INPUT("DMIC2 Pin"),
+       SND_SOC_DAPM_INPUT("MIC"),
+       SND_SOC_DAPM_INPUT("LINE1"),
+       SND_SOC_DAPM_INPUT("LINE2"),
+
+       /* DMIC */
+       SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0),
+       SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0),
+
+       /* ADCs */
+       SND_SOC_DAPM_ADC("ADC 0", NULL, RT274_SET_STREAMID_ADC1, 4, 0),
+       SND_SOC_DAPM_ADC("ADC 1", NULL, RT274_SET_STREAMID_ADC2, 4, 0),
+
+       /* ADC Mux */
+       SND_SOC_DAPM_MUX("ADC 0 Mux", SND_SOC_NOPM, 0, 0,
+               &rt274_adc0_mux),
+       SND_SOC_DAPM_MUX("ADC 1 Mux", SND_SOC_NOPM, 0, 0,
+               &rt274_adc1_mux),
+
+       /* Audio Interface */
+       SND_SOC_DAPM_AIF_IN("AIF1RXL", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("AIF1RXR", "AIF1 Playback", 1, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("AIF1TXL", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("AIF1TXR", "AIF1 Capture", 1, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("AIF2RXL", "AIF1 Playback", 2, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("AIF2RXR", "AIF1 Playback", 3, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("AIF2TXL", "AIF1 Capture", 2, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("AIF2TXR", "AIF1 Capture", 3, SND_SOC_NOPM, 0, 0),
+
+       /* Output Side */
+       /* DACs */
+       SND_SOC_DAPM_DAC("DAC 0", NULL, RT274_SET_STREAMID_DAC0, 4, 0),
+       SND_SOC_DAPM_DAC("DAC 1", NULL, RT274_SET_STREAMID_DAC1, 4, 0),
+
+       /* Output Mux */
+       SND_SOC_DAPM_MUX("HPO Mux", SND_SOC_NOPM, 0, 0, &rt274_hpo_mux),
+       SND_SOC_DAPM_MUX("LOUT Mux", SND_SOC_NOPM, 0, 0, &rt274_lout_mux),
+
+       SND_SOC_DAPM_SUPPLY("HP Power", RT274_SET_PIN_HPO,
+               RT274_SET_PIN_SFT, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("LOUT Power", RT274_SET_PIN_LOUT3,
+               RT274_SET_PIN_SFT, 0, NULL, 0),
+
+       /* Output Mixer */
+       SND_SOC_DAPM_PGA("DAC OUT0", SND_SOC_NOPM, 0, 0,
+                       NULL, 0),
+       SND_SOC_DAPM_PGA("DAC OUT1", SND_SOC_NOPM, 0, 0,
+                       NULL, 0),
+
+       /* Output Pga */
+       SND_SOC_DAPM_SWITCH("LOUT L", SND_SOC_NOPM, 0, 0,
+               &loutl_enable_control),
+       SND_SOC_DAPM_SWITCH("LOUT R", SND_SOC_NOPM, 0, 0,
+               &loutr_enable_control),
+       SND_SOC_DAPM_SWITCH("HPO L", SND_SOC_NOPM, 0, 0,
+               &hpol_enable_control),
+       SND_SOC_DAPM_SWITCH("HPO R", SND_SOC_NOPM, 0, 0,
+               &hpor_enable_control),
+
+       /* Output Lines */
+       SND_SOC_DAPM_OUTPUT("HPO Pin"),
+       SND_SOC_DAPM_OUTPUT("SPDIF"),
+       SND_SOC_DAPM_OUTPUT("LINE3"),
+};
+
+static const struct snd_soc_dapm_route rt274_dapm_routes[] = {
+       {"DMIC1", NULL, "DMIC1 Pin"},
+       {"DMIC2", NULL, "DMIC2 Pin"},
+
+       {"ADC 0 Mux", "Mic", "MIC"},
+       {"ADC 0 Mux", "Dmic", "DMIC1"},
+       {"ADC 0 Mux", "Line1", "LINE1"},
+       {"ADC 0 Mux", "Line2", "LINE2"},
+       {"ADC 1 Mux", "Mic", "MIC"},
+       {"ADC 1 Mux", "Dmic", "DMIC2"},
+       {"ADC 1 Mux", "Line1", "LINE1"},
+       {"ADC 1 Mux", "Line2", "LINE2"},
+
+       {"ADC 0", NULL, "ADC 0 Mux"},
+       {"ADC 1", NULL, "ADC 1 Mux"},
+
+       {"AIF1TXL", NULL, "ADC 0"},
+       {"AIF1TXR", NULL, "ADC 0"},
+       {"AIF2TXL", NULL, "ADC 1"},
+       {"AIF2TXR", NULL, "ADC 1"},
+
+       {"DAC 0", NULL, "AIF1RXL"},
+       {"DAC 0", NULL, "AIF1RXR"},
+       {"DAC 1", NULL, "AIF2RXL"},
+       {"DAC 1", NULL, "AIF2RXR"},
+
+       {"DAC OUT0", NULL, "DAC 0"},
+
+       {"DAC OUT1", NULL, "DAC 1"},
+
+       {"LOUT Mux", "DAC OUT0", "DAC OUT0"},
+       {"LOUT Mux", "DAC OUT1", "DAC OUT1"},
+
+       {"LOUT L", "Switch", "LOUT Mux"},
+       {"LOUT R", "Switch", "LOUT Mux"},
+       {"LOUT L", NULL, "LOUT Power"},
+       {"LOUT R", NULL, "LOUT Power"},
+
+       {"LINE3", NULL, "LOUT L"},
+       {"LINE3", NULL, "LOUT R"},
+
+       {"HPO Mux", "DAC OUT0", "DAC OUT0"},
+       {"HPO Mux", "DAC OUT1", "DAC OUT1"},
+
+       {"HPO L", "Switch", "HPO Mux"},
+       {"HPO R", "Switch", "HPO Mux"},
+       {"HPO L", NULL, "HP Power"},
+       {"HPO R", NULL, "HP Power"},
+
+       {"HPO Pin", NULL, "HPO L"},
+       {"HPO Pin", NULL, "HPO R"},
+};
+
+static int rt274_hw_params(struct snd_pcm_substream *substream,
+                           struct snd_pcm_hw_params *params,
+                           struct snd_soc_dai *dai)
+{
+       struct snd_soc_codec *codec = dai->codec;
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+       unsigned int val = 0;
+       int d_len_code = 0, c_len_code = 0;
+
+       switch (params_rate(params)) {
+       /* bit 14 0:48K 1:44.1K */
+       case 44100:
+       case 48000:
+               break;
+       default:
+               dev_err(codec->dev, "Unsupported sample rate %d\n",
+                                       params_rate(params));
+               return -EINVAL;
+       }
+       switch (rt274->sys_clk) {
+       case 12288000:
+       case 24576000:
+               if (params_rate(params) != 48000) {
+                       dev_err(codec->dev, "Sys_clk is not matched (%d %d)\n",
+                                       params_rate(params), rt274->sys_clk);
+                       return -EINVAL;
+               }
+               break;
+       case 11289600:
+       case 22579200:
+               if (params_rate(params) != 44100) {
+                       dev_err(codec->dev, "Sys_clk is not matched (%d %d)\n",
+                                       params_rate(params), rt274->sys_clk);
+                       return -EINVAL;
+               }
+               break;
+       }
+
+       if (params_channels(params) <= 16) {
+               /* bit 3:0 Number of Channel */
+               val |= (params_channels(params) - 1);
+       } else {
+               dev_err(codec->dev, "Unsupported channels %d\n",
+                                       params_channels(params));
+               return -EINVAL;
+       }
+
+       switch (params_width(params)) {
+       /* bit 6:4 Bits per Sample */
+       case 16:
+               d_len_code = 0;
+               c_len_code = 0;
+               val |= (0x1 << 4);
+               break;
+       case 32:
+               d_len_code = 2;
+               c_len_code = 3;
+               val |= (0x4 << 4);
+               break;
+       case 20:
+               d_len_code = 1;
+               c_len_code = 1;
+               val |= (0x2 << 4);
+               break;
+       case 24:
+               d_len_code = 2;
+               c_len_code = 2;
+               val |= (0x3 << 4);
+               break;
+       case 8:
+               d_len_code = 3;
+               c_len_code = 0;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (rt274->master)
+               c_len_code = 0x3;
+
+       snd_soc_update_bits(codec,
+               RT274_I2S_CTRL1, 0xc018, d_len_code << 3 | c_len_code << 14);
+       dev_dbg(codec->dev, "format val = 0x%x\n", val);
+
+       snd_soc_update_bits(codec, RT274_DAC_FORMAT, 0x407f, val);
+       snd_soc_update_bits(codec, RT274_ADC_FORMAT, 0x407f, val);
+
+       return 0;
+}
+
+static int rt274_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
+{
+       struct snd_soc_codec *codec = dai->codec;
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+       case SND_SOC_DAIFMT_CBM_CFM:
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_I2S_MODE_MASK, RT274_I2S_MODE_M);
+               rt274->master = true;
+               break;
+       case SND_SOC_DAIFMT_CBS_CFS:
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_I2S_MODE_MASK, RT274_I2S_MODE_S);
+               rt274->master = false;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+       case SND_SOC_DAIFMT_I2S:
+               snd_soc_update_bits(codec, RT274_I2S_CTRL1,
+                                       RT274_I2S_FMT_MASK, RT274_I2S_FMT_I2S);
+               break;
+       case SND_SOC_DAIFMT_LEFT_J:
+               snd_soc_update_bits(codec, RT274_I2S_CTRL1,
+                                       RT274_I2S_FMT_MASK, RT274_I2S_FMT_LJ);
+               break;
+       case SND_SOC_DAIFMT_DSP_A:
+               snd_soc_update_bits(codec, RT274_I2S_CTRL1,
+                                       RT274_I2S_FMT_MASK, RT274_I2S_FMT_PCMA);
+               break;
+       case SND_SOC_DAIFMT_DSP_B:
+               snd_soc_update_bits(codec, RT274_I2S_CTRL1,
+                                       RT274_I2S_FMT_MASK, RT274_I2S_FMT_PCMB);
+               break;
+       default:
+               return -EINVAL;
+       }
+       /* bit 15 Stream Type 0:PCM 1:Non-PCM */
+       snd_soc_update_bits(codec, RT274_DAC_FORMAT, 0x8000, 0);
+       snd_soc_update_bits(codec, RT274_ADC_FORMAT, 0x8000, 0);
+
+       return 0;
+}
+
+static int rt274_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
+                       unsigned int freq_in, unsigned int freq_out)
+{
+       struct snd_soc_codec *codec = dai->codec;
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       switch (source) {
+       case RT274_PLL2_S_MCLK:
+               snd_soc_update_bits(codec, RT274_PLL2_CTRL,
+                               RT274_PLL2_SRC_MASK, RT274_PLL2_SRC_MCLK);
+               break;
+       default:
+               dev_warn(codec->dev, "invalid pll source, use BCLK\n");
+       case RT274_PLL2_S_BCLK:
+               snd_soc_update_bits(codec, RT274_PLL2_CTRL,
+                               RT274_PLL2_SRC_MASK, RT274_PLL2_SRC_BCLK);
+               break;
+       }
+
+       if (source == RT274_PLL2_S_BCLK) {
+               snd_soc_update_bits(codec, RT274_MCLK_CTRL,
+                               (0x3 << 12), (0x3 << 12));
+               switch (rt274->fs) {
+               case 50:
+                       snd_soc_write(codec, 0x7a, 0xaab6);
+                       snd_soc_write(codec, 0x7b, 0x0301);
+                       snd_soc_write(codec, 0x7c, 0x04fe);
+                       break;
+               case 64:
+                       snd_soc_write(codec, 0x7a, 0xaa96);
+                       snd_soc_write(codec, 0x7b, 0x8003);
+                       snd_soc_write(codec, 0x7c, 0x081e);
+                       break;
+               case 128:
+                       snd_soc_write(codec, 0x7a, 0xaa96);
+                       snd_soc_write(codec, 0x7b, 0x8003);
+                       snd_soc_write(codec, 0x7c, 0x080e);
+                       break;
+               default:
+                       dev_warn(codec->dev, "invalid freq_in, assume 4.8M\n");
+               case 100:
+                       snd_soc_write(codec, 0x7a, 0xaab6);
+                       snd_soc_write(codec, 0x7b, 0x0301);
+                       snd_soc_write(codec, 0x7c, 0x047e);
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static int rt274_set_dai_sysclk(struct snd_soc_dai *dai,
+                               int clk_id, unsigned int freq, int dir)
+{
+       struct snd_soc_codec *codec = dai->codec;
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+       unsigned int clk_src, mclk_en;
+
+       dev_dbg(codec->dev, "%s freq=%d\n", __func__, freq);
+
+       switch (clk_id) {
+       case RT274_SCLK_S_MCLK:
+               mclk_en = RT274_MCLK_MODE_EN;
+               clk_src = RT274_CLK_SRC_MCLK;
+               break;
+       case RT274_SCLK_S_PLL1:
+               mclk_en = RT274_MCLK_MODE_DIS;
+               clk_src = RT274_CLK_SRC_MCLK;
+               break;
+       case RT274_SCLK_S_PLL2:
+               mclk_en = RT274_MCLK_MODE_EN;
+               clk_src = RT274_CLK_SRC_PLL2;
+               break;
+       default:
+               mclk_en = RT274_MCLK_MODE_DIS;
+               clk_src = RT274_CLK_SRC_MCLK;
+               dev_warn(codec->dev, "invalid sysclk source, use PLL1\n");
+               break;
+       }
+       snd_soc_update_bits(codec, RT274_MCLK_CTRL,
+                       RT274_MCLK_MODE_MASK, mclk_en);
+       snd_soc_update_bits(codec, RT274_CLK_CTRL,
+                       RT274_CLK_SRC_MASK, clk_src);
+
+       switch (freq) {
+       case 19200000:
+               if (clk_id == RT274_SCLK_S_MCLK) {
+                       dev_err(codec->dev, "Should not use MCLK\n");
+                       return -EINVAL;
+               }
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL2, 0x40, 0x40);
+               break;
+       case 24000000:
+               if (clk_id == RT274_SCLK_S_MCLK) {
+                       dev_err(codec->dev, "Should not use MCLK\n");
+                       return -EINVAL;
+               }
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL2, 0x40, 0x0);
+               break;
+       case 12288000:
+       case 11289600:
+               snd_soc_update_bits(codec,
+                       RT274_MCLK_CTRL, 0x1fcf, 0x0008);
+               break;
+       case 24576000:
+       case 22579200:
+               snd_soc_update_bits(codec,
+                       RT274_MCLK_CTRL, 0x1fcf, 0x1543);
+               break;
+       default:
+               dev_err(codec->dev, "Unsupported system clock\n");
+               return -EINVAL;
+       }
+
+       rt274->sys_clk = freq;
+       rt274->clk_id = clk_id;
+
+       return 0;
+}
+
+static int rt274_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
+{
+       struct snd_soc_codec *codec = dai->codec;
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       dev_dbg(codec->dev, "%s ratio=%d\n", __func__, ratio);
+       rt274->fs = ratio;
+       if ((ratio / 50) == 0)
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, 0x1000, 0x1000);
+       else
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, 0x1000, 0x0);
+
+
+       return 0;
+}
+
+static int rt274_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
+                       unsigned int rx_mask, int slots, int slot_width)
+
+{
+       struct snd_soc_codec *codec = dai->codec;
+
+       if (rx_mask || tx_mask) {
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_TDM_EN, RT274_TDM_EN);
+       } else {
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_TDM_EN, RT274_TDM_DIS);
+               return 0;
+       }
+
+       switch (slots) {
+       case 4:
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_TDM_CH_NUM, RT274_TDM_4CH);
+               break;
+       case 2:
+               snd_soc_update_bits(codec,
+                       RT274_I2S_CTRL1, RT274_TDM_CH_NUM, RT274_TDM_2CH);
+               break;
+       default:
+               dev_err(codec->dev,
+                       "Support 2 or 4 slots TDM only\n");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int rt274_set_bias_level(struct snd_soc_codec *codec,
+                                enum snd_soc_bias_level level)
+{
+       switch (level) {
+       case SND_SOC_BIAS_PREPARE:
+               if (SND_SOC_BIAS_STANDBY ==
+                       snd_soc_codec_get_bias_level(codec)) {
+                       snd_soc_write(codec,
+                               RT274_SET_AUDIO_POWER, AC_PWRST_D0);
+               }
+               break;
+
+       case SND_SOC_BIAS_STANDBY:
+               snd_soc_write(codec,
+                       RT274_SET_AUDIO_POWER, AC_PWRST_D3);
+               break;
+
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+static irqreturn_t rt274_irq(int irq, void *data)
+{
+       struct rt274_priv *rt274 = data;
+       bool hp = false;
+       bool mic = false;
+       int ret, status = 0;
+
+       /* Clear IRQ */
+       regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
+                               RT274_IRQ_CLR, RT274_IRQ_CLR);
+
+       ret = rt274_jack_detect(rt274, &hp, &mic);
+
+       if (ret == 0) {
+               if (hp == true)
+                       status |= SND_JACK_HEADPHONE;
+
+               if (mic == true)
+                       status |= SND_JACK_MICROPHONE;
+
+               snd_soc_jack_report(rt274->jack, status,
+                       SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
+
+               pm_wakeup_event(&rt274->i2c->dev, 300);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static int rt274_probe(struct snd_soc_codec *codec)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       rt274->codec = codec;
+
+       if (rt274->i2c->irq) {
+               INIT_DELAYED_WORK(&rt274->jack_detect_work,
+                                       rt274_jack_detect_work);
+               schedule_delayed_work(&rt274->jack_detect_work,
+                                       msecs_to_jiffies(1250));
+       }
+
+       return 0;
+}
+
+static int rt274_remove(struct snd_soc_codec *codec)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       cancel_delayed_work_sync(&rt274->jack_detect_work);
+
+       return 0;
+}
+
+#ifdef CONFIG_PM
+static int rt274_suspend(struct snd_soc_codec *codec)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       regcache_cache_only(rt274->regmap, true);
+       regcache_mark_dirty(rt274->regmap);
+
+       return 0;
+}
+
+static int rt274_resume(struct snd_soc_codec *codec)
+{
+       struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
+
+       regcache_cache_only(rt274->regmap, false);
+       rt274_index_sync(codec);
+       regcache_sync(rt274->regmap);
+
+       return 0;
+}
+#else
+#define rt274_suspend NULL
+#define rt274_resume NULL
+#endif
+
+#define RT274_STEREO_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
+#define RT274_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+                       SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8)
+
+static const struct snd_soc_dai_ops rt274_aif_dai_ops = {
+       .hw_params = rt274_hw_params,
+       .set_fmt = rt274_set_dai_fmt,
+       .set_sysclk = rt274_set_dai_sysclk,
+       .set_pll = rt274_set_dai_pll,
+       .set_bclk_ratio = rt274_set_bclk_ratio,
+       .set_tdm_slot = rt274_set_tdm_slot,
+};
+
+static struct snd_soc_dai_driver rt274_dai[] = {
+       {
+               .name = "rt274-aif1",
+               .id = RT274_AIF1,
+               .playback = {
+                       .stream_name = "AIF1 Playback",
+                       .channels_min = 1,
+                       .channels_max = 2,
+                       .rates = RT274_STEREO_RATES,
+                       .formats = RT274_FORMATS,
+               },
+               .capture = {
+                       .stream_name = "AIF1 Capture",
+                       .channels_min = 1,
+                       .channels_max = 2,
+                       .rates = RT274_STEREO_RATES,
+                       .formats = RT274_FORMATS,
+               },
+               .ops = &rt274_aif_dai_ops,
+               .symmetric_rates = 1,
+       },
+};
+
+static const struct snd_soc_codec_driver soc_codec_dev_rt274 = {
+       .probe = rt274_probe,
+       .remove = rt274_remove,
+       .suspend = rt274_suspend,
+       .resume = rt274_resume,
+       .set_bias_level = rt274_set_bias_level,
+       .idle_bias_off = true,
+       .component_driver = {
+               .controls               = rt274_snd_controls,
+               .num_controls           = ARRAY_SIZE(rt274_snd_controls),
+               .dapm_widgets           = rt274_dapm_widgets,
+               .num_dapm_widgets       = ARRAY_SIZE(rt274_dapm_widgets),
+               .dapm_routes            = rt274_dapm_routes,
+               .num_dapm_routes        = ARRAY_SIZE(rt274_dapm_routes),
+       },
+       .set_jack = rt274_mic_detect,
+};
+
+static const struct regmap_config rt274_regmap = {
+       .reg_bits = 32,
+       .val_bits = 32,
+       .max_register = 0x05bfffff,
+       .volatile_reg = rt274_volatile_register,
+       .readable_reg = rt274_readable_register,
+       .reg_write = rl6347a_hw_write,
+       .reg_read = rl6347a_hw_read,
+       .cache_type = REGCACHE_RBTREE,
+       .reg_defaults = rt274_reg,
+       .num_reg_defaults = ARRAY_SIZE(rt274_reg),
+};
+
+#ifdef CONFIG_OF
+static const struct of_device_id rt274_of_match[] = {
+       {.compatible = "realtek,rt274"},
+       {},
+};
+MODULE_DEVICE_TABLE(of, rt274_of_match);
+#endif
+
+static const struct i2c_device_id rt274_i2c_id[] = {
+       {"rt274", 0},
+       {}
+};
+MODULE_DEVICE_TABLE(i2c, rt274_i2c_id);
+
+static const struct acpi_device_id rt274_acpi_match[] = {
+       { "10EC0274", 0 },
+       {},
+};
+MODULE_DEVICE_TABLE(acpi, rt274_acpi_match);
+
+static int rt274_i2c_probe(struct i2c_client *i2c,
+                          const struct i2c_device_id *id)
+{
+       struct rt274_priv *rt274;
+
+       int ret;
+       unsigned int val;
+
+       rt274 = devm_kzalloc(&i2c->dev, sizeof(*rt274),
+                               GFP_KERNEL);
+       if (rt274 == NULL)
+               return -ENOMEM;
+
+       rt274->regmap = devm_regmap_init(&i2c->dev, NULL, i2c, &rt274_regmap);
+       if (IS_ERR(rt274->regmap)) {
+               ret = PTR_ERR(rt274->regmap);
+               dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
+                       ret);
+               return ret;
+       }
+
+       regmap_read(rt274->regmap,
+               RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
+       if (val != RT274_VENDOR_ID) {
+               dev_err(&i2c->dev,
+                       "Device with ID register %#x is not rt274\n", val);
+               return -ENODEV;
+       }
+
+       rt274->index_cache = devm_kmemdup(&i2c->dev, rt274_index_def,
+                                         sizeof(rt274_index_def), GFP_KERNEL);
+       if (!rt274->index_cache)
+               return -ENOMEM;
+
+       rt274->index_cache_size = INDEX_CACHE_SIZE;
+       rt274->i2c = i2c;
+       i2c_set_clientdata(i2c, rt274);
+
+       /* reset codec */
+       regmap_write(rt274->regmap, RT274_RESET, 0);
+       regmap_update_bits(rt274->regmap, 0x1a, 0x4000, 0x4000);
+
+       /* Set Pad PDB is floating */
+       regmap_update_bits(rt274->regmap, RT274_PAD_CTRL12, 0x3, 0x0);
+       regmap_write(rt274->regmap, RT274_COEF5b_INDEX, 0x01);
+       regmap_write(rt274->regmap, RT274_COEF5b_COEF, 0x8540);
+       regmap_update_bits(rt274->regmap, 0x6f, 0x0100, 0x0100);
+       /* Combo jack auto detect */
+       regmap_write(rt274->regmap, 0x4a, 0x201b);
+       /* Aux mode off */
+       regmap_update_bits(rt274->regmap, 0x6f, 0x3000, 0x2000);
+       /* HP DC Calibration */
+       regmap_update_bits(rt274->regmap, 0x6f, 0xf, 0x0);
+       /* Set NID=58h.Index 00h [15]= 1b; */
+       regmap_write(rt274->regmap, RT274_COEF58_INDEX, 0x00);
+       regmap_write(rt274->regmap, RT274_COEF58_COEF, 0xb888);
+       msleep(500);
+       regmap_update_bits(rt274->regmap, 0x6f, 0xf, 0xb);
+       regmap_write(rt274->regmap, RT274_COEF58_INDEX, 0x00);
+       regmap_write(rt274->regmap, RT274_COEF58_COEF, 0x3888);
+       /* Set pin widget */
+       regmap_write(rt274->regmap, RT274_SET_PIN_HPO, 0x40);
+       regmap_write(rt274->regmap, RT274_SET_PIN_LOUT3, 0x40);
+       regmap_write(rt274->regmap, RT274_SET_MIC, 0x20);
+       regmap_write(rt274->regmap, RT274_SET_PIN_DMIC1, 0x20);
+
+       regmap_update_bits(rt274->regmap, RT274_I2S_CTRL2, 0xc004, 0x4004);
+       regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
+                               RT274_GPI2_SEL_MASK, RT274_GPI2_SEL_DMIC_CLK);
+
+       /* jack detection */
+       regmap_write(rt274->regmap, RT274_UNSOLICITED_HP_OUT, 0x81);
+       regmap_write(rt274->regmap, RT274_UNSOLICITED_MIC, 0x82);
+
+       if (rt274->i2c->irq) {
+               ret = request_threaded_irq(rt274->i2c->irq, NULL, rt274_irq,
+                       IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt274", rt274);
+               if (ret != 0) {
+                       dev_err(&i2c->dev,
+                               "Failed to reguest IRQ: %d\n", ret);
+                       return ret;
+               }
+       }
+
+       ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt274,
+                                    rt274_dai, ARRAY_SIZE(rt274_dai));
+
+       return ret;
+}
+
+static int rt274_i2c_remove(struct i2c_client *i2c)
+{
+       struct rt274_priv *rt274 = i2c_get_clientdata(i2c);
+
+       if (i2c->irq)
+               free_irq(i2c->irq, rt274);
+       snd_soc_unregister_codec(&i2c->dev);
+
+       return 0;
+}
+
+
+static struct i2c_driver rt274_i2c_driver = {
+       .driver = {
+                  .name = "rt274",
+                  .acpi_match_table = ACPI_PTR(rt274_acpi_match),
+#ifdef CONFIG_OF
+                  .of_match_table = of_match_ptr(rt274_of_match),
+#endif
+                  },
+       .probe = rt274_i2c_probe,
+       .remove = rt274_i2c_remove,
+       .id_table = rt274_i2c_id,
+};
+
+module_i2c_driver(rt274_i2c_driver);
+
+MODULE_DESCRIPTION("ASoC RT274 driver");
+MODULE_AUTHOR("Bard Liao <bardliao@realtek.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/codecs/rt274.h b/sound/soc/codecs/rt274.h
new file mode 100644 (file)
index 0000000..4fd1bcb
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * rt274.h  --  RT274 ALSA SoC audio driver
+ *
+ * Copyright 2016 Realtek Microelectronics
+ * Author: Bard Liao <bardliao@realtek.com>
+ *
+ * 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 __RT274_H__
+#define __RT274_H__
+
+#define VERB_CMD(V, N, D) ((N << 20) | (V << 8) | D)
+
+#define RT274_AUDIO_FUNCTION_GROUP                     0x01
+#define RT274_DAC_OUT0                                 0x02
+#define RT274_DAC_OUT1                                 0x03
+#define RT274_ADC_IN2                                  0x08
+#define RT274_ADC_IN1                                  0x09
+#define RT274_DIG_CVT                                  0x0a
+#define RT274_DMIC1                                    0x12
+#define RT274_DMIC2                                    0x13
+#define RT274_MIC                                      0x19
+#define RT274_LINE1                                    0x1a
+#define RT274_LINE2                                    0x1b
+#define RT274_LINE3                                    0x16
+#define RT274_SPDIF                                    0x1e
+#define RT274_VENDOR_REGISTERS                         0x20
+#define RT274_HP_OUT                                   0x21
+#define RT274_MIXER_IN1                                        0x22
+#define RT274_MIXER_IN2                                        0x23
+#define RT274_INLINE_CMD                               0x55
+
+#define RT274_SET_PIN_SFT                              6
+#define RT274_SET_PIN_ENABLE                           0x40
+#define RT274_SET_PIN_DISABLE                          0
+#define RT274_SET_EAPD_HIGH                            0x2
+#define RT274_SET_EAPD_LOW                             0
+
+#define RT274_MUTE_SFT                                 7
+
+/* Verb commands */
+#define RT274_RESET\
+       VERB_CMD(AC_VERB_SET_CODEC_RESET, RT274_AUDIO_FUNCTION_GROUP, 0)
+#define RT274_GET_PARAM(NID, PARAM) VERB_CMD(AC_VERB_PARAMETERS, NID, PARAM)
+#define RT274_SET_POWER(NID) VERB_CMD(AC_VERB_SET_POWER_STATE, NID, 0)
+#define RT274_SET_AUDIO_POWER RT274_SET_POWER(RT274_AUDIO_FUNCTION_GROUP)
+#define RT274_SET_HPO_POWER RT274_SET_POWER(RT274_HP_OUT)
+#define RT274_SET_DMIC1_POWER RT274_SET_POWER(RT274_DMIC1)
+#define RT274_LOUT_MUX\
+       VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT274_LINE3, 0)
+#define RT274_HPO_MUX\
+       VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT274_HP_OUT, 0)
+#define RT274_ADC0_MUX\
+       VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT274_MIXER_IN1, 0)
+#define RT274_ADC1_MUX\
+       VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT274_MIXER_IN2, 0)
+#define RT274_SET_MIC\
+       VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT274_MIC, 0)
+#define RT274_SET_PIN_LOUT3\
+       VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT274_LINE3, 0)
+#define RT274_SET_PIN_HPO\
+       VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT274_HP_OUT, 0)
+#define RT274_SET_PIN_DMIC1\
+       VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT274_DMIC1, 0)
+#define RT274_SET_PIN_SPDIF\
+       VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT274_SPDIF, 0)
+#define RT274_SET_PIN_DIG_CVT\
+       VERB_CMD(AC_VERB_SET_DIGI_CONVERT_1, RT274_DIG_CVT, 0)
+#define RT274_SET_AMP_GAIN_HPO\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_HP_OUT, 0)
+#define RT274_SET_AMP_GAIN_ADC_IN1\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_ADC_IN1, 0)
+#define RT274_SET_AMP_GAIN_ADC_IN2\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_ADC_IN2, 0)
+#define RT274_GET_HP_SENSE\
+       VERB_CMD(AC_VERB_GET_PIN_SENSE, RT274_HP_OUT, 0)
+#define RT274_GET_MIC_SENSE\
+       VERB_CMD(AC_VERB_GET_PIN_SENSE, RT274_MIC, 0)
+#define RT274_SET_DMIC2_DEFAULT\
+       VERB_CMD(AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, RT274_DMIC2, 0)
+#define RT274_SET_SPDIF_DEFAULT\
+       VERB_CMD(AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, RT274_SPDIF, 0)
+#define RT274_DAC0L_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_DAC_OUT0, 0xa000)
+#define RT274_DAC0R_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_DAC_OUT0, 0x9000)
+#define RT274_DAC1L_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_DAC_OUT1, 0xa000)
+#define RT274_DAC1R_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_DAC_OUT1, 0x9000)
+#define RT274_ADCL_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_ADC_IN1, 0x6000)
+#define RT274_ADCR_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_ADC_IN1, 0x5000)
+#define RT274_MIC_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_MIC, 0x7000)
+#define RT274_LOUTL_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_LINE3, 0xa000)
+#define RT274_LOUTR_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_LINE3, 0x9000)
+#define RT274_HPOL_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_HP_OUT, 0xa000)
+#define RT274_HPOR_GAIN\
+       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT274_HP_OUT, 0x9000)
+#define RT274_DAC_FORMAT\
+       VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT274_DAC_OUT0, 0)
+#define RT274_ADC_FORMAT\
+       VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT274_ADC_IN1, 0)
+#define RT274_COEF_INDEX\
+       VERB_CMD(AC_VERB_SET_COEF_INDEX, RT274_VENDOR_REGISTERS, 0)
+#define RT274_PROC_COEF\
+       VERB_CMD(AC_VERB_SET_PROC_COEF, RT274_VENDOR_REGISTERS, 0)
+#define RT274_UNSOLICITED_INLINE_CMD\
+       VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT274_INLINE_CMD, 0)
+#define RT274_UNSOLICITED_HP_OUT\
+       VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT274_HP_OUT, 0)
+#define RT274_UNSOLICITED_MIC\
+       VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT274_MIC, 0)
+#define RT274_COEF58_INDEX\
+       VERB_CMD(AC_VERB_SET_COEF_INDEX, 0x58, 0)
+#define RT274_COEF58_COEF\
+       VERB_CMD(AC_VERB_SET_PROC_COEF, 0x58, 0)
+#define RT274_COEF5b_INDEX\
+       VERB_CMD(AC_VERB_SET_COEF_INDEX, 0x5b, 0)
+#define RT274_COEF5b_COEF\
+       VERB_CMD(AC_VERB_SET_PROC_COEF, 0x5b, 0)
+#define RT274_SET_STREAMID_DAC0\
+       VERB_CMD(AC_VERB_SET_CHANNEL_STREAMID, RT274_DAC_OUT0, 0)
+#define RT274_SET_STREAMID_DAC1\
+       VERB_CMD(AC_VERB_SET_CHANNEL_STREAMID, RT274_DAC_OUT1, 0)
+#define RT274_SET_STREAMID_ADC1\
+       VERB_CMD(AC_VERB_SET_CHANNEL_STREAMID, RT274_ADC_IN1, 0)
+#define RT274_SET_STREAMID_ADC2\
+       VERB_CMD(AC_VERB_SET_CHANNEL_STREAMID, RT274_ADC_IN2, 0)
+
+/* Index registers */
+#define RT274_EAPD_GPIO_IRQ_CTRL       0x10
+#define RT274_PAD_CTRL12               0x35
+#define RT274_I2S_CTRL1                        0x63
+#define RT274_I2S_CTRL2                        0x64
+#define RT274_MCLK_CTRL                        0x71
+#define RT274_CLK_CTRL                 0x72
+#define RT274_PLL2_CTRL                        0x7b
+
+
+/* EAPD GPIO IRQ control (Index 0x10) */
+#define RT274_IRQ_DIS          (0x0 << 13)
+#define RT274_IRQ_EN           (0x1 << 13)
+#define RT274_IRQ_CLR          (0x1 << 12)
+#define RT274_GPI2_SEL_MASK    (0x3 << 7)
+#define RT274_GPI2_SEL_GPIO2   (0x0 << 7)
+#define RT274_GPI2_SEL_I2S     (0x1 << 7)
+#define RT274_GPI2_SEL_DMIC_CLK        (0x2 << 7)
+#define RT274_GPI2_SEL_CBJ     (0x3 << 7)
+
+/* Front I2S_Interface control 1 (Index 0x63) */
+#define RT274_I2S_MODE_MASK    (0x1 << 11)
+#define RT274_I2S_MODE_S       (0x0 << 11)
+#define RT274_I2S_MODE_M       (0x1 << 11)
+#define RT274_TDM_DIS          (0x0 << 10)
+#define RT274_TDM_EN           (0x1 << 10)
+#define RT274_TDM_CH_NUM       (0x1 << 7)
+#define RT274_TDM_2CH          (0x0 << 7)
+#define RT274_TDM_4CH          (0x1 << 7)
+#define RT274_I2S_FMT_MASK     (0x3 << 8)
+#define RT274_I2S_FMT_I2S      (0x0 << 8)
+#define RT274_I2S_FMT_LJ       (0x1 << 8)
+#define RT274_I2S_FMT_PCMA     (0x2 << 8)
+#define RT274_I2S_FMT_PCMB     (0x3 << 8)
+
+/* MCLK clock domain control (Index 0x71) */
+#define RT274_MCLK_MODE_MASK   (0x1 << 14)
+#define RT274_MCLK_MODE_DIS    (0x0 << 14)
+#define RT274_MCLK_MODE_EN     (0x1 << 14)
+
+/* Clock control (Index 0x72) */
+#define RT274_CLK_SRC_MASK     (0x7 << 3)
+#define RT274_CLK_SRC_MCLK     (0x0 << 3)
+#define RT274_CLK_SRC_PLL2     (0x3 << 3)
+
+/* PLL2 control (Index 0x7b) */
+#define RT274_PLL2_SRC_MASK    (0x1 << 13)
+#define RT274_PLL2_SRC_MCLK    (0x0 << 13)
+#define RT274_PLL2_SRC_BCLK    (0x1 << 13)
+
+/* HP-OUT (0x21) */
+#define RT274_M_HP_MUX_SFT     14
+#define RT274_HP_SEL_MASK      0x1
+#define RT274_HP_SEL_SFT       0
+#define RT274_HP_SEL_F         0
+#define RT274_HP_SEL_S         1
+
+/* ADC (0x22) (0x23) */
+#define RT274_ADC_SEL_MASK     0x7
+#define RT274_ADC_SEL_SFT      0
+#define RT274_ADC_SEL_MIC      0
+#define RT274_ADC_SEL_LINE1    1
+#define RT274_ADC_SEL_LINE2    2
+#define RT274_ADC_SEL_DMIC     3
+
+#define RT274_SCLK_S_MCLK      0
+#define RT274_SCLK_S_PLL1      1
+#define RT274_SCLK_S_PLL2      2
+
+#define RT274_PLL2_S_MCLK      0
+#define RT274_PLL2_S_BCLK      1
+
+enum {
+       RT274_AIF1,
+       RT274_AIFS,
+};
+
+#endif /* __RT274_H__ */
+
index 7899a2cdeb42f46c5d76cd051319a4b547b1ed04..af6325c78292d2e49eae9021887d437b9aac9e22 100644 (file)
@@ -1046,7 +1046,7 @@ static struct snd_soc_dai_driver rt286_dai[] = {
 
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt286 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt286 = {
        .probe = rt286_probe,
        .remove = rt286_remove,
        .suspend = rt286_suspend,
index d9e96e65e1c43f95cebd224960da0bd53de5c27d..ce963768449f188a804ad86136650b5afd540024 100644 (file)
@@ -1113,7 +1113,7 @@ static struct snd_soc_dai_driver rt298_dai[] = {
 
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt298 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt298 = {
        .probe = rt298_probe,
        .remove = rt298_remove,
        .suspend = rt298_suspend,
index 7ed62e8c80b4bfe98093f9166e68683a051dccdf..87a587fa90fe81ecfa019fcf805a425f648f6836 100644 (file)
@@ -260,7 +260,7 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform)
        return 0;
 }
 
-static struct snd_soc_platform_driver rt5514_spi_platform = {
+static const struct snd_soc_platform_driver rt5514_spi_platform = {
        .probe = rt5514_spi_pcm_probe,
        .ops = &rt5514_spi_pcm_ops,
 };
index 1b6796c4c471cc536e5d2dc6e3a10fb23d6bff66..7a1b36f6596a5cd1e07c867b3f9d565ee13f47ef 100644 (file)
@@ -1042,7 +1042,7 @@ struct snd_soc_dai_driver rt5514_dai[] = {
        }
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5514 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5514 = {
        .probe = rt5514_probe,
        .idle_bias_off = true,
        .set_bias_level = rt5514_set_bias_level,
index 7d6e0823f98f12023d2e2f95a7734ec51a6bef68..3c5f555ae6d085122d63206b5776a554381e1387 100644 (file)
@@ -1294,7 +1294,7 @@ static struct snd_soc_dai_driver rt5616_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5616 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5616 = {
        .probe = rt5616_probe,
        .suspend = rt5616_suspend,
        .resume = rt5616_resume,
index 0e418089c053ca716619da9ad79aca4090f8415b..55b04c55fb4b37b91f5e890e1daad3b8a9b4eee3 100644 (file)
@@ -1653,7 +1653,7 @@ static struct snd_soc_dai_driver rt5631_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5631 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5631 = {
        .probe = rt5631_probe,
        .set_bias_level = rt5631_set_bias_level,
        .suspend_bias_off = true,
index 1584ccc3a87bb9feffcdc09e8d800dfed045e43b..438fe52a12dfb50472437ca1204c7a2b1748ba34 100644 (file)
@@ -2259,7 +2259,7 @@ static struct snd_soc_dai_driver rt5640_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5640 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5640 = {
        .probe = rt5640_probe,
        .remove = rt5640_remove,
        .suspend = rt5640_suspend,
index 9ec58166f7c427f50d9b72ba1f6bc9cbf0362a50..ce31d0dcf894943bc401967c6509c2af786915c1 100644 (file)
@@ -3473,7 +3473,7 @@ static struct snd_soc_dai_driver rt5645_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5645 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5645 = {
        .probe = rt5645_probe,
        .remove = rt5645_remove,
        .suspend = rt5645_suspend,
index db05b60d50029c3d53b1bdbc5ad5d0118687887a..da60b28ba3dff4d7ec6adf61e01f76a03b46b074 100644 (file)
@@ -1664,7 +1664,7 @@ static struct snd_soc_dai_driver rt5651_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5651 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5651 = {
        .probe = rt5651_probe,
        .suspend = rt5651_suspend,
        .resume = rt5651_resume,
index 1b7060850340bd04041079ad09f9509b6f07b9ad..e8018fce7e4bae0c080741f5ad9c333d7490bcfe 100644 (file)
@@ -3730,7 +3730,7 @@ static struct snd_soc_dai_driver rt5659_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5659 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5659 = {
        .probe = rt5659_probe,
        .remove = rt5659_remove,
        .suspend = rt5659_suspend,
index c93490d77f2aea38af1b7f5f3c3dbe22f27f4a4f..d22ef00e0d964e09c9930f58d62c5f5c247e1a25 100644 (file)
@@ -1197,7 +1197,7 @@ static struct snd_soc_dai_driver rt5660_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5660 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5660 = {
        .probe = rt5660_probe,
        .remove = rt5660_remove,
        .suspend = rt5660_suspend,
index a33202affeb123aca338303d9d9c61bd7d5f5f39..ebc5e3b2b62b0b62b63a0805229c11bdb4fa229b 100644 (file)
@@ -2891,7 +2891,7 @@ static struct snd_soc_dai_driver rt5663_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5663 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5663 = {
        .probe = rt5663_probe,
        .remove = rt5663_remove,
        .suspend = rt5663_suspend,
index 370ed54d1e1590f1036a4ff4425c0462245d3360..2c405456d89f745ad2ee905f70ba57f174f45396 100644 (file)
@@ -4562,7 +4562,7 @@ static struct snd_soc_dai_driver rt5665_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5665 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5665 = {
        .probe = rt5665_probe,
        .remove = rt5665_remove,
        .suspend = rt5665_suspend,
index 0ec7985ed306612db13bd6314ccc94733e835cce..52a6ce8f0b39b1ba88c979ed4724ea20d56e267d 100644 (file)
@@ -2765,7 +2765,7 @@ static struct snd_soc_dai_driver rt5670_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5670 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5670 = {
        .probe = rt5670_probe,
        .remove = rt5670_remove,
        .suspend = rt5670_suspend,
index 36e530a36c8241d5005c8e8f5f933f2a405c3434..ce9b65d466e8f563e39a6989a4dde8194d0af68f 100644 (file)
@@ -4968,7 +4968,7 @@ static struct snd_soc_dai_driver rt5677_dai[] = {
        },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_rt5677 = {
+static const struct snd_soc_codec_driver soc_codec_dev_rt5677 = {
        .probe = rt5677_probe,
        .remove = rt5677_remove,
        .suspend = rt5677_suspend,
index 8f6814c1eb6b34aa7b83c04c87594cca18b90152..68e7020b287512a5b2b63fb0cc9bb16e469a9b6f 100644 (file)
@@ -1248,7 +1248,7 @@ static int sgtl5000_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver sgtl5000_driver = {
+static const struct snd_soc_codec_driver sgtl5000_driver = {
        .probe = sgtl5000_probe,
        .remove = sgtl5000_remove,
        .set_bias_level = sgtl5000_set_bias_level,
index 5344f4aa8fde74bdb78f302aa711100e391cd3d5..354dc0d64f11fbd29f59d324c8fd4fb9449acaee 100644 (file)
@@ -236,7 +236,7 @@ static struct regmap *si476x_get_regmap(struct device *dev)
        return dev_get_regmap(dev->parent, NULL);
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_si476x = {
+static const struct snd_soc_codec_driver soc_codec_dev_si476x = {
        .get_regmap = si476x_get_regmap,
        .component_driver = {
                .dapm_widgets           = si476x_dapm_widgets,
index 6bfd25c289d1924b4cc3d33892dba97e3366a351..50bc22266ecbc833cc79530adc6e910882c36f7d 100644 (file)
@@ -429,7 +429,7 @@ static int sirf_audio_codec_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_device_sirf_audio_codec = {
+static const struct snd_soc_codec_driver soc_codec_device_sirf_audio_codec = {
        .probe = sirf_audio_codec_probe,
        .remove = sirf_audio_codec_remove,
        .dapm_widgets = sirf_audio_codec_dapm_widgets,
index eae54c37cff948fcb38f0665d0a3dfd16e1acba1..887923e688499090cf16ef4b4be15da6320a2904 100644 (file)
@@ -883,7 +883,7 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver sn95031_codec = {
+static const struct snd_soc_codec_driver sn95031_codec = {
        .probe          = sn95031_codec_probe,
        .set_bias_level = sn95031_set_vaud_bias,
        .idle_bias_off  = true,
index 234f87b54838b964d6c42ab5db5c0214824b5707..7acd05140a810c53065186ce6aa6dfa22235c6f7 100644 (file)
@@ -37,7 +37,7 @@ static const struct snd_soc_dapm_route dir_routes[] = {
                        SNDRV_PCM_FMTBIT_S24_LE | \
                        SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
 
-static struct snd_soc_codec_driver soc_codec_spdif_dir = {
+static const struct snd_soc_codec_driver soc_codec_spdif_dir = {
        .component_driver = {
                .dapm_widgets           = dir_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(dir_widgets),
index ee367536a4980a930984f386e515a84f3517de9f..063a64ff82d3ed9c764f917b22f22ff291d3c3d1 100644 (file)
@@ -37,7 +37,7 @@ static const struct snd_soc_dapm_route dit_routes[] = {
        { "spdif-out", NULL, "Playback" },
 };
 
-static struct snd_soc_codec_driver soc_codec_spdif_dit = {
+static const struct snd_soc_codec_driver soc_codec_spdif_dit = {
        .component_driver = {
                .dapm_widgets           = dit_widgets,
                .num_dapm_widgets       = ARRAY_SIZE(dit_widgets),
index 38a85f3adc802ffea8c577065e69e9f9617ec081..15486fd16269d1719d8d080d1e939c0208b309ae 100644 (file)
@@ -710,7 +710,7 @@ static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id,
                        SSM2518_POWER1_NO_BCLK, val);
 }
 
-static struct snd_soc_codec_driver ssm2518_codec_driver = {
+static const struct snd_soc_codec_driver ssm2518_codec_driver = {
        .set_bias_level = ssm2518_set_bias_level,
        .set_sysclk = ssm2518_set_sysclk,
        .idle_bias_off = true,
index 993bde29ca1bcc6e611bf8d7b7b1f83caa0ce396..9b341c23f62bdf26f2f007efb76c8709104dc48a 100644 (file)
@@ -591,7 +591,7 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
        return ret;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_ssm2602 = {
+static const struct snd_soc_codec_driver soc_codec_dev_ssm2602 = {
        .probe =        ssm260x_codec_probe,
        .resume =       ssm2602_resume,
        .set_bias_level = ssm2602_set_bias_level,
index a622623e8558a44090a0ec4869f2aff3f70aa524..4afeddef77285386959bf106b66c5ac6b91e0c41 100644 (file)
@@ -417,7 +417,7 @@ static struct snd_soc_dai_driver ssm4567_dai = {
        .ops = &ssm4567_dai_ops,
 };
 
-static struct snd_soc_codec_driver ssm4567_codec_driver = {
+static const struct snd_soc_codec_driver ssm4567_codec_driver = {
        .set_bias_level = ssm4567_set_bias_level,
        .idle_bias_off = true,
 
index 9de7fe8af25508203ed9b9fa1f31491c2cdcee58..c66363a2cac7150e7240b1fd1c52bf547cf219e6 100644 (file)
@@ -307,7 +307,7 @@ static int stac9766_codec_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
+static const struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
        .component_driver = {
                .controls               = stac9766_snd_ac97_controls,
                .num_controls           = ARRAY_SIZE(stac9766_snd_ac97_controls),
index 8840f72f3c4ad7f2a2b5f8bcb0cb54745d8dfbf1..49cf9bc32eb6fd937d125a51364bd95231d64411 100644 (file)
@@ -660,7 +660,7 @@ static int tas2552_resume(struct snd_soc_codec *codec)
 #define tas2552_resume NULL
 #endif
 
-static struct snd_soc_codec_driver soc_codec_dev_tas2552 = {
+static const struct snd_soc_codec_driver soc_codec_dev_tas2552 = {
        .probe = tas2552_codec_probe,
        .remove = tas2552_codec_remove,
        .suspend =      tas2552_suspend,
index b7de857abb16bd5fa4cc28abdf76332040a23234..199272d5cb6a84cff97e74acd750b24ffe7b230d 100644 (file)
@@ -885,7 +885,7 @@ static int tas5086_remove(struct snd_soc_codec *codec)
        return 0;
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_tas5086 = {
+static const struct snd_soc_codec_driver soc_codec_dev_tas5086 = {
        .probe                  = tas5086_probe,
        .remove                 = tas5086_remove,
        .suspend                = tas5086_soc_suspend,
index c65b917598d2e20e7a93f3759c86e1f59bdf15f4..d14b78b1917b31ee014ace4d535dcb89528f99c8 100644 (file)
@@ -483,7 +483,7 @@ static const struct snd_soc_dapm_route tas5720_audio_map[] = {
        { "OUT", NULL, "DAC" },
 };
 
-static struct snd_soc_codec_driver soc_codec_dev_tas5720 = {
+static const struct snd_soc_codec_driver soc_codec_dev_tas5720 = {
        .probe = tas5720_codec_probe,
        .remove = tas5720_codec_remove,
        .suspend = tas5720_suspend,
index 628a8eeaab689eb85b6d3dba54ec5a98aefe6da0..3d42138a7974c0c3df1e2b10207ff54b37c5c229 100644 (file)
@@ -576,7 +576,7 @@ static int tlv320aic23_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = {
+static const struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = {
        .probe = tlv320aic23_codec_probe,
        .resume = tlv320aic23_resume,
        .set_bias_level = tlv320aic23_set_bias_level,
index 14aa96d417198500bf94a037e58592fad654119f..89421caaeb707709a3ee6a9c4876f71677cdd1d7 100644 (file)
@@ -319,7 +319,7 @@ static int aic26_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver aic26_soc_codec_dev = {
+static const struct snd_soc_codec_driver aic26_soc_codec_dev = {
        .probe = aic26_probe,
        .component_driver = {
                .controls               = aic26_snd_controls,
index d7d03c92cb8a6103b4c9db2148fe706e3bf68cfe..54a87a905eb63a4cc94e0d2f214992a1011d2cc2 100644 (file)
@@ -1185,7 +1185,7 @@ static int aic31xx_codec_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_driver_aic31xx = {
+static const struct snd_soc_codec_driver soc_codec_driver_aic31xx = {
        .probe                  = aic31xx_codec_probe,
        .remove                 = aic31xx_codec_remove,
        .set_bias_level         = aic31xx_set_bias_level,
index 28fdfc5ec54430d82083bc2e62d727ae5b046699..ccfc955321aec016aad21377ce8581e9e28c2c8c 100644 (file)
@@ -792,7 +792,7 @@ static int aic32x4_codec_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_aic32x4 = {
+static const struct snd_soc_codec_driver soc_codec_dev_aic32x4 = {
        .probe = aic32x4_codec_probe,
        .set_bias_level = aic32x4_set_bias_level,
        .suspend_bias_off = true,
index 29bf8c81ae028c0dad3dbff8c4cde406bf693c07..405f4602888aec6e952fcd9bf3dc865ce4d8e280 100644 (file)
@@ -1684,7 +1684,7 @@ static int aic3x_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
+static const struct snd_soc_codec_driver soc_codec_dev_aic3x = {
        .set_bias_level = aic3x_set_bias_level,
        .idle_bias_off = true,
        .probe = aic3x_probe,
index 7bcf01efdf9ad0df4253c40958df35fc1f01e5f7..5b94a151539ce1f828e4af7feb643be9d62eb7fd 100644 (file)
@@ -1433,7 +1433,7 @@ static int dac33_soc_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
+static const struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
        .read = dac33_read_reg_cache,
        .write = dac33_write_locked,
        .set_bias_level = dac33_set_bias_level,
index a2104d68169d9e6bc9aa30fe8269070a6dc88e40..d439c4c6fe50a9def802a3ad86419c0900527c17 100644 (file)
@@ -2191,7 +2191,7 @@ static int twl4030_soc_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_twl4030 = {
+static const struct snd_soc_codec_driver soc_codec_dev_twl4030 = {
        .probe = twl4030_soc_probe,
        .remove = twl4030_soc_remove,
        .read = twl4030_read,
index 2b6ad09e08868323e3e9bef25bd26b33bb5e2949..0dc21f7e0af923fc7073f72890af4b6837713b1b 100644 (file)
@@ -1155,7 +1155,7 @@ static int twl6040_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_twl6040 = {
+static const struct snd_soc_codec_driver soc_codec_dev_twl6040 = {
        .probe = twl6040_probe,
        .remove = twl6040_remove,
        .read = twl6040_read,
index 5fdee874406d72b1d444a9e3823dbe34c41e66cf..77c9cc4467b82d65f3f595a1cca5d6cddffe8fe8 100644 (file)
@@ -518,7 +518,7 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_uda134x = {
+static const struct snd_soc_codec_driver soc_codec_dev_uda134x = {
        .probe =        uda134x_soc_probe,
        .set_bias_level = uda134x_set_bias_level,
        .suspend_bias_off = true,
index 61cdc79840e70743229f5919bfc5aa3293f38270..926c81ae81853477241c1deecb5400a226f1665a 100644 (file)
@@ -720,7 +720,7 @@ static int uda1380_probe(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
+static const struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
        .probe =        uda1380_probe,
        .read =         uda1380_read_reg_cache,
        .write =        uda1380_write,
index fcffb6e707d9b8fcdacddb77d445eb5d738837ef..942f1644973e8dd52b4b68d71cbc73123b249cd5 100644 (file)
@@ -480,7 +480,7 @@ static int wl1273_remove(struct snd_soc_codec *codec)
        return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_wl1273 = {
+static const struct snd_soc_codec_driver soc_codec_dev_wl1273 = {
        .probe = wl1273_probe,
        .remove = wl1273_remove,
 
index 1fe358e6be6126572a924911742f111bc7eb5c44..f5006923be2e21549ab031c6fb3fc21aed9c2e29 100644 (file)
@@ -2027,7 +2027,7 @@ static struct snd_compr_ops wm5102_compr_ops = {
        .copy = wm_adsp_compr_copy,
 };
 
-static struct snd_soc_platform_driver wm5102_compr_platform = {
+static const struct snd_soc_platform_driver wm5102_compr_platform = {
        .compr_ops = &wm5102_compr_ops,
 };
 
index 1bc942152effa8f22e7202abd9d245a7ed8eb587..d6fae1397ce26860b8ddd2bbd6595b8ab862394c 100644 (file)
@@ -2382,7 +2382,7 @@ static struct snd_compr_ops wm5110_compr_ops = {
        .copy = wm_adsp_compr_copy,
 };
 
-static struct snd_soc_platform_driver wm5110_compr_platform = {
+static const struct snd_soc_platform_driver wm5110_compr_platform = {
        .compr_ops = &wm5110_compr_ops,
 };
 
index 032fb7cf6cbdfce68f00577c41243561b9534742..36d0a7087a540ca967bae4303f8797952b47cadd 100644 (file)
@@ -261,7 +261,7 @@ static const struct snd_soc_dapm_route aud96p22_dapm_routes[] = {
        { "LINEOUTMN", NULL, "LD2" },
 };
 
-static struct snd_soc_codec_driver aud96p22_driver = {
+static const struct snd_soc_codec_driver aud96p22_driver = {
        .component_driver = {
                .controls = aud96p22_snd_controls,
                .num_controls = ARRAY_SIZE(aud96p22_snd_controls),
index f07aa1e1cdfe1627aeef875524347d49253cfaa8..96a079d9f6979cc87eacaa66c1d0176eefc1edf4 100644 (file)
@@ -206,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) {