blob: 50386e9669c0f128c073542195bd4eeb997f0e1b [file] [log] [blame]
Brian Swetland12981aa2009-01-02 01:31:43 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
4 *
Unnati Gandhi7c536732014-07-17 14:37:49 +05305 * Copyright (c) 2014 The Linux Foundation. All rights reserved
6 *
Brian Swetland12981aa2009-01-02 01:31:43 -08007 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
Unnati Gandhi7c536732014-07-17 14:37:49 +053031#include <platform/gpio.h>
32
Brian Swetland12981aa2009-01-02 01:31:43 -080033#ifndef __DEV_GPIO_H
34#define __DEV_GPIO_H
35
Greg Griscod2471ef2011-07-14 13:00:42 -070036#ifndef GPIO_INPUT
Brian Swetland12981aa2009-01-02 01:31:43 -080037#define GPIO_INPUT 0x0000
Greg Griscod2471ef2011-07-14 13:00:42 -070038#endif
39#ifndef GPIO_OUTPUT
Brian Swetland12981aa2009-01-02 01:31:43 -080040#define GPIO_OUTPUT 0x0001
Greg Griscod2471ef2011-07-14 13:00:42 -070041#endif
Brian Swetland12981aa2009-01-02 01:31:43 -080042
43#define GPIO_LEVEL 0x0000
44#define GPIO_EDGE 0x0010
45
46#define GPIO_RISING 0x0020
47#define GPIO_FALLING 0x0040
48
49#define GPIO_HIGH 0x0020
50#define GPIO_LOW 0x0040
51
52#define GPIO_PULLUP 0x0100
53#define GPIO_PULLDOWN 0x0200
54
55int gpio_config(unsigned nr, unsigned flags);
56void gpio_set(unsigned nr, unsigned on);
57int gpio_get(unsigned nr);
58
59#endif