Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6098794ybl; Sun, 22 Dec 2019 23:20:08 -0800 (PST) X-Google-Smtp-Source: APXvYqx85tIiqkdYLpiwm7j5z0x10vhJfQxtDrNRQZ1COc2y1qMDtnZieU31Cm64/08+kfTFUQpH X-Received: by 2002:a05:6830:1f94:: with SMTP id v20mr9555753otr.185.1577085608249; Sun, 22 Dec 2019 23:20:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577085608; cv=none; d=google.com; s=arc-20160816; b=xmQRhwQI5z8O9L/1ejDNT2dQNeM7xMO1xdo09ja6b5mnRdYiSvtgZaZDwwWVH64Duf uU5H3tQaOxY5DTjXrH8f5a6CJTzJtBfXqyeaasjNo78VoP2VvNiE3Hm+VGBsAaDuUI9M woerFOqwCJSBvie+L10hXNRswa+YM6enpNmdxCMsbKREew7sd+80qyIfkqoIWVa84q22 QFD7GbyWytcxHbYAAGQXhcjkxriNnVKeDngYvYzQuNeHCWa04Beqm2uzDA04wHiYNEiC 0J3BBwvdgfq0IIgTcEDM+f1AJ8uvQFl8xwRlFY4YEuZYEOMWwusogNok8Iirbv90GsGp iO0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ZvvmjsaQRSYI5Hwo2AugDJq97eSzPxkp9W+pRzyQSNY=; b=W/fjF23imKE8Cem7upX7C4SjFoCuPA+7eASI2Ffuy4j7xDzj5Hmk9+XASbfh648jGe W7sG7OaLPNUT+uk1DVIK/k/uU4afiDjk3hLrdUtjLtUG73HdBZkJLxXgiF/62PLgjoM8 08dkOBmn6Nq+mpzwsuJt7OnPYn74J+/BgXhnEOTDkHk9fDi9GoO/5OzzPfLxzST6Sejf 5e5cmydHGu5ms/C4FpQbZe3N2iDks9Usyx4WEn67ONSMGdpt90KzQZw7oHTgmodsycaP I17A6dLfm5Izh8F3gc+Ek8ArvITCh/or+WxgtqYyw8h6LoHil+DbsCN5oupc0ERiFmDF xnFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H6FUA0QA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si9527717otm.224.2019.12.22.23.19.56; Sun, 22 Dec 2019 23:20:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H6FUA0QA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725947AbfLWHTP (ORCPT + 99 others); Mon, 23 Dec 2019 02:19:15 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:42998 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725810AbfLWHTO (ORCPT ); Mon, 23 Dec 2019 02:19:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577085553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZvvmjsaQRSYI5Hwo2AugDJq97eSzPxkp9W+pRzyQSNY=; b=H6FUA0QAdZg4dDD4ImV5rgYnSSinogPhH1Z9N4AnbV8X5vm4FBhZhfwWqoMHvGKel/N0UV bPDzkOLqBzr3VPMnyGuDjXjoqw/4O2/iGUKg5KTGMu6kzmWy93ErWF4qx/O4rMXKuPsKr6 ZCk1HLsAVpDd2A6tmjNaLsCYqOhV7Xk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-dYUBmFnvMG2D053ZSakGLw-1; Mon, 23 Dec 2019 02:19:09 -0500 X-MC-Unique: dYUBmFnvMG2D053ZSakGLw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8471E802CAC; Mon, 23 Dec 2019 07:19:08 +0000 (UTC) Received: from localhost.localdomain (ovpn-12-202.pek2.redhat.com [10.72.12.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2F636444F; Mon, 23 Dec 2019 07:19:02 +0000 (UTC) Subject: Re: [3/5] drm/i915: Fix DPCD register order in intel_dp_aux_enable_backlight() To: Lyude Paul , intel-gfx@lists.freedesktop.org Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20191122231616.2574-4-lyude@redhat.com> From: Perr Yuan Message-ID: Date: Mon, 23 Dec 2019 02:19:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20191122231616.2574-4-lyude@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/22/19 6:16 PM, Lyude Paul wrote: > For eDP panels, it appears it's expected that so long as the panel is in > DPCD control mode that the brightness value is never set to 0. Instead, > if the desired effect is to set the panel's backlight to 0 we're > expected to simply turn off the backlight through the > DP_EDP_DISPLAY_CONTROL_REGISTER. > > We already do the latter correctly in intel_dp_aux_disable_backlight(). > But, we make the mistake of writing the DPCD registers in the wrong > order when enabling the backlight in intel_dp_aux_enable_backlight() > since we currently enable the backlight through > DP_EDP_DISPLAY_CONTROL_REGISTER before writing the brightness level. On > the X1 Extreme 2nd Generation, this appears to have the potential of > confusing the panel in such a way that further attempts to set the > brightness don't actually change the backlight as expected and leave it > off. Presumably, this happens because the incorrect register writing > order briefly leaves the panel with DPCD mode enabled and a 0 brightness > level set. > > So, reverse the order we write the DPCD registers when enabling the > panel backlight so that we write the brightness value first, and enable > the backlight second. This fix appears to be the final bit needed to get > the backlight on the ThinkPad X1 Extreme 2nd Generation's AMOLED screen > working. > > Signed-off-by: Lyude Paul > Reviewed-by: Jani Nikula > --- > drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > 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 0bf8772bc7bb..87b59db9ffe3 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > @@ -205,8 +205,9 @@ static void intel_dp_aux_enable_backlight(const struct intel_crtc_state *crtc_st > } > } > > + intel_dp_aux_set_backlight(conn_state, > + connector->panel.backlight.level); > set_aux_backlight_enable(intel_dp, true); > - intel_dp_aux_set_backlight(conn_state, connector->panel.backlight.level); > } > > static void intel_dp_aux_disable_backlight(const struct drm_connector_state *old_conn_state) > Tested-by:Perry Yuan