From e1446381675be454d91081a2db1d275129970556 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Fri, 5 Sep 2008 15:09:40 +0000 Subject: Add Onda VX767 target git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18422 a1c6a512-1295-4272-9138-f99709370657 --- .../onda_vx767/backlight-ondavx767.c | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c') diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c new file mode 100644 index 0000000000..9deab7712a --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c @@ -0,0 +1,80 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Maurus Cuelenaere + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "jz4740.h" +#include "backlight-target.h" + +#define GPIO_PWM 123 +#define PWM_CHN 7 +#define PWM_FULL 101 + +static void set_backlight(int unk, int val) +{ + if(val == 0) + __gpio_as_pwm7(); + else + { + REG_TCU_TCSR(7) |= 2; + REG_TCU_TCSR(7) &= ~0x100; + int tmp; + tmp = (unk/2 + __cpm_get_rtcclk()) / unk; + if(tmp > 0xFFFF) + tmp = 0xFFFF; + + __tcu_set_half_data(7, (tmp * unk * 1374389535) >> 5); + __tcu_set_full_data(7, tmp); + + REG_TCU_TSCR = (1 << 7); + REG_TCU_TESR = (1 << 7); + + __tcu_enable_pwm_output(7); + } + __tcu_set_count(7, 0); +} + +bool _backlight_init(void) +{ + __gpio_as_pwm7(); + + __tcu_stop_counter(7); + __tcu_disable_pwm_output(7); + + set_backlight(300, 7); + + return true; +} +void _backlight_on(void) +{ + set_backlight(300, 7); +} +void _backlight_off(void) +{ + set_backlight(300, 0); +} + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +void _backlight_set_brightness(int brightness) +{ + (void)brightness; + return; +} +#endif -- cgit v1.2.3