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)