Skip to content

Commit 5ec6fd3

Browse files
ukleinekkrzk
authored andcommitted
ARM: s3c24xx: Switch to atomic pwm API in rx1950
Stop using the legacy PWM API which only still exists because there are some users left. Note this change make use of the fact that the value of struct pwm_state::duty_cycle doesn't matter for a disabled PWM and so its value can stay constant simplifying the code a bit. A side effect of the conversion is that the pwm isn't stopped in rx1950_backlight_init() by the call to pwm_apply_args() just before reenabling it when rx1950_lcd_power(1) is called. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 45984f0 commit 5ec6fd3

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

arch/arm/mach-s3c24xx/mach-rx1950.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ static struct pwm_lookup rx1950_pwm_lookup[] = {
377377
};
378378

379379
static struct pwm_device *lcd_pwm;
380+
static struct pwm_state lcd_pwm_state;
380381

381382
static void rx1950_lcd_power(int enable)
382383
{
@@ -429,15 +430,16 @@ static void rx1950_lcd_power(int enable)
429430

430431
/* GPB1->OUTPUT, GPB1->0 */
431432
gpio_direction_output(S3C2410_GPB(1), 0);
432-
pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
433-
pwm_disable(lcd_pwm);
433+
434+
lcd_pwm_state.enabled = false;
435+
pwm_apply_state(lcd_pwm, &lcd_pwm_state);
434436

435437
/* GPC0->0, GPC10->0 */
436438
gpio_direction_output(S3C2410_GPC(0), 0);
437439
gpio_direction_output(S3C2410_GPC(10), 0);
438440
} else {
439-
pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
440-
pwm_enable(lcd_pwm);
441+
lcd_pwm_state.enabled = true;
442+
pwm_apply_state(lcd_pwm, &lcd_pwm_state);
441443

442444
gpio_direction_output(S3C2410_GPC(0), 1);
443445
gpio_direction_output(S3C2410_GPC(5), 1);
@@ -493,10 +495,13 @@ static int rx1950_backlight_init(struct device *dev)
493495
}
494496

495497
/*
496-
* FIXME: pwm_apply_args() should be removed when switching to
497-
* the atomic PWM API.
498+
* This is only required to initialize .polarity; all other values are
499+
* fixed in this driver.
498500
*/
499-
pwm_apply_args(lcd_pwm);
501+
pwm_init_state(lcd_pwm, &lcd_pwm_state);
502+
503+
lcd_pwm_state.period = LCD_PWM_PERIOD;
504+
lcd_pwm_state.duty_cycle = LCD_PWM_DUTY;
500505

501506
rx1950_lcd_power(1);
502507
rx1950_bl_power(1);

0 commit comments

Comments
 (0)