|
8 | 8 | * License, or (at your option) any later version. |
9 | 9 | */ |
10 | 10 | #include <linux/gpio.h> |
| 11 | +#include <linux/gpio/machine.h> |
11 | 12 | #include <linux/kernel.h> |
12 | 13 | #include <linux/init.h> |
13 | 14 | #include <linux/platform_device.h> |
@@ -139,34 +140,45 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = { |
139 | 140 | static struct gpio_led mv2120_led_pins[] = { |
140 | 141 | { |
141 | 142 | .name = "mv2120:blue:health", |
142 | | - .gpio = 0, |
143 | 143 | }, |
144 | 144 | { |
145 | 145 | .name = "mv2120:red:health", |
146 | | - .gpio = 1, |
147 | 146 | }, |
148 | 147 | { |
149 | 148 | .name = "mv2120:led:bright", |
150 | | - .gpio = 4, |
151 | 149 | .default_trigger = "default-on", |
152 | 150 | }, |
153 | 151 | { |
154 | 152 | .name = "mv2120:led:dimmed", |
155 | | - .gpio = 5, |
156 | 153 | }, |
157 | 154 | { |
158 | 155 | .name = "mv2120:red:sata0", |
159 | | - .gpio = 8, |
160 | | - .active_low = 1, |
161 | 156 | }, |
162 | 157 | { |
163 | 158 | .name = "mv2120:red:sata1", |
164 | | - .gpio = 9, |
165 | | - .active_low = 1, |
166 | 159 | }, |
167 | 160 |
|
168 | 161 | }; |
169 | 162 |
|
| 163 | +static struct gpiod_lookup_table mv2120_leds_gpio_table = { |
| 164 | + .dev_id = "leds-gpio", |
| 165 | + .table = { |
| 166 | + GPIO_LOOKUP_IDX("orion_gpio0", 0, NULL, |
| 167 | + 0, GPIO_ACTIVE_HIGH), |
| 168 | + GPIO_LOOKUP_IDX("orion_gpio0", 1, NULL, |
| 169 | + 1, GPIO_ACTIVE_HIGH), |
| 170 | + GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL, |
| 171 | + 2, GPIO_ACTIVE_HIGH), |
| 172 | + GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL, |
| 173 | + 3, GPIO_ACTIVE_HIGH), |
| 174 | + GPIO_LOOKUP_IDX("orion_gpio0", 8, NULL, |
| 175 | + 4, GPIO_ACTIVE_LOW), |
| 176 | + GPIO_LOOKUP_IDX("orion_gpio0", 9, NULL, |
| 177 | + 5, GPIO_ACTIVE_LOW), |
| 178 | + { }, |
| 179 | + }, |
| 180 | +}; |
| 181 | + |
170 | 182 | static struct gpio_led_platform_data mv2120_led_data = { |
171 | 183 | .leds = mv2120_led_pins, |
172 | 184 | .num_leds = ARRAY_SIZE(mv2120_led_pins), |
@@ -219,6 +231,7 @@ static void __init mv2120_init(void) |
219 | 231 | gpio_free(MV2120_GPIO_RTC_IRQ); |
220 | 232 | } |
221 | 233 | i2c_register_board_info(0, &mv2120_i2c_rtc, 1); |
| 234 | + gpiod_add_lookup_table(&mv2120_leds_gpio_table); |
222 | 235 | platform_device_register(&mv2120_leds); |
223 | 236 |
|
224 | 237 | /* register mv2120 specific power-off method */ |
|
0 commit comments