Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp400721ybn; Wed, 25 Sep 2019 01:30:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTZ0k5qR2rZ+pmH64BF8Ts/Xs1U88/nFumgBKktckJvsCFtj69GjHFb4sYDkpvgVVllqXY X-Received: by 2002:a2e:878b:: with SMTP id n11mr5168408lji.13.1569400250230; Wed, 25 Sep 2019 01:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569400250; cv=none; d=google.com; s=arc-20160816; b=fB7TqhUG03pr/c1mnW1N/8BX7CS/jRI5YxRJezLlEDmKP8/rS2JD/jJQCnnKQU3GTw 0CQyBEejR4hmQMj4U+kr0F0JpUnTVKRNqR/swCNgsvZ626ioRJKirMFRMMFTXZIKiyn3 +1eGQoX1Ow+1c4DLQQf1S6b+mzdwrFoh2Goi0p+5sw7fVytTsdpoczc6t8lCUW1AUmXa QHbaapGHyKLwVY/UKL3o/9uxPMwalUtjZqMB6udiHdsSJ+eDqcvkKRgEPyH14yK/EE20 GoRnH0Q1u/rwz62qBljkOzByCjHLC5RMjkreWbMU4xhxo4oztiz1zhGQK3DUiC3KHefm GtIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=BJHjML3SI9D2+EbTLuvMPDk5GTC8ZZ5KbbxFlhyt+ws=; b=LSr7vglq00PpubOaJ9DtuIMHAbbGKyXz8NSufg+iFDVXFFzjd9HkGsx6YMMJkWXepd +no+F4U5Aq7OiyiDcZw3EZjfBZQjoKa9BCVR1k7r4e0dO2XO44w+n8lmWVEvqgFyMxRU vCGApaC7f5gZpOgCW2ZWtCBCIgbXh3S0JYaRVxU1RqQeUFWKB3/ikMH7DEfviDZqmaeY dRv1LfgHvrDz104Ti+vTqiH94SpefDGl2EolMAlSpgKRlnD6/bYtr32I9JWQvDOkga9x EC5ZRPXpsz0pk4Fl5EyKn8zwk7iiMsarzTR0RsBD1MjzTOVphTQdU2eGrSWnc4hKQMN5 3BpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=UsZPbcuZ; 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 d24si2919816ede.119.2019.09.25.01.30.26; Wed, 25 Sep 2019 01:30:50 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=UsZPbcuZ; 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 S1731512AbfIWIqA (ORCPT + 99 others); Mon, 23 Sep 2019 04:46:00 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33614 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728307AbfIWIqA (ORCPT ); Mon, 23 Sep 2019 04:46:00 -0400 Received: by mail-lf1-f67.google.com with SMTP id y127so9485555lfc.0 for ; Mon, 23 Sep 2019 01:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BJHjML3SI9D2+EbTLuvMPDk5GTC8ZZ5KbbxFlhyt+ws=; b=UsZPbcuZRmE+Z3GSClH5/Mu9pa0xactT8q65lCY9ZQRMxMBG6shGQrEFWmS0QPKePT NbH/aWlJIVV/9FnXQijrVB5eG14WBp07hOFwnBLnZojOsILfMyD9JEsCCB6pT1OcWCp4 eMpNQCu4hZN0omTdSXytMm98/IpN8fCAY9LZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BJHjML3SI9D2+EbTLuvMPDk5GTC8ZZ5KbbxFlhyt+ws=; b=dTWgZEb7OT6DvG1P8LiPcb6CXttJqW1Y7Fz7ozCCq8IIjb20o0WshYK4E2nd8jHDYt lmhVb0jHbQxpfPfXtNgTxP07NsC+QX+5ZbiPo7VHVzgGl7eACfcusp7hlXgH8OD0QsEl rY2EVXb6OEnnvjYFDbGlCNPgjRX/CioxHf36lQxHvz2PpMiVzCmn+xXqg6yVGaIvHYoC B1SZHhzc8HbMg3XjD613XixcNBR18BzvZWTSPG6dl5UC9ws+bSG6W+SyE3AsxMDBrFIV dASWhptrhG3LCGaYYXuECXq+PxgojYbxxl9eVhZC5YtFQyLpsg5+pL8mOJ9nfPTbrdly oTBQ== X-Gm-Message-State: APjAAAV0MCCqCyzNi2c1A47oii35tTo6n4VRIwV3evSR0zIfhQyOPbpc vix1LXtXrWNVSjOQZmG5+Gd4Zg== X-Received: by 2002:a19:4f5a:: with SMTP id a26mr15849533lfk.116.1569228358242; Mon, 23 Sep 2019 01:45:58 -0700 (PDT) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 134sm2072003lfk.70.2019.09.23.01.45.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 01:45:57 -0700 (PDT) Subject: Re: [PATCH 3/4] pwm: mxs: add support for inverse polarity To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Rasmus Villemoes Cc: Thierry Reding , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org References: <20190923081348.6843-1-linux@rasmusvillemoes.dk> <20190923081348.6843-4-linux@rasmusvillemoes.dk> <20190923082735.tzxyhvjlnztsxhsc@pengutronix.de> From: Rasmus Villemoes Message-ID: Date: Mon, 23 Sep 2019 10:45:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190923082735.tzxyhvjlnztsxhsc@pengutronix.de> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). Rasmus