extcon: Split out extcon header file for consumer and provider device
The extcon has two type of extcon devices as following. - 'extcon provider deivce' adds new extcon device and detect the state/properties of external connector. Also, it notifies the state/properties to the extcon consumer device. - 'extcon consumer device' gets the change state/properties from extcon provider device. Prior to that, include/linux/extcon.h contains all exported API for both provider and consumer device driver. To clarify the meaning of header file and to remove the wrong use-case on consumer device, this patch separates into extcon.h and extcon-provider.h. [Description for include/linux/{extcon.h|extcon-provider.h}] - extcon.h includes the extcon API and data structure for extcon consumer device driver. This header file contains the following APIs: : Register/unregister the notifier to catch the change of extcon device : Get the extcon device instance : Get the extcon device name : Get the state of each external connector : Get the property value of each external connector : Get the property capability of each external connector - extcon-provider.h includes the extcon API and data structure for extcon provider device driver. This header file contains the following APIs: : Include 'include/linux/extcon.h' : Allocate the memory for extcon device instance : Register/unregister extcon device : Set the state of each external connector : Set the property value of each external connector : Set the property capability of each external connector Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:
parent
2bd6bf03f4
commit
176aa36012
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/iio/consumer.h>
|
#include <linux/iio/consumer.h>
|
||||||
#include <linux/extcon/extcon-adc-jack.h>
|
#include <linux/extcon/extcon-adc-jack.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct adc_jack_data - internal data for adc_jack device driver
|
* struct adc_jack_data - internal data for adc_jack device driver
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/extcon/extcon-gpio.h>
|
#include <linux/extcon/extcon-gpio.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* more details.
|
* more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/mfd/intel_soc_pmic.h>
|
#include <linux/mfd/intel_soc_pmic.h>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/mfd/max14577.h>
|
#include <linux/mfd/max14577.h>
|
||||||
#include <linux/mfd/max14577-private.h>
|
#include <linux/mfd/max14577-private.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
#define DELAY_MS_DEFAULT 17000 /* unit: millisecond */
|
#define DELAY_MS_DEFAULT 17000 /* unit: millisecond */
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* may be copied, distributed, and modified under those terms.
|
* may be copied, distributed, and modified under those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/mfd/max77693.h>
|
#include <linux/mfd/max77693.h>
|
||||||
#include <linux/mfd/max77693-common.h>
|
#include <linux/mfd/max77693-common.h>
|
||||||
#include <linux/mfd/max77693-private.h>
|
#include <linux/mfd/max77693-private.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/irqdomain.h>
|
#include <linux/irqdomain.h>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <linux/kobject.h>
|
#include <linux/kobject.h>
|
||||||
#include <linux/mfd/max8997.h>
|
#include <linux/mfd/max8997.h>
|
||||||
#include <linux/mfd/max8997-private.h>
|
#include <linux/mfd/max8997-private.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/irqdomain.h>
|
#include <linux/irqdomain.h>
|
||||||
|
|
||||||
#define DEV_NAME "max8997-muic"
|
#define DEV_NAME "max8997-muic"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
#include "extcon-rt8973a.h"
|
#include "extcon-rt8973a.h"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
#include "extcon-sm5502.h"
|
#include "extcon-sm5502.h"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/mfd/cros_ec.h>
|
#include <linux/mfd/cros_ec.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __LINUX_EXTCON_INTERNAL_H__
|
#ifndef __LINUX_EXTCON_INTERNAL_H__
|
||||||
#define __LINUX_EXTCON_INTERNAL_H__
|
#define __LINUX_EXTCON_INTERNAL_H__
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct extcon_dev - An extcon device represents one external connector.
|
* struct extcon_dev - An extcon device represents one external connector.
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/clk-provider.h>
|
#include <linux/clk-provider.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <linux/power_supply.h>
|
#include <linux/power_supply.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/regulator/driver.h>
|
#include <linux/regulator/driver.h>
|
||||||
|
|
||||||
#define SMBB_CHG_VMAX 0x040
|
#define SMBB_CHG_VMAX 0x040
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/usb/otg.h>
|
#include <linux/usb/otg.h>
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* External Connector (extcon) framework
|
||||||
|
* - linux/include/linux/extcon-provider.h for extcon provider device driver.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Samsung Electronics
|
||||||
|
* Author: Chanwoo Choi <cw00.choi@samsung.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 __LINUX_EXTCON_PROVIDER_H__
|
||||||
|
#define __LINUX_EXTCON_PROVIDER_H__
|
||||||
|
|
||||||
|
#include <linux/extcon.h>
|
||||||
|
|
||||||
|
struct extcon_dev;
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_EXTCON)
|
||||||
|
|
||||||
|
/* Following APIs register/unregister the extcon device. */
|
||||||
|
extern int extcon_dev_register(struct extcon_dev *edev);
|
||||||
|
extern void extcon_dev_unregister(struct extcon_dev *edev);
|
||||||
|
extern int devm_extcon_dev_register(struct device *dev,
|
||||||
|
struct extcon_dev *edev);
|
||||||
|
extern void devm_extcon_dev_unregister(struct device *dev,
|
||||||
|
struct extcon_dev *edev);
|
||||||
|
|
||||||
|
/* Following APIs allocate/free the memory of the extcon device. */
|
||||||
|
extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
|
||||||
|
extern void extcon_dev_free(struct extcon_dev *edev);
|
||||||
|
extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
|
||||||
|
const unsigned int *cable);
|
||||||
|
extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
|
||||||
|
|
||||||
|
/* Synchronize the state and property value for each external connector. */
|
||||||
|
extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Following APIs set the connected state of each external connector.
|
||||||
|
* The 'id' argument indicates the defined external connector.
|
||||||
|
*/
|
||||||
|
extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
|
||||||
|
bool state);
|
||||||
|
extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
|
||||||
|
bool state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Following APIs set the property of each external connector.
|
||||||
|
* The 'id' argument indicates the defined external connector
|
||||||
|
* and the 'prop' indicates the extcon property.
|
||||||
|
*
|
||||||
|
* And extcon_set_property_capability() set the capability of the property
|
||||||
|
* for each external connector. They are used to set the capability of the
|
||||||
|
* property of each external connector based on the id and property.
|
||||||
|
*/
|
||||||
|
extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
|
||||||
|
unsigned int prop,
|
||||||
|
union extcon_property_value prop_val);
|
||||||
|
extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
|
||||||
|
unsigned int prop,
|
||||||
|
union extcon_property_value prop_val);
|
||||||
|
extern int extcon_set_property_capability(struct extcon_dev *edev,
|
||||||
|
unsigned int id, unsigned int prop);
|
||||||
|
|
||||||
|
#else /* CONFIG_EXTCON */
|
||||||
|
static inline int extcon_dev_register(struct extcon_dev *edev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
|
||||||
|
|
||||||
|
static inline int devm_extcon_dev_register(struct device *dev,
|
||||||
|
struct extcon_dev *edev)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void devm_extcon_dev_unregister(struct device *dev,
|
||||||
|
struct extcon_dev *edev) { }
|
||||||
|
|
||||||
|
static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-ENOSYS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void extcon_dev_free(struct extcon_dev *edev) { }
|
||||||
|
|
||||||
|
static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
|
||||||
|
const unsigned int *cable)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-ENOSYS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
|
||||||
|
|
||||||
|
|
||||||
|
static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
|
||||||
|
bool state)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
|
||||||
|
bool state)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
|
||||||
|
unsigned int prop,
|
||||||
|
union extcon_property_value prop_val)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int extcon_set_property_sync(struct extcon_dev *edev,
|
||||||
|
unsigned int id, unsigned int prop,
|
||||||
|
union extcon_property_value prop_val)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int extcon_set_property_capability(struct extcon_dev *edev,
|
||||||
|
unsigned int id, unsigned int prop)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_EXTCON */
|
||||||
|
#endif /* __LINUX_EXTCON_PROVIDER_H__ */
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* External Connector (extcon) framework
|
* External Connector (extcon) framework
|
||||||
|
* - linux/include/linux/extcon.h for extcon consumer device driver.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Samsung Electronics
|
* Copyright (C) 2015 Samsung Electronics
|
||||||
* Author: Chanwoo Choi <cw00.choi@samsung.com>
|
* Author: Chanwoo Choi <cw00.choi@samsung.com>
|
||||||
|
@ -170,61 +171,29 @@ union extcon_property_value {
|
||||||
int intval; /* type : integer (intval) */
|
int intval; /* type : integer (intval) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct extcon_cable;
|
|
||||||
struct extcon_dev;
|
struct extcon_dev;
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_EXTCON)
|
#if IS_ENABLED(CONFIG_EXTCON)
|
||||||
|
|
||||||
/* Following APIs register/unregister the extcon device. */
|
|
||||||
extern int extcon_dev_register(struct extcon_dev *edev);
|
|
||||||
extern void extcon_dev_unregister(struct extcon_dev *edev);
|
|
||||||
extern int devm_extcon_dev_register(struct device *dev,
|
|
||||||
struct extcon_dev *edev);
|
|
||||||
extern void devm_extcon_dev_unregister(struct device *dev,
|
|
||||||
struct extcon_dev *edev);
|
|
||||||
|
|
||||||
/* Following APIs allocate/free the memory of the extcon device. */
|
|
||||||
extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
|
|
||||||
extern void extcon_dev_free(struct extcon_dev *edev);
|
|
||||||
extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
|
|
||||||
const unsigned int *cable);
|
|
||||||
extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
|
|
||||||
|
|
||||||
/* Synchronize the state and property value for each external connector. */
|
|
||||||
extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Following APIs get/set the connected state of each external connector.
|
* Following APIs get the connected state of each external connector.
|
||||||
* The 'id' argument indicates the defined external connector.
|
* The 'id' argument indicates the defined external connector.
|
||||||
*/
|
*/
|
||||||
extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
|
extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
|
||||||
extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
|
|
||||||
bool state);
|
|
||||||
extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
|
|
||||||
bool state);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Following APIs get/set the property of each external connector.
|
* Following APIs get the property of each external connector.
|
||||||
* The 'id' argument indicates the defined external connector
|
* The 'id' argument indicates the defined external connector
|
||||||
* and the 'prop' indicates the extcon property.
|
* and the 'prop' indicates the extcon property.
|
||||||
*
|
*
|
||||||
* And extcon_get/set_property_capability() set the capability of the property
|
* And extcon_get_property_capability() get the capability of the property
|
||||||
* for each external connector. They are used to set the capability of the
|
* for each external connector. They are used to get the capability of the
|
||||||
* property of each external connector based on the id and property.
|
* property of each external connector based on the id and property.
|
||||||
*/
|
*/
|
||||||
extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
|
extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
|
||||||
unsigned int prop,
|
unsigned int prop,
|
||||||
union extcon_property_value *prop_val);
|
union extcon_property_value *prop_val);
|
||||||
extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
|
|
||||||
unsigned int prop,
|
|
||||||
union extcon_property_value prop_val);
|
|
||||||
extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
|
|
||||||
unsigned int prop,
|
|
||||||
union extcon_property_value prop_val);
|
|
||||||
extern int extcon_get_property_capability(struct extcon_dev *edev,
|
extern int extcon_get_property_capability(struct extcon_dev *edev,
|
||||||
unsigned int id, unsigned int prop);
|
unsigned int id, unsigned int prop);
|
||||||
extern int extcon_set_property_capability(struct extcon_dev *edev,
|
|
||||||
unsigned int id, unsigned int prop);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Following APIs register the notifier block in order to detect
|
* Following APIs register the notifier block in order to detect
|
||||||
|
@ -268,79 +237,17 @@ extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
|
||||||
extern const char *extcon_get_edev_name(struct extcon_dev *edev);
|
extern const char *extcon_get_edev_name(struct extcon_dev *edev);
|
||||||
|
|
||||||
#else /* CONFIG_EXTCON */
|
#else /* CONFIG_EXTCON */
|
||||||
static inline int extcon_dev_register(struct extcon_dev *edev)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
|
|
||||||
|
|
||||||
static inline int devm_extcon_dev_register(struct device *dev,
|
|
||||||
struct extcon_dev *edev)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void devm_extcon_dev_unregister(struct device *dev,
|
|
||||||
struct extcon_dev *edev) { }
|
|
||||||
|
|
||||||
static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
|
|
||||||
{
|
|
||||||
return ERR_PTR(-ENOSYS);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void extcon_dev_free(struct extcon_dev *edev) { }
|
|
||||||
|
|
||||||
static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
|
|
||||||
const unsigned int *cable)
|
|
||||||
{
|
|
||||||
return ERR_PTR(-ENOSYS);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
|
|
||||||
|
|
||||||
|
|
||||||
static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
|
static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
|
|
||||||
bool state)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
|
|
||||||
bool state)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
|
static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
|
||||||
unsigned int prop,
|
unsigned int prop,
|
||||||
union extcon_property_value *prop_val)
|
union extcon_property_value *prop_val)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
|
|
||||||
unsigned int prop,
|
|
||||||
union extcon_property_value prop_val)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_set_property_sync(struct extcon_dev *edev,
|
|
||||||
unsigned int id, unsigned int prop,
|
|
||||||
union extcon_property_value prop_val)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_get_property_capability(struct extcon_dev *edev,
|
static inline int extcon_get_property_capability(struct extcon_dev *edev,
|
||||||
unsigned int id, unsigned int prop)
|
unsigned int id, unsigned int prop)
|
||||||
|
@ -348,12 +255,6 @@ static inline int extcon_get_property_capability(struct extcon_dev *edev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int extcon_set_property_capability(struct extcon_dev *edev,
|
|
||||||
unsigned int id, unsigned int prop)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_register_notifier(struct extcon_dev *edev,
|
static inline int extcon_register_notifier(struct extcon_dev *edev,
|
||||||
unsigned int id, struct notifier_block *nb)
|
unsigned int id, struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/regulator/driver.h>
|
#include <linux/regulator/driver.h>
|
||||||
#include <linux/extcon.h>
|
#include <linux/extcon-provider.h>
|
||||||
#include <linux/of_gpio.h>
|
#include <linux/of_gpio.h>
|
||||||
#include <linux/usb/phy_companion.h>
|
#include <linux/usb/phy_companion.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue