blob: 232bb8f80b5142c40a9795718a9a32862eb71355 [file] [log] [blame]
MyungJoo Hambe483082012-04-20 14:16:23 +09001/*
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.
Chanwoo Choia75e1c72013-08-31 13:16:49 +090028 * @name: The name of this GPIO extcon device.
Chanwoo Choice6f7492015-09-29 22:57:24 +090029 * @extcon_id: The unique id of specific external connector.
Chanwoo Choia75e1c72013-08-31 13:16:49 +090030 * @gpio: Corresponding GPIO.
Guenter Roeck5bfbdc92013-09-12 08:49:54 +090031 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
32 * If true, low state of gpio means active.
33 * If false, high state of gpio means active.
Chanwoo Choia75e1c72013-08-31 13:16:49 +090034 * @debounce: Debounce time for GPIO IRQ in ms.
35 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
36 * @state_on: print_state is overriden with state_on if attached.
37 * If NULL, default method of extcon class is used.
George Cherian62364352014-09-09 09:44:34 +053038 * @state_off: print_state is overriden with state_off if detached.
Chanwoo Choia75e1c72013-08-31 13:16:49 +090039 * If NUll, default method of extcon class is used.
George Cherian62364352014-09-09 09:44:34 +053040 * @check_on_resume: Boolean describing whether to check the state of gpio
41 * while resuming from sleep.
MyungJoo Hambe483082012-04-20 14:16:23 +090042 *
43 * Note that in order for state_on or state_off to be valid, both state_on
44 * and state_off should be not NULL. If at least one of them is NULL,
45 * the print_state is not overriden.
46 */
47struct gpio_extcon_platform_data {
48 const char *name;
Chanwoo Choice6f7492015-09-29 22:57:24 +090049 unsigned int extcon_id;
MyungJoo Hambe483082012-04-20 14:16:23 +090050 unsigned gpio;
Guenter Roeck5bfbdc92013-09-12 08:49:54 +090051 bool gpio_active_low;
MyungJoo Hambe483082012-04-20 14:16:23 +090052 unsigned long debounce;
53 unsigned long irq_flags;
54
55 /* if NULL, "0" or "1" will be printed */
56 const char *state_on;
57 const char *state_off;
Rongjun Ying6544dfa2014-01-09 09:50:13 +090058 bool check_on_resume;
MyungJoo Hambe483082012-04-20 14:16:23 +090059};
60
61#endif /* __EXTCON_GPIO_H__ */