diff options
Diffstat (limited to 'firmware/target/arm/imx233/samsung-ypz5')
12 files changed, 0 insertions, 1044 deletions
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Lorenzo Miori | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef __audio_target__ | ||
22 | #define __audio_target__ | ||
23 | |||
24 | /* MUTE_ON toggles a transistor that in turns toggles a mosfet... */ | ||
25 | #define IMX233_AUDIO_HP_GATE_BANK 1 | ||
26 | #define IMX233_AUDIO_HP_GATE_PIN 22 | ||
27 | #define IMX233_AUDIO_HP_GATE_INVERTED | ||
28 | |||
29 | #define IMX233_AUDIO_COUPLING_MODE ACM_CAP | ||
30 | |||
31 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 by Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #ifndef BACKLIGHT_TARGET_H | ||
21 | #define BACKLIGHT_TARGET_H | ||
22 | |||
23 | bool backlight_hw_init(void); | ||
24 | void backlight_hw_on(void); | ||
25 | void backlight_hw_off(void); | ||
26 | void backlight_hw_brightness(int brightness); | ||
27 | |||
28 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 by Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "system.h" | ||
23 | #include "lcd.h" | ||
24 | #include "backlight.h" | ||
25 | #include "backlight-target.h" | ||
26 | #include "pinctrl-imx233.h" | ||
27 | |||
28 | /** | ||
29 | * AAT3151 Backlight Controller | ||
30 | */ | ||
31 | |||
32 | /* Timings */ | ||
33 | #define TIME_OFF 500 | ||
34 | #define TIME_LOW 50 | ||
35 | #define TIME_HI 50 | ||
36 | #define TIME_LAT 500 | ||
37 | |||
38 | /* Number of raising edges to select the particular register */ | ||
39 | #define D1_D4_CURRENT_E 17 | ||
40 | #define D1_D3_CURRENT_E 18 | ||
41 | #define D4_CURRENT_E 19 | ||
42 | #define MAX_CURRENT_E 20 | ||
43 | #define LOW_CURRENT_E 21 | ||
44 | |||
45 | /* The actual register address / number */ | ||
46 | #define D1_D4_CURRENT 1 | ||
47 | #define D1_D3_CURRENT 2 | ||
48 | #define D4_CURRENT 3 | ||
49 | #define MAX_CURRENT 4 | ||
50 | #define LOW_CURRENT 5 | ||
51 | |||
52 | /* Valid values for LOW_CURRENT register */ | ||
53 | #define MAX_CURRENT_20 1 | ||
54 | #define MAX_CURRENT_30 2 | ||
55 | #define MAX_CURRENT_15 3 | ||
56 | #define MAX_CURRENT_LOW_CURRENT 4 | ||
57 | |||
58 | static int current_level = -1; | ||
59 | |||
60 | static void create_raising_edges(int num) | ||
61 | { | ||
62 | while (num--) | ||
63 | { | ||
64 | /* Setting a register takes a sufficient small amount of time, | ||
65 | * in the order of 50 ns. Thus the necessary 2 delays TIME_LOW/TIME_HI | ||
66 | * are not strictly necessary */ | ||
67 | imx233_pinctrl_set_gpio(3, 13, false); | ||
68 | imx233_pinctrl_set_gpio(3, 13, true); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | static void aat3151_write(int addr, int data) | ||
73 | { | ||
74 | create_raising_edges(16 + addr); | ||
75 | udelay(TIME_LAT); | ||
76 | create_raising_edges(data); | ||
77 | udelay(TIME_LAT); | ||
78 | } | ||
79 | |||
80 | void backlight_hw_brightness(int level) | ||
81 | { | ||
82 | /* Don't try to reset backlight if not necessary | ||
83 | * Moreover this helps to avoid flickering when | ||
84 | * being in some screens like USB mode and | ||
85 | * pressing some keys / touchpad... | ||
86 | */ | ||
87 | if (current_level == level) return; | ||
88 | |||
89 | /* Check for limits and adjust in case */ | ||
90 | level = MIN(MAX_BRIGHTNESS_SETTING, MAX(0, level)); | ||
91 | |||
92 | if (level == 0) | ||
93 | { | ||
94 | /* Set pin low for a sufficient time, puts the device into low-power consumption state | ||
95 | * In other words backlight goes off | ||
96 | */ | ||
97 | imx233_pinctrl_set_gpio(3, 13, false); | ||
98 | udelay(TIME_OFF); | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | if (level > 3) { | ||
103 | /* This enables 16 levels of backlight */ | ||
104 | aat3151_write(MAX_CURRENT, MAX_CURRENT_15); | ||
105 | /* Set the value according Table 1 in datasheet | ||
106 | * For MAX_CURRENT_15, the scale is from 0 mA to 15 mA in 16 steps | ||
107 | */ | ||
108 | aat3151_write(D1_D3_CURRENT, 19 - level); | ||
109 | } | ||
110 | else { | ||
111 | /* This enables other 4 levels of backlight */ | ||
112 | aat3151_write(MAX_CURRENT, MAX_CURRENT_LOW_CURRENT); | ||
113 | /* Set the value according Table 1 in datasheet | ||
114 | * For LOW_CURRENT, there is no "real" scale. We have scattered values. | ||
115 | * We are interested in the last 3 -> 0.5 mA; 1 mA; 2 mA | ||
116 | */ | ||
117 | aat3151_write(LOW_CURRENT, 13 + level); | ||
118 | } | ||
119 | } | ||
120 | current_level = level; | ||
121 | } | ||
122 | |||
123 | bool backlight_hw_init(void) | ||
124 | { | ||
125 | imx233_pinctrl_acquire(3, 13, "backlight"); | ||
126 | imx233_pinctrl_set_function(3, 13, PINCTRL_FUNCTION_GPIO); | ||
127 | imx233_pinctrl_set_drive(3, 13, PINCTRL_DRIVE_4mA); | ||
128 | imx233_pinctrl_enable_gpio(3, 13, true); | ||
129 | imx233_pinctrl_set_gpio(3, 13, false); | ||
130 | return true; | ||
131 | } | ||
132 | |||
133 | void backlight_hw_on(void) | ||
134 | { | ||
135 | #ifdef HAVE_LCD_ENABLE | ||
136 | lcd_enable(true); /* power on lcd + visible display */ | ||
137 | #endif | ||
138 | /* restore the previous backlight level */ | ||
139 | backlight_hw_brightness(backlight_brightness); | ||
140 | } | ||
141 | |||
142 | void backlight_hw_off(void) | ||
143 | { | ||
144 | /* there is no real on/off but we can set to 0 brightness */ | ||
145 | backlight_hw_brightness(0); | ||
146 | #ifdef HAVE_LCD_ENABLE | ||
147 | lcd_enable(false); /* power off visible display */ | ||
148 | #endif | ||
149 | } | ||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Lorenzo Miori | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _BUTTON_TARGET_H_ | ||
22 | #define _BUTTON_TARGET_H_ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | |||
26 | #define HAS_BUTTON_HOLD | ||
27 | #define IMX233_BUTTON_LRADC_CHANNEL 0 | ||
28 | #define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO | ||
29 | #define BLH_GPIO_BANK 0 | ||
30 | #define BLH_GPIO_PIN 13 | ||
31 | |||
32 | #define IMX233_BUTTON_LRADC_CHANNEL 0 | ||
33 | |||
34 | /* Main unit's buttons */ | ||
35 | #define BUTTON_POWER 0x00000001 | ||
36 | #define BUTTON_VOL_UP 0x00000002 | ||
37 | #define BUTTON_VOL_DOWN 0x00000004 | ||
38 | /* Directional buttons by touchpad */ | ||
39 | #define BUTTON_LEFT 0x00000008 | ||
40 | #define BUTTON_UP 0x00000010 | ||
41 | #define BUTTON_RIGHT 0x00000020 | ||
42 | #define BUTTON_DOWN 0x00000040 | ||
43 | #define BUTTON_SELECT 0x00000080 | ||
44 | #define BUTTON_BACK 0x00000100 | ||
45 | #define BUTTON_REW 0x00000200 | ||
46 | #define BUTTON_FF 0x00000400 | ||
47 | |||
48 | |||
49 | #define BUTTON_MAIN (BUTTON_VOL_UP | BUTTON_VOL_DOWN | BUTTON_POWER | BUTTON_LEFT | \ | ||
50 | BUTTON_UP | BUTTON_RIGHT | BUTTON_DOWN | BUTTON_SELECT | \ | ||
51 | BUTTON_BACK | BUTTON_REW | BUTTON_FF) | ||
52 | |||
53 | /* Software power-off */ | ||
54 | #define POWEROFF_BUTTON BUTTON_POWER | ||
55 | #define POWEROFF_COUNT 10 | ||
56 | |||
57 | bool button_debug_screen(void); | ||
58 | |||
59 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 by Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "system.h" | ||
22 | #include "lcd.h" | ||
23 | #include "string.h" | ||
24 | #include "kernel.h" | ||
25 | #include "pinctrl-imx233.h" | ||
26 | #include "power-imx233.h" | ||
27 | #include "button-lradc-imx233.h" | ||
28 | #include "button-target.h" | ||
29 | #include "button-imx233.h" | ||
30 | |||
31 | #ifndef BOOTLOADER | ||
32 | #include "touchscreen.h" | ||
33 | #include "touchscreen-imx233.h" | ||
34 | #include "button.h" | ||
35 | #include "font.h" | ||
36 | #include "action.h" | ||
37 | #endif | ||
38 | |||
39 | #define CHAN 0 /* ADC channel for the buttons */ | ||
40 | #define I_VDDIO 0 /* Mock button to define the relative voltage to compute voltage from ADC steps */ | ||
41 | |||
42 | struct imx233_button_map_t imx233_button_map[] = | ||
43 | { | ||
44 | [I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3760), "vddio"), /* we need VDDIO for relative */ | ||
45 | IMX233_BUTTON_(HOLD, GPIO(0, 13), "hold"), | ||
46 | IMX233_BUTTON(POWER, PSWITCH(1), "power"), | ||
47 | IMX233_BUTTON(SELECT, PSWITCH(3), "select"), | ||
48 | IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 485, I_VDDIO), "vol up"), | ||
49 | IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 975, I_VDDIO), "vol down"), | ||
50 | IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1521, I_VDDIO), "back"), | ||
51 | IMX233_BUTTON(FF, LRADC_REL(CHAN, 2000, I_VDDIO), "ff"), | ||
52 | IMX233_BUTTON(REW, LRADC_REL(CHAN, 2480, I_VDDIO), "rew"), | ||
53 | IMX233_BUTTON_(END, END(), "") | ||
54 | }; | ||
55 | |||
56 | #ifndef BOOTLOADER | ||
57 | static int last_x = 0; | ||
58 | static int last_y = 0; | ||
59 | static bool touching = false; | ||
60 | #endif /* BOOTLOADER */ | ||
61 | |||
62 | #ifndef BOOTLOADER | ||
63 | |||
64 | /* Touchpad extra pin initialization | ||
65 | * Strange facts: | ||
66 | * 1. In the fully working sample I have, it seems that pins | ||
67 | * must be all set to low | ||
68 | * 2. In the other sample without LCD, it seems (by measurement) that | ||
69 | * not all the pins are set to low! Actually, I still need to see if | ||
70 | * touchpad works in this other sample. | ||
71 | */ | ||
72 | void touchpad_pin_setup(void) | ||
73 | { | ||
74 | /* TX+ */ | ||
75 | imx233_pinctrl_acquire(0, 25, "touchpad X+ power low"); | ||
76 | imx233_pinctrl_set_function(0, 25, PINCTRL_FUNCTION_GPIO); | ||
77 | imx233_pinctrl_set_drive(0, 25, PINCTRL_DRIVE_4mA); | ||
78 | imx233_pinctrl_enable_gpio(0, 25, true); | ||
79 | |||
80 | /* TY+ */ | ||
81 | imx233_pinctrl_acquire(0, 26, "touchpad Y+ power high"); | ||
82 | imx233_pinctrl_set_function(0, 26, PINCTRL_FUNCTION_GPIO); | ||
83 | imx233_pinctrl_set_drive(0, 26, PINCTRL_DRIVE_4mA); | ||
84 | imx233_pinctrl_enable_gpio(0, 26, true); | ||
85 | |||
86 | /* TY- */ | ||
87 | imx233_pinctrl_acquire(1, 21, "touchpad Y- power low"); | ||
88 | imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_GPIO); | ||
89 | imx233_pinctrl_set_drive(1, 21, PINCTRL_DRIVE_4mA); | ||
90 | imx233_pinctrl_enable_gpio(1, 21, true); | ||
91 | |||
92 | /* TX- */ | ||
93 | imx233_pinctrl_acquire(3, 15, "touchpad X- power high"); | ||
94 | imx233_pinctrl_set_function(3, 15, PINCTRL_FUNCTION_GPIO); | ||
95 | imx233_pinctrl_set_drive(3, 15, PINCTRL_DRIVE_4mA); | ||
96 | imx233_pinctrl_enable_gpio(3, 15, true); | ||
97 | |||
98 | } | ||
99 | #endif /* BOOTLOADER */ | ||
100 | |||
101 | void button_init_device(void) | ||
102 | { | ||
103 | /* init button subsystem */ | ||
104 | imx233_button_init(); | ||
105 | #ifndef BOOTLOADER | ||
106 | touchpad_pin_setup(); | ||
107 | /* Now that is powered up, proceed with touchpad initialization */ | ||
108 | imx233_touchscreen_init(); | ||
109 | imx233_touchscreen_enable(true); | ||
110 | #endif /* BOOTLOADER */ | ||
111 | } | ||
112 | |||
113 | /* X, Y, RadiusX, RadiusY */ | ||
114 | #define TOUCH_UP 2400, 1050, 650, 250 | ||
115 | #define TOUCH_DOWN 2057, 3320, 500, 350 | ||
116 | #define TOUCH_LEFT 3581, 2297, 300, 350 | ||
117 | #define TOUCH_RIGHT 1000, 2100, 400, 700 | ||
118 | #define TOUCH_CENTER 2682, 2167, 335, 276 | ||
119 | |||
120 | bool coord_in_radius(int x, int y, int cx, int cy, int rx, int ry) | ||
121 | { | ||
122 | return ((x >= cx - rx && x <= cx + rx) && (y >= cy - ry && y <= cy + ry)); | ||
123 | } | ||
124 | |||
125 | int button_read_device(void) | ||
126 | { | ||
127 | int res = 0; | ||
128 | |||
129 | #ifndef BOOTLOADER | ||
130 | /* handle the touchpad events */ | ||
131 | touching = imx233_touchscreen_get_touch(&last_x, &last_y); | ||
132 | if(touching) | ||
133 | { | ||
134 | if (coord_in_radius(last_x, last_y, TOUCH_LEFT)) | ||
135 | { | ||
136 | res |= BUTTON_LEFT; | ||
137 | } | ||
138 | else if (coord_in_radius(last_x, last_y, TOUCH_RIGHT)) | ||
139 | { | ||
140 | res |= BUTTON_RIGHT; | ||
141 | } | ||
142 | else if (coord_in_radius(last_x, last_y, TOUCH_DOWN)) | ||
143 | { | ||
144 | res |= BUTTON_DOWN; | ||
145 | } | ||
146 | else if (coord_in_radius(last_x, last_y, TOUCH_UP)) | ||
147 | { | ||
148 | res |= BUTTON_UP; | ||
149 | } | ||
150 | } | ||
151 | #endif /* BOOTLOADER */ | ||
152 | /* handle the generic events */ | ||
153 | return imx233_button_read(res); | ||
154 | } | ||
155 | |||
156 | #ifndef BOOTLOADER | ||
157 | |||
158 | #define MAX_ENTRIES 100 | ||
159 | #define VIEWPORT_HEIGHT 100 | ||
160 | #define VIEWPORT_WIDTH 100 | ||
161 | #define MAX_X 3700 | ||
162 | #define MAX_Y 3700 | ||
163 | #define ADAPT_TO_VIEWPORT(cx, cy, rx, ry) ((float)(cx) / MAX_X) * VIEWPORT_WIDTH, \ | ||
164 | ((float)(cy) / MAX_Y) * VIEWPORT_HEIGHT, \ | ||
165 | ((float)(rx) / MAX_X) * VIEWPORT_WIDTH, \ | ||
166 | ((float)(ry) / MAX_Y) * VIEWPORT_HEIGHT | ||
167 | static void draw_calibration_rect(int cx, int cy, int rx, int ry) | ||
168 | { | ||
169 | if (coord_in_radius(last_x, last_y, cx, cy, rx, ry)) | ||
170 | lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0xff, 0xff), LCD_BLACK); | ||
171 | else | ||
172 | lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0, 0), LCD_BLACK); | ||
173 | lcd_drawrect(ADAPT_TO_VIEWPORT(cx - rx, cy - ry, 2 * rx, 2 * ry)); | ||
174 | } | ||
175 | |||
176 | bool button_debug_screen(void) | ||
177 | { | ||
178 | int last = 0; | ||
179 | struct point_t | ||
180 | { | ||
181 | int x; | ||
182 | int y; | ||
183 | }; | ||
184 | struct point_t last_entries[MAX_ENTRIES]; | ||
185 | struct viewport report_vp; | ||
186 | |||
187 | memset(&report_vp, 0, sizeof(report_vp)); | ||
188 | report_vp.x = (LCD_WIDTH - VIEWPORT_WIDTH) / 2; | ||
189 | report_vp.y = (LCD_HEIGHT - VIEWPORT_HEIGHT) / 2; | ||
190 | report_vp.width = VIEWPORT_WIDTH; | ||
191 | report_vp.height = VIEWPORT_HEIGHT; | ||
192 | |||
193 | lcd_setfont(FONT_SYSFIXED); | ||
194 | lcd_clear_display(); | ||
195 | |||
196 | while(1) | ||
197 | { | ||
198 | int button = get_action(CONTEXT_STD, HZ / 10); | ||
199 | switch(button) | ||
200 | { | ||
201 | case ACTION_STD_OK: | ||
202 | case ACTION_STD_MENU: | ||
203 | lcd_set_viewport(NULL); | ||
204 | lcd_setfont(FONT_UI); | ||
205 | lcd_clear_display(); | ||
206 | return true; | ||
207 | case ACTION_STD_CANCEL: | ||
208 | lcd_set_viewport(NULL); | ||
209 | lcd_setfont(FONT_UI); | ||
210 | lcd_clear_display(); | ||
211 | return false; | ||
212 | } | ||
213 | |||
214 | lcd_set_viewport(NULL); | ||
215 | lcd_putsf(0, 1, "(%d,%d) %s", last_x, last_y, touching ? "touching!" : ""); | ||
216 | lcd_putsf(0, 0, "Type %s", imx233_pinctrl_get_gpio(0, 31) ? "CAP" : "REG"); | ||
217 | lcd_set_viewport(&report_vp); | ||
218 | lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0, 0, 0xff), LCD_BLACK); | ||
219 | lcd_drawrect(0, 0, 100, 100); | ||
220 | float percent_x = ((float)(last_x) / MAX_X); | ||
221 | float percent_y = ((float)(last_y) / MAX_Y); | ||
222 | if (touching) | ||
223 | { | ||
224 | lcd_set_viewport(NULL); | ||
225 | if (last < MAX_ENTRIES) | ||
226 | { | ||
227 | last_entries[last].x = last_x; | ||
228 | last_entries[last].y = last_y; | ||
229 | last++; | ||
230 | lcd_putsf(0, 17, "Recording: %d captures left", MAX_ENTRIES - last); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | int min_x = 9999; | ||
235 | int min_y = 9999; | ||
236 | int max_x = -1; | ||
237 | int max_y = -1; | ||
238 | int median_x = 0; | ||
239 | int median_y = 0; | ||
240 | for (int i = 0; i < MAX_ENTRIES; i++) | ||
241 | { | ||
242 | min_x = MIN(min_x, last_entries[i].x); | ||
243 | min_y = MIN(min_y, last_entries[i].y); | ||
244 | max_x = MAX(max_x, last_entries[i].x); | ||
245 | max_y = MAX(max_y, last_entries[i].y); | ||
246 | median_x += last_entries[i].x; | ||
247 | median_y += last_entries[i].y; | ||
248 | } | ||
249 | median_x /= MAX_ENTRIES; | ||
250 | median_y /= MAX_ENTRIES; | ||
251 | lcd_putsf(0, 17, "center(%d,%d)", median_x, median_y); | ||
252 | lcd_putsf(0, 18, "radius(%d,%d)", median_x / 2, median_y / 2); | ||
253 | } | ||
254 | lcd_set_viewport(&report_vp); | ||
255 | lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0x8c, 0), LCD_BLACK); | ||
256 | lcd_fillrect(VIEWPORT_WIDTH * percent_x, VIEWPORT_HEIGHT * percent_y, 2, 2); | ||
257 | } | ||
258 | |||
259 | /* Draw current calibration settings */ | ||
260 | lcd_set_viewport(&report_vp); | ||
261 | draw_calibration_rect(TOUCH_UP); | ||
262 | draw_calibration_rect(TOUCH_DOWN); | ||
263 | draw_calibration_rect(TOUCH_CENTER); | ||
264 | draw_calibration_rect(TOUCH_LEFT); | ||
265 | draw_calibration_rect(TOUCH_RIGHT); | ||
266 | |||
267 | lcd_update(); | ||
268 | yield(); | ||
269 | } | ||
270 | |||
271 | return true; | ||
272 | } | ||
273 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "system.h" | ||
23 | #include "button-target.h" | ||
24 | #include "lcd-target.h" | ||
25 | |||
26 | bool dbg_hw_target_info(void) | ||
27 | { | ||
28 | return button_debug_screen() && lcd_debug_screen(); | ||
29 | } | ||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _FMRADIO_TARGET_H_ | ||
22 | #define _FMRADIO_TARGET_H_ | ||
23 | |||
24 | #define IMX233_FMRADIO_I2C FMI_HW | ||
25 | |||
26 | #define IMX233_FMRADIO_POWER FMP_GPIO | ||
27 | #define FMP_GPIO_BANK 0 | ||
28 | #define FMP_GPIO_PIN 10 | ||
29 | #define FMP_GPIO_DELAY (HZ / 5) | ||
30 | |||
31 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Michael Sparmann | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef __FTL_TARGET_H__ | ||
23 | #define __FTL_TARGET_H__ | ||
24 | |||
25 | #include "config.h" | ||
26 | #include "inttypes.h" | ||
27 | |||
28 | #ifdef BOOTLOADER | ||
29 | /* Bootloaders don't need write access */ | ||
30 | #define FTL_READONLY | ||
31 | #endif | ||
32 | |||
33 | uint32_t ftl_init(void); | ||
34 | uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer); | ||
35 | uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer); | ||
36 | uint32_t ftl_sync(void); | ||
37 | |||
38 | |||
39 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (c) 2013 by Amaury Pouly | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #ifndef LCD_TARGET_H | ||
21 | #define LCD_TARGET_H | ||
22 | |||
23 | bool lcd_debug_screen(void); | ||
24 | |||
25 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (c) 2013 by Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #include <sys/types.h> /* off_t */ | ||
21 | #include <string.h> | ||
22 | #include "cpu.h" | ||
23 | #include "system.h" | ||
24 | #include "backlight-target.h" | ||
25 | #include "lcd.h" | ||
26 | #include "lcdif-imx233.h" | ||
27 | #include "clkctrl-imx233.h" | ||
28 | #include "pinctrl-imx233.h" | ||
29 | #include "dcp-imx233.h" | ||
30 | #include "logf.h" | ||
31 | #ifndef BOOTLOADER | ||
32 | #include "button.h" | ||
33 | #include "font.h" | ||
34 | #include "action.h" | ||
35 | #endif | ||
36 | #include "dma-imx233.h" | ||
37 | #include "kernel.h" | ||
38 | |||
39 | #include "regs/lcdif.h" | ||
40 | |||
41 | /** | ||
42 | * NOTE | ||
43 | * We don't know exact LCD models nor we have datasheets for them | ||
44 | * Register function are partly guessed from the values, others are guessed from other LCD | ||
45 | * drivers and others have been confirmed studying their values | ||
46 | */ | ||
47 | |||
48 | static enum lcd_type_t | ||
49 | { | ||
50 | LCD_TYPE_ZERO = 0, | ||
51 | LCD_TYPE_ONE = 1 | ||
52 | } lcd_type = LCD_TYPE_ZERO; | ||
53 | |||
54 | static void lcd_write_reg(uint16_t reg, uint16_t data) | ||
55 | { | ||
56 | imx233_lcdif_pio_send(false, 1, ®); | ||
57 | if(reg != 0x22) | ||
58 | imx233_lcdif_pio_send(true, 1, &data); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * The two LCD types require different initialization sequences | ||
63 | */ | ||
64 | void lcd_init_seq(void) | ||
65 | { | ||
66 | switch (lcd_type) | ||
67 | { | ||
68 | case LCD_TYPE_ZERO: | ||
69 | { | ||
70 | lcd_write_reg(0x11, 0x1f1e); | ||
71 | lcd_write_reg(0x38, 0xf0f); | ||
72 | lcd_write_reg(0x12, 0x1101); | ||
73 | lcd_write_reg(0x13, 0x808); | ||
74 | lcd_write_reg(0x14, 0x3119); | ||
75 | lcd_write_reg(0x10, 0x1a10); | ||
76 | udelay(0xc350); | ||
77 | lcd_write_reg(0x13, 0x83b); | ||
78 | udelay(0x30d40); | ||
79 | lcd_write_reg(1, 0x90c); /* Display mode */ | ||
80 | lcd_write_reg(2, 0x200); | ||
81 | lcd_write_reg(3, 0x1030); | ||
82 | lcd_write_reg(7, 5); | ||
83 | lcd_write_reg(8, 0x503); | ||
84 | lcd_write_reg(11, 0); | ||
85 | lcd_write_reg(12, 0); | ||
86 | /* Gamma control */ | ||
87 | lcd_write_reg(0x30, 0x606); | ||
88 | lcd_write_reg(0x31, 0x606); | ||
89 | lcd_write_reg(0x32, 0x305); | ||
90 | lcd_write_reg(0x33, 2); | ||
91 | lcd_write_reg(0x34, 0x503); | ||
92 | lcd_write_reg(0x35, 0x606); | ||
93 | lcd_write_reg(0x36, 0x606); | ||
94 | lcd_write_reg(0x37, 0x200); | ||
95 | |||
96 | lcd_write_reg(0x11, 0x1f1e); | ||
97 | lcd_write_reg(0x38, 0xf0f); | ||
98 | /* Set initial LCD limits and RAM settings */ | ||
99 | lcd_write_reg(0x40, 0); //BPP ? | ||
100 | lcd_write_reg(0x42, 0x9f00); | ||
101 | lcd_write_reg(0x43, 0); | ||
102 | lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */ | ||
103 | lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */ | ||
104 | |||
105 | lcd_write_reg(14, 0x13); | ||
106 | lcd_write_reg(0xa9, 0x14); | ||
107 | lcd_write_reg(0xa7, 0x30); | ||
108 | lcd_write_reg(0xa8, 0x124); | ||
109 | lcd_write_reg(0x6f, 0x1d00); | ||
110 | lcd_write_reg(0x70, 3); | ||
111 | lcd_write_reg(7, 1); | ||
112 | lcd_write_reg(0x10, 0x1a10); | ||
113 | udelay(0x9c40); | ||
114 | lcd_write_reg(7, 0x21); | ||
115 | lcd_write_reg(7, 0x23); | ||
116 | udelay(0x9c40); | ||
117 | lcd_write_reg(7, 0x37); /* Seems to be "power on" */ | ||
118 | break; | ||
119 | } | ||
120 | case LCD_TYPE_ONE: | ||
121 | { | ||
122 | lcd_write_reg(0, 1); | ||
123 | udelay(0x2710); | ||
124 | lcd_write_reg(0x11, 0x171b); | ||
125 | lcd_write_reg(0x12, 0); | ||
126 | lcd_write_reg(0x13, 0x80d); | ||
127 | lcd_write_reg(0x14, 0x18); | ||
128 | lcd_write_reg(0x10, 0x1a10); | ||
129 | udelay(0xc350); | ||
130 | lcd_write_reg(0x13, 0x81d); | ||
131 | udelay(0xc350); | ||
132 | lcd_write_reg(1, 0x90c); /* Display mode */ | ||
133 | lcd_write_reg(2, 0x200); | ||
134 | lcd_write_reg(3, 0x1030); | ||
135 | lcd_write_reg(7, 5); | ||
136 | lcd_write_reg(8, 0x30a); | ||
137 | lcd_write_reg(11, 4); | ||
138 | lcd_write_reg(12, 0); | ||
139 | /* Gamma control */ | ||
140 | lcd_write_reg(0x30, 0x300); | ||
141 | lcd_write_reg(0x31, 0); | ||
142 | lcd_write_reg(0x32, 0); | ||
143 | lcd_write_reg(0x33, 0x404); | ||
144 | lcd_write_reg(0x34, 0x707); | ||
145 | lcd_write_reg(0x35, 0x700); | ||
146 | lcd_write_reg(0x36, 0x703); | ||
147 | lcd_write_reg(0x37, 4); | ||
148 | |||
149 | lcd_write_reg(0x38, 0); | ||
150 | /* Set initial LCD limits and RAM settings */ | ||
151 | lcd_write_reg(0x40, 0); | ||
152 | lcd_write_reg(0x42, 0x9f00); /* LCD Display Start Address Register 0 */ | ||
153 | lcd_write_reg(0x43, 0); /* LCD Display Start Address Register 1 */ | ||
154 | lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */ | ||
155 | lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */ | ||
156 | |||
157 | lcd_write_reg(7, 1); | ||
158 | udelay(0x2710); | ||
159 | lcd_write_reg(7, 0x21); | ||
160 | lcd_write_reg(7, 0x23); | ||
161 | udelay(0x2710); | ||
162 | lcd_write_reg(7, 0x1037); | ||
163 | udelay(0x2710); | ||
164 | lcd_write_reg(7, 0x35); | ||
165 | lcd_write_reg(7, 0x36); | ||
166 | lcd_write_reg(7, 0x37); | ||
167 | udelay(10000); | ||
168 | break; | ||
169 | } | ||
170 | default: | ||
171 | break; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | static void send_update_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h) | ||
176 | { | ||
177 | /* Set horizontal refresh zone */ | ||
178 | lcd_write_reg(0x44, (x | (y + w - 1) << 0x8)); | ||
179 | /* Set vertical refresh zone */ | ||
180 | lcd_write_reg(0x45, (y | (y + h - 1) << 0x8)); | ||
181 | lcd_write_reg(0x21, x | y << 8); | ||
182 | /* Set register index to 0x22 to write screen data. 0 is mock value */ | ||
183 | lcd_write_reg(0x22, 0); | ||
184 | } | ||
185 | |||
186 | static void setup_lcd_pins(void) | ||
187 | { | ||
188 | imx233_lcdif_setup_system_pins(16); | ||
189 | /* lcd_rd */ | ||
190 | imx233_pinctrl_acquire(0, 9, "lcd rd"); | ||
191 | imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO); | ||
192 | imx233_pinctrl_set_gpio(0, 9, false); | ||
193 | /* | ||
194 | * This pin is important to know the LCD type | ||
195 | * There are two types that require two different initialization sequences | ||
196 | */ | ||
197 | /* lcd_tp */ | ||
198 | imx233_pinctrl_acquire(3, 12, "lcd type"); | ||
199 | imx233_pinctrl_set_function(3, 12, PINCTRL_FUNCTION_GPIO); | ||
200 | imx233_pinctrl_enable_gpio(3, 12, false); | ||
201 | /* Sense LCD Type */ | ||
202 | lcd_type = imx233_pinctrl_get_gpio(3, 12) ? LCD_TYPE_ONE : LCD_TYPE_ZERO; | ||
203 | } | ||
204 | |||
205 | static void setup_parameters(void) | ||
206 | { | ||
207 | imx233_lcdif_init(); | ||
208 | imx233_lcdif_enable(true); | ||
209 | imx233_lcdif_set_word_length(16); | ||
210 | imx233_lcdif_set_data_swizzle(false); | ||
211 | imx233_lcdif_set_timings(2, 1, 1, 1); | ||
212 | BF_WR(LCDIF_CTRL, MODE86_V(8080_MODE)); | ||
213 | |||
214 | imx233_lcdif_reset_lcd(true); | ||
215 | udelay(50); | ||
216 | imx233_lcdif_reset_lcd(false); | ||
217 | udelay(10); | ||
218 | imx233_lcdif_reset_lcd(true); | ||
219 | } | ||
220 | |||
221 | void lcd_init_device(void) | ||
222 | { | ||
223 | /* Setup interface pins */ | ||
224 | setup_lcd_pins(); | ||
225 | /* Set LCD parameters */ | ||
226 | setup_parameters(); | ||
227 | /* Send initialization sequence to LCD */ | ||
228 | lcd_init_seq(); | ||
229 | } | ||
230 | |||
231 | struct lcdif_cmd_t | ||
232 | { | ||
233 | struct apb_dma_command_t dma; | ||
234 | uint32_t ctrl0; | ||
235 | uint32_t pad[4]; | ||
236 | } __attribute__((packed)) CACHEALIGN_ATTR; | ||
237 | |||
238 | struct lcdif_cmd_t lcdif_dma; | ||
239 | void lcd_update(void) | ||
240 | { | ||
241 | unsigned size = LCD_WIDTH * LCD_HEIGHT * sizeof(fb_data); | ||
242 | |||
243 | send_update_rect(0,0,LCD_WIDTH,LCD_HEIGHT); | ||
244 | /* We can safely do the transfer in a single shot, since 160 * 128 * 2 < 65k, | ||
245 | * the maximum transfer size! | ||
246 | */ | ||
247 | lcdif_dma.dma.cmd |= BF_OR(APB_CHx_CMD, CMDWORDS(1), XFER_COUNT(size), COMMAND(2)); | ||
248 | lcdif_dma.ctrl0 = HW_LCDIF_CTRL & ~BM_LCDIF_CTRL_COUNT; | ||
249 | lcdif_dma.ctrl0 |= BF_OR(LCDIF_CTRL, COUNT(size/2), DATA_SELECT(1)); | ||
250 | lcdif_dma.dma.buffer = FBADDR(0,0); | ||
251 | lcdif_dma.dma.cmd |= BM_APB_CHx_CMD_SEMAPHORE; | ||
252 | |||
253 | imx233_dma_start_command(APB_LCDIF, &lcdif_dma.dma); | ||
254 | imx233_dma_wait_completion(APB_LCDIF, HZ); | ||
255 | } | ||
256 | |||
257 | void lcd_update_rect(int x, int y, int w, int h) | ||
258 | { | ||
259 | (void)x; | ||
260 | (void)y; | ||
261 | (void)w; | ||
262 | (void)h; | ||
263 | lcd_update(); | ||
264 | } | ||
265 | |||
266 | #ifndef BOOTLOADER | ||
267 | bool lcd_debug_screen(void) | ||
268 | { | ||
269 | lcd_setfont(FONT_SYSFIXED); | ||
270 | |||
271 | while(1) | ||
272 | { | ||
273 | int button = get_action(CONTEXT_STD, HZ / 10); | ||
274 | switch(button) | ||
275 | { | ||
276 | case ACTION_STD_NEXT: | ||
277 | case ACTION_STD_PREV: | ||
278 | case ACTION_STD_OK: | ||
279 | case ACTION_STD_MENU: | ||
280 | lcd_setfont(FONT_UI); | ||
281 | return true; | ||
282 | case ACTION_STD_CANCEL: | ||
283 | lcd_setfont(FONT_UI); | ||
284 | return false; | ||
285 | } | ||
286 | |||
287 | lcd_clear_display(); | ||
288 | lcd_putsf(0, 0, "LCD type: %d", lcd_type); | ||
289 | lcd_update(); | ||
290 | yield(); | ||
291 | } | ||
292 | |||
293 | return true; | ||
294 | } | ||
295 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef POWERMGMT_TARGET_H | ||
22 | #define POWERMGMT_TARGET_H | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "powermgmt-imx233.h" | ||
26 | |||
27 | #define IMX233_CHARGE_CURRENT 100 | ||
28 | #define IMX233_STOP_CURRENT 10 | ||
29 | #define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ) | ||
30 | #define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ) | ||
31 | #define IMX233_DIE_TEMP_HIGH 71 | ||
32 | #define IMX233_DIE_TEMP_LOW 56 | ||
33 | #define IMX233_BATT_TEMP_SENSOR 0 | ||
34 | #define IMX233_BATT_TEMP_HIGH 1100 | ||
35 | #define IMX233_BATT_TEMP_LOW 220 | ||
36 | |||
37 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "powermgmt-target.h" | ||
23 | #include "power-imx233.h" | ||
24 | |||
25 | |||
26 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
27 | { | ||
28 | 3400 | ||
29 | }; | ||
30 | |||
31 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
32 | { | ||
33 | 3300 | ||
34 | }; | ||
35 | |||
36 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
37 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
38 | { | ||
39 | /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */ | ||
40 | { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 }, | ||
41 | }; | ||
42 | |||
43 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
44 | const unsigned short percent_to_volt_charge[11] = | ||
45 | { | ||
46 | /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */ | ||
47 | 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335 | ||
48 | }; | ||