Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp823962ybl; Wed, 14 Aug 2019 06:33:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLXx7exYJccvfEmWoUy263VjzpzNf+ekWFO2kLV9lre4Ktq8UCmuycjxv+K+F5vxD3TMD7 X-Received: by 2002:a63:125c:: with SMTP id 28mr1224729pgs.255.1565789614103; Wed, 14 Aug 2019 06:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565789614; cv=none; d=google.com; s=arc-20160816; b=HJxcPpRd7g5gcBFUjOlfsKhXQ1nmzOb1/a4EOsrDPnciY9WyadH0xow1OrTIgpwZEn c8+UkdeDDM8nSWn1vOEciSVoTeDNXSRV2vdp5IS45a+I2CsIl4Ijp+WY4JAjizVlIb+J h99F5ZAosx76gEB23dIOxrA+tiTj2er9b3yqOy4Pux8k+TC+5Yd454kO6N7+Ht/I2ULr PVbCwvJDT5ovkYD1c/i5lCBSHmxLxCpDNyg9Jr4kSN4hVlrIb6zuAmR6YRHIxN7G/oBD 5sp7MrF0okfWkSCAGvWcdlJcGm9KjQrhRNlRD7o0rCayD5FzMiLwYKcwY/9uhIBSNGyb z6MQ== 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=7T+2q/Vfq8M9uvJTUtPoMwd4eZUQxtsmPlRsWSApQsA=; b=KeNdQ9GlKfAfQzO0VwncYA9ND+erS6R485sBal5pDteo7V4jJ1KVTywgoFMcxBUCCY Jxl0ytMVqKtwG/2RwRBCYXJ38kPN07/Mz6T4Ho1tg2/rj2SGC/HvpJ9IJvcSByPkX4B5 lJCr6U7l21OSPkVczaDsqLg+NSqkvETd2VchoMrgynUB96PQbqQKobe8Lb5MzgYB4ffT +Vq+mSzcFJh77xNlrOVZBrH+jXevJiXrqLCuj88yltptXtpDdZj+XN8oKE0F/o0vYasz zvXUCMIiakRZAgPMjdbmbObPVTs2eTOO6wkPGGhxqHAdzKoReBybhYcU2xO6i1uF7Klp 894g== 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 k13si41135667pgt.285.2019.08.14.06.33.16; Wed, 14 Aug 2019 06:33:34 -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 S1728029AbfHNNaw (ORCPT + 99 others); Wed, 14 Aug 2019 09:30:52 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:56759 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727453AbfHNNaw (ORCPT ); Wed, 14 Aug 2019 09:30:52 -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 1hxtMU-00068E-KA; Wed, 14 Aug 2019 15:30:46 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1hxtMR-0005bv-RB; Wed, 14 Aug 2019 15:30:43 +0200 Date: Wed, 14 Aug 2019 15:30:43 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Baolin Wang Cc: Thierry Reding , Rob Herring , Mark Rutland , Orson Zhai , Chunyan Zhang , Vincent Guittot , linux-pwm@vger.kernel.org, DTML , LKML , kernel@pengutronix.de Subject: Re: [PATCH v2 2/2] pwm: sprd: Add Spreadtrum PWM support Message-ID: <20190814133043.peh63lwngujjuo5d@pengutronix.de> References: <4f6e3110b4d7e0a2f7ab317bba98a933de12e5da.1565703607.git.baolin.wang@linaro.org> <20190813151612.v6x6e6kzxflkpu7b@pengutronix.de> <20190814092339.73ybj5mycklvpnrq@pengutronix.de> <20190814105535.svslc57qp3wx5lub@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 Hello, On Wed, Aug 14, 2019 at 08:23:37PM +0800, Baolin Wang wrote: > On Wed, 14 Aug 2019 at 18:55, Uwe Kleine-K?nig > wrote: > > On Wed, Aug 14, 2019 at 06:01:50PM +0800, Baolin Wang wrote: > > > On Wed, 14 Aug 2019 at 17:23, Uwe Kleine-K?nig > > > wrote: > > > > On Wed, Aug 14, 2019 at 04:42:28PM +0800, Baolin Wang wrote: > > > > > On Tue, 13 Aug 2019 at 23:16, Uwe Kleine-K?nig > > > > > wrote: > > > > > > On Tue, Aug 13, 2019 at 09:46:41PM +0800, Baolin Wang wrote: > > > > > > [...] > > > > > Not really, our hardware's method is, when you changed a new > > > > > configuration (MOD or duty is changed) , the hardware will wait for a > > > > > while to complete current period, then change to the new period. > > > > > > > > Can you describe that in more detail? This doesn't explain why MOD must be > > > > configured before DUTY. Is there another reason for that? > > > > > > Sorry, I did not explain this explicitly. When we change a new PWM > > > configuration, the PWM controller will make sure the current period is > > > completed before changing to a new period. Once setting the MOD > > > register (since we always set MOD firstly), that will tell the > > > hardware that a new period need to change. > > > > So if the current period just ended after you reconfigured MOD but > > before you wrote to DUTY we'll see a bogus period, right? I assume the > > same holds true for writing the prescale value? > > I confirmed again, I am sorry I missed something before. Yes, like you > said before, writing DUTY triggers the hardware to actually apply the > values written to MOD and DUTY to the output. So write DUTY last. I > will update the comments and change the PWM configure like: > > sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_PRESCALE, prescale); > sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_MOD, SPRD_PWM_MOD_MAX); > sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_DUTY, duty); So PRESCALE is independent and it can still happen that writing PRESCALE affects the output before MOD and DUTY do? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |