]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ALSA: hda - implement link_power ops for i915 display power control
authorMengdong Lin <mengdong.lin@intel.com>
Wed, 29 Apr 2015 09:43:29 +0000 (17:43 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 29 Apr 2015 10:27:53 +0000 (12:27 +0200)
This patch implements the bus link_power ops to request/release i915 display
power well. It can be used by the display codec which shares this power well
with GPU on Intel platforms.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_controller.h
sound/pci/hda/hda_intel.c

index e0bb6231ff0c2bea94335708b4cb14a16749ef29..120854ebd0546ea788c1aff81287108dd841508c 100644 (file)
@@ -775,9 +775,20 @@ static int azx_get_response(struct hdac_bus *bus, unsigned int addr,
                return azx_rirb_get_response(bus, addr, res);
 }
 
+static int azx_link_power(struct hdac_bus *bus, bool enable)
+{
+       struct azx *chip = bus_to_azx(bus);
+
+       if (chip->ops->link_power)
+               return chip->ops->link_power(chip, enable);
+       else
+               return -EINVAL;
+}
+
 static const struct hdac_bus_ops bus_core_ops = {
        .command = azx_send_cmd,
        .get_response = azx_get_response,
+       .link_power = azx_link_power,
 };
 
 #ifdef CONFIG_SND_HDA_DSP_LOADER
index 173bf7c85b6e7cc0b72233e7375d3c08d67b415a..3d26e613ab6768764ccded38bfd1506241cc0d33 100644 (file)
@@ -89,6 +89,8 @@ struct hda_controller_ops {
                                 struct vm_area_struct *area);
        /* Check if current position is acceptable */
        int (*position_check)(struct azx *chip, struct azx_dev *azx_dev);
+       /* enable/disable the link power */
+       int (*link_power)(struct azx *chip, bool enable);
 };
 
 struct azx_pcm {
index 2b823d4ad888e8772ca8746d451d7e4a60c6edbb..d7922a6df91b2fcbd0ad7fce9ba765fb2d222487 100644 (file)
@@ -540,6 +540,14 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)
        return 0;
 }
 
+/* Enable/disable i915 display power for the link */
+static int azx_intel_link_power(struct azx *chip, bool enable)
+{
+       struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+
+       return hda_display_power(hda, enable);
+}
+
 /*
  * Check whether the current DMA position is acceptable for updating
  * periods.  Returns non-zero if it's OK.
@@ -1786,6 +1794,7 @@ static const struct hda_controller_ops pci_hda_ops = {
        .substream_free_pages = substream_free_pages,
        .pcm_mmap_prepare = pcm_mmap_prepare,
        .position_check = azx_position_check,
+       .link_power = azx_intel_link_power,
 };
 
 static int azx_probe(struct pci_dev *pci,