From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 482E9342CA7 for ; Fri, 10 Apr 2026 10:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775816672; cv=none; b=riz/4j8I/yMwBJUBo+0Tqtv1SlOkZRmaQNVNMFwjCKcysCYnjnzvqvJjbUn8RyS9lRi7gboIzhUHTbEo9ZpVr6gP0pkMdYPS25pEVBykQ0yQa3jKfHqrtUtd/ECNtQqH8h8vkd14HGeZloz5kYZJE/9rPw7lwaWBaqJQjVuVXI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775816672; c=relaxed/simple; bh=xe5BlvWEmvuJ0r8jiIZC9Qt6O5+U0xuQTEj7QAoXSxA=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kHxRh7BY0yhqTcHO/2a9erSsEhmL/D4FfAnUYZw9k1fENUcwLlEwW8N/C7RSxjzqtBp4aZR6BAwHcwXtUEgEhbDOLnF45WQN02/9cEJwrvk5FlJ5r+UbbSjwHEV5b5fMkmetRMLevmZ5OlpvqnZN8H2bbc62Uuaq8UsFoFYuppk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=N22ioBIM; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="N22ioBIM" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-43b8e8e7432so1641315f8f.1 for ; Fri, 10 Apr 2026 03:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775816670; x=1776421470; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=ZKnPag+J1FK879lrPixqSysMm2rbphTSL3HqF/0DRQk=; b=N22ioBIMsFLNgTbEmrA5vN8oKPwMYWkVy1y8v7my5f3kB6ez+n2+0pS6ccJMv37w/+ biEJg/KuGgcnMXbnQYiYnDU5DKLGsTekqm022Tmz9RvMTDLcr277RpgC8vq6FcYxcBJl shxJ7LBr5hDtPN9mm/2Ofn0p4ZW+lDw5aufanq1Z7bL6TfzqVtBADIHcnNvPgPuqq/wq dNKIR2hhUlJk8uyQMNpOcsB5fIYijnctWCnwlAM7gZTZ/6ijtc11rgsCJ/9dkZiVHD0x 4NFaWhfsd2sHSVunW3DGZd30Lq2sxkh7s0Wd433et7af55cgj6glpiwEMP/Y6u1SMHQV FCTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775816670; x=1776421470; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZKnPag+J1FK879lrPixqSysMm2rbphTSL3HqF/0DRQk=; b=AuDw3kXIuRJAEu9kSTEEKpItIXhXfCCS5ZXTFRB6VJGjv0Y5POEoHUhAluA+tSGjqq 5Qn8xccBVkoLJID5ddZ6FCY6jffRDS+7Hhpfa4Wmkpfuzyq5Bx6gzbEmFe2JO/ThMd0v j9zNk88U7O6T4OoTnzDWTioTKz8kGhjHqkA6ykJ/mogx/XAmRYSGV4ju2BepU/ErO+n+ bdmYKa+i6i3MqGoYuQ+uxkX//MsIGsuL4iIOdmRRg/hAKJKmXgT3Eb2rsYjDDTeGJCGm jODSWqI0Aokbk2TSyt6bHbSQ0TcQFecqq4CPuvhQilEFgcn+WMiIFBneR2pfyF0+o3xJ EKmw== X-Forwarded-Encrypted: i=1; AJvYcCXq1f2dY2F+F2oclSp7EY1EQ0OCkULELsP9QEdJhNKYwkpZFVInLaBDReASzCcwsV8rQXSOCc2IB5HRVto=@vger.kernel.org X-Gm-Message-State: AOJu0YyKJ3Cpr08uRtQoHASeRALaVS06h+g7I3TBfdy1jRnOaP8tZmej K0E2wNqu1QO9wuFEZu3NpB0VkntUYyYSc5+vPP0Km+3hYM2bpu7tsj199qSFld9t3Ik= X-Gm-Gg: AeBDiesw+tdJuVw8ptCn61Ss00U0CFqPmgBWj7HuXh++3YpqR+Tf8GlM8IgbylgdB7b oRD60zbGTjFQ+Se4CevrKx6RZ1CUaI+EpHG2W0IQIHZ6G/Dwng3/pPj7kM7JoGTbyUCGpyF7kU6 SD4qwwfcHF82Va2dyY/kDhYm4e4tu47NwiPuK7/Vh71x8tZqrbyITRgQYgEni88v+KLIgdhdziL ChJKWmw0n++Pa11iD4LcTpMwrCZHoFUeLN5mhQT0lQi6FrWfjSAY4kAwFnGSe5AjNxmXSVSVh0d NyUlst180XjM8gKWPwfAv8AWaK/JNqeRsbJFxbjA5MKvMf2aY88N4q7H6X3a6XP2DIY6lgYsaeB c0ekU8UppTp4jEQYZPc0OTcelevw1Lr2x7LTdXrAr0pDzzDAaufMnRtmZ92lBGKaThUJC9x9YlY ah2y4QWfKtoDJCxdMhdh1aWcxj6G6jeTaT1YJ5la6hDkAgPtV+zw== X-Received: by 2002:a05:6000:402a:b0:43b:8f23:a87b with SMTP id ffacd0b85a97d-43d642d9d59mr3841629f8f.44.1775816669353; Fri, 10 Apr 2026 03:24:29 -0700 (PDT) Received: from localhost (93-41-3-120.ip79.fastwebnet.it. [93.41.3.120]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63e5c981sm6454744f8f.33.2026.04.10.03.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 03:24:29 -0700 (PDT) From: Andrea della Porta X-Google-Original-From: Andrea della Porta Date: Fri, 10 Apr 2026 12:27:35 +0200 To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Andrea della Porta , linux-pwm@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Naushir Patuck , Stanimir Varbanov Subject: Re: [PATCH 2/3] pwm: rp1: Add RP1 PWM controller driver Message-ID: References: <28e29fbfc20c0b8a115d006233c2759d8f49e639.1775223441.git.andrea.porta@suse.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: Hi Uwe, On 08:27 Fri 10 Apr , Uwe Kleine-König wrote: > Hello Andrea, > > On Thu, Apr 09, 2026 at 06:16:41PM +0200, Andrea della Porta wrote: > > On 23:45 Sun 05 Apr , Uwe Kleine-König wrote: > > > On Fri, Apr 03, 2026 at 04:31:55PM +0200, Andrea della Porta wrote: > > > > +static void rp1_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) > > > > +{ > > > > + struct rp1_pwm *rp1 = pwmchip_get_drvdata(chip); > > > > + u32 value; > > > > + > > > > + value = readl(rp1->base + PWM_CHANNEL_CTRL(pwm->hwpwm)); > > > > + value &= ~PWM_MODE_MASK; > > > > + writel(value, rp1->base + PWM_CHANNEL_CTRL(pwm->hwpwm)); > > > > + > > > > + rp1_pwm_apply_config(chip, pwm); > > > > > > What is the purpose of this call? > > > > To update the configuration on the next PWM strobe in order to avoid > > glitches. I'll add a short comment in the code. > > .pwm_free() should not touch the hardware configuration. Changing the > pinmuxing (which I guess is the purpose of clearing PWM_MODE_MASK) is > somewhat a grey area. If that saves energy, that's okish. Otherwise > not interfering with the operation of the PWM (e.g. to keep a display on > during kexec or so) is preferred. Sorry I should've been more clear on this. The pinmux/conf is not changed at all by this mask, only the PWM output mode is. The controller can output several type of waveforms and clearing PWM_MODE_MASK is just setting the controller to output a 0, which is the reset default i.e. the same value as just before exporting the channel. I guess this is the expected behaviour in case of a fan, it should stop spinning in case you unexport the pwm channel, but I see it could be different with displays. Honestly I don't have a strong opinion about that, please just let me know if I should drop that pwm_free entirely. > > > > > +static int rp1_pwm_resume(struct device *dev) > > > > +{ > > > > + struct rp1_pwm *rp1 = dev_get_drvdata(dev); > > > > + > > > > + return clk_prepare_enable(rp1->clk); > > > > > > Hmm, if this fails and then the driver is unbound, the clk operations > > > are not balanced. > > > > I'll add some flags to check if the clock is really enabled or not. > > To be honest, I guess that is a problem of several drivers, not only in > drivers/pwm. If this complicates the driver, I guess addressing this > isn't very critical. I'll come up with something, we can always drop this check if deemed too 'noisy'. Many thanks, Andrea > > Best regards > Uwe