Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17234636ybl; Thu, 2 Jan 2020 01:15:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyGR5DfUAwPklufEWtjeKRasV6awleRVX3h9PngZgkRkEmmlr8LiXQeWb8q9M596hRq5YWG X-Received: by 2002:a9d:6441:: with SMTP id m1mr75208838otl.310.1577956523399; Thu, 02 Jan 2020 01:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577956523; cv=none; d=google.com; s=arc-20160816; b=fMRAA8NNGt7pNiELyEfZAtduyA3X0hCXnwJCa7J29w8QonA0nmcqS85sDXgjgmlwkL 8vQt+aNFHVTRay2jlnbIvpVe/ntFMaRpbrm5Z+Va1uL85Aald/3saV2cKBMzrGohE8oo ESdJNcixXtpsnAQgpZ1c0YvYozd9U5n+paCNcFXRQeIvjG6v3hCaT8gnDwnE7zwTuJ40 LXPOChvMNHRfg/UpD/mq3xDQk4fmGLAfcAiluvaORTL+Wjpx2PH+xgc+zHs4WbYuyEEm KJiTb8ZSDtNf33brakVqqQDKnEgY6Bnw4oF628cAlrTqqNCLwCehb421DhNtd96H5/K2 nZGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from; bh=yBE0x5IEfQUMHumgtseiG13rxXsbI/2wtWPQv6aGvq0=; b=fkyULDrLnnoRsHSQEqZj3ZCvGl0WDgU6Ag/3++z1Ddiu4ozC5j8zq1UfdD2Sf08l1k yZYDtG0ek2quJlz5bOiowVX6KZ1H+d5+6N8hdyDflOYa9LHtwtWLtVKzMXhiCKEngqso ZcwevlH3Uev7kZI1ijYMTeKXm87XZ8bajE0/zkYgwkFnzR0fLfqSxC9/vQbctoDxSJxh gV0AmtiOshZ1DKPhMO9KJFguZyV57t0n69psnq/tnOh1swpQ7oBavcFHS4HTct2iHZhd ZBG+w2/btmk/floq1sO+K4TvOgaW8AOR/axxDs/oMqvrm2Je27clsP1QoO2bw1adQ5nw 1A+w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si16686938oic.168.2020.01.02.01.15.10; Thu, 02 Jan 2020 01:15:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727924AbgABJON (ORCPT + 99 others); Thu, 2 Jan 2020 04:14:13 -0500 Received: from mga09.intel.com ([134.134.136.24]:25527 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbgABJON (ORCPT ); Thu, 2 Jan 2020 04:14:13 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 01:14:12 -0800 X-IronPort-AV: E=Sophos;i="5.69,386,1571727600"; d="scan'208";a="214099775" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 01:14:09 -0800 From: Jani Nikula To: Hans de Goede , Joonas Lahtinen , Rodrigo Vivi , Ville =?utf-8?B?U3lyasOkbMOk?= , intel-gfx , Lee Jones , Andy Shevchenko , Linus Walleij Cc: Hans de Goede , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH v2 3/5] drm/i915/dsi: Init panel-enable GPIO to low when the LCD is initially off (v2) In-Reply-To: <20191216205122.1850923-4-hdegoede@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20191216205122.1850923-1-hdegoede@redhat.com> <20191216205122.1850923-4-hdegoede@redhat.com> Date: Thu, 02 Jan 2020 11:14:06 +0200 Message-ID: <871rsiuso1.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Dec 2019, Hans de Goede wrote: > When the LCD has not been turned on by the firmware/GOP, because e.g. the > device was booted with an external monitor connected over HDMI, we should > not turn on the panel-enable GPIO when we request it. > > Turning on the panel-enable GPIO when we request it, means we turn it on > too early in the init-sequence, which causes some panels to not correctly > light up. > > This commits adds a panel_is_on parameter to intel_dsi_vbt_gpio_init() > and makes intel_dsi_vbt_gpio_init() set the initial GPIO value accordingly. > > This fixes the panel not lighting up on a Thundersoft TST168 tablet when > booted with an external monitor connected over HDMI. > > Changes in v2: > - Call intel_dsi_get_hw_state() to check if the panel is on instead of > relying on the current_mode pointer > > Reviewed-by: Linus Walleij > Signed-off-by: Hans de Goede > --- > drivers/gpu/drm/i915/display/intel_dsi.h | 2 +- > drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 7 +++---- > drivers/gpu/drm/i915/display/vlv_dsi.c | 4 +++- > 3 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dsi.h b/drivers/gpu/drm/i915/display/intel_dsi.h > index de7e51cd3460..675771ea91aa 100644 > --- a/drivers/gpu/drm/i915/display/intel_dsi.h > +++ b/drivers/gpu/drm/i915/display/intel_dsi.h > @@ -203,7 +203,7 @@ void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port); > > /* intel_dsi_vbt.c */ > bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id); > -void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi); > +void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on); > void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi); > void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi, > enum mipi_seq seq_id); > diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c > index 8be7d6c507aa..4210f449553e 100644 > --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c > +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c > @@ -688,17 +688,16 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) > * On some BYT/CHT devs some sequences are incomplete and we need to manually > * control some GPIOs. > */ > -void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi) > +void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on) > { > struct drm_device *dev = intel_dsi->base.base.dev; > struct drm_i915_private *dev_priv = to_i915(dev); > struct mipi_config *mipi_config = dev_priv->vbt.dsi.config; > + enum gpiod_flags flags = panel_is_on ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; > > if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && > mipi_config->pwm_blc == PPS_BLC_PMIC) { > - intel_dsi->gpio_panel = > - gpiod_get(dev->dev, "panel", GPIOD_OUT_HIGH); > - > + intel_dsi->gpio_panel = gpiod_get(dev->dev, "panel", flags); > if (IS_ERR(intel_dsi->gpio_panel)) { > DRM_ERROR("Failed to own gpio for panel control\n"); > intel_dsi->gpio_panel = NULL; > diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c > index c1edd8857af0..d0efee09c593 100644 > --- a/drivers/gpu/drm/i915/display/vlv_dsi.c > +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c > @@ -1759,6 +1759,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) > struct drm_connector *connector; > struct drm_display_mode *current_mode, *fixed_mode; > enum port port; > + enum pipe pipe; > > DRM_DEBUG_KMS("\n"); > > @@ -1857,7 +1858,8 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) > > vlv_dphy_param_init(intel_dsi); > > - intel_dsi_vbt_gpio_init(intel_dsi); > + intel_dsi_vbt_gpio_init(intel_dsi, > + intel_dsi_get_hw_state(intel_encoder, &pipe)); Feels a bit scary to call into the hooks before everything is initialized, but this seems safe. Fingers crossed. Reviewed-by: Jani Nikula > > drm_connector_init(dev, connector, &intel_dsi_connector_funcs, > DRM_MODE_CONNECTOR_DSI); -- Jani Nikula, Intel Open Source Graphics Center