1
0
Fork 0
forked from len0rd/rockbox

hm60x/hm801: Increase backlight frequency. This will remove background hiss.

Change-Id: I3b51dc5592c069745a62f21f6f9004c79a1f3985
Reviewed-on: http://gerrit.rockbox.org/225
Tested-by: Andrew Ryabinin <ryabinin.a.a@gmail.com>
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
This commit is contained in:
Andrew Ryabinin 2012-04-26 13:57:34 +04:00
parent f40bfc9267
commit 56e406d9b6

View file

@ -36,16 +36,32 @@ static int brightness = DEFAULT_BRIGHTNESS_SETTING;
* where Yn is luminance of reference white
*
* Actual function is lightly tweaked to account for the fact
* that fill factor of the PWM below ~15% gives black.
* that fill factor of the PWM below some value gives black.
* So the function used to calculate the values in the matrix was:
* f(x) = 42000 * ((100*x/31 + 16)/116)^3 + 8000
* f(x) = (PWM_FREQ_MAX - PWM_FREQ_MIN) * ((100*x/31 + 16)/116)^3 + PWM_FREQ_MIN
*/
#ifdef RK27GENERIC
static const unsigned short lin_brightness[] = {
8110, 8191, 8304, 8455, 8649, 8892, 9189, 9545,
9966, 10457, 11024, 11671, 12406, 13232, 14156, 15182,
16316, 17565, 18932, 20423, 22045, 23801, 25699, 27742,
29937, 32289, 34803, 37485, 40340, 43374, 46592, 50000
};
#elif defined(HM801)
static const unsigned short lin_brightness[] = {
541, 542, 543, 544, 547, 549, 553, 556,
561, 566, 573, 580, 588, 597, 607, 618,
631, 644, 659, 676, 693, 713, 733, 756,
780, 806, 833, 862, 894, 927, 962, 1000
};
#elif defined(HM60X)
static const unsigned short lin_brightness[] = {
3, 5, 8, 11, 16, 22, 29, 37,
47, 59, 72, 88, 105, 125, 147, 171,
198, 228, 261, 296, 335, 376, 421, 470,
522, 578, 638, 702, 770, 842, 918, 1000
};
#endif
bool _backlight_init(void)
{
@ -61,9 +77,9 @@ bool _backlight_init(void)
/* DIV/2, PWM reset */
PWMT0_CTRL = (0<<9) | (1<<7);
/* set pwm frequency to 500Hz - my lcd panel can't cope more reliably */
/* (apb_freq/pwm_freq)/pwm_div = (50 000 000/500)/2 */
PWMT0_LRC = 50000;
/* set pwm frequency */
/* (apb_freq/pwm_freq)/pwm_div = (50 000 000/pwm_freq)/2 */
PWMT0_LRC = lin_brightness[MAX_BRIGHTNESS_SETTING];
PWMT0_HRC = lin_brightness[brightness];
/* reset counter */