Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2865177pxb; Fri, 12 Feb 2021 03:30:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJylNx06P1NOweP+9rcqAldiJS9iMfkOAHqDYzAG9KGQkWnAM+Ai/E/MF4a9mz2C7zXi90J3 X-Received: by 2002:a17:906:cc5d:: with SMTP id mm29mr2568796ejb.183.1613129441343; Fri, 12 Feb 2021 03:30:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613129441; cv=none; d=google.com; s=arc-20160816; b=H6lmcUL3g+EOdz/thvt5x4JBzMy/oa7UypxDcr2+le2/WKZ/U0l3eh33I1kHD+Wy4J 5fbI6xHTsY5XvkGcxVTUqbgawBmGl6lnQzaPFYpBWsa3TiIIo36KowJHBexaMiFjicHw dsNVfh7mYAn/0fKnDYjvNkWFJV0run4jfYHw2dibQzXsad9Fyv3bUmZWioeVuSOotnxr gh+NrgVSPtur+G3aJUvcz0S9uOg4zaVJpDrhey67VwkAqyMU3ZNDycg3ss4SuEFyka0x NQR3Z8ov8ak1EN8B3sdsRGo/Qkg3AZ1m7aMK4P6B5uWCH0k55RBFEU1F2hqtFy48fs8f 3xEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=e1PEFZ+w1+SD5+6Q+U31T7tSK1CUMBNeL6670Kzb0hQ=; b=g1ywOwlnYFZEu/BfsdlYf/fPEqKHwqQkM/qRhNHG253pFaqQPJ8IlmOXgAnJJsuuUF Riz8k7aYPE2mnoyhH6R0AHjEBOx33vbEwwmxM2Iv0n7b78qQaeQXJT2h0dS7sTzdgxR2 f7Bha3JFqYFBHfFIE0sWRZev46FHnRXlb0GbrkvHzGP/ZC/u5DWd8s1R94mJPcTMISb6 OBlBR/VmELCqKBQWSz7LthDmbnoMpmd6FhYJQuFEj3JkEvSTtO0BUwR376sP1irapL6j NY+nCegEJQmmZ3YSistJDhIIKMvE0pAcRM8cqj9tBktSxvYrX39wZHC1bUX9u15el5Vn AbRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si6625989ejd.83.2021.02.12.03.30.16; Fri, 12 Feb 2021 03:30:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbhBLL3X (ORCPT + 99 others); Fri, 12 Feb 2021 06:29:23 -0500 Received: from mga05.intel.com ([192.55.52.43]:24929 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhBLL3W (ORCPT ); Fri, 12 Feb 2021 06:29:22 -0500 IronPort-SDR: 4bb3RBDLKo2zOYT7DFfOFOI1adCHZC6rVwScRjKFGHVykPp5JcsUulY/7731HGxS6FGbS26aZa ZTQwuPxcI/2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9892"; a="267241350" X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="267241350" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 03:28:42 -0800 IronPort-SDR: 10O1SAjzXR69ChWDX/cN8MLqIhMl+B9DJrP/wpC0lbj/31h38bep16Q2KxFSH6WHcCsqjDYRfk 71qik/sLdFaA== X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="397943677" Received: from mpetrica-mobl.ger.corp.intel.com (HELO localhost) ([10.252.54.176]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 03:28:38 -0800 From: Jani Nikula To: Lyude Paul , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Sean Paul , open list Subject: Re: [RFC v4 05/11] drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit In-Reply-To: <20210208233902.1289693-6-lyude@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20210208233902.1289693-1-lyude@redhat.com> <20210208233902.1289693-6-lyude@redhat.com> Date: Fri, 12 Feb 2021 13:28:35 +0200 Message-ID: <87h7mhcyos.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 08 Feb 2021, Lyude Paul wrote: > Get rid of the extraneous switch case in here, and just open code > edp_backlight_mode as we only ever use it once. > > v4: > * Check that backlight mode is DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD, not > DP_EDP_BACKLIGHT_CONTROL_MODE_MASK - imirkin > > Signed-off-by: Lyude Paul > --- > .../gpu/drm/i915/display/intel_dp_aux_backlight.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 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 c37ccc8538cb..57218faed4a3 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > @@ -382,7 +382,7 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, > struct intel_dp *intel_dp = intel_attached_dp(connector); > struct drm_i915_private *i915 = dp_to_i915(intel_dp); > struct intel_panel *panel = &connector->panel; > - u8 dpcd_buf, new_dpcd_buf, edp_backlight_mode; > + u8 dpcd_buf, new_dpcd_buf; > u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; > > if (drm_dp_dpcd_readb(&intel_dp->aux, > @@ -393,12 +393,8 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, > } > > new_dpcd_buf = dpcd_buf; > - edp_backlight_mode = dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; > > - switch (edp_backlight_mode) { > - case DP_EDP_BACKLIGHT_CONTROL_MODE_PWM: > - case DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET: > - case DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT: > + if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) != DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { > new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; > new_dpcd_buf |= DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; > > @@ -406,13 +402,6 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, > pwmgen_bit_count) != 1) What baseline is this on? None that I can think of have the above != 1, they're all < 0 AFAICT. BR, Jani. > drm_dbg_kms(&i915->drm, > "Failed to write aux pwmgen bit count\n"); > - > - break; > - > - /* Do nothing when it is already DPCD mode */ > - case DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD: > - default: > - break; > } > > if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { -- Jani Nikula, Intel Open Source Graphics Center