Merge branch 'topic/rt5677' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
authorMark Brown <broonie@kernel.org>
Fri, 16 Jun 2017 16:53:20 +0000 (17:53 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 16 Jun 2017 16:53:20 +0000 (17:53 +0100)
sound/soc/codecs/rt5677.c
sound/soc/intel/boards/bdw-rt5677.c

index 65ac4518ad06096e1ca8d04c539fc19ddf1b8f15..36e530a36c8241d5005c8e8f5f933f2a405c3434 100644 (file)
 
 #define RT5677_PR_BASE (RT5677_PR_RANGE_BASE + (0 * RT5677_PR_SPACING))
 
-/* GPIO indexes defined by ACPI */
-enum {
-       RT5677_GPIO_PLUG_DET            = 0,
-       RT5677_GPIO_MIC_PRESENT_L       = 1,
-       RT5677_GPIO_HOTWORD_DET_L       = 2,
-       RT5677_GPIO_DSP_INT             = 3,
-       RT5677_GPIO_HP_AMP_SHDN_L       = 4,
-};
-
 static const struct regmap_range_cfg rt5677_ranges[] = {
        {
                .name = "PR",
@@ -5030,7 +5021,6 @@ static const struct regmap_config rt5677_regmap = {
 static const struct i2c_device_id rt5677_i2c_id[] = {
        { "rt5677", RT5677 },
        { "rt5676", RT5676 },
-       { "RT5677CE:00", RT5677 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
@@ -5041,28 +5031,19 @@ static const struct of_device_id rt5677_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rt5677_of_match);
 
-static const struct acpi_gpio_params plug_det_gpio = { RT5677_GPIO_PLUG_DET, 0, false };
-static const struct acpi_gpio_params mic_present_gpio = { RT5677_GPIO_MIC_PRESENT_L, 0, false };
-static const struct acpi_gpio_params headphone_enable_gpio = { RT5677_GPIO_HP_AMP_SHDN_L, 0, false };
-
-static const struct acpi_gpio_mapping bdw_rt5677_gpios[] = {
-       { "plug-det-gpios", &plug_det_gpio, 1 },
-       { "mic-present-gpios", &mic_present_gpio, 1 },
-       { "headphone-enable-gpios", &headphone_enable_gpio, 1 },
-       { NULL },
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id rt5677_acpi_match[] = {
+       { "RT5677CE", RT5677 },
+       { }
 };
+MODULE_DEVICE_TABLE(acpi, rt5677_acpi_match);
+#endif
 
 static void rt5677_read_acpi_properties(struct rt5677_priv *rt5677,
                struct device *dev)
 {
-       int ret;
        u32 val;
 
-       ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
-                       bdw_rt5677_gpios);
-       if (ret)
-               dev_warn(dev, "Failed to add driver gpios\n");
-
        if (!device_property_read_u32(dev, "DCLK", &val))
                rt5677->pdata.dmic2_clk_pin = val;
 
@@ -5301,6 +5282,7 @@ static struct i2c_driver rt5677_i2c_driver = {
        .driver = {
                .name = "rt5677",
                .of_match_table = rt5677_of_match,
+               .acpi_match_table = ACPI_PTR(rt5677_acpi_match),
        },
        .probe = rt5677_i2c_probe,
        .remove   = rt5677_i2c_remove,
index 14d9693c1641b460159f9b13ba0f0e8298825e69..bb98e94dd6f93beed94a5337a19bea79df91e496 100644 (file)
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/gpio/consumer.h>
@@ -120,6 +121,26 @@ static struct snd_soc_jack_gpio mic_jack_gpio = {
        .invert                 = 1,
 };
 
+/* GPIO indexes defined by ACPI */
+enum {
+       RT5677_GPIO_PLUG_DET            = 0,
+       RT5677_GPIO_MIC_PRESENT_L       = 1,
+       RT5677_GPIO_HOTWORD_DET_L       = 2,
+       RT5677_GPIO_DSP_INT             = 3,
+       RT5677_GPIO_HP_AMP_SHDN_L       = 4,
+};
+
+static const struct acpi_gpio_params plug_det_gpio = { RT5677_GPIO_PLUG_DET, 0, false };
+static const struct acpi_gpio_params mic_present_gpio = { RT5677_GPIO_MIC_PRESENT_L, 0, false };
+static const struct acpi_gpio_params headphone_enable_gpio = { RT5677_GPIO_HP_AMP_SHDN_L, 0, false };
+
+static const struct acpi_gpio_mapping bdw_rt5677_gpios[] = {
+       { "plug-det-gpios", &plug_det_gpio, 1 },
+       { "mic-present-gpios", &mic_present_gpio, 1 },
+       { "headphone-enable-gpios", &headphone_enable_gpio, 1 },
+       { NULL },
+};
+
 static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
                        struct snd_pcm_hw_params *params)
 {
@@ -184,6 +205,12 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd)
                        snd_soc_card_get_drvdata(rtd->card);
        struct snd_soc_codec *codec = rtd->codec;
        struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+       int ret;
+
+       ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(codec->dev),
+                       bdw_rt5677_gpios);
+       if (ret)
+               dev_warn(codec->dev, "Failed to add driver gpios\n");
 
        /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1.
         * The ASRC clock source is clk_i2s1_asrc.