1. 28 Sep, 2017 1 commit
  2. 08 May, 2017 1 commit
    • Edoardo Scaglia's avatar
      vulcano-*-dm.dtsi: fix backlight PWM frequency to be ~520KHz · a6e585f1
      Edoardo Scaglia authored
      HLCDC PWM period is given by:
           HLCDC_PWM_period = 1 / (clk_src / presc / pwm_modulo)
       - clk_src is the selected clock source (see CLKPWMSEL in LCDC_LCDCFG0
       - presc is prescaler (see PWMPS field in LCDC_LCDCFG6 register)
       - pwm_modulo is 256 (see size of PWMCVAL field in LCDC_LCDCFG6
      In Vulcano based boards such as Homer, NWE and Ganador the LP filter
      used to obtain a DC reference value for backlight inverter is designed
      for PWM signals with a frequency of ~520 KHz.
      When we first ported these boards we chose the PWM period with a
      simple calculation: 1/520000 KHz = 1923 ns period and writing that
      value in boards DTS, probably without actually testing with a scope
      the actual PWM frequency.
      Recently, during a board repair, we noticed that the backlight PWM
      frequency was 260KHz, the half of what it was expected.
      After a while digging into the problem we realized that during PWM
      HLCDC driver initialization (pwm/pwm-atmel-hlcdc.c) the clock
      prescaler is the lowest between 1, 2, 4, 8, 16, 32 or 64 which gives a
      PWM period equal-or-greater than the chosen one.
      In our case the clock source is the system clock at 133333333 Hz which
      with prescaler 1 allow the lowest PWM period of:
           HLCDC_PWM_period = 1 / (133333333 Hz / 1 / 256) = 1920 ns
      Which is 4 ns less than the period we specified in boards DTS, thus
      during initialization the driver choose the next value 2 as prescaler
      which gives a period of:
           HLCDC_PWM_period = 1 / (133333333 Hz / 2 / 256) = 3840 ns
      almost the double of what we require.
      *Solution (workaround)*
      Modify backlight PWM period in boards DTS file to be 1900 ns.
      *Solution (real, TBD)*
      During HLCDC PWM driver initialization select the prescaler which
      gives the closest period to the chosen one.
      Signed-off-by: Edoardo Scaglia's avatarEdoardo Scaglia <scaglia@amelchem.com>
  3. 13 Oct, 2016 38 commits