diff options
author | Lorenzo Miori <memoryS60@gmail.com> | 2013-12-28 19:00:57 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-05 21:57:31 +0100 |
commit | f005d841f292287326b8b9d1a74aac9bf3abbfc3 (patch) | |
tree | 4839b0a83e9af55a372610d65916aecbf06c563a | |
parent | e32ace831af98fd50bf0c08999802ce0f6a51bc8 (diff) | |
download | rockbox-f005d841f292287326b8b9d1a74aac9bf3abbfc3.tar.gz rockbox-f005d841f292287326b8b9d1a74aac9bf3abbfc3.zip |
Samsung YP-R0/YP-R1 refactoring
This patch includes some refactoring:
- renaming according to Rockbox guidelines
- GPIO code merging, still with target defines
- some simplification in firmware/SOURCES
Change-Id: I7fd95aece53f40efdf8caac22348376615795431
-rw-r--r-- | firmware/SOURCES | 35 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/gpio-ypr.c (renamed from firmware/target/hosted/samsungypr/gpio_ypr.c) | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/gpio-ypr.h | 201 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/button-ypr0.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/gpio-target.h | 7 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h | 185 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/system-ypr0.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/button-ypr1.c | 3 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/gpio-target.h | 9 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/ioctl-ypr1.h | 180 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/system-ypr1.c | 2 |
11 files changed, 223 insertions, 405 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index f062a015bd..38e4bef0bb 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -74,54 +74,47 @@ target/hosted/sdl/app/button-application.c | |||
74 | #endif | 74 | #endif |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) | ||
78 | target/hosted/kernel-unix.c | ||
79 | target/hosted/filesystem-unix.c | ||
80 | target/hosted/lc-unix.c | ||
81 | thread.c | ||
82 | drivers/lcd-memframe.c | ||
83 | target/hosted/samsungypr/lcd-ypr.c | ||
84 | target/hosted/samsungypr/gpio-ypr.c | ||
85 | #if CONFIG_TUNER | ||
86 | target/hosted/samsungypr/radio-ypr.c | ||
87 | #endif | ||
88 | #endif | ||
89 | |||
77 | #if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) | 90 | #if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) |
78 | drivers/adc-as3514.c | 91 | drivers/adc-as3514.c |
79 | drivers/lcd-memframe.c | ||
80 | #if (CONFIG_RTC == RTC_AS3514) | 92 | #if (CONFIG_RTC == RTC_AS3514) |
81 | drivers/rtc/rtc_as3514.c | 93 | drivers/rtc/rtc_as3514.c |
82 | #else | 94 | #else |
83 | target/hosted/rtc.c | 95 | target/hosted/rtc.c |
84 | #endif | 96 | #endif |
85 | target/hosted/kernel-unix.c | ||
86 | target/hosted/filesystem-unix.c | ||
87 | target/hosted/lc-unix.c | ||
88 | target/hosted/samsungypr/ypr0/button-ypr0.c | 97 | target/hosted/samsungypr/ypr0/button-ypr0.c |
89 | target/hosted/samsungypr/lcd-ypr.c | ||
90 | target/hosted/samsungypr/ypr0/system-ypr0.c | 98 | target/hosted/samsungypr/ypr0/system-ypr0.c |
91 | thread.c | ||
92 | #ifdef HAVE_BACKLIGHT | 99 | #ifdef HAVE_BACKLIGHT |
93 | target/hosted/samsungypr/ypr0/backlight-ypr0.c | 100 | target/hosted/samsungypr/ypr0/backlight-ypr0.c |
94 | #endif | 101 | #endif |
95 | target/hosted/samsungypr/ypr0/ascodec-ypr0.c | 102 | target/hosted/samsungypr/ypr0/ascodec-ypr0.c |
96 | target/hosted/samsungypr/ypr0/powermgmt-ypr0.c | 103 | target/hosted/samsungypr/ypr0/powermgmt-ypr0.c |
97 | target/hosted/samsungypr/gpio_ypr.c | ||
98 | target/hosted/samsungypr/ypr0/audio-ypr0.c | 104 | target/hosted/samsungypr/ypr0/audio-ypr0.c |
99 | #if CONFIG_TUNER | ||
100 | target/hosted/samsungypr/radio-ypr.c | ||
101 | #endif | ||
102 | #endif | 105 | #endif |
103 | 106 | ||
104 | #ifdef SAMSUNG_YPR1 | 107 | #if defined(SAMSUNG_YPR1) && !defined(SIMULATOR) |
105 | drivers/lcd-memframe.c | ||
106 | target/hosted/kernel-unix.c | ||
107 | target/hosted/filesystem-unix.c | ||
108 | target/hosted/lc-unix.c | ||
109 | target/hosted/samsungypr/ypr1/mcs5000-ypr1.c | 108 | target/hosted/samsungypr/ypr1/mcs5000-ypr1.c |
110 | target/hosted/samsungypr/ypr1/button-ypr1.c | 109 | target/hosted/samsungypr/ypr1/button-ypr1.c |
111 | target/hosted/samsungypr/lcd-ypr.c | ||
112 | target/hosted/samsungypr/ypr1/system-ypr1.c | 110 | target/hosted/samsungypr/ypr1/system-ypr1.c |
113 | thread.c | ||
114 | #ifdef HAVE_BACKLIGHT | 111 | #ifdef HAVE_BACKLIGHT |
115 | target/hosted/samsungypr/ypr1/backlight-ypr1.c | 112 | target/hosted/samsungypr/ypr1/backlight-ypr1.c |
116 | #endif | 113 | #endif |
117 | target/hosted/samsungypr/ypr1/powermgmt-ypr1.c | 114 | target/hosted/samsungypr/ypr1/powermgmt-ypr1.c |
118 | target/hosted/samsungypr/gpio_ypr.c | ||
119 | target/hosted/samsungypr/ypr1/audio-ypr1.c | 115 | target/hosted/samsungypr/ypr1/audio-ypr1.c |
120 | target/hosted/samsungypr/ypr1/pmu-ypr1.c | 116 | target/hosted/samsungypr/ypr1/pmu-ypr1.c |
121 | target/hosted/samsungypr/ypr1/wmcodec-ypr1.c | 117 | target/hosted/samsungypr/ypr1/wmcodec-ypr1.c |
122 | #if CONFIG_TUNER | ||
123 | target/hosted/samsungypr/radio-ypr.c | ||
124 | #endif | ||
125 | #endif | 118 | #endif |
126 | 119 | ||
127 | /* Maemo specific files */ | 120 | /* Maemo specific files */ |
diff --git a/firmware/target/hosted/samsungypr/gpio_ypr.c b/firmware/target/hosted/samsungypr/gpio-ypr.c index 1782d4cfe4..e5abc4cdc9 100644 --- a/firmware/target/hosted/samsungypr/gpio_ypr.c +++ b/firmware/target/hosted/samsungypr/gpio-ypr.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
26 | #include <gpio-target.h> /* includes common ioctl device definitions */ | 26 | #include <gpio-ypr.h> /* includes common ioctl device definitions */ |
27 | #include <sys/ioctl.h> | 27 | #include <sys/ioctl.h> |
28 | 28 | ||
29 | static int gpio_dev = 0; | 29 | static int gpio_dev = 0; |
diff --git a/firmware/target/hosted/samsungypr/gpio-ypr.h b/firmware/target/hosted/samsungypr/gpio-ypr.h new file mode 100644 index 0000000000..c10991e20c --- /dev/null +++ b/firmware/target/hosted/samsungypr/gpio-ypr.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 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 | #ifndef __DEV_GPIO_IOCTL_H__ | ||
22 | #define __DEV_GPIO_IOCTL_H__ | ||
23 | |||
24 | /* Specifies device name and ioctl magic */ | ||
25 | #include "gpio-target.h" | ||
26 | #include "sys/ioctl.h" | ||
27 | |||
28 | struct gpio_info { | ||
29 | int num; | ||
30 | int mode; | ||
31 | int val; | ||
32 | } __attribute__((packed)); | ||
33 | |||
34 | #define E_IOCTL_GPIO_SET_MUX 0 | ||
35 | #define E_IOCTL_GPIO_UNSET_MUX 1 | ||
36 | #define E_IOCTL_GPIO_SET_TYPE 2 | ||
37 | #define E_IOCTL_GPIO_SET_OUTPUT 3 | ||
38 | #define E_IOCTL_GPIO_SET_INPUT 4 | ||
39 | #define E_IOCTL_GPIO_SET_HIGH 5 | ||
40 | #define E_IOCTL_GPIO_SET_LOW 6 | ||
41 | #define E_IOCTL_GPIO_GET_VAL 7 | ||
42 | #define E_IOCTL_GPIO_IS_HIGH 8 | ||
43 | #define E_IOCTL_GPIO_MAX_NR 9 | ||
44 | |||
45 | #define DEV_CTRL_GPIO_SET_MUX _IOW(GPIO_IOCTL_MAGIC, 0, struct gpio_info) | ||
46 | #define DEV_CTRL_GPIO_UNSET_MUX _IOW(GPIO_IOCTL_MAGIC, 1, struct gpio_info) | ||
47 | #define DEV_CTRL_GPIO_SET_TYPE _IOW(GPIO_IOCTL_MAGIC, 2, struct gpio_info) | ||
48 | #define DEV_CTRL_GPIO_SET_OUTPUT _IOW(GPIO_IOCTL_MAGIC, 3, struct gpio_info) | ||
49 | #define DEV_CTRL_GPIO_SET_INPUT _IOW(GPIO_IOCTL_MAGIC, 4, struct gpio_info) | ||
50 | #define DEV_CTRL_GPIO_SET_HIGH _IOW(GPIO_IOCTL_MAGIC, 5, struct gpio_info) | ||
51 | #define DEV_CTRL_GPIO_SET_LOW _IOW(GPIO_IOCTL_MAGIC, 6, struct gpio_info) | ||
52 | #define DEV_CTRL_GPIO_GET_VAL _IOW(GPIO_IOCTL_MAGIC, 7, struct gpio_info) | ||
53 | #define DEV_CTRL_GPIO_IS_HIGH _IOW(GPIO_IOCTL_MAGIC, 8, struct gpio_info) | ||
54 | |||
55 | enum | ||
56 | { | ||
57 | GPIO1_0 = 0, /* GPIO group 1 start */ | ||
58 | GPIO1_1, | ||
59 | GPIO1_2, | ||
60 | GPIO1_3, | ||
61 | GPIO1_4, | ||
62 | GPIO1_5, | ||
63 | GPIO1_6, | ||
64 | GPIO1_7, | ||
65 | GPIO1_8, | ||
66 | GPIO1_9, | ||
67 | GPIO1_10, | ||
68 | GPIO1_11, | ||
69 | GPIO1_12, | ||
70 | GPIO1_13, | ||
71 | GPIO1_14, | ||
72 | GPIO1_15, | ||
73 | GPIO1_16, | ||
74 | GPIO1_17, | ||
75 | GPIO1_18, | ||
76 | GPIO1_19, | ||
77 | GPIO1_20, | ||
78 | GPIO1_21, | ||
79 | GPIO1_22, | ||
80 | GPIO1_23, | ||
81 | GPIO1_24, | ||
82 | GPIO1_25, | ||
83 | GPIO1_26, | ||
84 | GPIO1_27, | ||
85 | GPIO1_28, | ||
86 | GPIO1_29, | ||
87 | GPIO1_30, | ||
88 | GPIO1_31, | ||
89 | GPIO2_0, /* GPIO group 2 start */ | ||
90 | GPIO2_1, | ||
91 | GPIO2_2, | ||
92 | GPIO2_3, | ||
93 | GPIO2_4, | ||
94 | GPIO2_5, | ||
95 | GPIO2_6, | ||
96 | GPIO2_7, | ||
97 | GPIO2_8, | ||
98 | GPIO2_9, | ||
99 | GPIO2_10, | ||
100 | GPIO2_11, | ||
101 | GPIO2_12, | ||
102 | GPIO2_13, | ||
103 | GPIO2_14, | ||
104 | GPIO2_15, | ||
105 | GPIO2_16, | ||
106 | GPIO2_17, | ||
107 | GPIO2_18, | ||
108 | GPIO2_19, | ||
109 | GPIO2_20, | ||
110 | GPIO2_21, | ||
111 | GPIO2_22, | ||
112 | GPIO2_23, | ||
113 | GPIO2_24, | ||
114 | GPIO2_25, | ||
115 | GPIO2_26, | ||
116 | GPIO2_27, | ||
117 | GPIO2_28, | ||
118 | GPIO2_29, | ||
119 | GPIO2_30, | ||
120 | GPIO2_31, | ||
121 | GPIO3_0, /* GPIO group 3 start */ | ||
122 | GPIO3_1, | ||
123 | GPIO3_2, | ||
124 | GPIO3_3, | ||
125 | GPIO3_4, | ||
126 | GPIO3_5, | ||
127 | GPIO3_6, | ||
128 | GPIO3_7, | ||
129 | GPIO3_8, | ||
130 | GPIO3_9, | ||
131 | GPIO3_10, | ||
132 | GPIO3_11, | ||
133 | GPIO3_12, | ||
134 | GPIO3_13, | ||
135 | GPIO3_14, | ||
136 | GPIO3_15, | ||
137 | GPIO3_16, | ||
138 | GPIO3_17, | ||
139 | GPIO3_18, | ||
140 | GPIO3_19, | ||
141 | GPIO3_20, | ||
142 | GPIO3_21, | ||
143 | GPIO3_22, | ||
144 | GPIO3_23, | ||
145 | GPIO3_24, | ||
146 | GPIO3_25, | ||
147 | GPIO3_26, | ||
148 | GPIO3_27, | ||
149 | GPIO3_28, | ||
150 | GPIO3_29, | ||
151 | GPIO3_30, | ||
152 | GPIO3_31, | ||
153 | }; | ||
154 | |||
155 | enum | ||
156 | { | ||
157 | CONFIG_ALT0, | ||
158 | CONFIG_ALT1, | ||
159 | CONFIG_ALT2, | ||
160 | CONFIG_ALT3, | ||
161 | CONFIG_ALT4, | ||
162 | CONFIG_ALT5, | ||
163 | CONFIG_ALT6, | ||
164 | CONFIG_ALT7, | ||
165 | CONFIG_GPIO, | ||
166 | CONFIG_SION = 0x01 << 4, | ||
167 | CONFIG_DEFAULT | ||
168 | }; | ||
169 | |||
170 | enum | ||
171 | { | ||
172 | PAD_CTL_SRE_SLOW = 0x0 << 0, | ||
173 | PAD_CTL_SRE_FAST = 0x1 << 0, | ||
174 | PAD_CTL_DRV_LOW = 0x0 << 1, | ||
175 | PAD_CTL_DRV_MEDIUM = 0x1 << 1, | ||
176 | PAD_CTL_DRV_HIGH = 0x2 << 1, | ||
177 | PAD_CTL_DRV_MAX = 0x3 << 1, | ||
178 | PAD_CTL_ODE_OPENDRAIN_NONE = 0x0 << 3, | ||
179 | PAD_CTL_ODE_OPENDRAIN_ENABLE = 0x1 << 3, | ||
180 | PAD_CTL_100K_PD = 0x0 << 4, | ||
181 | PAD_CTL_47K_PU = 0x1 << 4, | ||
182 | PAD_CTL_100K_PU = 0x2 << 4, | ||
183 | PAD_CTL_22K_PU = 0x3 << 4, | ||
184 | PAD_CTL_PUE_KEEPER = 0x0 << 6, | ||
185 | PAD_CTL_PUE_PULL = 0x1 << 6, | ||
186 | PAD_CTL_PKE_NONE = 0x0 << 7, | ||
187 | PAD_CTL_PKE_ENABLE = 0x1 << 7, | ||
188 | PAD_CTL_HYS_NONE = 0x0 << 8, | ||
189 | PAD_CTL_HYS_ENABLE = 0x1 << 8, | ||
190 | PAD_CTL_DDR_INPUT_CMOS = 0x0 << 9, | ||
191 | PAD_CTL_DDR_INPUT_DDR = 0x1 << 9, | ||
192 | PAD_CTL_DRV_VOT_LOW = 0x0 << 13, | ||
193 | PAD_CTL_DRV_VOT_HIGH = 0x1 << 13, | ||
194 | }; | ||
195 | |||
196 | void gpio_init(void); | ||
197 | void gpio_close(void); | ||
198 | int gpio_control_struct(int request, struct gpio_info pin); | ||
199 | int gpio_control(int request, int num, int mode, int val); | ||
200 | |||
201 | #endif | ||
diff --git a/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c index e3ad309187..08aacd18c6 100644 --- a/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "button-target.h" | 26 | #include "button-target.h" |
27 | #include <gpio-target.h> /* For headphones sense and buttons */ | 27 | #include "gpio-ypr.h" /* For headphones sense and buttons */ |
28 | 28 | ||
29 | int button_read_device(void) | 29 | int button_read_device(void) |
30 | { | 30 | { |
diff --git a/firmware/target/hosted/samsungypr/ypr0/gpio-target.h b/firmware/target/hosted/samsungypr/ypr0/gpio-target.h index f27b176195..a840975b39 100644 --- a/firmware/target/hosted/samsungypr/ypr0/gpio-target.h +++ b/firmware/target/hosted/samsungypr/ypr0/gpio-target.h | |||
@@ -23,8 +23,6 @@ | |||
23 | #ifndef GPIO_YPR0_H | 23 | #ifndef GPIO_YPR0_H |
24 | #define GPIO_YPR0_H | 24 | #define GPIO_YPR0_H |
25 | 25 | ||
26 | #include "r0GPIOIoctl.h" | ||
27 | |||
28 | /* Some meaningful pins used in the R0 */ | 26 | /* Some meaningful pins used in the R0 */ |
29 | 27 | ||
30 | #define GPIO_HEADPHONE_SENSE GPIO1_5 | 28 | #define GPIO_HEADPHONE_SENSE GPIO1_5 |
@@ -54,9 +52,6 @@ | |||
54 | #define GPIO_RIGHT_KEY GPIO3_7 | 52 | #define GPIO_RIGHT_KEY GPIO3_7 |
55 | 53 | ||
56 | #define GPIO_DEVICE "/dev/r0GPIO" | 54 | #define GPIO_DEVICE "/dev/r0GPIO" |
57 | 55 | #define GPIO_IOCTL_MAGIC 'G' | |
58 | void gpio_init(void); | ||
59 | void gpio_close(void); | ||
60 | int gpio_control(int request, int num, int mode, int val); | ||
61 | 56 | ||
62 | #endif | 57 | #endif |
diff --git a/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h b/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h deleted file mode 100644 index 7e116eeeee..0000000000 --- a/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | /* This file originates from the linux kernel provided in Samsung's YP-R0 Open | ||
2 | * Source package (second release, which includes some driver modules sources). | ||
3 | */ | ||
4 | |||
5 | #ifndef __IOCTL_GPIO_H__ | ||
6 | #define __IOCTL_GPIO_H__ | ||
7 | |||
8 | #include <sys/ioctl.h> | ||
9 | //#include "iomux.h" | ||
10 | |||
11 | struct gpio_info { | ||
12 | int num; | ||
13 | int mode; | ||
14 | int val; | ||
15 | } __attribute__((packed)); | ||
16 | |||
17 | |||
18 | #define IOCTL_GPIO_MAGIC 'G' | ||
19 | |||
20 | #define E_IOCTL_GPIO_SET_MUX 0 | ||
21 | #define E_IOCTL_GPIO_UNSET_MUX 1 | ||
22 | #define E_IOCTL_GPIO_SET_TYPE 2 | ||
23 | #define E_IOCTL_GPIO_SET_OUTPUT 3 | ||
24 | #define E_IOCTL_GPIO_SET_INPUT 4 | ||
25 | #define E_IOCTL_GPIO_SET_HIGH 5 | ||
26 | #define E_IOCTL_GPIO_SET_LOW 6 | ||
27 | #define E_IOCTL_GPIO_GET_VAL 7 | ||
28 | #define E_IOCTL_GPIO_IS_HIGH 8 | ||
29 | #define E_IOCTL_GPIO_MAX_NR 9 | ||
30 | |||
31 | #define DEV_CTRL_GPIO_SET_MUX _IOW(IOCTL_GPIO_MAGIC, 0, struct gpio_info) | ||
32 | #define DEV_CTRL_GPIO_UNSET_MUX _IOW(IOCTL_GPIO_MAGIC, 1, struct gpio_info) | ||
33 | #define DEV_CTRL_GPIO_SET_TYPE _IOW(IOCTL_GPIO_MAGIC, 2, struct gpio_info) | ||
34 | #define DEV_CTRL_GPIO_SET_OUTPUT _IOW(IOCTL_GPIO_MAGIC, 3, struct gpio_info) | ||
35 | #define DEV_CTRL_GPIO_SET_INPUT _IOW(IOCTL_GPIO_MAGIC, 4, struct gpio_info) | ||
36 | #define DEV_CTRL_GPIO_SET_HIGH _IOW(IOCTL_GPIO_MAGIC, 5, struct gpio_info) | ||
37 | #define DEV_CTRL_GPIO_SET_LOW _IOW(IOCTL_GPIO_MAGIC, 6, struct gpio_info) | ||
38 | #define DEV_CTRL_GPIO_GET_VAL _IOW(IOCTL_GPIO_MAGIC, 7, struct gpio_info) | ||
39 | #define DEV_CTRL_GPIO_IS_HIGH _IOW(IOCTL_GPIO_MAGIC, 8, struct gpio_info) | ||
40 | |||
41 | |||
42 | typedef enum | ||
43 | { | ||
44 | GPIO1_0 = 0, /* GPIO group 1 start */ | ||
45 | GPIO1_1, | ||
46 | GPIO1_2, | ||
47 | GPIO1_3, | ||
48 | GPIO1_4, | ||
49 | GPIO1_5, | ||
50 | GPIO1_6, | ||
51 | GPIO1_7, | ||
52 | GPIO1_8, | ||
53 | GPIO1_9, | ||
54 | GPIO1_10, | ||
55 | GPIO1_11, | ||
56 | GPIO1_12, | ||
57 | GPIO1_13, | ||
58 | GPIO1_14, | ||
59 | GPIO1_15, | ||
60 | GPIO1_16, | ||
61 | GPIO1_17, | ||
62 | GPIO1_18, | ||
63 | GPIO1_19, | ||
64 | GPIO1_20, | ||
65 | GPIO1_21, | ||
66 | GPIO1_22, | ||
67 | GPIO1_23, | ||
68 | GPIO1_24, | ||
69 | GPIO1_25, | ||
70 | GPIO1_26, | ||
71 | GPIO1_27, | ||
72 | GPIO1_28, | ||
73 | GPIO1_29, | ||
74 | GPIO1_30, | ||
75 | GPIO1_31, | ||
76 | GPIO2_0, /* GPIO group 2 start */ | ||
77 | GPIO2_1, | ||
78 | GPIO2_2, | ||
79 | GPIO2_3, | ||
80 | GPIO2_4, | ||
81 | GPIO2_5, | ||
82 | GPIO2_6, | ||
83 | GPIO2_7, | ||
84 | GPIO2_8, | ||
85 | GPIO2_9, | ||
86 | GPIO2_10, | ||
87 | GPIO2_11, | ||
88 | GPIO2_12, | ||
89 | GPIO2_13, | ||
90 | GPIO2_14, | ||
91 | GPIO2_15, | ||
92 | GPIO2_16, | ||
93 | GPIO2_17, | ||
94 | GPIO2_18, | ||
95 | GPIO2_19, | ||
96 | GPIO2_20, | ||
97 | GPIO2_21, | ||
98 | GPIO2_22, | ||
99 | GPIO2_23, | ||
100 | GPIO2_24, | ||
101 | GPIO2_25, | ||
102 | GPIO2_26, | ||
103 | GPIO2_27, | ||
104 | GPIO2_28, | ||
105 | GPIO2_29, | ||
106 | GPIO2_30, | ||
107 | GPIO2_31, | ||
108 | GPIO3_0, /* GPIO group 3 start */ | ||
109 | GPIO3_1, | ||
110 | GPIO3_2, | ||
111 | GPIO3_3, | ||
112 | GPIO3_4, | ||
113 | GPIO3_5, | ||
114 | GPIO3_6, | ||
115 | GPIO3_7, | ||
116 | GPIO3_8, | ||
117 | GPIO3_9, | ||
118 | GPIO3_10, | ||
119 | GPIO3_11, | ||
120 | GPIO3_12, | ||
121 | GPIO3_13, | ||
122 | GPIO3_14, | ||
123 | GPIO3_15, | ||
124 | GPIO3_16, | ||
125 | GPIO3_17, | ||
126 | GPIO3_18, | ||
127 | GPIO3_19, | ||
128 | GPIO3_20, | ||
129 | GPIO3_21, | ||
130 | GPIO3_22, | ||
131 | GPIO3_23, | ||
132 | GPIO3_24, | ||
133 | GPIO3_25, | ||
134 | GPIO3_26, | ||
135 | GPIO3_27, | ||
136 | GPIO3_28, | ||
137 | GPIO3_29, | ||
138 | GPIO3_30, | ||
139 | GPIO3_31, | ||
140 | }R0_MX37_GPIO; | ||
141 | |||
142 | typedef enum | ||
143 | { | ||
144 | CONFIG_ALT0, | ||
145 | CONFIG_ALT1, | ||
146 | CONFIG_ALT2, | ||
147 | CONFIG_ALT3, | ||
148 | CONFIG_ALT4, | ||
149 | CONFIG_ALT5, | ||
150 | CONFIG_ALT6, | ||
151 | CONFIG_ALT7, | ||
152 | CONFIG_GPIO, | ||
153 | CONFIG_SION = 0x01 << 4, | ||
154 | CONFIG_DEFAULT | ||
155 | } R0_MX37_PIN_CONFIG; | ||
156 | |||
157 | #ifndef __MACH_MX37_IOMUX_H__ | ||
158 | typedef enum | ||
159 | { | ||
160 | PAD_CTL_SRE_SLOW = 0x0 << 0, | ||
161 | PAD_CTL_SRE_FAST = 0x1 << 0, | ||
162 | PAD_CTL_DRV_LOW = 0x0 << 1, | ||
163 | PAD_CTL_DRV_MEDIUM = 0x1 << 1, | ||
164 | PAD_CTL_DRV_HIGH = 0x2 << 1, | ||
165 | PAD_CTL_DRV_MAX = 0x3 << 1, | ||
166 | PAD_CTL_ODE_OPENDRAIN_NONE = 0x0 << 3, | ||
167 | PAD_CTL_ODE_OPENDRAIN_ENABLE = 0x1 << 3, | ||
168 | PAD_CTL_100K_PD = 0x0 << 4, | ||
169 | PAD_CTL_47K_PU = 0x1 << 4, | ||
170 | PAD_CTL_100K_PU = 0x2 << 4, | ||
171 | PAD_CTL_22K_PU = 0x3 << 4, | ||
172 | PAD_CTL_PUE_KEEPER = 0x0 << 6, | ||
173 | PAD_CTL_PUE_PULL = 0x1 << 6, | ||
174 | PAD_CTL_PKE_NONE = 0x0 << 7, | ||
175 | PAD_CTL_PKE_ENABLE = 0x1 << 7, | ||
176 | PAD_CTL_HYS_NONE = 0x0 << 8, | ||
177 | PAD_CTL_HYS_ENABLE = 0x1 << 8, | ||
178 | PAD_CTL_DDR_INPUT_CMOS = 0x0 << 9, | ||
179 | PAD_CTL_DDR_INPUT_DDR = 0x1 << 9, | ||
180 | PAD_CTL_DRV_VOT_LOW = 0x0 << 13, | ||
181 | PAD_CTL_DRV_VOT_HIGH = 0x1 << 13, | ||
182 | } R0_MX37_PAD_CONFIG; | ||
183 | #endif | ||
184 | |||
185 | #endif /* __IOCTL_GPIO__H__ */ | ||
diff --git a/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c index 7ee2697a24..f8fc9c7a86 100644 --- a/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include "ascodec.h" | 32 | #include "ascodec.h" |
33 | #include "gpio-target.h" | 33 | #include "gpio-ypr.h" |
34 | 34 | ||
35 | void power_off(void) | 35 | void power_off(void) |
36 | { | 36 | { |
diff --git a/firmware/target/hosted/samsungypr/ypr1/button-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/button-ypr1.c index 09891cfaf6..d12b8486b6 100644 --- a/firmware/target/hosted/samsungypr/ypr1/button-ypr1.c +++ b/firmware/target/hosted/samsungypr/ypr1/button-ypr1.c | |||
@@ -25,9 +25,8 @@ | |||
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "button-target.h" | 26 | #include "button-target.h" |
27 | 27 | ||
28 | #include <gpio-target.h> /* For headphones sense and buttons */ | 28 | #include "gpio-ypr.h" /* For headphones sense and buttons */ |
29 | #include "mcs5000.h" /* Touchscreen controller */ | 29 | #include "mcs5000.h" /* Touchscreen controller */ |
30 | #include "ioctl-ypr1.h" | ||
31 | 30 | ||
32 | enum { | 31 | enum { |
33 | STATE_UNKNOWN, | 32 | STATE_UNKNOWN, |
diff --git a/firmware/target/hosted/samsungypr/ypr1/gpio-target.h b/firmware/target/hosted/samsungypr/ypr1/gpio-target.h index f439e786de..706f8dd249 100644 --- a/firmware/target/hosted/samsungypr/ypr1/gpio-target.h +++ b/firmware/target/hosted/samsungypr/ypr1/gpio-target.h | |||
@@ -23,8 +23,6 @@ | |||
23 | #ifndef GPIO_TARGET_H | 23 | #ifndef GPIO_TARGET_H |
24 | #define GPIO_TARGET_H | 24 | #define GPIO_TARGET_H |
25 | 25 | ||
26 | #include "ioctl-ypr1.h" | ||
27 | |||
28 | /* Some meaningful pins used in the YP-R1 */ | 26 | /* Some meaningful pins used in the YP-R1 */ |
29 | 27 | ||
30 | #define GPIO_HEADPHONE_SENSE GPIO1_31 | 28 | #define GPIO_HEADPHONE_SENSE GPIO1_31 |
@@ -58,10 +56,7 @@ | |||
58 | #define GPIO_POWER_KEY GPIO2_16 | 56 | #define GPIO_POWER_KEY GPIO2_16 |
59 | 57 | ||
60 | #define GPIO_DEVICE "/dev/r1Gpio" | 58 | #define GPIO_DEVICE "/dev/r1Gpio" |
61 | 59 | /* Strangely for whatever reason magic differs from R0 (A vs. G) */ | |
62 | void gpio_init(void); | 60 | #define GPIO_IOCTL_MAGIC 'A' |
63 | void gpio_close(void); | ||
64 | int gpio_control_struct(int request, struct gpio_info pin); | ||
65 | int gpio_control(int request, int num, int mode, int val); | ||
66 | 61 | ||
67 | #endif /* GPIO_TARGET_H */ | 62 | #endif /* GPIO_TARGET_H */ |
diff --git a/firmware/target/hosted/samsungypr/ypr1/ioctl-ypr1.h b/firmware/target/hosted/samsungypr/ypr1/ioctl-ypr1.h index 4ac7a1c4b5..95b882f0d1 100644 --- a/firmware/target/hosted/samsungypr/ypr1/ioctl-ypr1.h +++ b/firmware/target/hosted/samsungypr/ypr1/ioctl-ypr1.h | |||
@@ -47,184 +47,4 @@ void max17040_init(void); | |||
47 | void max17040_close(void); | 47 | void max17040_close(void); |
48 | int max17040_ioctl(int request, int *data); | 48 | int max17040_ioctl(int request, int *data); |
49 | 49 | ||
50 | /** | ||
51 | * This is the wrapper to r1Gpio.ko module with the possible | ||
52 | * ioctl calls | ||
53 | * TODO move this into a more generic file for ypr platform | ||
54 | */ | ||
55 | |||
56 | struct gpio_info { | ||
57 | int num; | ||
58 | int mode; | ||
59 | int val; | ||
60 | } __attribute__((packed)); | ||
61 | |||
62 | /* Strangely for whatever reason magic differs from R0 (A vs. G) */ | ||
63 | #define IOCTL_GPIO_MAGIC 'A' | ||
64 | |||
65 | #define E_IOCTL_GPIO_SET_MUX 0 | ||
66 | #define E_IOCTL_GPIO_UNSET_MUX 1 | ||
67 | #define E_IOCTL_GPIO_SET_TYPE 2 | ||
68 | #define E_IOCTL_GPIO_SET_OUTPUT 3 | ||
69 | #define E_IOCTL_GPIO_SET_INPUT 4 | ||
70 | #define E_IOCTL_GPIO_SET_HIGH 5 | ||
71 | #define E_IOCTL_GPIO_SET_LOW 6 | ||
72 | #define E_IOCTL_GPIO_GET_VAL 7 | ||
73 | #define E_IOCTL_GPIO_IS_HIGH 8 | ||
74 | #define E_IOCTL_GPIO_MAX_NR 9 | ||
75 | |||
76 | #define DEV_CTRL_GPIO_SET_MUX _IOW(IOCTL_GPIO_MAGIC, 0, struct gpio_info) | ||
77 | #define DEV_CTRL_GPIO_UNSET_MUX _IOW(IOCTL_GPIO_MAGIC, 1, struct gpio_info) | ||
78 | #define DEV_CTRL_GPIO_SET_TYPE _IOW(IOCTL_GPIO_MAGIC, 2, struct gpio_info) | ||
79 | #define DEV_CTRL_GPIO_SET_OUTPUT _IOW(IOCTL_GPIO_MAGIC, 3, struct gpio_info) | ||
80 | #define DEV_CTRL_GPIO_SET_INPUT _IOW(IOCTL_GPIO_MAGIC, 4, struct gpio_info) | ||
81 | #define DEV_CTRL_GPIO_SET_HIGH _IOW(IOCTL_GPIO_MAGIC, 5, struct gpio_info) | ||
82 | #define DEV_CTRL_GPIO_SET_LOW _IOW(IOCTL_GPIO_MAGIC, 6, struct gpio_info) | ||
83 | #define DEV_CTRL_GPIO_GET_VAL _IOW(IOCTL_GPIO_MAGIC, 7, struct gpio_info) | ||
84 | #define DEV_CTRL_GPIO_IS_HIGH _IOW(IOCTL_GPIO_MAGIC, 8, struct gpio_info) | ||
85 | |||
86 | |||
87 | typedef enum | ||
88 | { | ||
89 | GPIO1_0 = 0, /* GPIO group 1 start */ | ||
90 | GPIO1_1, | ||
91 | GPIO1_2, | ||
92 | GPIO1_3, | ||
93 | GPIO1_4, | ||
94 | GPIO1_5, | ||
95 | GPIO1_6, | ||
96 | GPIO1_7, | ||
97 | GPIO1_8, | ||
98 | GPIO1_9, | ||
99 | GPIO1_10, | ||
100 | GPIO1_11, | ||
101 | GPIO1_12, | ||
102 | GPIO1_13, | ||
103 | GPIO1_14, | ||
104 | GPIO1_15, | ||
105 | GPIO1_16, | ||
106 | GPIO1_17, | ||
107 | GPIO1_18, | ||
108 | GPIO1_19, | ||
109 | GPIO1_20, | ||
110 | GPIO1_21, | ||
111 | GPIO1_22, | ||
112 | GPIO1_23, | ||
113 | GPIO1_24, | ||
114 | GPIO1_25, | ||
115 | GPIO1_26, | ||
116 | GPIO1_27, | ||
117 | GPIO1_28, | ||
118 | GPIO1_29, | ||
119 | GPIO1_30, | ||
120 | GPIO1_31, | ||
121 | GPIO2_0, /* GPIO group 2 start */ | ||
122 | GPIO2_1, | ||
123 | GPIO2_2, | ||
124 | GPIO2_3, | ||
125 | GPIO2_4, | ||
126 | GPIO2_5, | ||
127 | GPIO2_6, | ||
128 | GPIO2_7, | ||
129 | GPIO2_8, | ||
130 | GPIO2_9, | ||
131 | GPIO2_10, | ||
132 | GPIO2_11, | ||
133 | GPIO2_12, | ||
134 | GPIO2_13, | ||
135 | GPIO2_14, | ||
136 | GPIO2_15, | ||
137 | GPIO2_16, | ||
138 | GPIO2_17, | ||
139 | GPIO2_18, | ||
140 | GPIO2_19, | ||
141 | GPIO2_20, | ||
142 | GPIO2_21, | ||
143 | GPIO2_22, | ||
144 | GPIO2_23, | ||
145 | GPIO2_24, | ||
146 | GPIO2_25, | ||
147 | GPIO2_26, | ||
148 | GPIO2_27, | ||
149 | GPIO2_28, | ||
150 | GPIO2_29, | ||
151 | GPIO2_30, | ||
152 | GPIO2_31, | ||
153 | GPIO3_0, /* GPIO group 3 start */ | ||
154 | GPIO3_1, | ||
155 | GPIO3_2, | ||
156 | GPIO3_3, | ||
157 | GPIO3_4, | ||
158 | GPIO3_5, | ||
159 | GPIO3_6, | ||
160 | GPIO3_7, | ||
161 | GPIO3_8, | ||
162 | GPIO3_9, | ||
163 | GPIO3_10, | ||
164 | GPIO3_11, | ||
165 | GPIO3_12, | ||
166 | GPIO3_13, | ||
167 | GPIO3_14, | ||
168 | GPIO3_15, | ||
169 | GPIO3_16, | ||
170 | GPIO3_17, | ||
171 | GPIO3_18, | ||
172 | GPIO3_19, | ||
173 | GPIO3_20, | ||
174 | GPIO3_21, | ||
175 | GPIO3_22, | ||
176 | GPIO3_23, | ||
177 | GPIO3_24, | ||
178 | GPIO3_25, | ||
179 | GPIO3_26, | ||
180 | GPIO3_27, | ||
181 | GPIO3_28, | ||
182 | GPIO3_29, | ||
183 | GPIO3_30, | ||
184 | GPIO3_31, | ||
185 | }R0_MX37_GPIO; | ||
186 | |||
187 | typedef enum | ||
188 | { | ||
189 | CONFIG_ALT0, | ||
190 | CONFIG_ALT1, | ||
191 | CONFIG_ALT2, | ||
192 | CONFIG_ALT3, | ||
193 | CONFIG_ALT4, | ||
194 | CONFIG_ALT5, | ||
195 | CONFIG_ALT6, | ||
196 | CONFIG_ALT7, | ||
197 | CONFIG_GPIO, | ||
198 | CONFIG_SION = 0x01 << 4, | ||
199 | CONFIG_DEFAULT | ||
200 | } R0_MX37_PIN_CONFIG; | ||
201 | |||
202 | #ifndef __MACH_MX37_IOMUX_H__ | ||
203 | typedef enum | ||
204 | { | ||
205 | PAD_CTL_SRE_SLOW = 0x0 << 0, | ||
206 | PAD_CTL_SRE_FAST = 0x1 << 0, | ||
207 | PAD_CTL_DRV_LOW = 0x0 << 1, | ||
208 | PAD_CTL_DRV_MEDIUM = 0x1 << 1, | ||
209 | PAD_CTL_DRV_HIGH = 0x2 << 1, | ||
210 | PAD_CTL_DRV_MAX = 0x3 << 1, | ||
211 | PAD_CTL_ODE_OPENDRAIN_NONE = 0x0 << 3, | ||
212 | PAD_CTL_ODE_OPENDRAIN_ENABLE = 0x1 << 3, | ||
213 | PAD_CTL_100K_PD = 0x0 << 4, | ||
214 | PAD_CTL_47K_PU = 0x1 << 4, | ||
215 | PAD_CTL_100K_PU = 0x2 << 4, | ||
216 | PAD_CTL_22K_PU = 0x3 << 4, | ||
217 | PAD_CTL_PUE_KEEPER = 0x0 << 6, | ||
218 | PAD_CTL_PUE_PULL = 0x1 << 6, | ||
219 | PAD_CTL_PKE_NONE = 0x0 << 7, | ||
220 | PAD_CTL_PKE_ENABLE = 0x1 << 7, | ||
221 | PAD_CTL_HYS_NONE = 0x0 << 8, | ||
222 | PAD_CTL_HYS_ENABLE = 0x1 << 8, | ||
223 | PAD_CTL_DDR_INPUT_CMOS = 0x0 << 9, | ||
224 | PAD_CTL_DDR_INPUT_DDR = 0x1 << 9, | ||
225 | PAD_CTL_DRV_VOT_LOW = 0x0 << 13, | ||
226 | PAD_CTL_DRV_VOT_HIGH = 0x1 << 13, | ||
227 | } R0_MX37_PAD_CONFIG; | ||
228 | #endif | ||
229 | |||
230 | #endif /* __DEV_IOCTL_YPR0_H__ */ | 50 | #endif /* __DEV_IOCTL_YPR0_H__ */ |
diff --git a/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c index d0cbddc55a..9aa49786f1 100644 --- a/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c +++ b/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "panic.h" | 25 | #include "panic.h" |
26 | #include "debug.h" | 26 | #include "debug.h" |
27 | 27 | ||
28 | #include "gpio-target.h" | 28 | #include "gpio-ypr.h" |
29 | #include "pmu-ypr1.h" | 29 | #include "pmu-ypr1.h" |
30 | #include "ioctl-ypr1.h" | 30 | #include "ioctl-ypr1.h" |
31 | #include "audiohw.h" | 31 | #include "audiohw.h" |