My lcd backlight need pwm control, so I config pwm4, backlight in dts:
lvds_backlight: lvds_backlight {
compatible = "pwm-backlight";
pwms = <&pwm4 0 100000 0>;
status = "okay";
enable-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>;
brightness-levels = < 0 1 2 3 4 5 6 7 8 9
.......
};
&pwm4 {
#pwm-cells = <3>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm4>;
status = "okay";
};
I also open the driver: pwm-imx.c pwm-backlight.c in Config file
But it got stuck in the driver:
int pwm_config_internal(struct pwm_regs *pwm, unsigned long period_cycles,
unsigned long duty_cycles, unsigned long prescale)
{
u32 cr;
printf("%s %d, &pwm->ir=0x%x\n", __func__, __LINE__, &pwm->ir);
writel(0, &pwm->ir);
printf("%s %d\n", __func__, __LINE__);
cr = PWMCR_PRESCALER(prescale) |
PWMCR_DOZEEN | PWMCR_WAITEN |
PWMCR_DBGEN | PWMCR_CLKSRC_IPG_HIGH;
printf("%s %d\n", __func__, __LINE__);
writel(cr, &pwm->cr);
printf("%s %d\n", __func__, __LINE__);
/* set duty cycles */
writel(duty_cycles, &pwm->sar);
printf("%s %d\n", __func__, __LINE__);
/* set period cycles */
writel(period_cycles, &pwm->pr);
printf("%s %d\n", __func__, __LINE__);
return 0;
}
The log show the "&pwm->ir" address is correct: 0x30690008, But it's stuck here :
writel(0, &pwm->ir);
It seems that the address 0x30690008 cannot be directly accessed
I have also tried using ioremap function to obtain addresses, But there is a compilation error prompt
I have also tried to disable the PWM4 configuration in DTS, and used:
pwm_init(3, 0, 0);
pwm_config(3, 5, 10);
pwm_enable(3);
But we also encountered the same problem
Can someone help me please ?