From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gofer.mess.org (gofer.mess.org [88.97.38.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBDC1125A3; Tue, 16 Jan 2024 08:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mess.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mess.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mess.org header.i=@mess.org header.b="KAVU3mtA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mess.org; s=2020; t=1705393686; bh=atc+5+ojRvm8ThjhjD7yUzq2b3yJt/kmV+ymWWi8EQg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KAVU3mtAAmNdfm2lPlBc3yrxcepLBsM0BAxgkupmPr3o0C/hI4SsBcW6N3deojhSZ SwLgxJMXS7055SAA9oYxM9fSTUvPnOc+IQj+mRgVanuOTLMOgOPqs1Hs5HIV2DrqvC aoP1cHxPpN+msTzz9K9jk4LnMp3vGX2Iz736rrM4qTdFhXq6UN5ShVEF2R8nYTuz2d 2TFH6KM4XhNENO1/crKT1TzF5bB3yy2XWjxbas56EArRXrHtXyiXj1RkoiYigdEj7H nOxyKKG8aqDbAkRJwG3GmPhrKovXYzIBYZyd84ajXRY/7oJXl/E5a+x0Yhzib5ML5U Ag/yfhu6xOnxA== Received: by gofer.mess.org (Postfix, from userid 1000) id D212A1000C2; Tue, 16 Jan 2024 08:28:06 +0000 (GMT) Date: Tue, 16 Jan 2024 08:28:06 +0000 From: Sean Young To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Trevor Gamblin , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, michael.hennerich@analog.com, nuno.sa@analog.com, devicetree@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: Re: [PATCH 2/2] pwm: Add driver for AXI PWM generator Message-ID: References: <20240115201222.1423626-1-tgamblin@baylibre.com> <20240115201222.1423626-3-tgamblin@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Jan 15, 2024 at 10:18:04PM +0100, Uwe Kleine-König wrote: > On Mon, Jan 15, 2024 at 03:12:21PM -0500, Trevor Gamblin wrote: > > +static int axi_pwmgen_probe(struct platform_device *pdev) > > +{ > > + struct axi_pwmgen *pwm; > > + void __iomem *io_base; > > + int ret; > > + > > + pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); > > + if (!pwm) > > + return -ENOMEM; > > + > > + io_base = devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(io_base)) > > + return PTR_ERR(io_base); > > + > > + pwm->regmap = devm_regmap_init_mmio(&pdev->dev, io_base, &axi_pwm_regmap_config); > > + if (IS_ERR(pwm->regmap)) > > + return dev_err_probe(&pdev->dev, PTR_ERR(pwm->regmap), > > + "failed to init register map\n"); > > + > > + pwm->clk = devm_clk_get_enabled(&pdev->dev, NULL); > > + if (IS_ERR(pwm->clk)) > > + return dev_err_probe(&pdev->dev, PTR_ERR(pwm->clk), "failed to get clock\n"); > > Please call clk_rate_exclusive_get() on pwm->clk and cache the rate in > struct axi_pwmgen. > > > + pwm->chip.dev = &pdev->dev; > > + pwm->chip.ops = &axi_pwmgen_pwm_ops; In that case pwm->chip.atomic = true; can be set too (although this should be tested with CONFIG_DEBUG_ATOMIC_SLEEP and CONFIG_PWM_DEBUG). Thanks, Sean