Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1466784ybz; Sat, 18 Apr 2020 01:24:55 -0700 (PDT) X-Google-Smtp-Source: APiQypKsEWFMZG4M9j2GbiemhpP+Zmdjt9I0ISA63/FHitoi1sTIascD2a+0Q4mCbR4rqaHgwM66 X-Received: by 2002:aa7:d60a:: with SMTP id c10mr6536390edr.66.1587198294984; Sat, 18 Apr 2020 01:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587198294; cv=none; d=google.com; s=arc-20160816; b=ZrrULmGJcPoiJ/OsjBQRRRDxMypoacGxWB0kaWwMpID0nwv2xm4Q98ATerW+LNdGEW T6YfPy3ReZT7jOcnTOIuF4a3oIIiONy3WO+FL8ihPqIgERV6j5VCd8HnNKXs3vDayt6F LFhgjeRGrASkO9R+I6+Ye0Y0VCSN3ZmM1Hqo/8mwDHQBsi60QfZFYHfCyC5yoMJPl3Um uBe//I7DHL4yB5S1bdseg5gQkaovDMMciEnQz9xro7vw2ccBHZIAXatl1HO8qW+ebG3P l4D0pONdxi8uIQzEIQVsvVkmcmVdmenOyJ9t6ntvAa8D2frJO4VHlK5EHdP4rWK39PGB 4aAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tHw91au5FRY+uKSpxt/tkZ4/ZJ8qzAgj9SyUngZDos8=; b=Oqx+OcP58muJBogKxCk2RCRJ+E46rIhQOcZKLQaRVBwZEhzvvaGt6zELyEcxgB7uWO N+v9Jq8WzpLu4M2Bq13f1Kfi2MBGPv8wMcCeVxHAegrZo/0PmevV2KeqworJkOwLJ46u uiXd/77ZOjKCqcSsMUjmht03fmzoCUasbX8IxrzniicdACTHKJrO4LD7gUGYbJ/kRvob gw3ku0EDcY71gG+PE0f3w5McwYh0WIpOw1k7wBSS9qsHhTRm9nxT9fwmF000+rpOEPfm j2DLpPtpdwGsXfgPQmsupZu5NnXcfbuPecT+gTniGcqxOR3pS+wMYAv5zuJU/VBh8NA1 vYbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj19si13658027ejb.297.2020.04.18.01.24.32; Sat, 18 Apr 2020 01:24:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725801AbgDRIXT (ORCPT + 99 others); Sat, 18 Apr 2020 04:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgDRIXT (ORCPT ); Sat, 18 Apr 2020 04:23:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F8EC061A0F for ; Sat, 18 Apr 2020 01:23:19 -0700 (PDT) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPikf-0005Wz-ET; Sat, 18 Apr 2020 10:23:01 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1jPike-0006bn-RM; Sat, 18 Apr 2020 10:23:00 +0200 Date: Sat, 18 Apr 2020 10:23:00 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Sandipan Patra Cc: Thierry Reding , "robh+dt@kernel.org" , Jonathan Hunter , Bibek Basu , Laxman Dewangan , "linux-pwm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] pwm: tegra: dynamic clk freq configuration by PWM driver Message-ID: <20200418082300.mucrg2srysvvjbfn@pengutronix.de> References: <1585917303-10573-1-git-send-email-spatra@nvidia.com> <20200403151050.nh2mrffkqdqtkozq@pengutronix.de> <20200415141856.ck3w3gtae4bsxyfl@pengutronix.de> <20200417135027.wkj6bxiplnehsa5s@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Apr 17, 2020 at 02:53:22PM +0000, Sandipan Patra wrote: > > To put my expression in words: pick the maximum of the possible periods that > > are less or equal to the requested value. Maybe this is better > > understandable: > > > > max { x ∊ implementablePeriods | x <= requestedPeriod } > > > > ? > > I think I got your question. > Should tegra_pwm_config() not return error (EINVAL) when the requested period is > invalid but it should configure to a nearest possible value? If you cannot configure according to the above rule, yes, return an error code. EINVAL is the usual one I think (some also return ERANGE). > > > Yes, the output stops as soon as the PWM_ENABLE bit is cleared in > > > hardware. Then The output is set to 0 (which is inactive). > > > Once .disable() => tegra_pwm_disable() gets invoked, enable bit is > > > cleared and hence PWM will possess no output signal. > > > tegra_pwm_config() will be invoked for any new configuration request. > > > > Some drivers already have a "Limitations" section in their header. > > Please take a look at the existing examples and provide something similar. (Note > > you still didn't answer "How does a running PWM behave when the register is > > updated? Does it complete the currently running period?". I assume the answer > > to the second question is "No" (and the first is only there for rhetoric reasons).) > > > > 1. I will add the below comments as Limitations: > - When PWM is disabled, the output is driven to 0 and In fact, this is a good property. So the only problem is, that for both stop and reconfiguration the currently running period isn't completed. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |