Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932265AbaDHUnY (ORCPT ); Tue, 8 Apr 2014 16:43:24 -0400 Received: from mail-ob0-f169.google.com ([209.85.214.169]:57616 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757203AbaDHUnW convert rfc822-to-8bit (ORCPT ); Tue, 8 Apr 2014 16:43:22 -0400 MIME-Version: 1.0 In-Reply-To: <20140408070259.68923987@ipc1.ka-ro> References: <1395235375-12925-1-git-send-email-LW@KARO-electronics.de> <1395996540-10999-1-git-send-email-LW@KARO-electronics.de> <1395996540-10999-2-git-send-email-LW@KARO-electronics.de> <20140402055350.GX17250@pengutronix.de> <20140407113652.GE26985@ulmo> <20140408070259.68923987@ipc1.ka-ro> Date: Tue, 8 Apr 2014 13:43:22 -0700 Message-ID: Subject: Re: [PATCHv3 1/3] pwm: make the PWM_POLARITY flag in DTB optional From: Tim Kryger To: =?ISO-8859-1?Q?Lothar_Wa=DFmann?= Cc: Thierry Reding , Sascha Hauer , "linux-kernel@vger.kernel.org" , Linux PWM List , Shawn Guo , Sascha Hauer , Arnd Bergmann Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 7, 2014 at 10:02 PM, Lothar Wa?mann wrote: > Thierry Reding wrote: >> No. You cannot emulate polarity inversion in software. >> > Why not? > > duty_ns = period_ns - duty_ns; Since I made the same mistake, I will pass along the pointer Thierry gave me. In include/linux/pwm.h the second difference for an inverted signal is described. /** * enum pwm_polarity - polarity of a PWM signal * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty- * cycle, followed by a low signal for the remainder of the pulse * period * @PWM_POLARITY_INVERSED: a low signal for the duration of the duty- * cycle, followed by a high signal for the remainder of the pulse * period */ enum pwm_polarity { PWM_POLARITY_NORMAL, PWM_POLARITY_INVERSED, }; Of course, I suspect not all PWM hardware respects this definition of inverted output. Either way, hacking the duty in software certainly would get the high/low order wrong. -Tim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/