Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'backlight-fixes-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight fix from Lee Jones:
"Fix brightness levels when !DT in pwm_bl driver"

* tag 'backlight-fixes-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
backlight: pwm_bl: Fix brightness levels for non-DT case.

+35 -6
+35 -6
drivers/video/backlight/pwm_bl.c
··· 562 562 goto err_alloc; 563 563 } 564 564 565 - if (!data->levels) { 565 + if (data->levels) { 566 + /* 567 + * For the DT case, only when brightness levels is defined 568 + * data->levels is filled. For the non-DT case, data->levels 569 + * can come from platform data, however is not usual. 570 + */ 571 + for (i = 0; i <= data->max_brightness; i++) { 572 + if (data->levels[i] > pb->scale) 573 + pb->scale = data->levels[i]; 574 + 575 + pb->levels = data->levels; 576 + } 577 + } else if (!data->max_brightness) { 578 + /* 579 + * If no brightness levels are provided and max_brightness is 580 + * not set, use the default brightness table. For the DT case, 581 + * max_brightness is set to 0 when brightness levels is not 582 + * specified. For the non-DT case, max_brightness is usually 583 + * set to some value. 584 + */ 585 + 586 + /* Get the PWM period (in nanoseconds) */ 587 + pwm_get_state(pb->pwm, &state); 588 + 566 589 ret = pwm_backlight_brightness_default(&pdev->dev, data, 567 590 state.period); 568 591 if (ret < 0) { ··· 593 570 "failed to setup default brightness table\n"); 594 571 goto err_alloc; 595 572 } 596 - } 597 573 598 - for (i = 0; i <= data->max_brightness; i++) { 599 - if (data->levels[i] > pb->scale) 600 - pb->scale = data->levels[i]; 574 + for (i = 0; i <= data->max_brightness; i++) { 575 + if (data->levels[i] > pb->scale) 576 + pb->scale = data->levels[i]; 601 577 602 - pb->levels = data->levels; 578 + pb->levels = data->levels; 579 + } 580 + } else { 581 + /* 582 + * That only happens for the non-DT case, where platform data 583 + * sets the max_brightness value. 584 + */ 585 + pb->scale = data->max_brightness; 603 586 } 604 587 605 588 pb->lth_brightness = data->lth_brightness * (state.period / pb->scale);