Skip to content
Snippets Groups Projects
  1. Jan 26, 2023
  2. Jan 25, 2023
    • AngeloGioacchino Del Regno's avatar
      pwm: mtk-disp: Configure double buffering before reading in .get_state() · 68bc26ef
      AngeloGioacchino Del Regno authored and Nícolas F. R. A. Prado's avatar Nícolas F. R. A. Prado committed
      
      The DISP_PWM controller's default behavior is to always use register
      double buffering: all reads/writes are then performed on shadow
      registers instead of working registers and this becomes an issue
      in case our chosen configuration in Linux is different from the
      default (or from the one that was pre-applied by the bootloader).
      
      An example of broken behavior is when the controller is configured
      to use shadow registers, but this driver wants to configure it
      otherwise: what happens is that the .get_state() callback is called
      right after registering the pwmchip and checks whether the PWM is
      enabled by reading the DISP_PWM_EN register;
      At this point, if shadow registers are enabled but their content
      was not committed before booting Linux, we are *not* reading the
      current PWM enablement status, leading to the kernel knowing that
      the hardware is actually enabled when, in reality, it's not.
      
      The aforementioned issue emerged since this driver was fixed with
      commit 0b5ef342 ("pwm: mtk-disp: Fix the parameters calculated
      by the enabled flag of disp_pwm") making it to read the enablement
      status from the right register.
      
      Configure the controller in the .get_state() callback to avoid
      this desync issue and get the backlight properly working again.
      
      Fixes: 3f2b1673 ("pwm: mtk-disp: Implement atomic API .get_state()")
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      68bc26ef
    • AngeloGioacchino Del Regno's avatar
      pwm: mtk-disp: Disable shadow registers before setting backlight values · 2c4bc319
      AngeloGioacchino Del Regno authored and Nícolas F. R. A. Prado's avatar Nícolas F. R. A. Prado committed
      
      If shadow registers usage is not desired, disable that before performing
      any write to CON0/1 registers in the .apply() callback, otherwise we may
      lose clkdiv or period/width updates.
      
      Fixes: cd4b45ac ("pwm: Add MediaTek MT2701 display PWM driver support")
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      2c4bc319
  3. Jan 20, 2023
  4. Jan 17, 2023
Loading