Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp136571iob; Wed, 11 May 2022 11:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyxoTkW327PM0/3uDAq0viFydC3BiDDPaJA2xvauhGbCXvd8clkKQfwXpcQX1MKMx4W3sn X-Received: by 2002:a17:906:c14c:b0:6f4:fdf3:4a3a with SMTP id dp12-20020a170906c14c00b006f4fdf34a3amr25861899ejc.525.1652292205134; Wed, 11 May 2022 11:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652292205; cv=none; d=google.com; s=arc-20160816; b=wb9AhxTDqLDGd6hAzHuiruuo9qP6UiifjWcIfYA4c4iaz4r8KGq44K2oPQcM68xs1D U56bo7uXYVqSJIKJUAWZFcw9RhXlBFyU8wBy9HOr3LbwBOi0AGmd5ImoXGXZyxJ8Vg4K 74yzxhSnrlyb/l/acJfyuoCCTci3flCLyoXakO30lQj1+Y7kiHnYQydS87Gc8YrJEmDt dI5Pd8RVH/sXRYgke58ZBJKiqRuFw7la0yxz+c46LwjPNKuuDVa+ce15fgaQJfBUhrY3 pWnyfWElVV010eUEtjwVlDjvVv81b4EE17rbxKTrj7an4qbNxdOOBp0geXZV0nY1cNL7 hlHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tIIc8BNy6CGofopZVJFbIY2nvwuNpSIe9y9o4Ek7axo=; b=LTeBiEo95rqCSunGyxp6gE0V3tXGCRYhFrI6wKRYawuslrUqtgyG14Rbbay+QRgiv7 RDz2U3u9VY/nKu5eQDt6aTL1komLeogVzN5vgWlSSnfXgC3dRT+OvTO/H4WwxrnI8AqA DqIaRr5LMpR0afCL/n6i7+3QzQvwghA8ArWM1KWhC0OHUyfVWfVnqiqoo62RUKlSj3e0 16mcfkQzOZKjccXtHDr517hFpggBNVg5AKgu183+M/4lql6FV6f3mhLTrlZJNJHJnMvK 4HUjpKm0H+pT/dXMysv8pfzoOHZwfMVVoDRz14vNZFMRKr4G0e89mLP9cO6SruoHbInQ V7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nHHV+CAw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb20-20020a1709077e9400b006f392b2aac4si3502183ejc.190.2022.05.11.11.02.48; Wed, 11 May 2022 11:03:25 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=nHHV+CAw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245528AbiEKPCb (ORCPT + 99 others); Wed, 11 May 2022 11:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245501AbiEKPBX (ORCPT ); Wed, 11 May 2022 11:01:23 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC04F3191E for ; Wed, 11 May 2022 08:01:20 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 459B46DD; Wed, 11 May 2022 17:01:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652281278; bh=bVcJtp0XYB8s5syvPckxTbg4rgf7boXFqjdL9plxvuQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nHHV+CAwEwehLeLC1DPRLFfME9j77NYuJZ9dSJIpAz4z24dHvZC2Yoxzr73hkVUbP zZTcWwauUkOg+X3vwIYGFx7xmSnYLlr0BeTaXgPnz0fIgQNFSORjR3PZ2L6C3/y5QY mjYSgl7TfV5U1emCDlS554DUqlJTP3YJB0JuP1ls= Date: Wed, 11 May 2022 18:01:12 +0300 From: Laurent Pinchart To: Jayshri Pawar Cc: dri-devel@lists.freedesktop.org, daniel@ffwll.ch, airlied@linux.ie, andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, jonas@kwiboo.se, jernej.skrabec@gmail.com, linux-kernel@vger.kernel.org, mparab@cadence.com, sjakhade@cadence.com, nm@ti.com, yogeshs@ti.com, kishon@ti.com Subject: Re: [PATCH] drm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions. Message-ID: References: <20220411140606.15654-1-jpawar@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220411140606.15654-1-jpawar@cadence.com> X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_SBL_CSS,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 Jayshri, Thank you for the patch. On Mon, Apr 11, 2022 at 04:06:06PM +0200, Jayshri Pawar wrote: > From: jpawar > > Add support for pre_enable and post_enable drm bridge control functions. > Making sure that host to be prepared before panel is powered up, > for the panels like TC358762. > > Signed-off-by: jpawar > --- > drivers/gpu/drm/bridge/cdns-dsi.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c > index 829e1a144656..20bece84ff8c 100644 > --- a/drivers/gpu/drm/bridge/cdns-dsi.c > +++ b/drivers/gpu/drm/bridge/cdns-dsi.c > @@ -462,6 +462,7 @@ struct cdns_dsi { > struct reset_control *dsi_p_rst; > struct clk *dsi_sys_clk; > bool link_initialized; > + bool phy_initialized; > struct phy *dphy; > }; > > @@ -711,11 +712,21 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge) > pm_runtime_put(dsi->base.dev); > } > > +static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge) > +{ > + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); > + struct cdns_dsi *dsi = input_to_dsi(input); > + > + pm_runtime_put(dsi->base.dev); > +} > + > static void cdns_dsi_hs_init(struct cdns_dsi *dsi) > { > struct cdns_dsi_output *output = &dsi->output; > u32 status; > > + if (dsi->phy_initialized) > + return; > /* > * Power all internal DPHY blocks down and maintain their reset line > * asserted before changing the DPHY config. > @@ -739,6 +750,7 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi) > writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN | > DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB, > dsi->regs + MCTL_DPHY_CFG0); > + dsi->phy_initialized = true; > } > > static void cdns_dsi_init_link(struct cdns_dsi *dsi) > @@ -914,11 +926,25 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) > writel(tmp, dsi->regs + MCTL_MAIN_EN); > } > > +static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge) > +{ > + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); > + struct cdns_dsi *dsi = input_to_dsi(input); > + > + if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) This should use pm_runtime_resume_and_get(), otherwise you need to call pm_runtime_put_noidle() on failure. > + return; > + > + cdns_dsi_init_link(dsi); > + cdns_dsi_hs_init(dsi); > +} > + > static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = { > .attach = cdns_dsi_bridge_attach, > .mode_valid = cdns_dsi_bridge_mode_valid, > .disable = cdns_dsi_bridge_disable, > + .pre_enable = cdns_dsi_bridge_pre_enable, > .enable = cdns_dsi_bridge_enable, > + .post_disable = cdns_dsi_bridge_post_disable, > }; > > static int cdns_dsi_attach(struct mipi_dsi_host *host, -- Regards, Laurent Pinchart