public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, Mengdong Lin <mengdong.lin@intel.com>
Subject: Re: [RFC PATCH 1/3] drm/i915: add opregion function to	notify BIOS of CDCLK changes
Date: Tue, 01 Jul 2014 17:11:55 +0300	[thread overview]
Message-ID: <871tu5god0.fsf@intel.com> (raw)
In-Reply-To: <e54d20f661447a999ac83cceab9a7000abc8f613.1404222047.git.jani.nikula@intel.com>

On Tue, 01 Jul 2014, Jani Nikula <jani.nikula@intel.com> wrote:
> Notifying the BIOS about CDCLK changes lets it program audio controller
> EM4/EM5 divider values accordingly.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h       |  6 ++++++
>  drivers/gpu/drm/i915/intel_opregion.c | 29 +++++++++++++++++++++++++++++
>  2 files changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 8cea59649ef2..2feb8215f9fa 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2602,6 +2602,7 @@ 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);
> +extern int intel_opregion_notify_cdclk(struct drm_device *dev, int cdclk);
>  #else
>  static inline int intel_opregion_setup(struct drm_device *dev) { return 0; }
>  static inline void intel_opregion_init(struct drm_device *dev) { return; }
> @@ -2617,6 +2618,11 @@ intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
>  {
>  	return 0;
>  }
> +static inline int
> +intel_opregion_notify_cdclk(struct drm_device *dev, int cdclk)
> +{
> +	return 0;
> +}
>  #endif
>  
>  /* intel_acpi.c */
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 2e2c71fcc9ed..6450d2625624 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -219,6 +219,7 @@ struct opregion_asle {
>  #define SWSCI_SBCB_SET_SPREAD_SPECTRUM	SWSCI_FUNCTION_CODE(SWSCI_SBCB, 18)
>  #define SWSCI_SBCB_POST_VBE_PM		SWSCI_FUNCTION_CODE(SWSCI_SBCB, 19)
>  #define SWSCI_SBCB_ENABLE_DISABLE_AUDIO	SWSCI_FUNCTION_CODE(SWSCI_SBCB, 21)
> +#define SWSCI_SBCB_CD_CLOCK_CHANGE	SWSCI_FUNCTION_CODE(SWSCI_SBCB, 22)
>  
>  #define ACPI_OTHER_OUTPUT (0<<8)
>  #define ACPI_VGA_OUTPUT (1<<8)
> @@ -395,6 +396,34 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
>  	return -EINVAL;
>  }
>  
> +int intel_opregion_notify_cdclk(struct drm_device *dev, int cdclk)
> +{
> +	u32 parm;
> +
> +	if (!IS_BROADWELL(dev))
> +		return 0;

To clarify, the spec I have states this call is just for Broadwell, so
it seems we can't just call this on Haswell to fix the bug.

BR,
Jani.

> +
> +	switch (cdclk) {
> +	case 337500:
> +		parm = 2;
> +		break;
> +	case 450000:
> +		parm = 0;
> +		break;
> +	case 540000:
> +		parm = 1;
> +		break;
> +	case 675000:
> +		parm = 3;
> +		break;
> +	default:
> +		WARN_ONCE(1, "unknown cdclk %d\n", cdclk);
> +		return -EINVAL;
> +	}
> +
> +	return swsci(dev, SWSCI_SBCB_CD_CLOCK_CHANGE, parm, NULL);
> +}
> +
>  static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -- 
> 2.0.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2014-07-01 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01 13:48 [RFC PATCH 0/3] drm/i915: tell bios to update audio controller em4/5 values Jani Nikula
2014-07-01 13:49 ` [RFC PATCH 1/3] drm/i915: add opregion function to notify BIOS of CDCLK changes Jani Nikula
2014-07-01 14:11   ` Jani Nikula [this message]
2014-07-01 13:49 ` [RFC PATCH 2/3] drm/i915: add opregion function to enable/disable audio device Jani Nikula
2014-07-01 13:49 ` [RFC PATCH 3/3] drm/i915: tell BIOS to update audio controller EM4/EM5 divider values Jani Nikula
2014-07-01 15:00 ` [RFC PATCH 4/3 :] drm/i915: tell BIOS to update " Jani Nikula

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=871tu5god0.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mengdong.lin@intel.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