source: trunk/target/linux/ar7/files-2.6.30/arch/mips/ar7/gpio.c @ 19518

Last change on this file since 19518 was 19518, checked in by florian, 6 years ago

[ar7] move files to file-2.6.30

File size: 1.3 KB
Line 
1/*
2 * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#include <linux/module.h>
21
22#include <asm/ar7/gpio.h>
23
24static const char *ar7_gpio_list[TITAN_GPIO_MAX];
25
26int gpio_request(unsigned gpio, const char *label)
27{
28        if (gpio >= (ar7_is_titan() ? TITAN_GPIO_MAX : AR7_GPIO_MAX))
29                return -EINVAL;
30
31        if (ar7_gpio_list[gpio])
32                return -EBUSY;
33
34        if (label) {
35                ar7_gpio_list[gpio] = label;
36        } else {
37                ar7_gpio_list[gpio] = "busy";
38        }
39
40        return 0;
41}
42EXPORT_SYMBOL(gpio_request);
43
44void gpio_free(unsigned gpio)
45{
46        BUG_ON(!ar7_gpio_list[gpio]);
47        ar7_gpio_list[gpio] = NULL;
48}
49EXPORT_SYMBOL(gpio_free);
Note: See TracBrowser for help on using the repository browser.