From patchwork Mon Jun 20 07:20:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hogander, Jouni" X-Patchwork-Id: 12887066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD873C433EF for ; Mon, 20 Jun 2022 07:25:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5D5610E486; Mon, 20 Jun 2022 07:25:10 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8DAF310E486 for ; Mon, 20 Jun 2022 07:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655709909; x=1687245909; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z4Xo6ZdoUUDIxZO2KZ+KCvXOI2y6hS1HxcCiJO4WM7U=; b=TxZdNapG6Q+RwlpRToY2W7mnMMqnOT6aqh3l4oX5OFRhDJ8cmvT4RzxJ ajYmSnT+Db90OkUTjq/gAXrrETP3ZSkoaFZT7mvNGTT9hxkCrO2OtvPua i+yYY5NIk857/wJfH71aYE4LerD7zAN/2q9ntsUGpBHKPYvTJI/8MhF1F RqsHn10ZYePhImg7bsGRWhvQnXTT8BUuSthIvHP3mT+xZGd0GGzBB9vMJ JlfwRI9kwiwrpblmGOQQSvWHX92IdR1h7vW8AyjokPdE0iir/xhLihQKQ 2tRG5+UONDNMQ1IEVBaAUf/fy6CWR2opf5algZhBRFkYM4ZutZe9qkz7r g==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="268545346" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="268545346" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 00:25:09 -0700 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="642986889" Received: from gpetrea-mobl1.ger.corp.intel.com (HELO jhogande-mobl1.ger.corp.intel.com) ([10.249.41.172]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 00:25:06 -0700 From: =?utf-8?q?Jouni_H=C3=B6gander?= To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 4/4] drm/i915: Use luminance range calculated during edid parsing Date: Mon, 20 Jun 2022 10:20:19 +0300 Message-Id: <20220620072019.2710652-5-jouni.hogander@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220620072019.2710652-1-jouni.hogander@intel.com> References: <20220620072019.2710652-1-jouni.hogander@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Jouni_H=C3=B6gander?= , Jani Nikula , Manasi Navare , Mika Kahola Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of using fixed 0 - 512 range use luminance range calculated as a part of edid parsing. As a backup fall back to static 0 - 512. v2: Use values calculated during edid parsing Cc: Lyude Paul Cc: Mika Kahola Cc: Jani Nikula Cc: Manasi Navare Signed-off-by: Jouni Högander --- .../drm/i915/display/intel_dp_aux_backlight.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index c92d5bb2326a..b2666bd67701 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -276,8 +276,11 @@ intel_dp_aux_hdr_disable_backlight(const struct drm_connector_state *conn_state, static int intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pipe) { - struct drm_i915_private *i915 = to_i915(connector->base.dev); + struct drm_connector *conn_base = &connector->base; + struct drm_i915_private *i915 = to_i915(conn_base->dev); struct intel_panel *panel = &connector->panel; + struct drm_luminance_range_info *luminance_range = + &conn_base->display_info.luminance_range; int ret; if (panel->backlight.edp.intel.sdr_uses_aux) { @@ -293,8 +296,16 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi } } - panel->backlight.max = 512; - panel->backlight.min = 0; + if (!luminance_range->max_luminance) { + panel->backlight.max = 512; + panel->backlight.min = 0; + } else { + panel->backlight.max = luminance_range->max_luminance; + panel->backlight.min = luminance_range->min_luminance; + } + + drm_dbg(&i915->drm, "Using range %d..%d\n", panel->backlight.min, panel->backlight.max); + panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe); panel->backlight.enabled = panel->backlight.level != 0;