From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C0AC432C0 for ; Thu, 28 Nov 2019 17:51:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B6B921771 for ; Thu, 28 Nov 2019 17:51:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p12cZq7W"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="DFl5tTg+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="v+MOEEjF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B6B921771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Mr8iHtNJlhbivhBVluVZ64m1wdApQQxgMqY5hn0H+JY=; b=p12cZq7WZDW2W5rWFjE7p38VM ylb/ZNqE5cLVFte5VR5C7eKBYRVXjgHQI4hNnfhVnjb8lAaZlVWtgCVVDTq/Fg6k91nZ27v4HmHMb vdOVhjWIF0l4+qTw+DmEazjMykXYLZ/WvwrnQEj0E3qaEFoAOwVXZ+aSm9ezTxWhRkIl50xNgT02p dsp5rQv80PDnXoU//RZUjyoOTA6XnzFWKDsqy6sQ+sQ2XPy7pQCDbcxdKvjiBrlPLXzoPmpjsP82R DschX1fheWx0kZj9RnKebfqNxrwgu8UNTAvY5EG+ktHNIpk9FnIHbU0mPSI91mIT4DcPNcFjnqVjP cL6+wYmuw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iaNxF-0007TP-Ju; Thu, 28 Nov 2019 17:51:49 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iaNxB-0007Ro-Vr for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2019 17:51:47 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 8DFB1342C; Thu, 28 Nov 2019 12:51:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 28 Nov 2019 12:51:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=ZW6UxhH0Hm8lRDs/4M+dETDPOEm QhBVGqXhRss+nCzY=; b=DFl5tTg+prW79LfU+kzaWtNO/eowldIHYBmvX2oICxC z4QBHxeowgDuQeqF/wcvVgXCD/JIA7vUBEnxyFJKacjnmq2D5DhVBaPUyJEFFNpr ui0s990Z5w369E8CqQ+ROh372czQk2SQbSIwDUsymMubr/RBjguRYmpQqB6UX/2P 6bztS8S/q4uHFsQBkzNv6PQIemC7eQEEHVVW2adweCXZ8ms6fKQ0gGPz+WQpeHgc mTugC6RfzC4yEu5nmcPLeKpcyHCSIA3gIaLXACbUgvWmjBsUztGVm6BthVVr4c/X HpP8gyUiQ0b1BiXXkDwNBYfnlrWLB+73QCcjPQPcdVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ZW6Uxh H0Hm8lRDs/4M+dETDPOEmQhBVGqXhRss+nCzY=; b=v+MOEEjFVGd6R+cUGyIQEp 8BBMItY604U7PPVeZD8V6/l/Zrk6WUqRBidI5gGkP50HSr9OnjMCT851g1HvqL5Y Q41d5T1R6mncxHXSErZpagb8ilXLBOWo7UG3q4R0MuBK82jFxXeMEw8AtlVBgyQQ uT1dXj5P/x3KBHZZoIISmoZsljpqIq9UF7MNiONNRzf8SEVM07+nDYMsIJ7kEibe flsO0R1+TMPHeh2VahjVuhvzMa9gJLdp0HIntlM0IiaqId/hra/wZfXV//jP3tgi fOhgy4BJpUtf/rzV9atguRr7uaTIlXjgQj5M9TidtAQEBG98CIqwxpjy9ipy0y3w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeijedguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucfkpheple dtrdekledrieekrdejieenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegt vghrnhhordhtvggthhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id DEE4180061; Thu, 28 Nov 2019 12:51:37 -0500 (EST) Date: Thu, 28 Nov 2019 18:51:34 +0100 From: Maxime Ripard To: Jagan Teki Subject: Re: [PATCH v11 4/7] drm/sun4i: dsi: Handle bus clock explicitly Message-ID: <20191128175134.kcgtylfo4ax6ifz7@gilmour.lan> References: <20191025175625.8011-1-jagan@amarulasolutions.com> <20191025175625.8011-5-jagan@amarulasolutions.com> <20191028153427.pc3tnoz2d23filhx@hendrix> <20191029085401.gvqpwmmpyml75vis@hendrix> <20191103173227.GF7001@gilmour> <20191122181820.GQ4345@gilmour.lan> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191128_095146_171452_1A8F95C5 X-CRM114-Status: GOOD ( 19.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree , Michael Trimarchi , David Airlie , linux-kernel , dri-devel , linux-sunxi , Rob Herring , Chen-Yu Tsai , linux-amarula , linux-arm-kernel , Icenowy Zheng Content-Type: multipart/mixed; boundary="===============5675605437648425233==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5675605437648425233== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tueqnmro5e6uu24k" Content-Disposition: inline --tueqnmro5e6uu24k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 23, 2019 at 01:20:21AM +0530, Jagan Teki wrote: > > > Please have a look at this snippet, I have used your second > > > suggestions. let me know if you have any comments? > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > index 8fa90cfc2ac8..91c95e56d870 100644 > > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > @@ -1109,24 +1109,36 @@ static int sun6i_dsi_probe(struct platform_device *pdev) > > > return PTR_ERR(dsi->regulator); > > > } > > > > > > - dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, > > > - &sun6i_dsi_regmap_config); > > > - if (IS_ERR(dsi->regs)) { > > > - dev_err(dev, "Couldn't create the DSI encoder regmap\n"); > > > - return PTR_ERR(dsi->regs); > > > - } > > > - > > > dsi->reset = devm_reset_control_get_shared(dev, NULL); > > > if (IS_ERR(dsi->reset)) { > > > dev_err(dev, "Couldn't get our reset line\n"); > > > return PTR_ERR(dsi->reset); > > > } > > > > > > + dsi->regs = regmap_init_mmio(dev, base, &sun6i_dsi_regmap_config); > > > > You should use the devm variant here > > Sure. > > > > > > + if (IS_ERR(dsi->regs)) { > > > + dev_err(dev, "Couldn't init regmap\n"); > > > + return PTR_ERR(dsi->regs); > > > + } > > > + > > > + dsi->bus_clk = devm_clk_get(dev, NULL); > > > > I guess you still need to pass 'bus' here? > > But the idea here is not to specify clock name explicitly to support > A64. otherwise A64 would fail as we are not specifying the clock-names > explicitly on dsi node. Right. But you have no guarantee that the bus clock is going to be the first one on the other SoCs either. What about something like that instead: char *clk_name = NULL; if (dsi->has_mod_clk) clk_name = "bus"; clk = devm_clk_get(dev, clk_name); if (IS_ERR(clk)) return PTR_ERR(clk)); regmap_mmio_attach_clk(regmap, clk); > > dsi: dsi@1ca0000 { > compatible = "allwinner,sun50i-a64-mipi-dsi"; > reg = <0x01ca0000 0x1000>; > interrupts = ; > clocks = <&ccu CLK_BUS_MIPI_DSI>; > resets = <&ccu RST_BUS_MIPI_DSI>; > phys = <&dphy>; > phy-names = "dphy"; > ..... > }; > > > > > > + if (IS_ERR(dsi->bus_clk)) { > > > + dev_err(dev, "Couldn't get the DSI bus clock\n"); > > > + ret = PTR_ERR(dsi->bus_clk); > > > + goto err_regmap; > > > + } else { > > > + printk("Jagan.. Got the BUS clock\n"); > > > + ret = regmap_mmio_attach_clk(dsi->regs, dsi->bus_clk); > > > + if (ret) > > > + goto err_bus_clk; > > > + } > > > + > > > if (dsi->variant->has_mod_clk) { > > > dsi->mod_clk = devm_clk_get(dev, "mod"); > > > if (IS_ERR(dsi->mod_clk)) { > > > dev_err(dev, "Couldn't get the DSI mod clock\n"); > > > - return PTR_ERR(dsi->mod_clk); > > > + ret = PTR_ERR(dsi->mod_clk); > > > + goto err_attach_clk; > > > } > > > } > > > > > > @@ -1167,6 +1179,14 @@ static int sun6i_dsi_probe(struct platform_device *pdev) > > > err_unprotect_clk: > > > if (dsi->variant->has_mod_clk) > > > clk_rate_exclusive_put(dsi->mod_clk); > > > +err_attach_clk: > > > + if (!IS_ERR(dsi->bus_clk)) > > > + regmap_mmio_detach_clk(dsi->regs); > > > +err_bus_clk: > > > + if (!IS_ERR(dsi->bus_clk)) > > > + clk_put(dsi->bus_clk); > > > +err_regmap: > > > + regmap_exit(dsi->regs); > > > return ret; > > > } > > > > > > @@ -1181,6 +1201,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev) > > > if (dsi->variant->has_mod_clk) > > > clk_rate_exclusive_put(dsi->mod_clk); > > > > > > + if (!IS_ERR(dsi->bus_clk)) { > > > + regmap_mmio_detach_clk(dsi->regs); > > > + clk_put(dsi->bus_clk); > > > > This will trigger a warning, you put down the reference twice > > You mean regmap_mmio_detach_clk will put the clk? No, devm_clk_get will. Maxime --tueqnmro5e6uu24k Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXeAJJgAKCRDj7w1vZxhR xeTeAQCacNpV8Wm/rBcNEWf932Rl1dECN/23C4NSORo+wFWl+QEA9eslBkFZsEsR 8bsW4OOl0eHdwYb6HSh9C+3pq52yBgU= =UsjM -----END PGP SIGNATURE----- --tueqnmro5e6uu24k-- --===============5675605437648425233== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5675605437648425233==--