From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754064AbcIJNsg (ORCPT ); Sat, 10 Sep 2016 09:48:36 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:38201 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753431AbcIJNsd (ORCPT ); Sat, 10 Sep 2016 09:48:33 -0400 Message-ID: <57D40F2C.7000805@baylibre.com> Date: Sat, 10 Sep 2016 15:48:28 +0200 From: Neil Armstrong User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Matthijs van Duin , "H. Nikolaus Schaller" , David Rivshin CC: =?ISO-8859-1?Q?Beno=EEt_Cousson?= , Tony Lindgren , Rob Herring , Mark Rutland , Russell King , marek@goldelico.com, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org Subject: Re: [PATCH] ARM: dts: omap3-gta04: reduce panel backlight PWM frequency to 83Hz References: <954d43b570092fe92b8b49cf8f475c027d3d8342.1473066997.git.hns@goldelico.com> <20160910031736.xwnepaoifpedqfbr@squirrel.local> In-Reply-To: <20160910031736.xwnepaoifpedqfbr@squirrel.local> 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 Le 10/09/2016 05:17, Matthijs van Duin a écrit : > On Mon, Sep 05, 2016 at 11:16:38AM +0200, H. Nikolaus Schaller wrote: >> This helps to get 100% intensity closer to "always on". >> >> It compensates for an effect of dmtimer which at 100% still emits short >> "off" impulses and the startup-time of the DC/DC converter makes >> backlight intensity not reach full scale. The lower the PWM frequency >> is, the smaller is this effect. > > Sounds to me like you're working around something that should be fixed > in the pwm-omap-dmtimer driver instead? > > Looking at the (baremetal) dmtimer pwm code I wrote ages ago, which > supports fully off to fully on, I do seem to be handling both endpoints > in a special way. A rough conversion of my code into C: > > // period in timer cycles > void pwm_init( volatile struct dmtimer *timer, u32 period, bool invert ) > { > assert( period >= 2 ); > timer->if_ctrl = 2; // reset timer, configure as non-posted > timer->reload = -period; > timer->trigger = 0; > timer->config = 0x1043 | invert << 7; // pwm initially disabled > } > > // value in timer cycles, 0 <= value <= period > void pwm_set( volatile struct dmtimer *timer, u32 value ) > { > if( value == 0 ) { > timer->config &= ~0x800; // disable pwm > return; > } > u32 period = -timer->reload; > if( value >= period ) > timer->match = 0; > else > timer->match = value - period - 1; > timer->config |= 0x800; // enable pwm > } > > At the time I used a scope to check the exact behaviour of dmtimer pwm > on a dm814x. My notes mention (when pwm enabled): > match < reload output on continuous > match == reload output on 1 cycle, off period-1 cycles > match == -2 output on period-1 cycles, off 1 cycle > match == -1 output freezes > > Hope this helps Hi, I think these corner cases should definitely be handled in the dmtimer driver. I'll try to post a fix to handle these, thanks for the original code dump. > > Matthijs > Neil From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Armstrong Subject: Re: [PATCH] ARM: dts: omap3-gta04: reduce panel backlight PWM frequency to 83Hz Date: Sat, 10 Sep 2016 15:48:28 +0200 Message-ID: <57D40F2C.7000805@baylibre.com> References: <954d43b570092fe92b8b49cf8f475c027d3d8342.1473066997.git.hns@goldelico.com> <20160910031736.xwnepaoifpedqfbr@squirrel.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20160910031736.xwnepaoifpedqfbr-2pNSKKP3PSK44ywRPIzf9A@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matthijs van Duin , "H. Nikolaus Schaller" , David Rivshin Cc: =?ISO-8859-1?Q?Beno=EEt_Cousson?= , Tony Lindgren , Rob Herring , Mark Rutland , Russell King , marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, letux-kernel-S0jZdbWzriLCfDggNXIi3w@public.gmane.org List-Id: devicetree@vger.kernel.org Le 10/09/2016 05:17, Matthijs van Duin a écrit : > On Mon, Sep 05, 2016 at 11:16:38AM +0200, H. Nikolaus Schaller wrote: >> This helps to get 100% intensity closer to "always on". >> >> It compensates for an effect of dmtimer which at 100% still emits short >> "off" impulses and the startup-time of the DC/DC converter makes >> backlight intensity not reach full scale. The lower the PWM frequency >> is, the smaller is this effect. > > Sounds to me like you're working around something that should be fixed > in the pwm-omap-dmtimer driver instead? > > Looking at the (baremetal) dmtimer pwm code I wrote ages ago, which > supports fully off to fully on, I do seem to be handling both endpoints > in a special way. A rough conversion of my code into C: > > // period in timer cycles > void pwm_init( volatile struct dmtimer *timer, u32 period, bool invert ) > { > assert( period >= 2 ); > timer->if_ctrl = 2; // reset timer, configure as non-posted > timer->reload = -period; > timer->trigger = 0; > timer->config = 0x1043 | invert << 7; // pwm initially disabled > } > > // value in timer cycles, 0 <= value <= period > void pwm_set( volatile struct dmtimer *timer, u32 value ) > { > if( value == 0 ) { > timer->config &= ~0x800; // disable pwm > return; > } > u32 period = -timer->reload; > if( value >= period ) > timer->match = 0; > else > timer->match = value - period - 1; > timer->config |= 0x800; // enable pwm > } > > At the time I used a scope to check the exact behaviour of dmtimer pwm > on a dm814x. My notes mention (when pwm enabled): > match < reload output on continuous > match == reload output on 1 cycle, off period-1 cycles > match == -2 output on period-1 cycles, off 1 cycle > match == -1 output freezes > > Hope this helps Hi, I think these corner cases should definitely be handled in the dmtimer driver. I'll try to post a fix to handle these, thanks for the original code dump. > > Matthijs > Neil -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html