.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2008 David Brownell |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/init.h> |
---|
.. | .. |
---|
16 | 12 | #include <linux/module.h> |
---|
17 | 13 | #include <linux/err.h> |
---|
18 | 14 | #include <linux/gpio.h> |
---|
| 15 | +#include <linux/gpio/machine.h> |
---|
19 | 16 | #include <linux/leds.h> |
---|
20 | 17 | #include <linux/i2c.h> |
---|
21 | 18 | #include <linux/mfd/dm355evm_msp.h> |
---|
.. | .. |
---|
118 | 115 | */ |
---|
119 | 116 | MSP_GPIO(2, SDMMC), MSP_GPIO(1, SDMMC), /* mmc0 WP, nCD */ |
---|
120 | 117 | MSP_GPIO(4, SDMMC), MSP_GPIO(3, SDMMC), /* mmc1 WP, nCD */ |
---|
| 118 | +}; |
---|
| 119 | + |
---|
| 120 | +static struct gpio_led evm_leds[] = { |
---|
| 121 | + { .name = "dm355evm::ds14", |
---|
| 122 | + .default_trigger = "heartbeat", }, |
---|
| 123 | + { .name = "dm355evm::ds15", |
---|
| 124 | + .default_trigger = "mmc0", }, |
---|
| 125 | + { .name = "dm355evm::ds16", |
---|
| 126 | + /* could also be a CE-ATA drive */ |
---|
| 127 | + .default_trigger = "mmc1", }, |
---|
| 128 | + { .name = "dm355evm::ds17", |
---|
| 129 | + .default_trigger = "nand-disk", }, |
---|
| 130 | + { .name = "dm355evm::ds18", }, |
---|
| 131 | + { .name = "dm355evm::ds19", }, |
---|
| 132 | + { .name = "dm355evm::ds20", }, |
---|
| 133 | + { .name = "dm355evm::ds21", }, |
---|
| 134 | +}; |
---|
| 135 | + |
---|
| 136 | +static struct gpio_led_platform_data evm_led_data = { |
---|
| 137 | + .num_leds = ARRAY_SIZE(evm_leds), |
---|
| 138 | + .leds = evm_leds, |
---|
| 139 | +}; |
---|
| 140 | + |
---|
| 141 | +static struct gpiod_lookup_table evm_leds_gpio_table = { |
---|
| 142 | + .dev_id = "leds-gpio", |
---|
| 143 | + .table = { |
---|
| 144 | + /* |
---|
| 145 | + * These GPIOs are on the dm355evm_msp |
---|
| 146 | + * GPIO chip at index 0..7 |
---|
| 147 | + */ |
---|
| 148 | + GPIO_LOOKUP_IDX("dm355evm_msp", 0, NULL, |
---|
| 149 | + 0, GPIO_ACTIVE_LOW), |
---|
| 150 | + GPIO_LOOKUP_IDX("dm355evm_msp", 1, NULL, |
---|
| 151 | + 1, GPIO_ACTIVE_LOW), |
---|
| 152 | + GPIO_LOOKUP_IDX("dm355evm_msp", 2, NULL, |
---|
| 153 | + 2, GPIO_ACTIVE_LOW), |
---|
| 154 | + GPIO_LOOKUP_IDX("dm355evm_msp", 3, NULL, |
---|
| 155 | + 3, GPIO_ACTIVE_LOW), |
---|
| 156 | + GPIO_LOOKUP_IDX("dm355evm_msp", 4, NULL, |
---|
| 157 | + 4, GPIO_ACTIVE_LOW), |
---|
| 158 | + GPIO_LOOKUP_IDX("dm355evm_msp", 5, NULL, |
---|
| 159 | + 5, GPIO_ACTIVE_LOW), |
---|
| 160 | + GPIO_LOOKUP_IDX("dm355evm_msp", 6, NULL, |
---|
| 161 | + 6, GPIO_ACTIVE_LOW), |
---|
| 162 | + GPIO_LOOKUP_IDX("dm355evm_msp", 7, NULL, |
---|
| 163 | + 7, GPIO_ACTIVE_LOW), |
---|
| 164 | + { }, |
---|
| 165 | + }, |
---|
121 | 166 | }; |
---|
122 | 167 | |
---|
123 | 168 | #define MSP_GPIO_REG(offset) (msp_gpios[(offset)] >> 3) |
---|
.. | .. |
---|
264 | 309 | |
---|
265 | 310 | /* LED output */ |
---|
266 | 311 | if (msp_has_leds()) { |
---|
267 | | -#define GPIO_LED(l) .name = l, .active_low = true |
---|
268 | | - static struct gpio_led evm_leds[] = { |
---|
269 | | - { GPIO_LED("dm355evm::ds14"), |
---|
270 | | - .default_trigger = "heartbeat", }, |
---|
271 | | - { GPIO_LED("dm355evm::ds15"), |
---|
272 | | - .default_trigger = "mmc0", }, |
---|
273 | | - { GPIO_LED("dm355evm::ds16"), |
---|
274 | | - /* could also be a CE-ATA drive */ |
---|
275 | | - .default_trigger = "mmc1", }, |
---|
276 | | - { GPIO_LED("dm355evm::ds17"), |
---|
277 | | - .default_trigger = "nand-disk", }, |
---|
278 | | - { GPIO_LED("dm355evm::ds18"), }, |
---|
279 | | - { GPIO_LED("dm355evm::ds19"), }, |
---|
280 | | - { GPIO_LED("dm355evm::ds20"), }, |
---|
281 | | - { GPIO_LED("dm355evm::ds21"), }, |
---|
282 | | - }; |
---|
283 | | -#undef GPIO_LED |
---|
284 | | - |
---|
285 | | - struct gpio_led_platform_data evm_led_data = { |
---|
286 | | - .num_leds = ARRAY_SIZE(evm_leds), |
---|
287 | | - .leds = evm_leds, |
---|
288 | | - }; |
---|
289 | | - |
---|
290 | | - for (i = 0; i < ARRAY_SIZE(evm_leds); i++) |
---|
291 | | - evm_leds[i].gpio = i + dm355evm_msp_gpio.base; |
---|
292 | | - |
---|
| 312 | + gpiod_add_lookup_table(&evm_leds_gpio_table); |
---|
293 | 313 | /* NOTE: these are the only fully programmable LEDs |
---|
294 | 314 | * on the board, since GPIO-61/ds22 (and many signals |
---|
295 | 315 | * going to DC7) must be used for AEMIF address lines |
---|