Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp451785ybn; Wed, 25 Sep 2019 02:30:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJdyk+RjT0ng6xVfeDG6Ew39+8CUZOORXOeBlFuLi7JK3cLaUwk9XByqv468j2GonynzaK X-Received: by 2002:a7b:c764:: with SMTP id x4mr6455991wmk.62.1569403799985; Wed, 25 Sep 2019 02:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569403799; cv=none; d=google.com; s=arc-20160816; b=mT2DIcOakHQSWL537glqyGGEUnJ0y2GdsjEW30cCxSZ19ygTJ0w66JFJ83Cy5JT9OM Tbbe03aMy5pIb6UtNTed4uNjHGhbms9wm47ejvK8jzH71dXFASWomRmUC0iGCKlZRgiO 1dLYJAJjAIgBuaGlrjwz2tdEJTYIV7MM3593n8j9S9ToqJGNI0DDbiWedIttotFqBLPY rfpsgkr/IqAnZ5yTCgb8gEgxt1briYuJqOMETjJ50aoVTRkopqZJ7U78Py0jE6IX2yfA 4vlJexUyUwVbTfgh+CfWZOE6J15NFZR+l0+lKErJOQ+ViUaI5Y6qa4DxzgIESg5h44f+ Zppg== 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=XtrbgnXqJ8tqfydA3G2qzKJIIEeSVKCmHdIQZMIuT5M=; b=B3Lrlx5nqU94eIQnKHeteSmcpkfQ8PUyByP9CaVT4b9wkTQy1tN6woz5EOps5AZF/0 i9GgTVsHVwNDk9w9BE8BazeEPotvvwbnq5vPTbMDgWadh7dVZlvnb+R9woyky9W/7v5h 5Mp9gyQjoSmwaZOtnB5P3xrWwoeoOVNG9A9Hlh/s8/4UWHabPgzZfNZ+VAB3ZzR3Jdxg lHrsSrmzMwfADEtyESjDBEyAsgNiLUgCkma7lIJY8yfe7nl+e87trKr6PfJBCIDZbCNb 0ySOQTwfzDcdiPZEOOuCGF/auuxjxl8il0uRd0re8NDcyLDLn4Y+g319jqg+oJzBdKs+ jm2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p40si565460eda.334.2019.09.25.02.29.36; Wed, 25 Sep 2019 02:29:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731985AbfIWIyS (ORCPT + 99 others); Mon, 23 Sep 2019 04:54:18 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47195 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731971AbfIWIyS (ORCPT ); Mon, 23 Sep 2019 04:54:18 -0400 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 1iCK6p-0002FR-FW; Mon, 23 Sep 2019 10:54:15 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iCK6o-0000rV-MN; Mon, 23 Sep 2019 10:54:14 +0200 Date: Mon, 23 Sep 2019 10:54:14 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Rasmus Villemoes Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, Shawn Guo , Sascha Hauer , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/4] pwm: mxs: add support for inverse polarity Message-ID: <20190923085414.6d3gbby6gglpjsfe@pengutronix.de> References: <20190923081348.6843-1-linux@rasmusvillemoes.dk> <20190923081348.6843-4-linux@rasmusvillemoes.dk> <20190923082735.tzxyhvjlnztsxhsc@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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 On Mon, Sep 23, 2019 at 10:45:56AM +0200, Rasmus Villemoes wrote: > On 23/09/2019 10.27, Uwe Kleine-K?nig wrote: > > On Mon, Sep 23, 2019 at 10:13:47AM +0200, Rasmus Villemoes wrote: > >> > >> > >> + pol_bits = state->polarity == PWM_POLARITY_NORMAL ? > >> + PERIOD_POLARITY_NORMAL : PERIOD_POLARITY_INVERSE; > >> + > >> writel(duty_cycles << 16, > >> mxs->base + PWM_ACTIVE0 + pwm->hwpwm * 0x20); > >> - writel(PERIOD_PERIOD(period_cycles) | PERIOD_POLARITY_NORMAL | PERIOD_CDIV(div), > >> + writel(PERIOD_PERIOD(period_cycles) | pol_bits | PERIOD_CDIV(div), > > > > When will this affect the output? Only on the next start of a period, or > > immediatly? Can it happen that this results in a mixed output (i.e. a > > period that has already the new duty cycle from the line above but not > > the new polarity (or period)? > > The data sheet says "Also, when the user reprograms the channel in this > manner, the new register values will not take effect until the beginning > of a new output period. This eliminates the potential for output > glitches that could occur if the registers were updated while the > channel was enabled and in the middle of a cycle.". So I think this > should be ok. "this manner" refers to the registers being written in the > proper order (first ACTIVEn, then PERIODn). OK. IMHO this is worth a code comment. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |