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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 002F4C4CEC9 for ; Wed, 18 Sep 2019 14:30:24 +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 C75A221924 for ; Wed, 18 Sep 2019 14:30:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Hl+B85Cr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="u0FC0ls3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C75A221924 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=i2ULdGllLeUP+FyLckrUnGLV//ktoefpWZqJt3iVtqQ=; b=Hl+B85Cr2o7ufy5egjT/h1hdD AxcCDBPruea47sd8u+iH91QGm6VjLNx3318HDjjkdghmJ9r2RsUW1hrKOQqTONo8zo84YpcifbMce CqxIc6DgyHWyel5ZPmmlocUqI0QX+MhjU8rn7W/i83ROCthFhQu5/NB1dlbpIbLoZTbCqt5a3oBzL etDCbTyX6DY82kbWRH8HCnfe1psUxwn6lU7rg1aBEF13+LnFEUkSqQxXCZ384gPTmdLk4MWiQBHlQ 4phvWE8kzZOiGed/50VdYS5Ht2C7VOamhyfbtKpqu1HB3UQKIfP2/fIBdob2IDiXHz+aBOrkDeDiy NCaREqJUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAayI-0003VO-Sd; Wed, 18 Sep 2019 14:30:18 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAayF-0003V4-UW for linux-arm-kernel@lists.infradead.org; Wed, 18 Sep 2019 14:30:17 +0000 Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BD8F218AE; Wed, 18 Sep 2019 14:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568817015; bh=n7hEc4U3JFOCFiwdHi6OxEy+MNo9Uxm6c6RnEDR8WCk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u0FC0ls3vLRORjqiIUVr1q5uIM4D5c4rEUU4iQtMFK+Zkh4h99Regs1s/KZ3GBhWq Cl8vuE9rrla1mh+Y+QW3Vxw9p3O8xmlC2DfI34/YeRkgXBIDmStGfXKkhtIJ9zmCf2 EZ12GpdDZk3k7CnbMblC+5hiUGtkMC/B7Ps3/BLY= Date: Wed, 18 Sep 2019 16:30:12 +0200 From: Maxime Ripard To: Jernej =?utf-8?Q?=C5=A0krabec?= Subject: Re: [PATCH 5/6] media: sun4i: Add H3 deinterlace driver Message-ID: <20190918143012.4o54doeauiv3j42z@gilmour> References: <20190912175132.411-1-jernej.skrabec@siol.net> <20190912175132.411-6-jernej.skrabec@siol.net> <20190912202647.wfcjur7yxhlelvd6@localhost.localdomain> <3227980.eWD6USAIP4@jernej-laptop> MIME-Version: 1.0 In-Reply-To: <3227980.eWD6USAIP4@jernej-laptop> User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190918_073016_029238_865F6A8A X-CRM114-Status: GOOD ( 19.40 ) 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@arm.com, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, wens@csie.org, robh+dt@kernel.org, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: multipart/mixed; boundary="===============4664860655692228324==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4664860655692228324== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="murlg7gnizd4neyj" Content-Disposition: inline --murlg7gnizd4neyj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sat, Sep 14, 2019 at 08:42:22AM +0200, Jernej =C5=A0krabec wrote: > Dne =C4=8Detrtek, 12. september 2019 ob 22:26:47 CEST je Maxime Ripard na= pisal(a): > > Hi, > > > > On Thu, Sep 12, 2019 at 07:51:31PM +0200, Jernej Skrabec wrote: > > > + dev->regmap =3D devm_regmap_init_mmio(dev->dev, dev->base, > > > + > &deinterlace_regmap_config); > > > + if (IS_ERR(dev->regmap)) { > > > + dev_err(dev->dev, "Couldn't create deinterlace > regmap\n"); > > > + > > > + return PTR_ERR(dev->regmap); > > > + } > > > + > > > + ret =3D clk_prepare_enable(dev->bus_clk); > > > + if (ret) { > > > + dev_err(dev->dev, "Failed to enable bus clock\n"); > > > + > > > + return ret; > > > + } > > > > Do you need to keep the bus clock enabled all the time? Usually, for > > the SoCs that have a reset line, you only need it to read / write to > > the registers, not to have the controller actually running. > > > > If you don't, then regmap_init_mmio_clk will take care of that for > > you. > > > > > + clk_set_rate(dev->mod_clk, 300000000); > > > + > > > + ret =3D clk_prepare_enable(dev->mod_clk); > > > + if (ret) { > > > + dev_err(dev->dev, "Failed to enable mod clock\n"); > > > + > > > + goto err_bus_clk; > > > + } > > > + > > > + ret =3D clk_prepare_enable(dev->ram_clk); > > > + if (ret) { > > > + dev_err(dev->dev, "Failed to enable ram clock\n"); > > > + > > > + goto err_mod_clk; > > > + } > > > + > > > + ret =3D reset_control_reset(dev->rstc); > > > + if (ret) { > > > + dev_err(dev->dev, "Failed to apply reset\n"); > > > + > > > + goto err_ram_clk; > > > + } > > > > This could be moved to a runtime_pm hook, with get_sync called in the > > open. That way you won't leave the device powered on if it's unused. > > Currently I'm looking at sun4i_csi.c as an example of runtime ops, but it > seems a bit wrong to have suspend and resume function marked with > __maybe_unused because they are the only functions which enable needed cl= ocks. > If CONFIG_PM is not enabled, then this driver simply won't work, because > clocks will never get enabled. I guess I can implement runtime pm ops in = the > same way and add additional handling when CONFIG_PM is not enabled, right? Ah, right. I guess you can either add a depends on PM, or you can call the function directly and use set_active like we're doing in the SPI driver. > BTW, which callback is get_sync? I don't see it in dev_pm_ops. I suppose I > need only runtime_suspend and runtime_resume. get_sync is the user facing API, ie what you call when you want the device to be powered up. This will call runtime_resume if needed (there were no users, and you become the first one), and on the parent devices if needed too (even though it's not our case). > Off topic: sun6i_csi.c includes linux/pm_runtime.h but it doesn't have an= y kind > of power management as far as I can see. That's probably something we can remove then Thanks! Maxime --murlg7gnizd4neyj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXYI/dAAKCRDj7w1vZxhR xevqAQCkxjBKYVgA/AYg52M5egxPmCw9EbU+dTVOFOS3HnL94wD8C/1DfMGYclzH K2NXT3v5e5dek4yjiUUAdMyPuzrn4gU= =xZgs -----END PGP SIGNATURE----- --murlg7gnizd4neyj-- --===============4664860655692228324== 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 --===============4664860655692228324==--