public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Subject: Re: [PATCH 4/6] drm/i915: add opregion function to notify bios of adapter power state
Date: Thu, 29 Aug 2013 18:21:25 +0300	[thread overview]
Message-ID: <87li3kcykq.fsf@intel.com> (raw)
In-Reply-To: <CA+gsUGRjDU46EAMRazhGLCnBbPPe7Ey7FEz6qBiLkWjnDp=eKA@mail.gmail.com>

On Thu, 29 Aug 2013, Paulo Zanoni <przanoni@gmail.com> wrote:
> 2013/8/23 Jani Nikula <jani.nikula@intel.com>:
>> Notifying the bios lets it enter power saving states.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  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.

*facepalm* that's ugly.

Thanks for the review,
Jani.


>
> 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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2013-08-29 15:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 10:17 [PATCH 0/6] drm/i915: BIOS display/adapter power state notifications Jani Nikula
2013-08-23 10:17 ` [PATCH 1/6] drm/i915: expose intel_ddi_get_encoder_port() Jani Nikula
2013-08-28 17:21   ` Paulo Zanoni
2013-08-23 10:17 ` [PATCH 2/6] drm/i915: add plumbing for SWSCI Jani Nikula
2013-08-28 13:56   ` [PATCH] " Jani Nikula
2013-08-29 13:50     ` Paulo Zanoni
2013-08-29 14:57       ` Paulo Zanoni
2013-08-29 15:12       ` Jani Nikula
2013-08-29 17:15         ` Paulo Zanoni
2013-08-23 10:17 ` [PATCH 3/6] drm/i915: add opregion function to notify bios of encoder enable/disable Jani Nikula
2013-08-29 14:36   ` Paulo Zanoni
2013-08-29 15:18     ` Jani Nikula
2013-08-29 17:31       ` Paulo Zanoni
2013-08-29 15:20     ` Paulo Zanoni
2013-08-23 10:17 ` [PATCH 4/6] drm/i915: add opregion function to notify bios of adapter power state Jani Nikula
2013-08-29 15:07   ` Paulo Zanoni
2013-08-29 15:21     ` Jani Nikula [this message]
2013-08-23 10:17 ` [PATCH 5/6] DRAFT: drm/i915: do display power state notification on crtc enable/disable Jani Nikula
2013-08-29 15:19   ` Paulo Zanoni
2013-08-23 10:17 ` [PATCH 6/6] DRAFT: drm/i915: do adapter power state notification on PC8+ enable/disable Jani Nikula
2013-08-23 16:44   ` Paulo Zanoni
2013-08-23 17:57     ` Kristen Carlson Accardi
2013-08-23 19:41       ` Paulo Zanoni
2013-08-23 20:06         ` Ville Syrjälä
2013-08-23 20:14           ` Paulo Zanoni
2013-08-26  7:43             ` Ville Syrjälä
2013-08-26  9:19               ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2013-08-30 16:40 [PATCH 0/6] drm/i915: BIOS display/adapter power state notifications Jani Nikula
2013-08-30 16:40 ` [PATCH 4/6] drm/i915: add opregion function to notify bios of adapter power state Jani Nikula
2013-08-30 19:47   ` Paulo Zanoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87li3kcykq.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kristen.c.accardi@intel.com \
    --cc=przanoni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox