From nobody Wed Dec 31 14:59:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B456AC4167D for ; Thu, 2 Nov 2023 15:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347721AbjKBPNj (ORCPT ); Thu, 2 Nov 2023 11:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347540AbjKBPNA (ORCPT ); Thu, 2 Nov 2023 11:13:00 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2563918B for ; Thu, 2 Nov 2023 08:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698937974; x=1730473974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d5TnJD8mZT4XCWRMm2D4HqLq+7mmDEPFtEmjmsmEvVE=; b=mFLgUlR76hkhjwo4koa+PL3BEYgn3Yuw0U48qFrE+/jGbvO4h2JmWFri UAtTTfx7oa7ygFmfFVU5Y9bqAT9t0WrZvjr1LBj1esZCgvIbskYBEqizj ktbhtJB5SV+2ndjodZbncQIUdo2iAjttgz0x3jZL7abD3jXfxCDSjIiEv 4y4OPkD6E23XXO9MBw3cdnz+XV1zUhp4utVnW6FljyIP+6suhJChViZI0 WeTTZohX+2uQIAmukIWA9mF4hf18EBTwIgvlTzAMe498Mwrmibmx7STMo APdDFf24tzbrGqwmON70DfWKijTRRo9EdlBPg82biCuYNaOUHOIKVG37K g==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="373773478" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="373773478" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 08:12:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="711174074" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="711174074" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 02 Nov 2023 08:12:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 03C84690; Thu, 2 Nov 2023 17:12:30 +0200 (EET) From: Andy Shevchenko To: Jani Nikula , Andy Shevchenko , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Hans de Goede Subject: [PATCH v3 09/15] drm/i915/dsi: Remove GPIO lookup table at the end of intel_dsi_vbt_gpio_init() Date: Thu, 2 Nov 2023 17:12:22 +0200 Message-Id: <20231102151228.668842-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231102151228.668842-1-andriy.shevchenko@linux.intel.com> References: <20231102151228.668842-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede To properly deal with GPIOs used in MIPI panel sequences a temporary GPIO lookup will be used. Since there can only be 1 GPIO lookup table for the "0000:00:02.0" device this will not work if the GPIO lookup table used by intel_dsi_vbt_gpio_init() is still registered. After getting the "backlight" and "panel" GPIOs the lookup table registered by intel_dsi_vbt_gpio_init() is no longer necessary, remove it so that another temporary lookup-table for the "0000:00:02.0" device can be added. Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm= /i915/display/intel_dsi_vbt.c index d270437217b3..8e6beef90e5e 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c @@ -955,6 +955,7 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_ds= i, bool panel_is_on) struct intel_connector *connector =3D intel_dsi->attached_connector; struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; enum gpiod_flags flags =3D panel_is_on ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; + struct gpiod_lookup_table *gpiod_lookup_table =3D NULL; bool want_backlight_gpio =3D false; bool want_panel_gpio =3D false; struct pinctrl *pinctrl; @@ -962,12 +963,12 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_= dsi, bool panel_is_on) =20 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && mipi_config->pwm_blc =3D=3D PPS_BLC_PMIC) { - gpiod_add_lookup_table(&pmic_panel_gpio_table); + gpiod_lookup_table =3D &pmic_panel_gpio_table; want_panel_gpio =3D true; } =20 if (IS_VALLEYVIEW(dev_priv) && mipi_config->pwm_blc =3D=3D PPS_BLC_SOC) { - gpiod_add_lookup_table(&soc_panel_gpio_table); + gpiod_lookup_table =3D &soc_panel_gpio_table; want_panel_gpio =3D true; want_backlight_gpio =3D true; =20 @@ -984,6 +985,9 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_ds= i, bool panel_is_on) "Failed to set pinmux to PWM\n"); } =20 + if (gpiod_lookup_table) + gpiod_add_lookup_table(gpiod_lookup_table); + if (want_panel_gpio) { intel_dsi->gpio_panel =3D gpiod_get(dev->dev, "panel", flags); if (IS_ERR(intel_dsi->gpio_panel)) { @@ -1002,15 +1006,13 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *inte= l_dsi, bool panel_is_on) intel_dsi->gpio_backlight =3D NULL; } } + + if (gpiod_lookup_table) + gpiod_remove_lookup_table(gpiod_lookup_table); } =20 void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi) { - struct drm_device *dev =3D intel_dsi->base.base.dev; - struct drm_i915_private *dev_priv =3D to_i915(dev); - struct intel_connector *connector =3D intel_dsi->attached_connector; - struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; - if (intel_dsi->gpio_panel) { gpiod_put(intel_dsi->gpio_panel); intel_dsi->gpio_panel =3D NULL; @@ -1020,13 +1022,4 @@ void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *in= tel_dsi) gpiod_put(intel_dsi->gpio_backlight); intel_dsi->gpio_backlight =3D NULL; } - - if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && - mipi_config->pwm_blc =3D=3D PPS_BLC_PMIC) - gpiod_remove_lookup_table(&pmic_panel_gpio_table); - - if (IS_VALLEYVIEW(dev_priv) && mipi_config->pwm_blc =3D=3D PPS_BLC_SOC) { - pinctrl_unregister_mappings(soc_pwm_pinctrl_map); - gpiod_remove_lookup_table(&soc_panel_gpio_table); - } } --=20 2.40.0.1.gaa8946217a0b