Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4860913rwb; Sun, 13 Nov 2022 15:47:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5WjxpLH0zeS54Q5vVjAZDkUZDObTHsBgoCC89tsttjcGOgYMISYKelDIMilQkEtIr/Ak2O X-Received: by 2002:a17:907:8c09:b0:7ad:a2ef:c62 with SMTP id ta9-20020a1709078c0900b007ada2ef0c62mr8700915ejc.126.1668383250773; Sun, 13 Nov 2022 15:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668383250; cv=none; d=google.com; s=arc-20160816; b=IWdEE//U8fi2oysHmvVO3dy7AMEB7/QgSKGGLJDwjraVvccGY/tCW5ku9NElgam2MJ vezpflTmqKfP9/TAKPVWBt4hsuYqytDr30QOaeocEg093MILxbeeCtzgvZAPFC4ndJwl 3O/Asn/7Ffo3af46xUJ3stA++AeNBzkjYzOIFQV2OFwZ5FBJ16iX3nquoGYj2lQQOwG5 bkpc/CwIZXl+Rt7BHBkRDkjxNxe9KP9IXtSGa/BuPZOzQ45paXADvhpDOLhA4yL7Qm9l w8ndb0oCK6aG5R6H9WfcRcO5V6Fqv8w03EF/6MevDDHatXLaSWJF7+temyLsHosCHhJN Okng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+agLLhk6BMbVRZoe5tEakKsNVKflbvH0K6ZAw7GtKnY=; b=kr9wy8N+1G+EieVgWL7qumOAIxMHDATFU4dIQmN816OCDoJdQqW1sv9BzlBQ14/Br0 Qw8H4413YaOcpQETfoG8waf6xjetrUGAZFlyvtrwXqY/8u8qrYNuW3kxBQJvPvYhUXiP 59V7XHSDLr0Yx/7OX3ZodH5i4R7Sb+StwvMqff/qLiOLQNaJScZPobwfxFuWDxgvNNiD Q3f8B/Qmxx6MSatj7BEi/mv+VXIUAg5OWXM1jZA2qNBn55ePa5X94TV3fTeOK62BsQTM YxgP3bHNIVvuOnd2qeholCMcTLDUltZV/mSvQLycu8t8rsOE4hJVu6OJpLBneMNEz002 Z3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=USV2Ddzm; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a05640235ce00b004615855c483si7731566edc.98.2022.11.13.15.47.07; Sun, 13 Nov 2022 15:47:30 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=USV2Ddzm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234149AbiKMXeT (ORCPT + 91 others); Sun, 13 Nov 2022 18:34:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbiKMXeR (ORCPT ); Sun, 13 Nov 2022 18:34:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4A096154 for ; Sun, 13 Nov 2022 15:34:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B87A60DD7 for ; Sun, 13 Nov 2022 23:34:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB60DC43144 for ; Sun, 13 Nov 2022 23:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668382454; bh=qAqHRLjgH1Z78cZZXlR1l2VU3CVTYWFxyboPeadk8Lg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=USV2DdzmKvfV1pNyBC2N0uRvMMGCR8N2fGmeAeOUru9d4t8C97H8qI9g16dYC+sdF N/LgIhRuXSnD2WZCoXC9PB0cziHKYJ+u6+F0p/mHZrQewruI70BdWAaJCFm4yJNLi5 nU37q/kFYiunlIiRCc91I8oE7nUO7SBQIOJGd9lluOgTuDn/XMtPW6zoD60p512Skl VAsm1X80nyiAMGetQG+ClUMuzDetlF7NLqITiF5WuvXkikTm73mN+rn3lPZnTuRCtn fzDSufB98+HUllPTjbN2yuLYxKYitA7cxDJGlUzLTaj+BnQ/e2rP1x6IlOEuFkYGym 09kUz8rf4nOhg== Received: by mail-ot1-f42.google.com with SMTP id d26-20020a05683018fa00b0066ab705617aso5794421otf.13 for ; Sun, 13 Nov 2022 15:34:14 -0800 (PST) X-Gm-Message-State: ANoB5pk8W/nsX2cggfCeKQsOstjUCuLDTrHT4HtB/oFD0zzW63oqRzLE PG7pvF7BtYLl9LLv29g6/W1TG2LIFDZSyDh4zA== X-Received: by 2002:a9d:4b02:0:b0:661:b04c:41d9 with SMTP id q2-20020a9d4b02000000b00661b04c41d9mr5380307otf.92.1668382453776; Sun, 13 Nov 2022 15:34:13 -0800 (PST) MIME-Version: 1.0 References: <1667988059-8635-1-git-send-email-xinlei.lee@mediatek.com> In-Reply-To: <1667988059-8635-1-git-send-email-xinlei.lee@mediatek.com> From: Chun-Kuang Hu Date: Mon, 14 Nov 2022 07:33:57 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] drm: mediatek: Modify dpi power on/off sequence. To: xinlei.lee@mediatek.com Cc: chunkuang.hu@kernel.org, p.zabel@pengutronix.de, airlied@linux.ie, daniel@ffwll.ch, matthias.bgg@gmail.com, jitao.shi@mediatek.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Hi, Xinlei: =E6=96=BC 2022=E5=B9=B411=E6=9C=889=E6=97=A5 =E9= =80=B1=E4=B8=89 =E4=B8=8B=E5=8D=886:01=E5=AF=AB=E9=81=93=EF=BC=9A > > From: Xinlei Lee > > Modify dpi power on/off sequence so that the first gpio operation will ta= ke effect. Applied to mediatek-drm-next [1], thanks. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/= log/?h=3Dmediatek-drm-next Regards, Chun-Kuang. > > Fixes: 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low to avoid= leakage current") > Signed-off-by: Xinlei Lee > --- > change note: > v3: Moved pull-down pin control after mtk_dpi_power_off. > > v2: Remove the empty line between Fixes: and S-o-b. > > v1: Rebase on linus/master v6.1-rc1. Change nothing. > > Because dpi power_on/off is protected by dpi->refcount, the first time > it cannot be powered on and off successfully, it will cause leakage. > --- > --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediate= k/mtk_dpi.c > index 508a6d994e83..1f5d39a4077c 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -461,9 +461,6 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi) > if (--dpi->refcount !=3D 0) > return; > > - if (dpi->pinctrl && dpi->pins_gpio) > - pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio); > - > mtk_dpi_disable(dpi); > clk_disable_unprepare(dpi->pixel_clk); > clk_disable_unprepare(dpi->engine_clk); > @@ -488,9 +485,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) > goto err_pixel; > } > > - if (dpi->pinctrl && dpi->pins_dpi) > - pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); > - > return 0; > > err_pixel: > @@ -721,12 +715,18 @@ static void mtk_dpi_bridge_disable(struct drm_bridg= e *bridge) > struct mtk_dpi *dpi =3D bridge_to_dpi(bridge); > > mtk_dpi_power_off(dpi); > + > + if (dpi->pinctrl && dpi->pins_gpio) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio); > } > > static void mtk_dpi_bridge_enable(struct drm_bridge *bridge) > { > struct mtk_dpi *dpi =3D bridge_to_dpi(bridge); > > + if (dpi->pinctrl && dpi->pins_dpi) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); > + > mtk_dpi_power_on(dpi); > mtk_dpi_set_display_mode(dpi, &dpi->mode); > mtk_dpi_enable(dpi); > -- > 2.18.0 >