Re: [PATCH 4/6] drm/i915: add opregion function to notify bios of adapter power state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/8/23 Jani Nikula <jani.nikula@xxxxxxxxx>:
> Notifying the bios lets it enter power saving states.
>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.h       |    3 +++
>  drivers/gpu/drm/i915/intel_opregion.c |   27 +++++++++++++++++++++++++++
>  2 files changed, 30 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1703029..e17a9a0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2179,12 +2179,15 @@ extern void intel_opregion_fini(struct drm_device *dev);
>  extern void intel_opregion_asle_intr(struct drm_device *dev);
>  extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
>                                          bool enable);
> +extern int intel_opregion_notify_adapter(struct drm_device *dev,
> +                                        pci_power_t state);
>  #else
>  static inline void intel_opregion_init(struct drm_device *dev) { return; }
>  static inline void intel_opregion_fini(struct drm_device *dev) { return; }
>  static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
>  static inline int
>  intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
> +intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)

I don't think this will compile when you don't have CONFIG_ACPI. The
"static inline int" part is missing, and the new function stole the
implementation of intel_opregion_notify_encoder.

Besides this, the patch looks correct. We could try to merge patches
1-4 before the others.

>  {
>         return 0;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 72a4af6..e47aefc 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -325,6 +325,33 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
>         return swsci(dev, SWSCI_SBCB_DISPLAY_POWER_STATE, parm, NULL);
>  }
>
> +static const struct {
> +       pci_power_t pci_power_state;
> +       u32 parm;
> +} power_state_map[] = {
> +       { PCI_D0,       0x00 },
> +       { PCI_D1,       0x01 },
> +       { PCI_D2,       0x02 },
> +       { PCI_D3hot,    0x04 },
> +       { PCI_D3cold,   0x04 },
> +};
> +
> +int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
> +{
> +       int i;
> +
> +       if (!HAS_DDI(dev))
> +               return 0;
> +
> +       for (i = 0; i < ARRAY_SIZE(power_state_map); i++) {
> +               if (state == power_state_map[i].pci_power_state)
> +                       return swsci(dev, SWSCI_SBCB_ADAPTER_POWER_STATE,
> +                                    power_state_map[i].parm, NULL);
> +       }
> +
> +       return -EINVAL;
> +}
> +
>  static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  {
>         struct drm_i915_private *dev_priv = dev->dev_private;
> --
> 1.7.9.5
>



-- 
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux