From 3ba2f6e5c7383c5d7a6f8a1c38b6b5403a8a5dcb Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 23 Apr 2021 11:09:49 -0400 Subject: Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX They were never finished, never saw any release ever, and haven't compiled for the better part of a decade. Given their HW capabilities [1], they are not worth trying to fix. [1] 1-2MB RAM, ~256MB onboard flash, no expandability Change-Id: I7b2a5806d687114c22156bb0458d4a10a9734190 --- firmware/target/arm/tcc77x/iaudio7/adc-target.h | 28 --- firmware/target/arm/tcc77x/iaudio7/ata2501.c | 110 --------- firmware/target/arm/tcc77x/iaudio7/ata2501.h | 27 --- firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c | 94 -------- .../target/arm/tcc77x/iaudio7/backlight-target.h | 48 ---- .../target/arm/tcc77x/iaudio7/button-iaudio7.c | 93 -------- firmware/target/arm/tcc77x/iaudio7/button-target.h | 47 ---- firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c | 260 --------------------- firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c | 149 ------------ .../target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c | 84 ------- 10 files changed, 940 deletions(-) delete mode 100644 firmware/target/arm/tcc77x/iaudio7/adc-target.h delete mode 100644 firmware/target/arm/tcc77x/iaudio7/ata2501.c delete mode 100644 firmware/target/arm/tcc77x/iaudio7/ata2501.h delete mode 100644 firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c delete mode 100644 firmware/target/arm/tcc77x/iaudio7/backlight-target.h delete mode 100644 firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c delete mode 100644 firmware/target/arm/tcc77x/iaudio7/button-target.h delete mode 100644 firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c delete mode 100644 firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c delete mode 100644 firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c (limited to 'firmware/target/arm/tcc77x/iaudio7') diff --git a/firmware/target/arm/tcc77x/iaudio7/adc-target.h b/firmware/target/arm/tcc77x/iaudio7/adc-target.h deleted file mode 100644 index 1916d93598..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/adc-target.h +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 Dave Chapman - * - * 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. - * - ****************************************************************************/ -#ifndef _ADC_TARGET_H_ -#define _ADC_TARGET_H_ - -#define NUM_ADC_CHANNELS 8 - -#define ADC_BUTTONS 0 - -#endif /* _ADC_TARGET_H_ */ diff --git a/firmware/target/arm/tcc77x/iaudio7/ata2501.c b/firmware/target/arm/tcc77x/iaudio7/ata2501.c deleted file mode 100644 index f7526b2b9a..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/ata2501.c +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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 "system.h" -#include "cpu.h" -#include "button.h" - -#include "ata2501.h" - -#define STB (1<<5) -#define SDATA (1<<4) -#define RESET (1<<6) -#define SIFMD (1<<7) -#define STB_DELAY 200 - -static inline void ndelay(unsigned long nsecs) -{ - nsecs /= 8; - while (nsecs) - nsecs--; -} - -/* - TODO: sensitivity -*/ -void ata2501_init(void) -{ - GPIOD_DIR |= (RESET | STB | SIFMD | (1 << 8) | (1 << 9)); - GPIOD_DIR &= ~SDATA; - - GPIOD &= ~STB; - GPIOD |= (1 << 8) | SIFMD | (1 << 9); - - GPIOD &= ~RESET; - ndelay(1000); - GPIOD |= RESET; -} - -unsigned short ata2501_read(void) -{ - unsigned short ret = 0; - int i; - - for (i = 0; i < 12; i++) { - GPIOD |= STB; - ndelay(100); - ret <<= 1; - if (GPIOD & SDATA) - ret |= 1; - GPIOD &= ~STB; - ndelay(100); - } - - return ret; -} - -//#define ATA2501_TEST -#ifdef ATA2501_TEST -#include "lcd.h" - -static -void bits(char *str, unsigned short val) -{ - int i; - - for (i = 0; i < 12; i++) - str[i] = (val & (1 << i)) ? '1' : '0'; - str[i] = 0; -} - -void ata2501_test(void) -{ - char buf[100]; - ata2501_init(); - - while (1) { - unsigned short data; - int line = 0; - - data = ata2501_read(); - lcd_clear_display(); - lcd_puts(0, line++, "ATA2501 test"); - - bits(buf, data); - lcd_puts(0, line++, buf); - - lcd_update(); - sleep(HZ/10); - } -} -#endif diff --git a/firmware/target/arm/tcc77x/iaudio7/ata2501.h b/firmware/target/arm/tcc77x/iaudio7/ata2501.h deleted file mode 100644 index 465d0b199c..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/ata2501.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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. - * - ****************************************************************************/ -#ifndef _ATA2501_H_ -#define _ATA2501_H_ - -void ata2501_init(void); -unsigned short ata2501_read(void); - -#endif /* _ATA2501_H_ */ diff --git a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c deleted file mode 100644 index bcb6843286..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 by Michael Sevakis - * - * 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 "system.h" -#include "cpu.h" -#include "audio.h" -#include "sound.h" - -int audio_channels = 2; -int audio_output_source = AUDIO_SRC_PLAYBACK; - -void audio_set_output_source(int source) -{ - int oldmode = set_fiq_status(FIQ_DISABLED); - - if ((unsigned)source >= AUDIO_NUM_SOURCES) - source = AUDIO_SRC_PLAYBACK; - - audio_output_source = source; - set_fiq_status(oldmode); -} - -void audio_input_mux(int source, unsigned flags) -{ - static int last_source = AUDIO_SRC_PLAYBACK; - static bool last_recording = false; - bool recording = flags & SRCF_RECORDING; - - switch (source) - { - default: /* playback - no recording */ - source = AUDIO_SRC_PLAYBACK; - case AUDIO_SRC_PLAYBACK: - audio_channels = 2; - if (source != last_source) - { - audiohw_set_monitor(false); - /* audiohw_disable_recording();*/ - } - break; - - case AUDIO_SRC_MIC: /* recording only */ - GPIOD |= 0x1; - - audio_channels = 1; - if (source != last_source) - { - /*audiohw_set_monitor(false); - audiohw_enable_recording(true); /. source mic */ - } - break; - - case AUDIO_SRC_FMRADIO: /* recording and playback */ - GPIOD &= ~0x1; - - audio_channels = 2; - - if (source == last_source && recording == last_recording) - break; - - last_recording = recording; - - if (recording) - { - /*audiohw_set_monitor(false); - audiohw_enable_recording(false);*/ - } - else - { - /*audiohw_disable_recording(); */ - audiohw_set_monitor(true); /* line 1 analog audio path */ - } - break; - } /* end switch */ - - last_source = source; -} /* audio_input_mux */ diff --git a/firmware/target/arm/tcc77x/iaudio7/backlight-target.h b/firmware/target/arm/tcc77x/iaudio7/backlight-target.h deleted file mode 100644 index 0b227cd11c..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/backlight-target.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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. - * - ****************************************************************************/ -#ifndef BACKLIGHT_TARGET_H -#define BACKLIGHT_TARGET_H - -#include -#include "tcc77x.h" - -void power_touch_panel(bool on); - -static inline bool backlight_hw_init(void) -{ - GPIOD_DIR |= 0x2; - /* set backlight on by default, since the screen is unreadable without it */ - GPIOD |= 0x2; - return true; -} - -static inline void backlight_hw_on(void) -{ - GPIOD |= 0x2; - power_touch_panel(true); -} - -static inline void backlight_hw_off(void) -{ - GPIOD &= ~0x2; - power_touch_panel(false); -} -#endif /* BACKLIGHT_TARGET_H */ diff --git a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c deleted file mode 100644 index abf31b4feb..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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 "cpu.h" -#include "button.h" -#include "backlight.h" -#include "adc.h" - -#include "button-target.h" -#include "ata2501.h" - -void button_init_device(void) -{ - ata2501_init(); -} - -/* - touchpad: - 0: stop - 1-8: between next & prev - 9: play - 10: next - 11: prev -*/ - -int button_read_device(void) -{ - static bool hold_button = false; - bool hold_button_old; - - int btn = BUTTON_NONE; - int adc; - int sensor; - - hold_button_old = hold_button; - hold_button = button_hold(); - -#ifndef BOOTLOADER - if (hold_button != hold_button_old) - backlight_hold_changed(hold_button); -#endif - - if (button_hold()) - return BUTTON_NONE; - - adc = adc_read(0); - sensor = ata2501_read(); - - if (0 == (GPIOA & 4)) - btn |= BUTTON_POWER; - - /* seems they can't be hold together */ - if (adc < 0x120) - btn |= BUTTON_VOLUP; - else if (adc < 0x270) - btn |= BUTTON_VOLDOWN; - else if (adc < 0x300) - btn |= BUTTON_MENU; - - if (sensor & (1 << 0)) - btn |= BUTTON_STOP; - if (sensor & (1 << 9)) - btn |= BUTTON_PLAY; - if (sensor & ((1 << 10) | 0x1c0)) - btn |= BUTTON_RIGHT; - if (sensor & ((1 << 11) | 0xe)) - btn |= BUTTON_LEFT; - - return btn; -} - -bool button_hold(void) -{ - return !(GPIOA & 0x2); -} diff --git a/firmware/target/arm/tcc77x/iaudio7/button-target.h b/firmware/target/arm/tcc77x/iaudio7/button-target.h deleted file mode 100644 index 9d232d9ae8..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/button-target.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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. - * - ****************************************************************************/ -#ifndef _IAUDIO7_BUTTON_TARGET_H_ -#define _IAUDIO7_BUTTON_TARGET_H_ - -#define HAS_BUTTON_HOLD - -/* Main unit's buttons */ -#define BUTTON_POWER 0x00000001 -#define BUTTON_VOLUP 0x00000002 -#define BUTTON_VOLDOWN 0x00000004 -#define BUTTON_MENU 0x00000008 - -#define BUTTON_LEFT 0x00000010 -#define BUTTON_RIGHT 0x00000020 -#define BUTTON_PLAY 0x00000040 -#define BUTTON_STOP 0x00000080 - -#define BUTTON_ON BUTTON_POWER - -#define BUTTON_MAIN (BUTTON_POWER|BUTTON_VOLUP|BUTTON_VOLDOWN| \ - BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT| \ - BUTTON_PLAY|BUTTON_STOP) - -/* Software power-off */ -#define POWEROFF_BUTTON BUTTON_POWER -#define POWEROFF_COUNT 10 - -#endif /* _IAUDIO7_BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c deleted file mode 100644 index e681e1eff7..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c +++ /dev/null @@ -1,260 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2004 by Linus Nielsen Feltzing - * - * 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. - * - ****************************************************************************/ - -/* - Thanks Hein-Pieter van Braam for initial work. - - Mostly based on lcd-h300.c, adapted for the iaudio 7 by Vitja Makarov - */ - -#include - -#include -#include -#include -#include -#include - -#include "hd66789r.h" - -static bool display_on = false; /* is the display turned on? */ - -static inline void lcd_write_reg(int reg, int data) -{ - GPIOA &= ~0x400; - outw(0, 0x50010000); - outw(reg << 1, 0x50010000); - GPIOA |= 0x400; - - outw((data & 0xff00) >> 7, 0x50010008); - outw((data << 24) >> 23, 0x50010008); -} - -static void lcd_write_cmd(int reg) -{ - GPIOA &= ~0x400; - outw(0, 0x50010000); - outw(reg << 1, 0x50010000); - GPIOA |= 0x400; -} - -/* Do what OF do */ -static void lcd_delay(int x) -{ - int i; - - x *= 0xc35; - for (i = 0; i < x * 8; i++) { - } -} - - -static void _display_on(void) -{ - GPIOA_DIR |= 0x8000 | 0x400; - GPIOA |= 0x8000; - - /* power setup */ - lcd_write_reg(R_START_OSC, 0x0001); - lcd_delay(0xf); - lcd_write_reg(R_DISP_CONTROL1, 0x000); - lcd_delay(0xa); - lcd_write_reg(R_POWER_CONTROL2, 0x0002); - lcd_write_reg(R_POWER_CONTROL3, 0x000a); - lcd_write_reg(R_POWER_CONTROL4, 0xc5a); - lcd_write_reg(R_POWER_CONTROL1, 0x0004); - lcd_write_reg(R_POWER_CONTROL1, 0x0134); - lcd_write_reg(R_POWER_CONTROL2, 0x0111); - lcd_write_reg(R_POWER_CONTROL3, 0x001c); - lcd_delay(0x28); - lcd_write_reg(R_POWER_CONTROL4, 0x2c40); - lcd_write_reg(R_POWER_CONTROL1, 0x0510); - lcd_delay(0x3c); - - /* lcd init 2 */ - lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x0113); - lcd_write_reg(R_DRV_WAVEFORM_CONTROL, 0x0700); - lcd_write_reg(R_ENTRY_MODE, 0x1038); - lcd_write_reg(R_DISP_CONTROL2, 0x0508); // 0x3c8, TMM - lcd_write_reg(R_DISP_CONTROL3, 0x0000); - lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0003); - lcd_write_reg(R_RAM_ADDR_SET, 0x0000); - lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0406); - lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0303); - lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0000); - lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0305); - lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0404); - lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0000); - lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0000); - lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0503); - lcd_write_reg(R_GAMMA_AMP_ADJ_RES_POS, 0x1d05); - lcd_write_reg(R_GAMMA_AMP_AVG_ADJ_RES_NEG, 0x1d05); - lcd_write_reg(R_VERT_SCROLL_CONTROL, 0x0000); - lcd_write_reg(R_1ST_SCR_DRV_POS, 0x9f00); - lcd_write_reg(R_2ND_SCR_DRV_POS, 0x9f00); - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00); - lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00); - - /* lcd init 3 */ - lcd_write_reg(R_POWER_CONTROL1, 0x4510); - lcd_write_reg(R_DISP_CONTROL1, 0x0005); - lcd_delay(0x28); - lcd_write_reg(R_DISP_CONTROL1, 0x0025); - lcd_write_reg(R_DISP_CONTROL1, 0x0027); - lcd_delay(0x28); - lcd_write_reg(R_DISP_CONTROL1, 0x0037); - - display_on = true; -} - -void lcd_init_device(void) -{ - /* Configure external memory banks */ - CSCFG1 = 0x0d500023 | tcc77x_cscfg_bw(TCC77X_CSCFG_BW16); - - /* may be reset */ - GPIOA |= 0x8000; - - _display_on(); -} - -void lcd_enable(bool on) -{ - if (display_on == on) - return; - - if (on) { - _display_on(); - send_event(LCD_EVENT_ACTIVATION, NULL); - } else { - /** Off sequence according to datasheet, p. 130 **/ - lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */ - lcd_write_reg(R_DISP_CONTROL1, 0x0036); /* GON=1, DTE=1, REV=1, D1-0=10 */ - sleep(2); - - lcd_write_reg(R_DISP_CONTROL1, 0x0026); /* GON=1, DTE=0, REV=1, D1-0=10 */ - sleep(2); - - lcd_write_reg(R_DISP_CONTROL1, 0x0000); /* GON=0, DTE=0, D1-0=00 */ - - lcd_write_reg(R_POWER_CONTROL1, 0x0000); /* SAP2-0=000, AP2-0=000 */ - lcd_write_reg(R_POWER_CONTROL3, 0x0000); /* PON=0 */ - lcd_write_reg(R_POWER_CONTROL4, 0x0000); /* VCOMG=0 */ - - /* datasheet p. 131 */ - lcd_write_reg(R_POWER_CONTROL1, 0x0001); /* STB=1: standby mode */ - - display_on = false; - } -} - -bool lcd_active(void) -{ - return display_on; -} - - -#define RGB(r,g,b) ((((r)&0x3f) << 12)|(((g)&0x3f) << 6)|(((b)&0x3f))) - - -void lcd_update(void) -{ - lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); -} - -/* todo: need tests */ -void lcd_update_rect(int sx, int sy, int width, int height) -{ - int x, y; - - if (!display_on) - return; - - if (width <= 0 || height <= 0) /* nothing to do */ - return; - - width += sx; - height += sy; - - if (width > LCD_WIDTH) - width = LCD_WIDTH; - if (height > LCD_HEIGHT) - height = LCD_HEIGHT; - - lcd_write_reg(R_ENTRY_MODE, 0x1028); - /* set update window */ - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_HEIGHT - 1) << 8); - lcd_write_reg(R_VERT_RAM_ADDR_POS, ((width - 1) << 8) | sx); - lcd_write_reg(R_RAM_ADDR_SET, (sx << 8) | (LCD_HEIGHT - sy - 1)); - lcd_write_cmd(R_WRITE_DATA_2_GRAM); - - for (y = sy; y < height; y++) { - for (x = sx; x < width; x++) { - fb_data c; - unsigned long color; - - c = *FBADDR(x,y); - color = - ((c & 0x1f) << 1) | ((c & 0x7e0) << 1) | ((c & 0xf800) << - 2); - - /* TODO: our color is 18-bit */ - outw((color >> 9) & 0x1ff, 0x50010008); - outw((color) & 0x1ff, 0x50010008); - } - } -} - -void lcd_set_contrast(int val) -{ - (void) val; -} - -void lcd_set_invert_display(bool yesno) -{ - (void) yesno; -} - -void lcd_set_flip(bool yesno) -{ - (void) yesno; -} - -/* TODO: implement me */ -void lcd_blit_yuv(unsigned char *const src[3], - int src_x, int src_y, int stride, - int x, int y, int width, int height) -{ - (void) src; - (void) src_x; - (void) src_y; - (void) stride; - (void) x; - (void) y; - - if (!display_on) - return; - - width &= ~1; /* stay on the safe side */ - height &= ~1; - - panicf("%s", __func__); -} diff --git a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c deleted file mode 100644 index baf93b73aa..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 Vitja Makarov - * - * 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 - -#include "config.h" -#include "cpu.h" -#include "kernel.h" -#include "system.h" -#include "power.h" -#include "backlight-target.h" - -#include "pcf50606.h" - -void power_init(void) -{ - pcf50606_write(PCF5060X_DCDC1, 0x90); - pcf50606_write(PCF5060X_DCDC2, 0x48); - pcf50606_write(PCF5060X_DCDC3, 0xfc); - pcf50606_write(PCF5060X_DCDC4, 0xb1); - - pcf50606_write(PCF5060X_IOREGC, 0xe9); - /* 3.3V, touch-panel */ - pcf50606_write(PCF5060X_D1REGC1, 0xf8); - pcf50606_write(PCF5060X_D2REGC1, 0xf2); - pcf50606_write(PCF5060X_D3REGC1, 0xf5); - - pcf50606_write(PCF5060X_LPREGC1, 0x00); - pcf50606_write(PCF5060X_LPREGC2, 0x02); - - pcf50606_write(PCF5060X_DCUDC1, 0xe6); - pcf50606_write(PCF5060X_DCUDC2, 0x30); - - pcf50606_write(PCF5060X_DCDEC1, 0xe7); - pcf50606_write(PCF5060X_DCDEC2, 0x02); - - pcf50606_write(PCF5060X_INT1M, 0x5b); - pcf50606_write(PCF5060X_INT1M, 0xaf); - pcf50606_write(PCF5060X_INT1M, 0x8f); - - pcf50606_write(PCF5060X_OOCC1, 0x40); - pcf50606_write(PCF5060X_OOCC2, 0x05); - - pcf50606_write(PCF5060X_MBCC3, 0x3a); - pcf50606_write(PCF5060X_GPOC1, 0x00); - pcf50606_write(PCF5060X_BBCC, 0xf8); -} - -/* Control leds on ata2501 board */ -void power_touch_panel(bool on) -{ - if (on) - pcf50606_write(PCF5060X_D1REGC1, 0xf8); - else - pcf50606_write(PCF5060X_D1REGC1, 0x00); -} - -void ide_power_enable(bool on) -{ - (void) on; -} - -bool ide_powered(void) -{ - return true; -} - -void power_off(void) -{ - /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */ - pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK); -} - -#if CONFIG_TUNER -#include "tuner.h" - -/** Tuner **/ -static bool powered = false; - -#define TUNNER_CLK (1 << 5) -#define TUNNER_DATA (1 << 6) -#define TUNNER_NR_W (1 << 7) - -bool tuner_power(bool status) -{ - bool old_status; - lv24020lp_lock(); - - old_status = powered; - - if (status != old_status) - { - if (status) - { - /* When power up, host should initialize the 3-wire bus - in host read mode: */ - - /* 1. Set direction of the DATA-line to input-mode. */ - GPIOA_DIR &= ~TUNNER_DATA; - - /* 2. Drive NR_W low */ - GPIOA &= ~TUNNER_NR_W; - GPIOA_DIR |= TUNNER_NR_W; - - /* 3. Drive CLOCK high */ - GPIOA |= TUNNER_CLK; - GPIOA_DIR |= TUNNER_CLK; - - lv24020lp_power(true); - } - else - { - lv24020lp_power(false); - - /* set all as inputs */ - GPIOC_DIR &= ~(TUNNER_CLK | TUNNER_DATA | TUNNER_NR_W); - } - - powered = status; - } - - lv24020lp_unlock(); - return old_status; -} - -#endif /* CONFIG_TUNER */ - -unsigned int power_input_status(void) -{ - return (GPIOA & 0x1) ? - POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; -} diff --git a/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c deleted file mode 100644 index bc7ead61f0..0000000000 --- a/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id: powermgmt-cowond2.c 17847 2008-06-28 18:10:04Z bagder $ - * - * Copyright (C) 2007 by Karl Kurbjun - * - * 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 "adc.h" -#include "powermgmt.h" -#include "kernel.h" -#include "pcf50606.h" - -unsigned short current_voltage = 5150; - -const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = -{ - /* FIXME: calibrate value */ - 4400 -}; - -const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = -{ - /* FIXME: calibrate value */ - 4600 -}; - -/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ -const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = -{ - /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */ - { 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 } -}; - -#if CONFIG_CHARGING -/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ -const unsigned short percent_to_volt_charge[11] = -{ - /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */ - 4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */ -}; -#endif /* CONFIG_CHARGING */ - -#define BATTERY_SCALE_FACTOR 6000 -/* full-scale ADC readout (2^10) in millivolt */ - -/* Returns battery voltage from ADC [millivolts] */ -int _battery_voltage(void) -{ - static unsigned last_tick = 0; - - if (0 == last_tick || TIME_BEFORE(last_tick+HZ, current_tick)) - { - int adc_val, irq_status; - unsigned char buf[2]; - - irq_status = disable_irq_save(); - pcf50606_write(PCF5060X_ADCC2, 0x1); - pcf50606_read_multiple(PCF5060X_ADCS1, buf, 2); - restore_interrupt(irq_status); - - adc_val = (buf[0]<<2) | (buf[1] & 3); //ADCDAT1H+ADCDAT1L - current_voltage = (adc_val * BATTERY_SCALE_FACTOR) >> 10; - - last_tick = current_tick; - } - - return current_voltage; -} - -- cgit v1.2.3