diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2012-04-20 01:16:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-20 12:22:02 -0400 |
commit | be48308a24c7651bf968b561dbd590edb8166d62 (patch) | |
tree | 7b7e7d49976f592171bdb75ea286d7b083946e64 /include/linux/extcon | |
parent | de55d8716ac50a356cea736c29bb7db5ac3d0190 (diff) |
Extcon: support generic GPIO extcon driver
The generic GPIO extcon driver (an external connector device based on
GPIO control) and imported from Android kernel.
switch: switch class and GPIO drivers. (splitted)
Author: Mike Lockwood <lockwood@android.com>
switch: gpio: Don't call request_irq with interrupts disabled
Author: Arve Hjønnevåg <arve@android.com>
switch_gpio: Add missing #include <linux/interrupt.h>
Author: Mike Lockwood <lockwood@android.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
--
Changed from v7:
- Style updates mentioned by Stephen Boyd and Mark Brown
Changed from v5:
- Splitted at v5 from the main extcon patch.
- Added debounce time for irq handlers.
- Use request_any_context_irq instead of request_irq
- User needs to specify irq flags for GPIO interrupts (was fixed to
IRQF_TRIGGER_LOW before)
- Use module_platform_driver().
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/extcon')
-rw-r--r-- | include/linux/extcon/extcon_gpio.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon_gpio.h new file mode 100644 index 000000000000..a2129b73dcb1 --- /dev/null +++ b/include/linux/extcon/extcon_gpio.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * External connector (extcon) class generic GPIO driver | ||
3 | * | ||
4 | * Copyright (C) 2012 Samsung Electronics | ||
5 | * Author: MyungJoo Ham <myungjoo.ham@samsung.com> | ||
6 | * | ||
7 | * based on switch class driver | ||
8 | * Copyright (C) 2008 Google, Inc. | ||
9 | * Author: Mike Lockwood <lockwood@android.com> | ||
10 | * | ||
11 | * This software is licensed under the terms of the GNU General Public | ||
12 | * License version 2, as published by the Free Software Foundation, and | ||
13 | * may be copied, distributed, and modified under those terms. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | */ | ||
21 | #ifndef __EXTCON_GPIO_H__ | ||
22 | #define __EXTCON_GPIO_H__ __FILE__ | ||
23 | |||
24 | #include <linux/extcon.h> | ||
25 | |||
26 | /** | ||
27 | * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. | ||
28 | * @name The name of this GPIO extcon device. | ||
29 | * @gpio Corresponding GPIO. | ||
30 | * @debounce Debounce time for GPIO IRQ in ms. | ||
31 | * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). | ||
32 | * @state_on print_state is overriden with state_on if attached. If Null, | ||
33 | * default method of extcon class is used. | ||
34 | * @state_off print_state is overriden with state_on if dettached. If Null, | ||
35 | * default method of extcon class is used. | ||
36 | * | ||
37 | * Note that in order for state_on or state_off to be valid, both state_on | ||
38 | * and state_off should be not NULL. If at least one of them is NULL, | ||
39 | * the print_state is not overriden. | ||
40 | */ | ||
41 | struct gpio_extcon_platform_data { | ||
42 | const char *name; | ||
43 | unsigned gpio; | ||
44 | unsigned long debounce; | ||
45 | unsigned long irq_flags; | ||
46 | |||
47 | /* if NULL, "0" or "1" will be printed */ | ||
48 | const char *state_on; | ||
49 | const char *state_off; | ||
50 | }; | ||
51 | |||
52 | #endif /* __EXTCON_GPIO_H__ */ | ||