2012-04-20 13:16:23 +08:00
|
|
|
/*
|
|
|
|
* 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.
|
2013-08-31 12:16:49 +08:00
|
|
|
* @name: The name of this GPIO extcon device.
|
2015-09-29 21:57:24 +08:00
|
|
|
* @extcon_id: The unique id of specific external connector.
|
2013-08-31 12:16:49 +08:00
|
|
|
* @gpio: Corresponding GPIO.
|
2013-09-12 07:49:54 +08:00
|
|
|
* @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
|
|
|
|
* If true, low state of gpio means active.
|
|
|
|
* If false, high state of gpio means active.
|
2013-08-31 12:16:49 +08:00
|
|
|
* @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.
|
2014-09-09 12:14:34 +08:00
|
|
|
* @state_off: print_state is overriden with state_off if detached.
|
2013-08-31 12:16:49 +08:00
|
|
|
* If NUll, default method of extcon class is used.
|
2014-09-09 12:14:34 +08:00
|
|
|
* @check_on_resume: Boolean describing whether to check the state of gpio
|
|
|
|
* while resuming from sleep.
|
2012-04-20 13:16:23 +08:00
|
|
|
*
|
|
|
|
* 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;
|
2015-09-29 21:57:24 +08:00
|
|
|
unsigned int extcon_id;
|
2012-04-20 13:16:23 +08:00
|
|
|
unsigned gpio;
|
2013-09-12 07:49:54 +08:00
|
|
|
bool gpio_active_low;
|
2012-04-20 13:16:23 +08:00
|
|
|
unsigned long debounce;
|
|
|
|
unsigned long irq_flags;
|
|
|
|
|
|
|
|
/* if NULL, "0" or "1" will be printed */
|
|
|
|
const char *state_on;
|
|
|
|
const char *state_off;
|
2014-01-09 08:50:13 +08:00
|
|
|
bool check_on_resume;
|
2012-04-20 13:16:23 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __EXTCON_GPIO_H__ */
|