]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - sound/soc/codecs/hdac_hda.c
ASoC: hdac_hda: Conditionally register dais for HDMI and Analog
[thirdparty/linux.git] / sound / soc / codecs / hdac_hda.c
index 355f30779a3487efc74d247eeaf63664051b39ff..b075689db2dcaa4afea6566e767ffbe8230c6df1 100644 (file)
@@ -132,6 +132,9 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = {
                .sig_bits = 24,
        },
 },
+};
+
+static struct snd_soc_dai_driver hdac_hda_hdmi_dais[] = {
 {
        .id = HDAC_HDMI_0_DAI_ID,
        .name = "intel-hdmi-hifi1",
@@ -607,8 +610,16 @@ static const struct snd_soc_component_driver hdac_hda_codec = {
        .endianness             = 1,
 };
 
+static const struct snd_soc_component_driver hdac_hda_hdmi_codec = {
+       .probe                  = hdac_hda_codec_probe,
+       .remove                 = hdac_hda_codec_remove,
+       .idle_bias_on           = false,
+       .endianness             = 1,
+};
+
 static int hdac_hda_dev_probe(struct hdac_device *hdev)
 {
+       struct hdac_hda_priv *hda_pvt = dev_get_drvdata(&hdev->dev);
        struct hdac_ext_link *hlink;
        int ret;
 
@@ -621,9 +632,15 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)
        snd_hdac_ext_bus_link_get(hdev->bus, hlink);
 
        /* ASoC specific initialization */
-       ret = devm_snd_soc_register_component(&hdev->dev,
-                                        &hdac_hda_codec, hdac_hda_dais,
-                                        ARRAY_SIZE(hdac_hda_dais));
+       if (hda_pvt->need_display_power)
+               ret = devm_snd_soc_register_component(&hdev->dev,
+                                               &hdac_hda_hdmi_codec, hdac_hda_hdmi_dais,
+                                               ARRAY_SIZE(hdac_hda_hdmi_dais));
+       else
+               ret = devm_snd_soc_register_component(&hdev->dev,
+                                               &hdac_hda_codec, hdac_hda_dais,
+                                               ARRAY_SIZE(hdac_hda_dais));
+
        if (ret < 0) {
                dev_err(&hdev->dev, "failed to register HDA codec %d\n", ret);
                return ret;