aboutsummaryrefslogtreecommitdiff
path: root/include/linux/extcon/extcon_gpio.h
blob: 2d8307f7d67decd0f0729b1f121cf0475e4b04b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 *  External connector (extcon) class generic GPIO driver
 *
 * Copyright (C) 2012 Samsung Electronics
 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
 *
 * based on switch class driver
 * Copyright (C) 2008 Google, Inc.
 * Author: Mike Lockwood <lockwood@android.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
*/
#ifndef __EXTCON_GPIO_H__
#define __EXTCON_GPIO_H__ __FILE__

#include <linux/extcon.h>

/**
 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
 * @name	The name of this GPIO extcon device.
 * @gpio	Corresponding GPIO.
 * @debounce	Debounce time for GPIO IRQ in ms.
 * @irq_flags	IRQ Flags (e.g., IRQF_TRIGGER_LOW).
 * @state_on	print_state is overriden with state_on if attached. If Null,
 *		default method of extcon class is used.
 * @state_off	print_state is overriden with state_on if detached. If Null,
 *		default method of extcon class is used.
 *
 * Note that in order for state_on or state_off to be valid, both state_on
 * and state_off should be not NULL. If at least one of them is NULL,
 * the print_state is not overriden.
 */
struct gpio_extcon_platform_data {
	const char *name;
	unsigned gpio;
	unsigned long debounce;
	unsigned long irq_flags;

	/* if NULL, "0" or "1" will be printed */
	const char *state_on;
	const char *state_off;
};

#endif /* __EXTCON_GPIO_H__ */