From: Joe Konno <joe.konno@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/7] drm/i915: make asle notifications update backlight on all connectors
Date: Wed, 06 Nov 2013 09:12:42 -0800 [thread overview]
Message-ID: <527A788A.8080401@linux.intel.com> (raw)
In-Reply-To: <8b90371d9355a4f29746104552ef9f5af5fb2620.1383237868.git.jani.nikula@intel.com>
On 10/31/2013 09:55 AM, Jani Nikula wrote:
> ALthough usually there's only one connector that supports backlight,
> this also finds the correct connector. Before, we only updated the
> connector on pipe A, which might not be the one with backlight. (This
> only made a difference on BYT.)
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_drv.h | 1 +
> drivers/gpu/drm/i915/intel_opregion.c | 43 ++++++++++-----------------------
> drivers/gpu/drm/i915/intel_panel.c | 4 +++
> 3 files changed, 18 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index b367f2f..3d2e0d2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -159,6 +159,7 @@ struct intel_panel {
>
> /* backlight */
> struct {
> + bool present;
> u32 level;
> bool enabled;
> struct backlight_device *device;
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 91b68dc..a0b5a99 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -396,13 +396,10 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
> static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> - struct drm_encoder *encoder;
> struct drm_connector *connector;
> - struct intel_connector *intel_connector = NULL;
> - struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[0];
> + struct intel_connector *intel_connector;
> + struct intel_panel *panel;
> struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> - u32 ret = 0;
> - bool found = false;
>
> DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
>
> @@ -414,38 +411,24 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
> return ASLC_BACKLIGHT_FAILED;
>
> mutex_lock(&dev->mode_config.mutex);
> +
> /*
> - * Could match the OpRegion connector here instead, but we'd also need
> - * to verify the connector could handle a backlight call.
> + * Update backlight on all connectors that support backlight (usually
> + * only one).
> */
> - list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
> - if (encoder->crtc == crtc) {
> - found = true;
> - break;
> - }
> -
> - if (!found) {
> - ret = ASLC_BACKLIGHT_FAILED;
> - goto out;
> - }
> -
> - list_for_each_entry(connector, &dev->mode_config.connector_list, head)
> - if (connector->encoder == encoder)
> - intel_connector = to_intel_connector(connector);
> -
> - if (!intel_connector) {
> - ret = ASLC_BACKLIGHT_FAILED;
> - goto out;
> - }
> -
> DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
> - intel_panel_set_backlight(intel_connector, bclp, 255);
> + list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
> + intel_connector = to_intel_connector(connector);
> + panel = &intel_connector->panel;
> + if (panel->backlight.present)
> + intel_panel_set_backlight(intel_connector, bclp, 255);
> + }
> iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
>
> -out:
> mutex_unlock(&dev->mode_config.mutex);
>
> - return ret;
> +
> + return 0;
> }
>
> static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi)
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 03e806f..e46226c 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -946,13 +946,17 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
>
> intel_backlight_device_register(intel_connector);
>
> + panel->backlight.present = true;
> +
> return 0;
> }
>
> void intel_panel_destroy_backlight(struct drm_connector *connector)
> {
> struct intel_connector *intel_connector = to_intel_connector(connector);
> + struct intel_panel *panel = &intel_connector->panel;
>
> + panel->backlight.present = false;
> intel_backlight_device_unregister(intel_connector);
> }
>
>
Tested-by: Joe Konno <joe.konno@intel.com>
next prev parent reply other threads:[~2013-11-06 17:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 16:55 [PATCH 0/7] drm/i915: per connector backlight, per chip vfuncs Jani Nikula
2013-10-31 16:55 ` [PATCH 1/7] drm/i915: move opregion asle request handling to a work queue Jani Nikula
2013-11-05 17:50 ` Jesse Barnes
2013-11-06 17:07 ` Joe Konno
2013-10-31 16:55 ` [PATCH 2/7] drm/i915: make backlight functions take a connector Jani Nikula
2013-11-06 17:08 ` Joe Konno
2013-10-31 16:55 ` [PATCH 3/7] drm/i915/vlv: use per-pipe backlight controls v2 Jani Nikula
2013-11-06 17:09 ` Joe Konno
2013-10-31 16:55 ` [PATCH 4/7] drm/i915: clean up backlight conditional build Jani Nikula
2013-11-06 17:11 ` Joe Konno
2013-10-31 16:55 ` [PATCH 5/7] drm/i915: make backlight info per-connector Jani Nikula
2013-11-06 17:12 ` Joe Konno
2013-10-31 16:55 ` [PATCH 6/7] drm/i915: handle backlight through chip specific functions Jani Nikula
2013-11-06 17:12 ` Joe Konno
2013-10-31 16:55 ` [PATCH 7/7] drm/i915: make asle notifications update backlight on all connectors Jani Nikula
2013-11-06 17:12 ` Joe Konno [this message]
2013-10-31 21:34 ` [PATCH 0/7] drm/i915: per connector backlight, per chip vfuncs Joe Konno
2013-11-01 13:28 ` Jani Nikula
2013-11-01 14:30 ` Joe Konno
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=527A788A.8080401@linux.intel.com \
--to=joe.konno@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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;
as well as URLs for NNTP newsgroup(s).