These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / sound / soc / codecs / ssm4567.c
index f7549cc..e619d56 100644 (file)
@@ -10,6 +10,7 @@
  * Licensed under the GPL-2.
  */
 
+#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
@@ -173,6 +174,12 @@ static const struct snd_soc_dapm_widget ssm4567_dapm_widgets[] = {
        SND_SOC_DAPM_SWITCH("Amplifier Boost", SSM4567_REG_POWER_CTRL, 3, 1,
                &ssm4567_amplifier_boost_control),
 
+       SND_SOC_DAPM_SIGGEN("Sense"),
+
+       SND_SOC_DAPM_PGA("Current Sense", SSM4567_REG_POWER_CTRL, 4, 1, NULL, 0),
+       SND_SOC_DAPM_PGA("Voltage Sense", SSM4567_REG_POWER_CTRL, 5, 1, NULL, 0),
+       SND_SOC_DAPM_PGA("VBAT Sense", SSM4567_REG_POWER_CTRL, 6, 1, NULL, 0),
+
        SND_SOC_DAPM_OUTPUT("OUT"),
 };
 
@@ -180,6 +187,13 @@ static const struct snd_soc_dapm_route ssm4567_routes[] = {
        { "OUT", NULL, "Amplifier Boost" },
        { "Amplifier Boost", "Switch", "DAC" },
        { "OUT", NULL, "DAC" },
+
+       { "Current Sense", NULL, "Sense" },
+       { "Voltage Sense", NULL, "Sense" },
+       { "VBAT Sense", NULL, "Sense" },
+       { "Capture Sense", NULL, "Current Sense" },
+       { "Capture Sense", NULL, "Voltage Sense" },
+       { "Capture Sense", NULL, "VBAT Sense" },
 };
 
 static int ssm4567_hw_params(struct snd_pcm_substream *substream,
@@ -359,7 +373,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec,
        case SND_SOC_BIAS_PREPARE:
                break;
        case SND_SOC_BIAS_STANDBY:
-               if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+               if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
                        ret = ssm4567_set_power(ssm4567, true);
                break;
        case SND_SOC_BIAS_OFF:
@@ -367,12 +381,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec,
                break;
        }
 
-       if (ret)
-               return ret;
-
-       codec->dapm.bias_level = level;
-
-       return 0;
+       return ret;
 }
 
 static const struct snd_soc_dai_ops ssm4567_dai_ops = {
@@ -392,6 +401,14 @@ static struct snd_soc_dai_driver ssm4567_dai = {
                .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
                        SNDRV_PCM_FMTBIT_S32,
        },
+       .capture = {
+               .stream_name = "Capture Sense",
+               .channels_min = 1,
+               .channels_max = 1,
+               .rates = SNDRV_PCM_RATE_8000_192000,
+               .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+                       SNDRV_PCM_FMTBIT_S32,
+       },
        .ops = &ssm4567_dai_ops,
 };
 
@@ -461,10 +478,20 @@ static const struct i2c_device_id ssm4567_i2c_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ssm4567_i2c_ids);
 
+#ifdef CONFIG_ACPI
+
+static const struct acpi_device_id ssm4567_acpi_match[] = {
+       { "INT343B", 0 },
+       {},
+};
+MODULE_DEVICE_TABLE(acpi, ssm4567_acpi_match);
+
+#endif
+
 static struct i2c_driver ssm4567_driver = {
        .driver = {
                .name = "ssm4567",
-               .owner = THIS_MODULE,
+               .acpi_match_table = ACPI_PTR(ssm4567_acpi_match),
        },
        .probe = ssm4567_i2c_probe,
        .remove = ssm4567_i2c_remove,