From patchwork Fri Aug 16 00:30:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Ausmus X-Patchwork-Id: 2845340 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E058BF546 for ; Fri, 16 Aug 2013 00:50:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F2F9202B4 for ; Fri, 16 Aug 2013 00:50:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E0A232021F for ; Fri, 16 Aug 2013 00:50:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5A31E853C for ; Thu, 15 Aug 2013 17:50:43 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 24FBEE6641 for ; Thu, 15 Aug 2013 17:32:08 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 15 Aug 2013 17:29:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,889,1367996400"; d="scan'208";a="387901448" Received: from jausmus-gentoo-dev5.jf.intel.com ([10.7.198.60]) by orsmga002.jf.intel.com with ESMTP; 15 Aug 2013 17:31:56 -0700 From: james.ausmus@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 15 Aug 2013 17:30:42 -0700 Message-Id: <1376613069-15790-18-git-send-email-james.ausmus@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> References: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] CHROMIUM: drm/i915: Move the backlight accessor functions in dev_priv X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stéphane Marchesin This abstracts those functions, so that we can plug-in platform-specific alternatives. BUG=chrome-os-partner:3276,chrome-os-partner:15248 TEST=by hand: compiles, works Change-Id: I29dd15722ffed8f5813b34bf0ce4431ce0524cc2 Reviewed-on: https://gerrit.chromium.org/gerrit/36974 Reviewed-by: Daniel Erat Commit-Ready: Stéphane Marchesin Tested-by: Stéphane Marchesin [marcheu: fixup for 3.8 rebase] Signed-off-by: Stéphane Marchesin --- drivers/gpu/drm/i915/i915_drv.h | 8 +++++++- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 3 --- drivers/gpu/drm/i915/intel_lvds.c | 4 ++-- drivers/gpu/drm/i915/intel_modes.c | 1 + drivers/gpu/drm/i915/intel_panel.c | 25 +++++++++++++++++-------- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 12ab3bd..67932ce 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -704,6 +704,13 @@ typedef struct drm_i915_private { struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ + /* Backlight driver */ + u32 (*get_backlight)(struct drm_device *dev); + u32 (*get_max_backlight)(struct drm_device *dev); + void (*set_backlight)(struct drm_device *dev, u32 level); + void (*disable_backlight)(struct drm_device *dev); + void (*enable_backlight)(struct drm_device *dev, enum pipe pipe); + /* Feature bits from the VBIOS */ unsigned int int_tv_support:1; unsigned int lvds_dither:1; @@ -915,7 +922,6 @@ typedef struct drm_i915_private { struct drm_property *broadcast_rgb_property; struct drm_property *force_audio_property; - bool hw_contexts_disabled; uint32_t hw_context_size; diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index fb3715b..d5f3105 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1196,7 +1196,7 @@ void ironlake_edp_backlight_on(struct intel_dp *intel_dp) I915_WRITE(PCH_PP_CONTROL, pp); POSTING_READ(PCH_PP_CONTROL); - intel_panel_enable_backlight(dev, pipe); + dev_priv->enable_backlight(dev, pipe); } void ironlake_edp_backlight_off(struct intel_dp *intel_dp) @@ -1208,7 +1208,7 @@ void ironlake_edp_backlight_off(struct intel_dp *intel_dp) if (!is_edp(intel_dp)) return; - intel_panel_disable_backlight(dev); + dev_priv->disable_backlight(dev); DRM_DEBUG_KMS("\n"); pp = ironlake_get_pp_control(dev_priv); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 8a1bd4a..4f41b8a 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -488,9 +488,6 @@ extern void intel_pch_panel_fitting(struct drm_device *dev, extern u32 intel_panel_get_max_backlight(struct drm_device *dev); extern void intel_panel_set_backlight(struct drm_device *dev, u32 level); extern int intel_panel_setup_backlight(struct drm_connector *connector); -extern void intel_panel_enable_backlight(struct drm_device *dev, - enum pipe pipe); -extern void intel_panel_disable_backlight(struct drm_device *dev); extern void intel_panel_destroy_backlight(struct drm_device *dev); extern enum drm_connector_status intel_panel_detect(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 17aee74..a2b9450 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -136,7 +136,7 @@ static void intel_enable_lvds(struct intel_encoder *encoder) if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000)) DRM_ERROR("timed out waiting for panel to power on\n"); - intel_panel_enable_backlight(dev, intel_crtc->pipe); + dev_priv->enable_backlight(dev, intel_crtc->pipe); } static void intel_disable_lvds(struct intel_encoder *encoder) @@ -156,7 +156,7 @@ static void intel_disable_lvds(struct intel_encoder *encoder) stat_reg = PP_STATUS; } - intel_panel_disable_backlight(dev); + dev_priv->disable_backlight(dev); I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); if (wait_for((I915_READ(stat_reg) & PP_ON) == 0, 1000)) diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index b00f1c8..0d9b115 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c @@ -126,3 +126,4 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector) drm_object_attach_property(&connector->base, prop, 0); } + diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index affd930..dddd4a1 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -32,6 +32,7 @@ #include #include "intel_drv.h" +#include "i915_drv.h" #define PCI_LBPC 0xf4 /* legacy/combination backlight modes */ @@ -245,7 +246,7 @@ static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val) if (i915_panel_invert_brightness > 0 || dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS) - return intel_panel_get_max_backlight(dev) - val; + return dev_priv->get_max_backlight(dev) - val; return val; } @@ -294,7 +295,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level return intel_pch_panel_set_backlight(dev, level); if (is_backlight_combination_mode(dev)) { - u32 max = intel_panel_get_max_backlight(dev); + u32 max = dev_priv->get_max_backlight(dev); u8 lbpc; lbpc = level * 0xfe / max + 1; @@ -318,7 +319,7 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level) intel_panel_actually_set_backlight(dev, level); } -void intel_panel_disable_backlight(struct drm_device *dev) +static void intel_panel_disable_backlight(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -340,13 +341,13 @@ void intel_panel_disable_backlight(struct drm_device *dev) } } -void intel_panel_enable_backlight(struct drm_device *dev, - enum pipe pipe) +static void intel_panel_enable_backlight(struct drm_device *dev, + enum pipe pipe) { struct drm_i915_private *dev_priv = dev->dev_private; if (dev_priv->backlight_level == 0) - dev_priv->backlight_level = intel_panel_get_max_backlight(dev); + dev_priv->backlight_level = dev_priv->get_max_backlight(dev); if (INTEL_INFO(dev)->gen >= 4) { uint32_t reg, tmp; @@ -395,7 +396,13 @@ static void intel_panel_init_backlight(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - dev_priv->backlight_level = intel_panel_get_backlight(dev); + dev_priv->get_backlight = intel_panel_get_backlight; + dev_priv->get_max_backlight = intel_panel_get_max_backlight; + dev_priv->set_backlight = intel_panel_set_backlight; + dev_priv->disable_backlight = intel_panel_disable_backlight; + dev_priv->enable_backlight = intel_panel_enable_backlight; + + dev_priv->backlight_level = dev_priv->get_backlight(dev); dev_priv->backlight_enabled = dev_priv->backlight_level != 0; } @@ -425,7 +432,9 @@ intel_panel_detect(struct drm_device *dev) static int intel_panel_update_status(struct backlight_device *bd) { struct drm_device *dev = bl_get_data(bd); - intel_panel_set_backlight(dev, bd->props.brightness); + struct drm_i915_private *dev_priv = dev->dev_private; + + dev_priv->set_backlight(dev, bd->props.brightness); return 0; }