Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp312178rdb; Tue, 16 Jan 2024 00:28:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEYdObvuwLnYCYWpsBO1y/D9BK1KfhPy+p7KCuiS/wMN15vr+8ei+7wrGliAcE6WxL51Ck X-Received: by 2002:ac2:4d82:0:b0:50e:3d69:69a7 with SMTP id g2-20020ac24d82000000b0050e3d6969a7mr2936975lfe.42.1705393709467; Tue, 16 Jan 2024 00:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705393709; cv=none; d=google.com; s=arc-20160816; b=BOOG2AJvCBuz5WBLq2JYYZgLOJ4yPsE+EH8Kvqy74u0x18Y4AyoLj4FaN2xaaPsr2M xbytwRTYMYlX3PXWyPd+3c0hvJlWRSVLxdYLfkMEIJv3D26Cm8r8z25GzRytCHjaMxbk gVDVOKIqsuUVMYCiLOS67d0MH5/UAuejsVm5S51qep3v3gHRGVxEvP6YehPAf4y2OVvb b9taWOxwj8N2clqV5BiPLPyxSVYKeEb0qp+vzTQSjAuHqDZeefWF0WkQddtDX2jJyS9H mVsGi0fNmEqKPM763TwfUG89vCo6kj+zdCWIvWal5dzUwNSRD5mUZVFVrUVTnYbWTjm7 F50A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gvEhKo1Xn8lOT/706oxqqDgBKXtsqBCxNz6ud4uOw7Q=; fh=x7qVVmsWHHHTIBtlJZdIej6fCbrwEWXfvoSfqbpD+RI=; b=SEA6EFwS6QbTG8PSEXWkCihoRPQsSp9ejxWbKgoluwiIGc1peDv3f91Y+97o1YcImZ d2F39w95fTMZDixhwhupzi3h4mnjXbSdEk8OF77HjbV6mzQse0zzAN+GMI3ugwUQsn39 PeR+1Rw/omJnIZLSS5s+HKYlQdSlOr7JqeBGBs6rqPuY38LK9fIk/vGexQzM4A/03VBS PmJQQ/f8Zp3QcoW4s5TknSWE47o6xaEJ1drpi5ZVFko8lRzB6jISLsB/0KO6SsOWf1SW x7iDus/CgT+MBi/nVqwviBi5MB9TJqG1wjz/CqkdWIkevR0xRdmFuD+C6gOBb4348eg3 tSFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=KAVU3mtA; spf=pass (google.com: domain of linux-kernel+bounces-27126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v20-20020a170906339400b00a2ca67879d5si3845539eja.984.2024.01.16.00.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=KAVU3mtA; spf=pass (google.com: domain of linux-kernel+bounces-27126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 37E3A1F23F54 for ; Tue, 16 Jan 2024 08:28:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82F6F11CB1; Tue, 16 Jan 2024 08:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mess.org header.i=@mess.org header.b="KAVU3mtA" 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 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