diff options
Diffstat (limited to 'firmware/target/arm/imx233')
23 files changed, 20 insertions, 1094 deletions
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c index c1bc379a49..ab4466300b 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c @@ -149,6 +149,8 @@ void lcd_update_rect(int x, int y, int w, int h) lcd_write_reg(0x17, y | (y + h - 1) << 8); lcd_write_reg(0x21, y * LCD_WIDTH + x); lcd_write_reg(0x22, 0); + + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int yy = y; yy < y + h; yy++) - imx233_lcdif_pio_send(true, 2 * w, FBADDR(x, yy)); + imx233_lcdif_pio_send(true, 2 * w, fbaddr(x,yy)); } diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c index 06b0f158f3..75d2775814 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c @@ -172,8 +172,9 @@ void lcd_update_rect(int x, int y, int w, int h) lcd_send(false, 0x75); lcd_send(true, y); lcd_send(true, y + h - 1); lcd_send(false, 0x5c); imx233_lcdif_set_word_length(16); + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int yy = y; yy < y + h; yy++) - imx233_lcdif_pio_send(true, w, FBADDR(x, yy)); + imx233_lcdif_pio_send(true, w, fbaddr(x,yy)); } #ifndef BOOTLOADER diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c b/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c index ce0bcc3885..825b0072a3 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c @@ -282,8 +282,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c index 890ff0b586..d0084900e7 100644 --- a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c +++ b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c @@ -241,8 +241,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c index 59496f2d24..d5f25a523c 100644 --- a/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c +++ b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c @@ -188,8 +188,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index bfc38b20dc..4487952162 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c @@ -940,8 +940,8 @@ bool dbg_hw_info_emi(void) bool dbg_hw_info_audio(void) { - static const char *hp_sel[2] = {"DAC", "Line1"}; - static const char *mux_sel[4] = {"Mic", "Line1", "HP", "Line2"}; + static const char * const hp_sel[2] = {"DAC", "Line1"}; + static const char * const mux_sel[4] = {"Mic", "Line1", "HP", "Line2"}; lcd_setfont(FONT_SYSFIXED); while(1) @@ -1171,7 +1171,7 @@ bool dbg_hw_info_button(void) } else if(MAP[i].periph == IMX233_BUTTON_LRADC) { - static const char *op_name[] = + static const char * const op_name[] = { [IMX233_BUTTON_EQ] = "eq", [IMX233_BUTTON_GT] = "gt", diff --git a/firmware/target/arm/imx233/pcm-imx233.c b/firmware/target/arm/imx233/pcm-imx233.c index c06120e4aa..1588d2c874 100644 --- a/firmware/target/arm/imx233/pcm-imx233.c +++ b/firmware/target/arm/imx233/pcm-imx233.c @@ -42,7 +42,6 @@ __ENSURE_STRUCT_CACHE_FRIENDLY(struct pcm_dma_command_t) static int dac_locked = 0; static struct pcm_dma_command_t dac_dma; -static bool dac_freezed = false; static const void *dac_buf; /* current buffer */ static size_t dac_size; /* remaining size */ @@ -175,17 +174,6 @@ void pcm_dma_apply_settings(void) pcm_play_unlock(); } -const void *pcm_play_dma_get_peak_buffer(int *count) -{ - if(!dac_freezed) - imx233_dma_freeze_channel(APB_AUDIO_DAC, true); - struct imx233_dma_info_t info = imx233_dma_get_info(APB_AUDIO_DAC, DMA_INFO_AHB_BYTES | DMA_INFO_BAR); - if(!dac_freezed) - imx233_dma_freeze_channel(APB_AUDIO_DAC, false); - *count = info.ahb_bytes; - return (void *)info.bar; -} - /* * Recording */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/audio-target.h b/firmware/target/arm/imx233/samsung-ypz5/audio-target.h deleted file mode 100644 index c0bee26e45..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/audio-target.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Lorenzo Miori - * - * 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 __audio_target__ -#define __audio_target__ - -/* MUTE_ON toggles a transistor that in turns toggles a mosfet... */ -#define IMX233_AUDIO_HP_GATE_BANK 1 -#define IMX233_AUDIO_HP_GATE_PIN 22 -#define IMX233_AUDIO_HP_GATE_INVERTED - -#define IMX233_AUDIO_COUPLING_MODE ACM_CAP - -#endif /* __audio_target__ */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h b/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h deleted file mode 100644 index e26f83811d..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2013 by Lorenzo Miori - * - * 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 - -bool backlight_hw_init(void); -void backlight_hw_on(void); -void backlight_hw_off(void); -void backlight_hw_brightness(int brightness); - -#endif /* BACKLIGHT_TARGET_H */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c deleted file mode 100644 index b02c3a1d16..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2013 by Lorenzo Miori - * - * 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 "lcd.h" -#include "backlight.h" -#include "backlight-target.h" -#include "pinctrl-imx233.h" - -/** - * AAT3151 Backlight Controller - */ - -/* Timings */ -#define TIME_OFF 500 -#define TIME_LOW 50 -#define TIME_HI 50 -#define TIME_LAT 500 - -/* Number of raising edges to select the particular register */ -#define D1_D4_CURRENT_E 17 -#define D1_D3_CURRENT_E 18 -#define D4_CURRENT_E 19 -#define MAX_CURRENT_E 20 -#define LOW_CURRENT_E 21 - -/* The actual register address / number */ -#define D1_D4_CURRENT 1 -#define D1_D3_CURRENT 2 -#define D4_CURRENT 3 -#define MAX_CURRENT 4 -#define LOW_CURRENT 5 - -/* Valid values for LOW_CURRENT register */ -#define MAX_CURRENT_20 1 -#define MAX_CURRENT_30 2 -#define MAX_CURRENT_15 3 -#define MAX_CURRENT_LOW_CURRENT 4 - -static int current_level = -1; - -static void create_raising_edges(int num) -{ - while (num--) - { - /* Setting a register takes a sufficient small amount of time, - * in the order of 50 ns. Thus the necessary 2 delays TIME_LOW/TIME_HI - * are not strictly necessary */ - imx233_pinctrl_set_gpio(3, 13, false); - imx233_pinctrl_set_gpio(3, 13, true); - } -} - -static void aat3151_write(int addr, int data) -{ - create_raising_edges(16 + addr); - udelay(TIME_LAT); - create_raising_edges(data); - udelay(TIME_LAT); -} - -void backlight_hw_brightness(int level) -{ - /* Don't try to reset backlight if not necessary - * Moreover this helps to avoid flickering when - * being in some screens like USB mode and - * pressing some keys / touchpad... - */ - if (current_level == level) return; - - /* Check for limits and adjust in case */ - level = MIN(MAX_BRIGHTNESS_SETTING, MAX(0, level)); - - if (level == 0) - { - /* Set pin low for a sufficient time, puts the device into low-power consumption state - * In other words backlight goes off - */ - imx233_pinctrl_set_gpio(3, 13, false); - udelay(TIME_OFF); - } - else - { - if (level > 3) { - /* This enables 16 levels of backlight */ - aat3151_write(MAX_CURRENT, MAX_CURRENT_15); - /* Set the value according Table 1 in datasheet - * For MAX_CURRENT_15, the scale is from 0 mA to 15 mA in 16 steps - */ - aat3151_write(D1_D3_CURRENT, 19 - level); - } - else { - /* This enables other 4 levels of backlight */ - aat3151_write(MAX_CURRENT, MAX_CURRENT_LOW_CURRENT); - /* Set the value according Table 1 in datasheet - * For LOW_CURRENT, there is no "real" scale. We have scattered values. - * We are interested in the last 3 -> 0.5 mA; 1 mA; 2 mA - */ - aat3151_write(LOW_CURRENT, 13 + level); - } - } - current_level = level; -} - -bool backlight_hw_init(void) -{ - imx233_pinctrl_acquire(3, 13, "backlight"); - imx233_pinctrl_set_function(3, 13, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_drive(3, 13, PINCTRL_DRIVE_4mA); - imx233_pinctrl_enable_gpio(3, 13, true); - imx233_pinctrl_set_gpio(3, 13, false); - return true; -} - -void backlight_hw_on(void) -{ -#ifdef HAVE_LCD_ENABLE - lcd_enable(true); /* power on lcd + visible display */ -#endif - /* restore the previous backlight level */ - backlight_hw_brightness(backlight_brightness); -} - -void backlight_hw_off(void) -{ - /* there is no real on/off but we can set to 0 brightness */ - backlight_hw_brightness(0); -#ifdef HAVE_LCD_ENABLE - lcd_enable(false); /* power off visible display */ -#endif -} diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-target.h b/firmware/target/arm/imx233/samsung-ypz5/button-target.h deleted file mode 100644 index 2f94f5fb31..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/button-target.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Lorenzo Miori - * - * 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 _BUTTON_TARGET_H_ -#define _BUTTON_TARGET_H_ - -#include <stdbool.h> - -#define HAS_BUTTON_HOLD -#define IMX233_BUTTON_LRADC_CHANNEL 0 -#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO -#define BLH_GPIO_BANK 0 -#define BLH_GPIO_PIN 13 - -#define IMX233_BUTTON_LRADC_CHANNEL 0 - -/* Main unit's buttons */ -#define BUTTON_POWER 0x00000001 -#define BUTTON_VOL_UP 0x00000002 -#define BUTTON_VOL_DOWN 0x00000004 -/* Directional buttons by touchpad */ -#define BUTTON_LEFT 0x00000008 -#define BUTTON_UP 0x00000010 -#define BUTTON_RIGHT 0x00000020 -#define BUTTON_DOWN 0x00000040 -#define BUTTON_SELECT 0x00000080 -#define BUTTON_BACK 0x00000100 -#define BUTTON_REW 0x00000200 -#define BUTTON_FF 0x00000400 - - -#define BUTTON_MAIN (BUTTON_VOL_UP | BUTTON_VOL_DOWN | BUTTON_POWER | BUTTON_LEFT | \ - BUTTON_UP | BUTTON_RIGHT | BUTTON_DOWN | BUTTON_SELECT | \ - BUTTON_BACK | BUTTON_REW | BUTTON_FF) - -/* Software power-off */ -#define POWEROFF_BUTTON BUTTON_POWER -#define POWEROFF_COUNT 10 - -bool button_debug_screen(void); - -#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c deleted file mode 100644 index 91fe059c31..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c +++ /dev/null @@ -1,273 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2013 by Lorenzo Miori - * - * 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 "lcd.h" -#include "string.h" -#include "kernel.h" -#include "pinctrl-imx233.h" -#include "power-imx233.h" -#include "button-lradc-imx233.h" -#include "button-target.h" -#include "button-imx233.h" - -#ifndef BOOTLOADER -#include "touchscreen.h" -#include "touchscreen-imx233.h" -#include "button.h" -#include "font.h" -#include "action.h" -#endif - -#define CHAN 0 /* ADC channel for the buttons */ -#define I_VDDIO 0 /* Mock button to define the relative voltage to compute voltage from ADC steps */ - -struct imx233_button_map_t imx233_button_map[] = -{ - [I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3760), "vddio"), /* we need VDDIO for relative */ - IMX233_BUTTON_(HOLD, GPIO(0, 13), "hold"), - IMX233_BUTTON(POWER, PSWITCH(1), "power"), - IMX233_BUTTON(SELECT, PSWITCH(3), "select"), - IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 485, I_VDDIO), "vol up"), - IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 975, I_VDDIO), "vol down"), - IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1521, I_VDDIO), "back"), - IMX233_BUTTON(FF, LRADC_REL(CHAN, 2000, I_VDDIO), "ff"), - IMX233_BUTTON(REW, LRADC_REL(CHAN, 2480, I_VDDIO), "rew"), - IMX233_BUTTON_(END, END(), "") -}; - -#ifndef BOOTLOADER -static int last_x = 0; -static int last_y = 0; -static bool touching = false; -#endif /* BOOTLOADER */ - -#ifndef BOOTLOADER - -/* Touchpad extra pin initialization - * Strange facts: - * 1. In the fully working sample I have, it seems that pins - * must be all set to low - * 2. In the other sample without LCD, it seems (by measurement) that - * not all the pins are set to low! Actually, I still need to see if - * touchpad works in this other sample. -*/ -void touchpad_pin_setup(void) -{ - /* TX+ */ - imx233_pinctrl_acquire(0, 25, "touchpad X+ power low"); - imx233_pinctrl_set_function(0, 25, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_drive(0, 25, PINCTRL_DRIVE_4mA); - imx233_pinctrl_enable_gpio(0, 25, true); - - /* TY+ */ - imx233_pinctrl_acquire(0, 26, "touchpad Y+ power high"); - imx233_pinctrl_set_function(0, 26, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_drive(0, 26, PINCTRL_DRIVE_4mA); - imx233_pinctrl_enable_gpio(0, 26, true); - - /* TY- */ - imx233_pinctrl_acquire(1, 21, "touchpad Y- power low"); - imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_drive(1, 21, PINCTRL_DRIVE_4mA); - imx233_pinctrl_enable_gpio(1, 21, true); - - /* TX- */ - imx233_pinctrl_acquire(3, 15, "touchpad X- power high"); - imx233_pinctrl_set_function(3, 15, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_drive(3, 15, PINCTRL_DRIVE_4mA); - imx233_pinctrl_enable_gpio(3, 15, true); - -} -#endif /* BOOTLOADER */ - -void button_init_device(void) -{ - /* init button subsystem */ - imx233_button_init(); -#ifndef BOOTLOADER - touchpad_pin_setup(); - /* Now that is powered up, proceed with touchpad initialization */ - imx233_touchscreen_init(); - imx233_touchscreen_enable(true); -#endif /* BOOTLOADER */ -} - -/* X, Y, RadiusX, RadiusY */ -#define TOUCH_UP 2400, 1050, 650, 250 -#define TOUCH_DOWN 2057, 3320, 500, 350 -#define TOUCH_LEFT 3581, 2297, 300, 350 -#define TOUCH_RIGHT 1000, 2100, 400, 700 -#define TOUCH_CENTER 2682, 2167, 335, 276 - -bool coord_in_radius(int x, int y, int cx, int cy, int rx, int ry) -{ - return ((x >= cx - rx && x <= cx + rx) && (y >= cy - ry && y <= cy + ry)); -} - -int button_read_device(void) -{ - int res = 0; - -#ifndef BOOTLOADER - /* handle the touchpad events */ - touching = imx233_touchscreen_get_touch(&last_x, &last_y); - if(touching) - { - if (coord_in_radius(last_x, last_y, TOUCH_LEFT)) - { - res |= BUTTON_LEFT; - } - else if (coord_in_radius(last_x, last_y, TOUCH_RIGHT)) - { - res |= BUTTON_RIGHT; - } - else if (coord_in_radius(last_x, last_y, TOUCH_DOWN)) - { - res |= BUTTON_DOWN; - } - else if (coord_in_radius(last_x, last_y, TOUCH_UP)) - { - res |= BUTTON_UP; - } - } -#endif /* BOOTLOADER */ - /* handle the generic events */ - return imx233_button_read(res); -} - -#ifndef BOOTLOADER - -#define MAX_ENTRIES 100 -#define VIEWPORT_HEIGHT 100 -#define VIEWPORT_WIDTH 100 -#define MAX_X 3700 -#define MAX_Y 3700 -#define ADAPT_TO_VIEWPORT(cx, cy, rx, ry) ((float)(cx) / MAX_X) * VIEWPORT_WIDTH, \ - ((float)(cy) / MAX_Y) * VIEWPORT_HEIGHT, \ - ((float)(rx) / MAX_X) * VIEWPORT_WIDTH, \ - ((float)(ry) / MAX_Y) * VIEWPORT_HEIGHT -static void draw_calibration_rect(int cx, int cy, int rx, int ry) -{ - if (coord_in_radius(last_x, last_y, cx, cy, rx, ry)) - lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0xff, 0xff), LCD_BLACK); - else - lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0, 0), LCD_BLACK); - lcd_drawrect(ADAPT_TO_VIEWPORT(cx - rx, cy - ry, 2 * rx, 2 * ry)); -} - -bool button_debug_screen(void) -{ - int last = 0; - struct point_t - { - int x; - int y; - }; - struct point_t last_entries[MAX_ENTRIES]; - struct viewport report_vp; - - memset(&report_vp, 0, sizeof(report_vp)); - report_vp.x = (LCD_WIDTH - VIEWPORT_WIDTH) / 2; - report_vp.y = (LCD_HEIGHT - VIEWPORT_HEIGHT) / 2; - report_vp.width = VIEWPORT_WIDTH; - report_vp.height = VIEWPORT_HEIGHT; - - lcd_setfont(FONT_SYSFIXED); - lcd_clear_display(); - - while(1) - { - int button = get_action(CONTEXT_STD, HZ / 10); - switch(button) - { - case ACTION_STD_OK: - case ACTION_STD_MENU: - lcd_set_viewport(NULL); - lcd_setfont(FONT_UI); - lcd_clear_display(); - return true; - case ACTION_STD_CANCEL: - lcd_set_viewport(NULL); - lcd_setfont(FONT_UI); - lcd_clear_display(); - return false; - } - - lcd_set_viewport(NULL); - lcd_putsf(0, 1, "(%d,%d) %s", last_x, last_y, touching ? "touching!" : ""); - lcd_putsf(0, 0, "Type %s", imx233_pinctrl_get_gpio(0, 31) ? "CAP" : "REG"); - lcd_set_viewport(&report_vp); - lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0, 0, 0xff), LCD_BLACK); - lcd_drawrect(0, 0, 100, 100); - float percent_x = ((float)(last_x) / MAX_X); - float percent_y = ((float)(last_y) / MAX_Y); - if (touching) - { - lcd_set_viewport(NULL); - if (last < MAX_ENTRIES) - { - last_entries[last].x = last_x; - last_entries[last].y = last_y; - last++; - lcd_putsf(0, 17, "Recording: %d captures left", MAX_ENTRIES - last); - } - else - { - int min_x = 9999; - int min_y = 9999; - int max_x = -1; - int max_y = -1; - int median_x = 0; - int median_y = 0; - for (int i = 0; i < MAX_ENTRIES; i++) - { - min_x = MIN(min_x, last_entries[i].x); - min_y = MIN(min_y, last_entries[i].y); - max_x = MAX(max_x, last_entries[i].x); - max_y = MAX(max_y, last_entries[i].y); - median_x += last_entries[i].x; - median_y += last_entries[i].y; - } - median_x /= MAX_ENTRIES; - median_y /= MAX_ENTRIES; - lcd_putsf(0, 17, "center(%d,%d)", median_x, median_y); - lcd_putsf(0, 18, "radius(%d,%d)", median_x / 2, median_y / 2); - } - lcd_set_viewport(&report_vp); - lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0x8c, 0), LCD_BLACK); - lcd_fillrect(VIEWPORT_WIDTH * percent_x, VIEWPORT_HEIGHT * percent_y, 2, 2); - } - - /* Draw current calibration settings */ - lcd_set_viewport(&report_vp); - draw_calibration_rect(TOUCH_UP); - draw_calibration_rect(TOUCH_DOWN); - draw_calibration_rect(TOUCH_CENTER); - draw_calibration_rect(TOUCH_LEFT); - draw_calibration_rect(TOUCH_RIGHT); - - lcd_update(); - yield(); - } - - return true; -} -#endif diff --git a/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c deleted file mode 100644 index c125eac973..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c +++ /dev/null @@ -1,29 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Amaury Pouly - * - * 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 "button-target.h" -#include "lcd-target.h" - -bool dbg_hw_target_info(void) -{ - return button_debug_screen() && lcd_debug_screen(); -} diff --git a/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h b/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h deleted file mode 100644 index 66bceb4071..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Amaury Pouly - * - * 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 _FMRADIO_TARGET_H_ -#define _FMRADIO_TARGET_H_ - -#define IMX233_FMRADIO_I2C FMI_HW - -#define IMX233_FMRADIO_POWER FMP_GPIO -#define FMP_GPIO_BANK 0 -#define FMP_GPIO_PIN 10 -#define FMP_GPIO_DELAY (HZ / 5) - -#endif /* _FMRADIO_TARGET_H_ */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h b/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h deleted file mode 100644 index cb943e34f2..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2009 by Michael Sparmann - * - * 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 __FTL_TARGET_H__ -#define __FTL_TARGET_H__ - -#include "config.h" -#include "inttypes.h" - -#ifdef BOOTLOADER -/* Bootloaders don't need write access */ -#define FTL_READONLY -#endif - -uint32_t ftl_init(void); -uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer); -uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer); -uint32_t ftl_sync(void); - - -#endif diff --git a/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h b/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h deleted file mode 100644 index 9993b7d731..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (c) 2013 by Amaury Pouly - * - * 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 LCD_TARGET_H -#define LCD_TARGET_H - -bool lcd_debug_screen(void); - -#endif /* LCD_TARGET_H */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c deleted file mode 100644 index 99fe0b2aef..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c +++ /dev/null @@ -1,295 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (c) 2013 by Lorenzo Miori - * - * 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 <sys/types.h> /* off_t */ -#include <string.h> -#include "cpu.h" -#include "system.h" -#include "backlight-target.h" -#include "lcd.h" -#include "lcdif-imx233.h" -#include "clkctrl-imx233.h" -#include "pinctrl-imx233.h" -#include "dcp-imx233.h" -#include "logf.h" -#ifndef BOOTLOADER -#include "button.h" -#include "font.h" -#include "action.h" -#endif -#include "dma-imx233.h" -#include "kernel.h" - -#include "regs/lcdif.h" - -/** - * NOTE - * We don't know exact LCD models nor we have datasheets for them - * Register function are partly guessed from the values, others are guessed from other LCD - * drivers and others have been confirmed studying their values - */ - -static enum lcd_type_t -{ - LCD_TYPE_ZERO = 0, - LCD_TYPE_ONE = 1 -} lcd_type = LCD_TYPE_ZERO; - -static void lcd_write_reg(uint16_t reg, uint16_t data) -{ - imx233_lcdif_pio_send(false, 1, ®); - if(reg != 0x22) - imx233_lcdif_pio_send(true, 1, &data); -} - -/* - * The two LCD types require different initialization sequences - */ -void lcd_init_seq(void) -{ - switch (lcd_type) - { - case LCD_TYPE_ZERO: - { - lcd_write_reg(0x11, 0x1f1e); - lcd_write_reg(0x38, 0xf0f); - lcd_write_reg(0x12, 0x1101); - lcd_write_reg(0x13, 0x808); - lcd_write_reg(0x14, 0x3119); - lcd_write_reg(0x10, 0x1a10); - udelay(0xc350); - lcd_write_reg(0x13, 0x83b); - udelay(0x30d40); - lcd_write_reg(1, 0x90c); /* Display mode */ - lcd_write_reg(2, 0x200); - lcd_write_reg(3, 0x1030); - lcd_write_reg(7, 5); - lcd_write_reg(8, 0x503); - lcd_write_reg(11, 0); - lcd_write_reg(12, 0); - /* Gamma control */ - lcd_write_reg(0x30, 0x606); - lcd_write_reg(0x31, 0x606); - lcd_write_reg(0x32, 0x305); - lcd_write_reg(0x33, 2); - lcd_write_reg(0x34, 0x503); - lcd_write_reg(0x35, 0x606); - lcd_write_reg(0x36, 0x606); - lcd_write_reg(0x37, 0x200); - - lcd_write_reg(0x11, 0x1f1e); - lcd_write_reg(0x38, 0xf0f); - /* Set initial LCD limits and RAM settings */ - lcd_write_reg(0x40, 0); //BPP ? - lcd_write_reg(0x42, 0x9f00); - lcd_write_reg(0x43, 0); - lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */ - lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */ - - lcd_write_reg(14, 0x13); - lcd_write_reg(0xa9, 0x14); - lcd_write_reg(0xa7, 0x30); - lcd_write_reg(0xa8, 0x124); - lcd_write_reg(0x6f, 0x1d00); - lcd_write_reg(0x70, 3); - lcd_write_reg(7, 1); - lcd_write_reg(0x10, 0x1a10); - udelay(0x9c40); - lcd_write_reg(7, 0x21); - lcd_write_reg(7, 0x23); - udelay(0x9c40); - lcd_write_reg(7, 0x37); /* Seems to be "power on" */ - break; - } - case LCD_TYPE_ONE: - { - lcd_write_reg(0, 1); - udelay(0x2710); - lcd_write_reg(0x11, 0x171b); - lcd_write_reg(0x12, 0); - lcd_write_reg(0x13, 0x80d); - lcd_write_reg(0x14, 0x18); - lcd_write_reg(0x10, 0x1a10); - udelay(0xc350); - lcd_write_reg(0x13, 0x81d); - udelay(0xc350); - lcd_write_reg(1, 0x90c); /* Display mode */ - lcd_write_reg(2, 0x200); - lcd_write_reg(3, 0x1030); - lcd_write_reg(7, 5); - lcd_write_reg(8, 0x30a); - lcd_write_reg(11, 4); - lcd_write_reg(12, 0); - /* Gamma control */ - lcd_write_reg(0x30, 0x300); - lcd_write_reg(0x31, 0); - lcd_write_reg(0x32, 0); - lcd_write_reg(0x33, 0x404); - lcd_write_reg(0x34, 0x707); - lcd_write_reg(0x35, 0x700); - lcd_write_reg(0x36, 0x703); - lcd_write_reg(0x37, 4); - - lcd_write_reg(0x38, 0); - /* Set initial LCD limits and RAM settings */ - lcd_write_reg(0x40, 0); - lcd_write_reg(0x42, 0x9f00); /* LCD Display Start Address Register 0 */ - lcd_write_reg(0x43, 0); /* LCD Display Start Address Register 1 */ - lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */ - lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */ - - lcd_write_reg(7, 1); - udelay(0x2710); - lcd_write_reg(7, 0x21); - lcd_write_reg(7, 0x23); - udelay(0x2710); - lcd_write_reg(7, 0x1037); - udelay(0x2710); - lcd_write_reg(7, 0x35); - lcd_write_reg(7, 0x36); - lcd_write_reg(7, 0x37); - udelay(10000); - break; - } - default: - break; - } -} - -static void send_update_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h) -{ - /* Set horizontal refresh zone */ - lcd_write_reg(0x44, (x | (y + w - 1) << 0x8)); - /* Set vertical refresh zone */ - lcd_write_reg(0x45, (y | (y + h - 1) << 0x8)); - lcd_write_reg(0x21, x | y << 8); - /* Set register index to 0x22 to write screen data. 0 is mock value */ - lcd_write_reg(0x22, 0); -} - -static void setup_lcd_pins(void) -{ - imx233_lcdif_setup_system_pins(16); - /* lcd_rd */ - imx233_pinctrl_acquire(0, 9, "lcd rd"); - imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_set_gpio(0, 9, false); - /* - * This pin is important to know the LCD type - * There are two types that require two different initialization sequences - */ - /* lcd_tp */ - imx233_pinctrl_acquire(3, 12, "lcd type"); - imx233_pinctrl_set_function(3, 12, PINCTRL_FUNCTION_GPIO); - imx233_pinctrl_enable_gpio(3, 12, false); - /* Sense LCD Type */ - lcd_type = imx233_pinctrl_get_gpio(3, 12) ? LCD_TYPE_ONE : LCD_TYPE_ZERO; -} - -static void setup_parameters(void) -{ - imx233_lcdif_init(); - imx233_lcdif_enable(true); - imx233_lcdif_set_word_length(16); - imx233_lcdif_set_data_swizzle(false); - imx233_lcdif_set_timings(2, 1, 1, 1); - BF_WR(LCDIF_CTRL, MODE86_V(8080_MODE)); - - imx233_lcdif_reset_lcd(true); - udelay(50); - imx233_lcdif_reset_lcd(false); - udelay(10); - imx233_lcdif_reset_lcd(true); -} - -void lcd_init_device(void) -{ - /* Setup interface pins */ - setup_lcd_pins(); - /* Set LCD parameters */ - setup_parameters(); - /* Send initialization sequence to LCD */ - lcd_init_seq(); -} - -struct lcdif_cmd_t -{ - struct apb_dma_command_t dma; - uint32_t ctrl0; - uint32_t pad[4]; -} __attribute__((packed)) CACHEALIGN_ATTR; - -struct lcdif_cmd_t lcdif_dma; -void lcd_update(void) -{ - unsigned size = LCD_WIDTH * LCD_HEIGHT * sizeof(fb_data); - - send_update_rect(0,0,LCD_WIDTH,LCD_HEIGHT); - /* We can safely do the transfer in a single shot, since 160 * 128 * 2 < 65k, - * the maximum transfer size! - */ - lcdif_dma.dma.cmd |= BF_OR(APB_CHx_CMD, CMDWORDS(1), XFER_COUNT(size), COMMAND(2)); - lcdif_dma.ctrl0 = HW_LCDIF_CTRL & ~BM_LCDIF_CTRL_COUNT; - lcdif_dma.ctrl0 |= BF_OR(LCDIF_CTRL, COUNT(size/2), DATA_SELECT(1)); - lcdif_dma.dma.buffer = FBADDR(0,0); - lcdif_dma.dma.cmd |= BM_APB_CHx_CMD_SEMAPHORE; - - imx233_dma_start_command(APB_LCDIF, &lcdif_dma.dma); - imx233_dma_wait_completion(APB_LCDIF, HZ); -} - -void lcd_update_rect(int x, int y, int w, int h) -{ - (void)x; - (void)y; - (void)w; - (void)h; - lcd_update(); -} - -#ifndef BOOTLOADER -bool lcd_debug_screen(void) -{ - lcd_setfont(FONT_SYSFIXED); - - while(1) - { - int button = get_action(CONTEXT_STD, HZ / 10); - switch(button) - { - case ACTION_STD_NEXT: - case ACTION_STD_PREV: - case ACTION_STD_OK: - case ACTION_STD_MENU: - lcd_setfont(FONT_UI); - return true; - case ACTION_STD_CANCEL: - lcd_setfont(FONT_UI); - return false; - } - - lcd_clear_display(); - lcd_putsf(0, 0, "LCD type: %d", lcd_type); - lcd_update(); - yield(); - } - - return true; -} -#endif diff --git a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h deleted file mode 100644 index 5d32bc5e9c..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Amaury Pouly - * - * 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 POWERMGMT_TARGET_H -#define POWERMGMT_TARGET_H - -#include "config.h" -#include "powermgmt-imx233.h" - -#define IMX233_CHARGE_CURRENT 100 -#define IMX233_STOP_CURRENT 10 -#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ) -#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ) -#define IMX233_DIE_TEMP_HIGH 71 -#define IMX233_DIE_TEMP_LOW 56 -#define IMX233_BATT_TEMP_SENSOR 0 -#define IMX233_BATT_TEMP_HIGH 1100 -#define IMX233_BATT_TEMP_LOW 220 - -#endif /* POWERMGMT_TARGET_H */ diff --git a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c deleted file mode 100644 index 9d9ed7de99..0000000000 --- a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2013 by Amaury Pouly - * - * 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 "powermgmt-target.h" -#include "power-imx233.h" - - -const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = -{ - 3400 -}; - -const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = -{ - 3300 -}; - -/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ -const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = -{ - /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */ - { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 }, -}; - -/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ -const unsigned short percent_to_volt_charge[11] = -{ - /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */ - 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335 -}; diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index 92864c9ed7..ceb7b4e090 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c @@ -637,8 +637,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c b/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c index cfcf85bfc0..8f49bfa3eb 100644 --- a/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c +++ b/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c @@ -228,8 +228,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c b/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c index 999f4ee525..862522da15 100644 --- a/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c +++ b/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c @@ -189,8 +189,9 @@ void lcd_update_rect(int x, int y, int w, int h) } else { + void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn; for(int i = 0; i < h; i++) - memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data)); + memcpy((fb_data *)FRAME + i * w, fbaddr(x,y + i), w * sizeof(fb_data)); } /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count diff --git a/firmware/target/arm/imx233/touchscreen-imx233.c b/firmware/target/arm/imx233/touchscreen-imx233.c index f98dc9b738..561b2c750a 100644 --- a/firmware/target/arm/imx233/touchscreen-imx233.c +++ b/firmware/target/arm/imx233/touchscreen-imx233.c @@ -23,9 +23,6 @@ #include "kernel.h" #include "touchscreen-imx233.h" #include "stdlib.h" -#ifdef SAMSUNG_YPZ5 -#include "pinctrl-imx233.h" -#endif /* Description: * the driver basically has 2 modes: @@ -82,24 +79,6 @@ static void touch_channel_irq(int chan) process(); } -#ifdef SAMSUNG_YPZ5 -/* On this target we need to manually setup pulldown pins, - * using specific GPIO lines - */ -static void pulldown_setup(bool xminus_enable, bool yminus_enable, - bool xplus_enable, bool yplus_enable) -{ - /* TX+ */ - imx233_pinctrl_set_gpio(0, 25, xplus_enable); - /* TX- */ - imx233_pinctrl_set_gpio(3, 15, xminus_enable); - /* TY+ */ - imx233_pinctrl_set_gpio(0, 26, yplus_enable); - /* TY- */ - imx233_pinctrl_set_gpio(1, 21, yminus_enable); -} -#endif - static void kick_measure(bool pull_x, bool pull_y, bool detect, int src) { #if IMX233_SUBTARGET < 3700 @@ -116,9 +95,6 @@ static void kick_measure(bool pull_x, bool pull_y, bool detect, int src) imx233_icoll_enable_interrupt(INT_SRC_LRADC_CHx(touch_chan), true); imx233_lradc_enable_channel_irq(touch_chan, true); /* setup measurement: x- pull down and x+ pull up */ -#ifdef SAMSUNG_YPZ5 - pulldown_setup(pull_x, pull_y, pull_x, pull_y); -#endif imx233_lradc_setup_touch(pull_x, pull_y, pull_x, pull_y, detect); imx233_lradc_enable_touch_detect_irq(false); imx233_lradc_enable_channel_irq(touch_chan, true); @@ -138,9 +114,6 @@ static void enter_state(enum touch_state_t state) switch(state) { case TOUCH_STATE_WAIT: -#ifdef SAMSUNG_YPZ5 - pulldown_setup(false, false, false, false); -#endif imx233_lradc_setup_touch(false, false, false, false, true); imx233_lradc_enable_touch_detect_irq(true); break; |