From patchwork Fri Aug 4 21:06:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 131377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp128334vqr; Fri, 4 Aug 2023 15:11:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqPAKrHVzI2XFcbTcbcd6V6RS6O3AVvBDzIOhBz7+ITowTlgxxWaahkYWdyMR6sdkWdrfU X-Received: by 2002:a05:6a20:7289:b0:131:dd92:4805 with SMTP id o9-20020a056a20728900b00131dd924805mr3281903pzk.57.1691187090304; Fri, 04 Aug 2023 15:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691187090; cv=none; d=google.com; s=arc-20160816; b=J1WQzOVllxoGSHNxGJlC4C19rCSH+WjBjBpq44IC1ouOmW5IlBOlT7q1hxGgQ8ZSQO 8sL2paAo7Ku1nei5puJqEm7USaSyhyNDSpYzUt6tVtoEJWmfoheLap4TCJTxK74xmIBH MD8fqjGdiN1CQM1fi5dkB9cNjF3lhaB4OfmQFEHEsqcLxKPEkS3V2XqQ0QduL4YDYZNz SQ172snlLe8q4BUqqC6FaorprybQhpbaCsoUp2EOFSzwps1q8HX/CIKP+DbfapwPrAca 5UiTJbp0r64CDGsWjYPaTawFyg++/44kvOmWptH0flH/R8BhuUGb+j2HjRQqhTuE40Fc D/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VrVsSAYx25sDv9lFVoDtvszHTPMnF37tDWONYbWLGR8=; fh=4Lbs+2siIZu2VjBgeWp6zR+UXvywmr0wcjkJrLkq7lo=; b=Kseu2hXq5UZouovlrOQQMDS8/lS5aiGIwuyTrUkKj/p/q3lstWkOQkuHlP1tRmEuWP HGIz+XHx+QMq+gJez1iCk6uxjSuW+cRIxLNI6+UHBHUzukyFJX27Qe42oq1s8FEMequw UD/8Zwwh8Jc3ZY1u6i2869SmBmvZRCGWrOGDSvG6c2i/+MQ8RYVUwmzcpF01IZ+eA6wC JHwtG+VTHapSMC0+rh8HQHTlTtSuQ9s+X1UMkUWjBChU9VPZjCr/8Za7w8l5/YDUhpsR ZAC1mio0AjnB8xNb/jbTCs/02X36SB8xRH5q7ZCWmaVQGyg4kNhS1jeGFL3lOYGSn8DF oBIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bjtuOkhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a656881000000b0055baed7e7efsi2300660pgt.671.2023.08.04.15.11.14; Fri, 04 Aug 2023 15:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bjtuOkhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbjHDVI2 (ORCPT + 99 others); Fri, 4 Aug 2023 17:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231161AbjHDVII (ORCPT ); Fri, 4 Aug 2023 17:08:08 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96072559D for ; Fri, 4 Aug 2023 14:07:16 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-686e29b058cso1941128b3a.1 for ; Fri, 04 Aug 2023 14:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691183234; x=1691788034; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VrVsSAYx25sDv9lFVoDtvszHTPMnF37tDWONYbWLGR8=; b=bjtuOkhvCsvKCv6YFVVUneXqB8dbj9NYo2prCIKW5jzlYf1sMgNWNmMgg3RmhJj9tQ RSvxrlSscMOBT2hSiivH2oP7EDhXQYbblnVomJpvUtHRY+t0E9nZr7nJ0+3zPsAz9Xx4 KggSiAqyZHCICJjvHlVpQWwtE8TOMa0jzVsuo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691183234; x=1691788034; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VrVsSAYx25sDv9lFVoDtvszHTPMnF37tDWONYbWLGR8=; b=IOULKJVO9JTzdNXFMJSsdAlILvWTJG2BMZQYj2n642Y41pUyRsFwYrRk8QbfXz5iju wFUDHTY4YGkPb6eluGrgwgScAVvdj9A4rRKiGJSVKhQ6uNdQNheZGsjbVrsgqfFYYU7U txcu0JykUzwuir+ymeoZdsvPeWPQxeb6iebT1WSanN+uIyk/X3pYdlo2ztBTJ+zMLVpy uY3627gJHpkq4MBbJLk6m8Fhwmrj73WFCGXNjKMWEyA67HAKTbix1PpY/FNYf4/6X/Ru xyzSYA2Qf2+r/n9NyIeg+XJlF/XgT5rzp0BkvyGaptmxAwcpw/BWGDfzhcxKdENgZPs2 gJJQ== X-Gm-Message-State: AOJu0Ywn9Tc0w0eKow3JixD1xvgXB6cxxn93l1a9y0K5CaySFOYyEQbR Z1zBIygvINJeFIoz8Ow5BCXYRA== X-Received: by 2002:a05:6a00:130f:b0:66d:514c:cb33 with SMTP id j15-20020a056a00130f00b0066d514ccb33mr2928832pfu.6.1691183233978; Fri, 04 Aug 2023 14:07:13 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e186:e5d2:e60:bad3]) by smtp.gmail.com with ESMTPSA id n22-20020aa78a56000000b0068664ace38asm2037584pfa.19.2023.08.04.14.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:07:13 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Douglas Anderson , Daniel Vetter , David Airlie , Jianhua Lu , Neil Armstrong , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [RFC PATCH 01/10] drm/panel: Don't store+check prepared/enabled for simple cases Date: Fri, 4 Aug 2023 14:06:04 -0700 Message-ID: <20230804140605.RFC.1.Ia54954fd2f7645c1b86597494902973f57feeb71@changeid> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> References: <20230804210644.1862287-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773338194055753940 X-GMAIL-MSGID: 1773338194055753940 As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. This pile of panel drivers appears to be simple to handle. Based on code inspection they seemed to be using the prepared/enabled state simply for double-checking that nothing else in the kernel called them inconsistently. Now that the core drm_panel is doing the double checking (and warning) it should be very clear that these devices don't need their own double-check. Signed-off-by: Douglas Anderson --- .../drm/panel/panel-asus-z00t-tm5p5-n35596.c | 9 ----- .../gpu/drm/panel/panel-boe-bf060y8m-aj0.c | 9 ----- drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 9 ----- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 9 ----- drivers/gpu/drm/panel/panel-novatek-nt36523.c | 12 ------ drivers/gpu/drm/panel/panel-raydium-rm68200.c | 38 ------------------- .../panel/panel-samsung-s6e88a0-ams452ef01.c | 10 ----- drivers/gpu/drm/panel/panel-samsung-sofef00.c | 9 ----- .../gpu/drm/panel/panel-sharp-ls060t1sx01.c | 10 ----- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 9 ----- .../panel/panel-sony-tulip-truly-nt35521.c | 18 --------- .../drm/panel/panel-startek-kd070fhfid015.c | 11 ------ drivers/gpu/drm/panel/panel-truly-nt35597.c | 20 ---------- drivers/gpu/drm/panel/panel-visionox-r66451.c | 16 -------- .../gpu/drm/panel/panel-visionox-rm69299.c | 8 ---- .../gpu/drm/panel/panel-visionox-vtdr6130.c | 9 ----- 16 files changed, 206 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c index 075a7af81eff..bcaa63d1955f 100644 --- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c +++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c @@ -16,7 +16,6 @@ struct tm5p5_nt35596 { struct mipi_dsi_device *dsi; struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; - bool prepared; }; static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel) @@ -112,9 +111,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) { dev_err(dev, "Failed to enable regulators: %d\n", ret); @@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -142,9 +137,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = tm5p5_nt35596_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -153,7 +145,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel) regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c index 90098b753e3b..e77db8597eb7 100644 --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c @@ -34,7 +34,6 @@ struct boe_bf060y8m_aj0 { struct mipi_dsi_device *dsi; struct regulator_bulk_data vregs[BF060Y8M_VREG_MAX]; struct gpio_desc *reset_gpio; - bool prepared; }; static inline @@ -129,9 +128,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) struct device *dev = &boe->dsi->dev; int ret; - if (boe->prepared) - return 0; - /* * Enable EL Driving Voltage first - doing that at the beginning * or at the end of the power sequence doesn't matter, so enable @@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) return ret; } - boe->prepared = true; return 0; err_vci: @@ -186,9 +181,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) struct device *dev = &boe->dsi->dev; int ret; - if (!boe->prepared) - return 0; - ret = boe_bf060y8m_aj0_off(boe); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -196,7 +188,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) gpiod_set_value_cansleep(boe->reset_gpio, 1); ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs); - boe->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c index 8912757a6f42..3e0a8e0d58a0 100644 --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c @@ -21,7 +21,6 @@ struct jdi_fhd_r63452 { struct drm_panel panel; struct mipi_dsi_device *dsi; struct gpio_desc *reset_gpio; - bool prepared; }; static inline struct jdi_fhd_r63452 *to_jdi_fhd_r63452(struct drm_panel *panel) @@ -157,9 +156,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - jdi_fhd_r63452_reset(ctx); ret = jdi_fhd_r63452_on(ctx); @@ -169,7 +165,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -179,16 +174,12 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = jdi_fhd_r63452_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); gpiod_set_value_cansleep(ctx->reset_gpio, 1); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c index 412ca84d0581..648ce9201426 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c @@ -59,7 +59,6 @@ struct nt35950 { int cur_mode; u8 last_page; - bool prepared; }; struct nt35950_panel_mode { @@ -431,9 +430,6 @@ static int nt35950_prepare(struct drm_panel *panel) struct device *dev = &nt->dsi[0]->dev; int ret; - if (nt->prepared) - return 0; - ret = regulator_enable(nt->vregs[0].consumer); if (ret) return ret; @@ -460,7 +456,6 @@ static int nt35950_prepare(struct drm_panel *panel) dev_err(dev, "Failed to initialize panel: %d\n", ret); goto end; } - nt->prepared = true; end: if (ret < 0) { @@ -477,9 +472,6 @@ static int nt35950_unprepare(struct drm_panel *panel) struct device *dev = &nt->dsi[0]->dev; int ret; - if (!nt->prepared) - return 0; - ret = nt35950_off(nt); if (ret < 0) dev_err(dev, "Failed to deinitialize panel: %d\n", ret); @@ -487,7 +479,6 @@ static int nt35950_unprepare(struct drm_panel *panel) gpiod_set_value_cansleep(nt->reset_gpio, 0); regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs); - nt->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c index 9632b9e95b71..9b9a7eb1bc60 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c @@ -38,8 +38,6 @@ struct panel_info { struct gpio_desc *reset_gpio; struct backlight_device *backlight; struct regulator *vddio; - - bool prepared; }; struct panel_desc { @@ -1046,9 +1044,6 @@ static int nt36523_prepare(struct drm_panel *panel) struct panel_info *pinfo = to_panel_info(panel); int ret; - if (pinfo->prepared) - return 0; - ret = regulator_enable(pinfo->vddio); if (ret) { dev_err(panel->dev, "failed to enable vddio regulator: %d\n", ret); @@ -1064,8 +1059,6 @@ static int nt36523_prepare(struct drm_panel *panel) return ret; } - pinfo->prepared = true; - return 0; } @@ -1095,14 +1088,9 @@ static int nt36523_unprepare(struct drm_panel *panel) { struct panel_info *pinfo = to_panel_info(panel); - if (!pinfo->prepared) - return 0; - gpiod_set_value_cansleep(pinfo->reset_gpio, 1); regulator_disable(pinfo->vddio); - pinfo->prepared = false; - return 0; } diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c index 5f9b340588fb..7b7fe987e292 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c @@ -77,8 +77,6 @@ struct rm68200 { struct drm_panel panel; struct gpio_desc *reset_gpio; struct regulator *supply; - bool prepared; - bool enabled; }; static const struct drm_display_mode default_mode = { @@ -231,27 +229,12 @@ static void rm68200_init_sequence(struct rm68200 *ctx) dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD1_UCS); } -static int rm68200_disable(struct drm_panel *panel) -{ - struct rm68200 *ctx = panel_to_rm68200(panel); - - if (!ctx->enabled) - return 0; - - ctx->enabled = false; - - return 0; -} - static int rm68200_unprepare(struct drm_panel *panel) { struct rm68200 *ctx = panel_to_rm68200(panel); struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (!ctx->prepared) - return 0; - ret = mipi_dsi_dcs_set_display_off(dsi); if (ret) dev_warn(panel->dev, "failed to set display off: %d\n", ret); @@ -269,8 +252,6 @@ static int rm68200_unprepare(struct drm_panel *panel) regulator_disable(ctx->supply); - ctx->prepared = false; - return 0; } @@ -280,9 +261,6 @@ static int rm68200_prepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (ctx->prepared) - return 0; - ret = regulator_enable(ctx->supply); if (ret < 0) { dev_err(ctx->dev, "failed to enable supply: %d\n", ret); @@ -310,20 +288,6 @@ static int rm68200_prepare(struct drm_panel *panel) msleep(20); - ctx->prepared = true; - - return 0; -} - -static int rm68200_enable(struct drm_panel *panel) -{ - struct rm68200 *ctx = panel_to_rm68200(panel); - - if (ctx->enabled) - return 0; - - ctx->enabled = true; - return 0; } @@ -352,10 +316,8 @@ static int rm68200_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs rm68200_drm_funcs = { - .disable = rm68200_disable, .unprepare = rm68200_unprepare, .prepare = rm68200_prepare, - .enable = rm68200_enable, .get_modes = rm68200_get_modes, }; diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c index 7431cae7427e..d2df227abbea 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c @@ -18,8 +18,6 @@ struct s6e88a0_ams452ef01 { struct mipi_dsi_device *dsi; struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; - - bool prepared; }; static inline struct @@ -115,9 +113,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) { dev_err(dev, "Failed to enable regulators: %d\n", ret); @@ -135,7 +130,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -145,9 +139,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = s6e88a0_ams452ef01_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -155,7 +146,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) gpiod_set_value_cansleep(ctx->reset_gpio, 0); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c index cbf9607dd576..04ce925b3d9d 100644 --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c @@ -23,7 +23,6 @@ struct sofef00_panel { struct regulator *supply; struct gpio_desc *reset_gpio; const struct drm_display_mode *mode; - bool prepared; }; static inline @@ -113,9 +112,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_enable(ctx->supply); if (ret < 0) { dev_err(dev, "Failed to enable regulator: %d\n", ret); @@ -131,7 +127,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -141,16 +136,12 @@ static int sofef00_panel_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = sofef00_panel_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); regulator_disable(ctx->supply); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c b/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c index 68f52eaaf4fa..74c760ee0c2d 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c @@ -24,7 +24,6 @@ struct sharp_ls060 { struct regulator *avdd_supply; struct regulator *avee_supply; struct gpio_desc *reset_gpio; - bool prepared; }; static inline struct sharp_ls060 *to_sharp_ls060(struct drm_panel *panel) @@ -101,9 +100,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_enable(ctx->vddi_supply); if (ret < 0) return ret; @@ -134,8 +130,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel) goto err_on; } - ctx->prepared = true; - return 0; err_on: @@ -163,9 +157,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = sharp_ls060_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -181,7 +172,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel) regulator_disable(ctx->vddi_supply); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c b/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c index 1bde2f01786b..472195d4bbbe 100644 --- a/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c +++ b/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c @@ -36,7 +36,6 @@ struct sony_td4353_jdi { struct regulator_bulk_data supplies[3]; struct gpio_desc *panel_reset_gpio; struct gpio_desc *touch_reset_gpio; - bool prepared; int type; }; @@ -150,9 +149,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) { dev_err(dev, "Failed to enable regulators: %d\n", ret); @@ -171,7 +167,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -181,9 +176,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = sony_td4353_jdi_off(ctx); if (ret < 0) dev_err(dev, "Failed to power off panel: %d\n", ret); @@ -191,7 +183,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel) sony_td4353_assert_reset_gpios(ctx, 0); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c index ee5d20ecc577..6d44970dccd9 100644 --- a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c +++ b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c @@ -23,8 +23,6 @@ struct truly_nt35521 { struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; struct gpio_desc *blen_gpio; - bool prepared; - bool enabled; }; static inline @@ -296,9 +294,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) { dev_err(dev, "Failed to enable regulators: %d\n", ret); @@ -314,7 +309,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -324,9 +318,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = truly_nt35521_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -335,7 +326,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel) regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } @@ -343,12 +333,8 @@ static int truly_nt35521_enable(struct drm_panel *panel) { struct truly_nt35521 *ctx = to_truly_nt35521(panel); - if (ctx->enabled) - return 0; - gpiod_set_value_cansleep(ctx->blen_gpio, 1); - ctx->enabled = true; return 0; } @@ -356,12 +342,8 @@ static int truly_nt35521_disable(struct drm_panel *panel) { struct truly_nt35521 *ctx = to_truly_nt35521(panel); - if (!ctx->enabled) - return 0; - gpiod_set_value_cansleep(ctx->blen_gpio, 0); - ctx->enabled = false; return 0; } diff --git a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c index 6e77a2d71d81..0156689f41cd 100644 --- a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c +++ b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c @@ -35,7 +35,6 @@ enum { }; struct stk_panel { - bool prepared; const struct drm_display_mode *mode; struct backlight_device *backlight; struct drm_panel base; @@ -145,16 +144,11 @@ static int stk_panel_unprepare(struct drm_panel *panel) { struct stk_panel *stk = to_stk_panel(panel); - if (!stk->prepared) - return 0; - stk_panel_off(stk); regulator_bulk_disable(ARRAY_SIZE(stk->supplies), stk->supplies); gpiod_set_value(stk->reset_gpio, 0); gpiod_set_value(stk->enable_gpio, 1); - stk->prepared = false; - return 0; } @@ -164,9 +158,6 @@ static int stk_panel_prepare(struct drm_panel *panel) struct device *dev = &stk->dsi->dev; int ret; - if (stk->prepared) - return 0; - gpiod_set_value(stk->reset_gpio, 0); gpiod_set_value(stk->enable_gpio, 0); ret = regulator_enable(stk->supplies[IOVCC].consumer); @@ -195,8 +186,6 @@ static int stk_panel_prepare(struct drm_panel *panel) goto poweroff; } - stk->prepared = true; - return 0; poweroff: diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c index 4f4009f9fe25..b73448cf349d 100644 --- a/drivers/gpu/drm/panel/panel-truly-nt35597.c +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c @@ -64,8 +64,6 @@ struct truly_nt35597 { struct mipi_dsi_device *dsi[2]; const struct nt35597_config *config; - bool prepared; - bool enabled; }; static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) @@ -313,16 +311,12 @@ static int truly_nt35597_disable(struct drm_panel *panel) struct truly_nt35597 *ctx = panel_to_ctx(panel); int ret; - if (!ctx->enabled) - return 0; - if (ctx->backlight) { ret = backlight_disable(ctx->backlight); if (ret < 0) dev_err(ctx->dev, "backlight disable failed %d\n", ret); } - ctx->enabled = false; return 0; } @@ -331,9 +325,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel) struct truly_nt35597 *ctx = panel_to_ctx(panel); int ret = 0; - if (!ctx->prepared) - return 0; - ctx->dsi[0]->mode_flags = 0; ctx->dsi[1]->mode_flags = 0; @@ -354,7 +345,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel) if (ret < 0) dev_err(ctx->dev, "power_off failed ret = %d\n", ret); - ctx->prepared = false; return ret; } @@ -367,9 +357,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel) const struct nt35597_config *config; u32 num_cmds; - if (ctx->prepared) - return 0; - ret = truly_35597_power_on(ctx); if (ret < 0) return ret; @@ -409,8 +396,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel) /* Per DSI spec wait 120ms after sending set_display_on DCS command */ msleep(120); - ctx->prepared = true; - return 0; power_off: @@ -424,17 +409,12 @@ static int truly_nt35597_enable(struct drm_panel *panel) struct truly_nt35597 *ctx = panel_to_ctx(panel); int ret; - if (ctx->enabled) - return 0; - if (ctx->backlight) { ret = backlight_enable(ctx->backlight); if (ret < 0) dev_err(ctx->dev, "backlight enable failed %d\n", ret); } - ctx->enabled = true; - return 0; } diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c b/drivers/gpu/drm/panel/panel-visionox-r66451.c index 00fc28ad3d07..fbb73464de33 100644 --- a/drivers/gpu/drm/panel/panel-visionox-r66451.c +++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c @@ -22,7 +22,6 @@ struct visionox_r66451 { struct mipi_dsi_device *dsi; struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[2]; - bool prepared, enabled; }; static inline struct visionox_r66451 *to_visionox_r66451(struct drm_panel *panel) @@ -124,9 +123,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel) struct device *dev = &dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) @@ -144,7 +140,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel) mipi_dsi_compression_mode(ctx->dsi, true); - ctx->prepared = true; return 0; } @@ -154,9 +149,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = visionox_r66451_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -164,7 +156,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel) gpiod_set_value_cansleep(ctx->reset_gpio, 1); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } @@ -190,9 +181,6 @@ static int visionox_r66451_enable(struct drm_panel *panel) struct drm_dsc_picture_parameter_set pps; int ret; - if (ctx->enabled) - return 0; - if (!dsi->dsc) { dev_err(&dsi->dev, "DSC not attached to DSI\n"); return -ENODEV; @@ -219,8 +207,6 @@ static int visionox_r66451_enable(struct drm_panel *panel) } msleep(20); - ctx->enabled = true; - return 0; } @@ -231,8 +217,6 @@ static int visionox_r66451_disable(struct drm_panel *panel) struct device *dev = &dsi->dev; int ret; - ctx->enabled = false; - ret = mipi_dsi_dcs_set_display_off(dsi); if (ret < 0) { dev_err(dev, "Failed to set display off: %d\n", ret); diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c index c2806e4fd553..775144695283 100644 --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c @@ -20,8 +20,6 @@ struct visionox_rm69299 { struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; struct mipi_dsi_device *dsi; - bool prepared; - bool enabled; }; static inline struct visionox_rm69299 *panel_to_ctx(struct drm_panel *panel) @@ -80,7 +78,6 @@ static int visionox_rm69299_unprepare(struct drm_panel *panel) ret = visionox_rm69299_power_off(ctx); - ctx->prepared = false; return ret; } @@ -89,9 +86,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel) struct visionox_rm69299 *ctx = panel_to_ctx(panel); int ret; - if (ctx->prepared) - return 0; - ret = visionox_rm69299_power_on(ctx); if (ret < 0) return ret; @@ -140,8 +134,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel) /* Per DSI spec wait 120ms after sending set_display_on DCS command */ msleep(120); - ctx->prepared = true; - return 0; power_off: diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c index bb0dfd86ea67..a23407b9f6fb 100644 --- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c @@ -20,7 +20,6 @@ struct visionox_vtdr6130 { struct mipi_dsi_device *dsi; struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[3]; - bool prepared; }; static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel) @@ -157,9 +156,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) @@ -175,7 +171,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel) return ret; } - ctx->prepared = true; return 0; } @@ -185,9 +180,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (!ctx->prepared) - return 0; - ret = visionox_vtdr6130_off(ctx); if (ret < 0) dev_err(dev, "Failed to un-initialize panel: %d\n", ret); @@ -196,7 +188,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel) regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } From patchwork Fri Aug 4 21:06:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 131356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp110897vqr; Fri, 4 Aug 2023 14:30:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFODJDk1ayLBJUc+lJFyDA9XEIOYd23tc3obLlysneDZe9+ZkdMEy9Cp5xDq2ln2EwBS2ux X-Received: by 2002:a05:6a00:17a2:b0:682:2fea:39f0 with SMTP id s34-20020a056a0017a200b006822fea39f0mr4123557pfg.5.1691184637262; Fri, 04 Aug 2023 14:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691184637; cv=none; d=google.com; s=arc-20160816; b=iV5Zw3m5+pv2L3OMqQQ3BeKSrVYu0pAHHFUYuuJfBXy67mjEMKtKXbsS9/SAs83qnw 0gKg62dfHIzwanJE2G9DTjgdl6XUc319RhtTWtSzcZyg1ewa75b8ebWip8gfnVurCSMo gBOZ5YTpaFIKls/3RYHbQVg1cJDfRLXJQ8U031EIDS+wOaD9uuki67X/iz5+FKWHmK6k Z8gkhN9bo2ktv+NxHk9tfkNmPODB8bTr8qenxYWJdQJRZaE51CefOpKt5KASlhXIDQUy z5jGGm1cSwKlO1GO/yzkJ4w3Vu5b4sHQ3iFlnxR12UHAmwzL9bUTGzJ4mcDLtvenacWW 3/Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+K4pAadzRZN083YWndwfDzadQIgjy+stzVGii5iIJGU=; fh=dprmmFr5kEs2oaIKuWw0OlwhpcBwFTafCHELzUCPXiw=; b=NI0HmccuMiSJQ3Q9QLOsD3/5I2FXDMZ0ZVbCNZK/nZ93aqWY1LHh7kh/287OOsE+Y2 Fzl2zDMibWhihavO+8ajhR23cKAe1vlyXPeDM8Jv7d9frtfo6b0swcn/Vg4MudmQe3Ya KsXGicG0TlhTzt1NBUsqnFlSXYMKM0c8P1K1urpL8AGqjx2ywAskkD31kWFw6awPNga9 3PaqepFO7wcFtKyVy5ZRr+GAqHYZYq1qm7ek+HBOolx749/dYtzLvDTdVjTleJAUZrrG 3sPr6q+szsi00TJG9wLNkr20/FMH8Zl3pmIEFqong3SX16djRiVjdwu/yQJyGZljpI49 lfkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=T1UYVJsN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g129-20020a636b87000000b00553a99dd783si2186892pgc.778.2023.08.04.14.30.23; Fri, 04 Aug 2023 14:30:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=T1UYVJsN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbjHDVIf (ORCPT + 99 others); Fri, 4 Aug 2023 17:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbjHDVIH (ORCPT ); Fri, 4 Aug 2023 17:08:07 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D1E559E for ; Fri, 4 Aug 2023 14:07:18 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-686f090310dso2442063b3a.0 for ; Fri, 04 Aug 2023 14:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691183237; x=1691788037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+K4pAadzRZN083YWndwfDzadQIgjy+stzVGii5iIJGU=; b=T1UYVJsN721ozkISMV86q9Yazgfhma0y3bUeJgLTkokFM2FXoQfsXSElONE+8QorfW 6KJCMyYa6HwgGob86Pamhm3mAAKLOuEG/C24hVShpaprAQaj9ga275WVxyVBsuNTp4Xq 4YsIw1eOx9vVerNFIlXmAaIu6WLUGVO5/Ovsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691183237; x=1691788037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+K4pAadzRZN083YWndwfDzadQIgjy+stzVGii5iIJGU=; b=kWaxTDyHtCTTLteBhMDbTbBTzVLB1/vedAyePrz3q11FIRLR4QJiZOnyyCSl/ydM7c 05tOm0JijHFtB9w44cPcj0IRkrVRRkgjjWm4H7/CdNftYVFbp+J5Xt8wtlnPsJO/LxZg 0Hm2swsKfSt3xYAGjFrxLGXM9+qVAC87JO/OPptwaEufiw3Cb/g0aV/38SF7KxWolK9w FR/ryZxbI6l+EErfrzRtqWbWul3HSi/rXWu4swBJ7HT/dKIUTBGXjopKjDFQyOuKH3eR D8foJ3U9sQrCzBtomsMF1nUoO3t4jP+NeXkM9fSGOA+epzftQ02RJk6cwKbqnENcL13v zbAg== X-Gm-Message-State: AOJu0YxpBjoaMkxq8cirCi/Fw1cwucTcOyC8MSI3K5iSI7J+mNvRwBLu s1wjsT34jxk69q0nhqGsUWxCxw== X-Received: by 2002:a05:6a21:7189:b0:133:f860:ac42 with SMTP id wq9-20020a056a21718900b00133f860ac42mr3100626pzb.34.1691183236984; Fri, 04 Aug 2023 14:07:16 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e186:e5d2:e60:bad3]) by smtp.gmail.com with ESMTPSA id n22-20020aa78a56000000b0068664ace38asm2037584pfa.19.2023.08.04.14.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:07:15 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Douglas Anderson , Daniel Vetter , David Airlie , Neil Armstrong , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [RFC PATCH 02/10] drm/panel: s6e63m0: Don't store+check prepared/enabled Date: Fri, 4 Aug 2023 14:06:05 -0700 Message-ID: <20230804140605.RFC.2.Iabafd062e70f6b6b554cf23eeb75f57a80f7e985@changeid> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> References: <20230804210644.1862287-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773335622369870505 X-GMAIL-MSGID: 1773335622369870505 As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. For the s6e63m0 panel driver, this actually fixes a subtle/minor error handling bug in s6e63m0_prepare(). In one error case s6e63m0_prepare() called s6e63m0_unprepare() directly if there was an error. This call to s6e63m0_unprepare() would have been a no-op since ctx->prepared wasn't set yet. Signed-off-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index b34fa4d5de07..a0e5698275a5 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -270,9 +270,6 @@ struct s6e63m0 { struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; - bool prepared; - bool enabled; - /* * This field is tested by functions directly accessing bus before * transfer, transfer is skipped if it is set. In case of transfer @@ -502,9 +499,6 @@ static int s6e63m0_disable(struct drm_panel *panel) { struct s6e63m0 *ctx = panel_to_s6e63m0(panel); - if (!ctx->enabled) - return 0; - backlight_disable(ctx->bl_dev); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_OFF); @@ -512,8 +506,6 @@ static int s6e63m0_disable(struct drm_panel *panel) s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE); msleep(120); - ctx->enabled = false; - return 0; } @@ -522,17 +514,12 @@ static int s6e63m0_unprepare(struct drm_panel *panel) struct s6e63m0 *ctx = panel_to_s6e63m0(panel); int ret; - if (!ctx->prepared) - return 0; - s6e63m0_clear_error(ctx); ret = s6e63m0_power_off(ctx); if (ret < 0) return ret; - ctx->prepared = false; - return 0; } @@ -541,9 +528,6 @@ static int s6e63m0_prepare(struct drm_panel *panel) struct s6e63m0 *ctx = panel_to_s6e63m0(panel); int ret; - if (ctx->prepared) - return 0; - ret = s6e63m0_power_on(ctx); if (ret < 0) return ret; @@ -564,8 +548,6 @@ static int s6e63m0_prepare(struct drm_panel *panel) if (ret < 0) s6e63m0_unprepare(panel); - ctx->prepared = true; - return ret; } @@ -573,9 +555,6 @@ static int s6e63m0_enable(struct drm_panel *panel) { struct s6e63m0 *ctx = panel_to_s6e63m0(panel); - if (ctx->enabled) - return 0; - s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE); msleep(120); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON); @@ -588,8 +567,6 @@ static int s6e63m0_enable(struct drm_panel *panel) backlight_enable(ctx->bl_dev); - ctx->enabled = true; - return 0; } @@ -709,8 +686,6 @@ int s6e63m0_probe(struct device *dev, void *trsp, dev_set_drvdata(dev, ctx); ctx->dev = dev; - ctx->enabled = false; - ctx->prepared = false; ret = device_property_read_u32(dev, "max-brightness", &max_brightness); if (ret) From patchwork Fri Aug 4 21:06:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 131398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp142499vqr; Fri, 4 Aug 2023 15:45:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbd0M3Eh0VCGh1SZDqk7rF+Mvxwy+SXR7lwkbR8Kd6dp/7HlugQWGR5aBkisw5jeODF09v X-Received: by 2002:a17:906:54:b0:999:26d3:b815 with SMTP id 20-20020a170906005400b0099926d3b815mr2969767ejg.64.1691189113076; Fri, 04 Aug 2023 15:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691189113; cv=none; d=google.com; s=arc-20160816; b=o875pY9O20svTy3Qofk77H/BenN4Ws68o6TvxEoDeQNLxpNmhg4TftLcsXos48WDT2 RaXA/0zJhqlz80a2wxcT49dE/vPiuprye79gC/ZCFoY3fAioH64A9j1X6smo3tk1njZa 6uNCq3Pi+u6EbIKDMDOUd1JkiH3Sa5i/VS8mol4POMzUOU8haRRVa+zzxz/whUTNd1rz xi8poaQrWF4etPeVk9A1Zpvwq+dY774QMfXxCtYCEsKyqDGeb+QFHLZWVrmuvm1QZAar XcFsi5TJHhAnChRRA1uwjCkURLZhxBQz1F24eUShjFI5ZZkKCzsuPx1csPPV0Cp4VgME XE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zs0Gv4Fg+9bXbPDS+x5MeuiOn4j7KTC6rQDcvADWb+8=; fh=dprmmFr5kEs2oaIKuWw0OlwhpcBwFTafCHELzUCPXiw=; b=viteTesKKPK1fMg3WJ8FiwXgbrJgjvBNsE/5HRQHzgwDScU2mwV02xCudW6/Gkck4A OUeFxbJ65VMklMXmEO1SVWU5EKQvhAF2m5NkabE/lEcRXxHG3jt43WfyQ3KnrIH8iH82 BUJZEYZT8EIluj0G/O8e+PGzZjrpiwhFU3zfDRjQWgk+cZ9oc+hODwHIB2luy+k7UphD fqJmPPz3rOWa5Sp/wW8qtmtKxd/xaDBoVVWE/bMMuBZzFbR9Ujsc4WdbR6blPioGWQBf PE4pOFleIAuHZqdB8QExqufnH9ZXAweY1KVPAApW/tik0jOZ52hON4KogkgjIPZgy6tw SiGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TFhIf+Y9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709061cc500b0099bd667fcf1si2114714ejh.776.2023.08.04.15.44.49; Fri, 04 Aug 2023 15:45:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TFhIf+Y9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbjHDVIS (ORCPT + 99 others); Fri, 4 Aug 2023 17:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjHDVIK (ORCPT ); Fri, 4 Aug 2023 17:08:10 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F36D655A5 for ; Fri, 4 Aug 2023 14:07:20 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-686f94328a4so1744043b3a.0 for ; Fri, 04 Aug 2023 14:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691183239; x=1691788039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zs0Gv4Fg+9bXbPDS+x5MeuiOn4j7KTC6rQDcvADWb+8=; b=TFhIf+Y92Yutq1q3r5QXOVtSDF6+EmNeMvB5c54nDo5/RLID3p2uAWC+vf3ZkgRLgr 5lVq8JsIHNr5sA1uIXxUjC0RY8/VDxXP02vT4SK9+Cx6ej0mEB22eYcCWFY8MFDlmbTm vgGaUnrtDEb268mi/DcLufyaS3DzHeChCP1/g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691183239; x=1691788039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zs0Gv4Fg+9bXbPDS+x5MeuiOn4j7KTC6rQDcvADWb+8=; b=iyWLiisJ/j5v/2sgzI/cXQQGRjK48JZsm8ZVskDUID4frFKViEJn1yOG8i8BIGI+WF ldZhpSNScahEv/1WpvfudSyQTwd+R8M2bjtiD8cTwmC7jziCUN+j9mgMp9SYTDBfI6cC Fezn7cjAQs6ER20BjbmEg1y3wK9YNPERbN1nQgywjYhG40b3E1bxwM1uwfBKLk64uH2l DG8eRkV/HwnBNOlEJfWcsz6kaHWYjbjt+90nFsoRVx/gCazURakEQ9k8vJmSFGxDI/dS xwX9LG0MKi/KsHC1kqBGUcEFyJ/CDzJZNXAoVaCvYFIRKMkyjXecBMiFGhsJ5s32dahB 4Cjg== X-Gm-Message-State: AOJu0YwWcx9nIJmyuqyI/0feaSluUo3BGTki9TdHGF+yAqKKe0xTR1Fv S8gtPZGUtcXEA5uTAvwdogq2mQ== X-Received: by 2002:a05:6a20:2587:b0:137:c971:6a0c with SMTP id k7-20020a056a20258700b00137c9716a0cmr852950pzd.31.1691183238826; Fri, 04 Aug 2023 14:07:18 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e186:e5d2:e60:bad3]) by smtp.gmail.com with ESMTPSA id n22-20020aa78a56000000b0068664ace38asm2037584pfa.19.2023.08.04.14.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:07:18 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Douglas Anderson , Daniel Vetter , David Airlie , Neil Armstrong , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [RFC PATCH 03/10] drm/panel: otm8009a: Don't double check prepared/enabled Date: Fri, 4 Aug 2023 14:06:06 -0700 Message-ID: <20230804140605.RFC.3.I6a4a3c81c78acf5acdc2e5b5d936e19bf57ec07a@changeid> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> References: <20230804210644.1862287-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773340315425278102 X-GMAIL-MSGID: 1773340315425278102 As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. For the "otm8009a" driver we fully remove the storing of the "enabled" state and we remove the double-checking, but we still keep the storing of the "prepared" state since the backlight code in the driver checks it. This backlight code may not be perfectly safe since there doesn't appear to be sufficient synchronization between the backlight driver (which userspace can call into directly) and the code that's unpreparing the panel. However, this lack of safety is not new and can be addressed in a future patch. Signed-off-by: Douglas Anderson --- From quick inspection, I think the right way to handle the backlight properly is: 1. Start calling backlight_get_brightness() instead of directly getting "bd->props.brightness" and bd->props.power. This should return 0 for a disabled (or blanked or powered off) backlight. 2. Cache the backlight level in "struct otm8009a" 3. If the backlight isn't changing compared to the cached value, make otm8009a_backlight_update_status() a no-op. 4. Remove the caching of the "prepared" value. That should work and always be safe because we always enable/disable the backlight in the panel's enable() and disable() functions. The backlight core has proper locking in this case. A disabled backlight will always return a level of 0 which will always make the backlight's update_status a no-op when the panel is disabled and keep us from trying to talk to the panel when it's off. Userspace can't directly cause a backlight to be enabled/disabled, it can only affect the other blanking modes. .../gpu/drm/panel/panel-orisetech-otm8009a.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c index 898b892f1143..93183f30d7d6 100644 --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c @@ -70,7 +70,6 @@ struct otm8009a { struct gpio_desc *reset_gpio; struct regulator *supply; bool prepared; - bool enabled; }; static const struct drm_display_mode modes[] = { @@ -267,9 +266,6 @@ static int otm8009a_disable(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (!ctx->enabled) - return 0; /* This is not an issue so we return 0 here */ - backlight_disable(ctx->bl_dev); ret = mipi_dsi_dcs_set_display_off(dsi); @@ -282,8 +278,6 @@ static int otm8009a_disable(struct drm_panel *panel) msleep(120); - ctx->enabled = false; - return 0; } @@ -291,9 +285,6 @@ static int otm8009a_unprepare(struct drm_panel *panel) { struct otm8009a *ctx = panel_to_otm8009a(panel); - if (!ctx->prepared) - return 0; - if (ctx->reset_gpio) { gpiod_set_value_cansleep(ctx->reset_gpio, 1); msleep(20); @@ -311,9 +302,6 @@ static int otm8009a_prepare(struct drm_panel *panel) struct otm8009a *ctx = panel_to_otm8009a(panel); int ret; - if (ctx->prepared) - return 0; - ret = regulator_enable(ctx->supply); if (ret < 0) { dev_err(panel->dev, "failed to enable supply: %d\n", ret); @@ -341,13 +329,8 @@ static int otm8009a_enable(struct drm_panel *panel) { struct otm8009a *ctx = panel_to_otm8009a(panel); - if (ctx->enabled) - return 0; - backlight_enable(ctx->bl_dev); - ctx->enabled = true; - return 0; } From patchwork Fri Aug 4 21:06:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 131396 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp142154vqr; Fri, 4 Aug 2023 15:44:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKqrV7KeUQyrvzCMV8xL9dasbaomBWSCgoGZvMV7fVUhZ+z9SGqV5cJdZjQsuegcgD5vm/ X-Received: by 2002:aa7:c383:0:b0:522:219b:ce05 with SMTP id k3-20020aa7c383000000b00522219bce05mr2860697edq.7.1691189078306; Fri, 04 Aug 2023 15:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691189078; cv=none; d=google.com; s=arc-20160816; b=kTJjMaApqR8yXB+ZkfyIVbtRbIwUSln7qEAbI+17Um6w2msD8Xla7n29Qot9fFirYy iIZiugf1EzUMuyldlaUgWlRbay3kOhhLJl2PJ0FO4jz+DtlH/x8qpRdNGXzcfS6A5KNG 8/z63ZrP74UmzgrPP1n8iA+R2A7NrxDRwUSbkxDhEJYlqHOGgYUkuwXgPyIyE9p+W6Nj uLS4FeOhsFt6XQU3wF4BZt11x64D/8Ak5QCh1WsT7O+kwnCjTh+dyhIwb/hayfFpp+iw V3oW2S1K/JvE06cLgLHRFrznlScMi2kM1OT1s2c94x7CiEKR11Lz/rFbMKIBcR0ea+zq tx/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OgZd04X0Jnac/fFUkos5qfSoj7pVaTLYh5udS8UWgcQ=; fh=YQkvLGSH2rMOvm7jeVZBE4fYFAuT8AmzBDO5AKFTYyM=; b=k0leOn8ypgSppBBt8dhjZI/jz3DYO/2151iUM/E/Xy+AnaCaTYQ6YfP7X1hvd1vuvf jvkJdMj23smtTGJa1OaiYOwYYmHKeg6eHHBMOF8ZxrC0gJjzxwGpQgLTW0EfgSKn9UG6 eO69ZM2K8LPQL/giEM1wXE09KQnqN9DlU7XGynEqa24KTy+H6FOhC/8gLAG9c+24Q5oc uY9A/P+Ud0XgG84m1gZBS+xdyywRZy99a72bfwFlKeUxwNpiPlqoK3PZEXiir1M8bw3f JRZW8f6UxYe41exKiYt2Qkt/nYVwtzFAkjArEfhcsLj7yXHBDOQW2G0Pbk7c2Ml8f9np mAnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dWh3dGKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020aa7d6d0000000b0052231491597si2344198edr.677.2023.08.04.15.44.15; Fri, 04 Aug 2023 15:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dWh3dGKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjHDVIc (ORCPT + 99 others); Fri, 4 Aug 2023 17:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbjHDVIK (ORCPT ); Fri, 4 Aug 2023 17:08:10 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FFF6E46 for ; Fri, 4 Aug 2023 14:07:22 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-686be3cbea0so2475633b3a.0 for ; Fri, 04 Aug 2023 14:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691183241; x=1691788041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OgZd04X0Jnac/fFUkos5qfSoj7pVaTLYh5udS8UWgcQ=; b=dWh3dGKdYpdYdRJj8hocS/Jx852k0NaOXKh3si1et2/K0fsZUcbFeMkfTyTNYq5AhB cJNWWInbDx8vJsvS+phmgohWTE73bsjN/5Z80kAS0A//0yp2Xzm9tudwtnQygKNbWH95 K/Xrfpa2vyLkXmYwfbCkA4JEa0g85HOvBrD4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691183241; x=1691788041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OgZd04X0Jnac/fFUkos5qfSoj7pVaTLYh5udS8UWgcQ=; b=OmAmtqvNvR/XqDBsJY1n9rwemQ0Y00W9q2304Il+9wvyC+7dDRJk/fOtO6vrG8AnM+ DMYYyjY+tR04GDTVO58QAFiaJHTf4KXfkr8OeJ6F/9V7/sIo99WUZ/yQ9LYfZupdfBqR K9/g99zOHHpWFo158/M1AxUyQdJJD4999L/aVfENTvsTXBl1k8/361zU4qseakR4nZ9N V1YjaLWjtQclxlObTMRuHL/nM0aD4VK2EidnHLjb5Tz0Y1HfU8mTklrxKFTYft1dvXmJ siwKanZ0unGHQPeMRtE6fdK4YDsjSx9AcwGw+PZwF94kNai3Qq7gEaDUr2fMEOBGvPw3 Xv3g== X-Gm-Message-State: AOJu0Yy00rydpNfkHhlJEEaszQUYFbG9w7u0e/0spXj+n2jQOPVM+bKd 0tP3yHCl5lROQPuLboQ1M8OxrA== X-Received: by 2002:a05:6a20:548e:b0:127:72c3:6428 with SMTP id i14-20020a056a20548e00b0012772c36428mr1108268pzk.18.1691183240969; Fri, 04 Aug 2023 14:07:20 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e186:e5d2:e60:bad3]) by smtp.gmail.com with ESMTPSA id n22-20020aa78a56000000b0068664ace38asm2037584pfa.19.2023.08.04.14.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:07:20 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Date: Fri, 4 Aug 2023 14:06:07 -0700 Message-ID: <20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> References: <20230804210644.1862287-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773340278766442691 X-GMAIL-MSGID: 1773340278766442691 The goal of this file is to contain helper functions for panel drivers to use. To start off with, let's add drm_panel_helper_shutdown() for use by panels that want to make sure they're powered off at shutdown/remove time if they happen to be powered on. The main goal of introducting this function is so that panel drivers don't need to track the enabled/prepared state themselves. Signed-off-by: Douglas Anderson --- If I've misunderstood and the drm_panel_helper_shutdown() should belong in some other file and we don't need to introduce a "helper" for this then please le me know. drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel_helper.c | 37 ++++++++++++++++++++++++++++++ include/drm/drm_panel_helper.h | 13 +++++++++++ 3 files changed, 51 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel_helper.c create mode 100644 include/drm/drm_panel_helper.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 215e78e79125..e811f3d68235 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -118,6 +118,7 @@ drm_kms_helper-y := \ drm_gem_framebuffer_helper.o \ drm_kms_helper_common.o \ drm_modeset_helper.o \ + drm_panel_helper.o \ drm_plane_helper.o \ drm_probe_helper.o \ drm_rect.o \ diff --git a/drivers/gpu/drm/drm_panel_helper.c b/drivers/gpu/drm/drm_panel_helper.c new file mode 100644 index 000000000000..85a55b5731cf --- /dev/null +++ b/drivers/gpu/drm/drm_panel_helper.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2023 Google Inc. + */ + +#include + +#include +#include + +/** + * drm_panel_helper_shutdown - helper for panels to use at shutdown time + * @panel: DRM panel + * + * Panels may call this function unconditionally at shutdown time to ensure + * that they are disabled and unprepared if necessary. + * + * As part of this function: + * - The backlight will be turned off, if it was on. + * - Any panel followers will be power sequenced. + */ +void drm_panel_helper_shutdown(struct drm_panel *panel) +{ + int ret; + + if (panel->enabled) { + ret = drm_panel_disable(panel); + if (ret) + dev_warn(panel->dev, "Error disabling panel %d\n", ret); + } + if (panel->prepared) { + ret = drm_panel_unprepare(panel); + if (ret) + dev_warn(panel->dev, "Error unpreparing panel %d\n", ret); + } +} +EXPORT_SYMBOL_GPL(drm_panel_helper_shutdown); diff --git a/include/drm/drm_panel_helper.h b/include/drm/drm_panel_helper.h new file mode 100644 index 000000000000..5621482053a9 --- /dev/null +++ b/include/drm/drm_panel_helper.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2023 Google Inc. + */ + +#ifndef DRM_PANEL_HELPER_H +#define DRM_PANEL_HELPER_H + +struct drm_panel; + +void drm_panel_helper_shutdown(struct drm_panel *panel); + +#endif /* DRM_PANEL_HELPER_H */ From patchwork Fri Aug 4 21:06:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 131362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp113531vqr; Fri, 4 Aug 2023 14:37:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjsEiIGSsd5ZP2b0gHTzIQC5UIlGL+qhnT9oCR8L/Z+tUoXsZEt2z1Kx1cd/0hvUAnnT/Y X-Received: by 2002:ac2:5e90:0:b0:4fb:c657:3376 with SMTP id b16-20020ac25e90000000b004fbc6573376mr1957763lfq.29.1691185027948; Fri, 04 Aug 2023 14:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691185027; cv=none; d=google.com; s=arc-20160816; b=P+UlxCCjEe1IkIan4VNF4WaAH4n63kI7nnTjY6z/i24Y+BO3Aa4DNIVD2CbC4jqtu2 gn8SF3xRhIRa0yU+AfxugdYyP0YhgjLZfGFU+LS/G6kIQ4AqSfKByv9ipUcQNJczvRR2 8yRjongFHy4Rx6Pt2ccDvTNa0hh0ATEQD6QjIhDLZClg+3kh3HoYi97uhSBIdV6fPCPT WhcwGZPFnIvD+XRELcOCBek97lTflT3exM+rLY4VlzSQFQs+6KZf6Lo8cF4mh3zLsbu/ W3tlxta9uzFyksiu8BBs08KrXOTr6+GHjd7ZWRP1Mu9NoTAFpDvR7sxFLYLDIDffkZ5m AtpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VNDAtrU25aj6ZP4bQWj0APLJi4B34GsziEpWhng/8JI=; fh=hqPcgtUOZMViQGxnmqePZRdmhmw2HEgIqEKo3NfIUrM=; b=AsW8ili4+065BXnjmMmWHn8n/XrzL8TF3m3SE2mR8Vbzn2nJauvAQJy1+OtQi8Tder GQ4RHVehRB6DLpFpRueyUSM3y/xXhIUZrXgRHWhProWT1GCYMU0Qv7cbjAFYorxtrSj3 ajWubL1ANPYmyOKdbWtvSymcgPbhIjSrJIzQtmsQKN59DagWC17Ttks3fjYRx0Hc6G/5 hwUaKVPXxEgCqpfsCPkAqBRpUlb1D5ItBt43pGI14x7pnBwF9uikK5elsPMD+FXxs9f3 /FajM5tYDivZojhRsf75z5PElTljxXz7DS1lxqUtvIH4F1QSyaOHiBEbaCE1zz5Sz4TD l6og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OIeIwYaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z25-20020aa7cf99000000b00522ac23622dsi2194929edx.168.2023.08.04.14.36.44; Fri, 04 Aug 2023 14:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OIeIwYaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbjHDVIn (ORCPT + 99 others); Fri, 4 Aug 2023 17:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjHDVIP (ORCPT ); Fri, 4 Aug 2023 17:08:15 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB4D4C3B for ; Fri, 4 Aug 2023 14:07:25 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-686ba97e4feso2333108b3a.0 for ; Fri, 04 Aug 2023 14:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691183243; x=1691788043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VNDAtrU25aj6ZP4bQWj0APLJi4B34GsziEpWhng/8JI=; b=OIeIwYaKjUbKT7o1VfqN2rM1ojzUgZhYMNyt9GXc4au4BxZNaKrvf44cxwhOEOJk99 nUT67+6BP32EIAmgd7GMcbkz8LKuxhP0jJkTSsx+E1aBgQbHs1RHaAYkjX6bqWNTJe5O wxNBUpp4NIteLU6F6Iqk/orzGfTiIcdFm5DPo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691183243; x=1691788043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VNDAtrU25aj6ZP4bQWj0APLJi4B34GsziEpWhng/8JI=; b=hQFJ95B0BQo5HRkSaPdfIyWDpm006Yu/xQ+jsq3B+OIHsMlZkjUS3EUfxajIrsTaO5 /y2nKN2aoWLSWaID8Q5wLVKiU56P43XW4Wg9j2lep+Z8uw1eQ5dzTDrgURJzM4iePAR6 XcJ7X+w0GFvqadr10HTH4KVDskZmvpvUqyjh5XPTdE5fKl4kUMJDCxMW4DaTI3yYTS7F wx0xnCc4DAf94TuiDVUPSIEsDNfGXtLojov6/ZVAG0mNP79wjRRhacyyZTvjqxGm39p6 BMdLuMWGBlaYRqDtIRvhiu765ZagEiioS6jD3BoXhGLe/mpoLG4Q86eGTwpUmJ/cHLSt gOsg== X-Gm-Message-State: AOJu0Yx7ngbXPbsoQc7CG/7Ac+9x17OlF8hYqA3rN4ysiJrNJ+ij9OLX Abj+pfSrA/FZBFHqHgAu8NqUPc8s8IdlfwcOuweWwTxf X-Received: by 2002:aa7:8884:0:b0:687:9909:3c75 with SMTP id z4-20020aa78884000000b0068799093c75mr3885000pfe.4.1691183243227; Fri, 04 Aug 2023 14:07:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e186:e5d2:e60:bad3]) by smtp.gmail.com with ESMTPSA id n22-20020aa78a56000000b0068664ace38asm2037584pfa.19.2023.08.04.14.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:07:22 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Douglas Anderson , Daniel Vetter , David Airlie , Javier Martinez Canillas , Jerry Han , Neil Armstrong , Ondrej Jirman , Sam Ravnborg , Stefan Mavrodiev , Sumit Semwal , linux-kernel@vger.kernel.org Subject: [RFC PATCH 05/10] drm/panel: Don't store+check prepared/enabled for panels needing shutdown Date: Fri, 4 Aug 2023 14:06:08 -0700 Message-ID: <20230804140605.RFC.5.Icc3238e91bc726d4b04c51a4acf67f001ec453d7@changeid> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> References: <20230804210644.1862287-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773336031761054118 X-GMAIL-MSGID: 1773336031761054118 As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. A number of panels seemed to need the extra double-checking of the prepared/enabled state to handle driver remove and/or shutdown. This set of drivers was easy to transform and used to call drm_panel_unprepare() and drm_panel_disable(). It's easy to move them to call the drm_panel_helper_shutdown() that does the double-checking for the panels. NOTE: this patch doesn't attempt to sanitize the shutdown or remove functions of these panels, it merely tries to preserve the old behavior while removing the need for the panels to track prepared/enabled state themselves. Specifically it can be noted that removing an in-use panel is not necessarily straightfoward and may not be correct in most panels. ALSO NOTE: some of the panels touched in this path used to not complain about disable/unprepare error at shutdown time. Now that we're using the drm_panel_helper_shutdown() function we'll consistently warn about these errors. THIRDLY NOTE: One of these panels, "boe-himax8279d", used to call its unprepare() and disable() functions directly instead of calling drm_panel_unprepare() and drm_panel_disable(). I believe that the only difference is that "boe-himax8279d" will now turn off its backlight at shutdown/remove. This will also pave the way if anyone wants to use this panel w/ the new "panel follower" APIs. Signed-off-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-boe-himax8279d.c | 36 ++----------- .../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 16 +----- drivers/gpu/drm/panel/panel-edp.c | 34 ++----------- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 21 +------- drivers/gpu/drm/panel/panel-himax-hx8394.c | 21 +------- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 51 ++----------------- drivers/gpu/drm/panel/panel-khadas-ts050.c | 35 ++----------- .../drm/panel/panel-kingdisplay-kd097d04.c | 43 ++-------------- .../drm/panel/panel-leadtek-ltk050h3146w.c | 21 +------- .../drm/panel/panel-leadtek-ltk500hd1829.c | 21 +------- .../gpu/drm/panel/panel-novatek-nt36672a.c | 24 ++------- .../drm/panel/panel-olimex-lcd-olinuxino.c | 45 +--------------- .../drm/panel/panel-osd-osd101t2587-53ts.c | 37 ++------------ .../gpu/drm/panel/panel-samsung-atna33xc20.c | 31 ++--------- drivers/gpu/drm/panel/panel-simple.c | 34 ++----------- drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 19 ++----- .../gpu/drm/panel/panel-xinpeng-xpp055c272.c | 21 +------- 17 files changed, 45 insertions(+), 465 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c index 11b64acbe8a9..cccf9400fa99 100644 --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c @@ -18,6 +18,7 @@ #include #include #include +#include #include