aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2017-09-20 23:11:24 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2017-10-23 01:07:58 -0400
commit176aa36012135d172394a928a03fb03dfecd83f9 (patch)
tree77b630eb0c9c08a4c3aaedc1552f6b47e2bbaa62
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff)
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>
-rw-r--r--drivers/extcon/extcon-adc-jack.c2
-rw-r--r--drivers/extcon/extcon-arizona.c2
-rw-r--r--drivers/extcon/extcon-axp288.c2
-rw-r--r--drivers/extcon/extcon-gpio.c2
-rw-r--r--drivers/extcon/extcon-intel-cht-wc.c2
-rw-r--r--drivers/extcon/extcon-intel-int3496.c2
-rw-r--r--drivers/extcon/extcon-max14577.c2
-rw-r--r--drivers/extcon/extcon-max3355.c2
-rw-r--r--drivers/extcon/extcon-max77693.c2
-rw-r--r--drivers/extcon/extcon-max77843.c2
-rw-r--r--drivers/extcon/extcon-max8997.c2
-rw-r--r--drivers/extcon/extcon-qcom-spmi-misc.c2
-rw-r--r--drivers/extcon/extcon-rt8973a.c2
-rw-r--r--drivers/extcon/extcon-sm5502.c2
-rw-r--r--drivers/extcon/extcon-usb-gpio.c2
-rw-r--r--drivers/extcon/extcon-usbc-cros-ec.c2
-rw-r--r--drivers/extcon/extcon.h2
-rw-r--r--drivers/phy/allwinner/phy-sun4i-usb.c2
-rw-r--r--drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c2
-rw-r--r--drivers/phy/renesas/phy-rcar-gen3-usb2.c2
-rw-r--r--drivers/phy/rockchip/phy-rockchip-inno-usb2.c2
-rw-r--r--drivers/power/supply/qcom_smbb.c2
-rw-r--r--drivers/usb/gadget/udc/renesas_usb3.c2
-rw-r--r--drivers/usb/phy/phy-tahvo.c2
-rw-r--r--include/linux/extcon-provider.h142
-rw-r--r--include/linux/extcon.h109
-rw-r--r--include/linux/mfd/palmas.h2
27 files changed, 172 insertions, 129 deletions
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index 6f6537ab0a79..3877d86c746a 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -26,7 +26,7 @@
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/iio/consumer.h> 27#include <linux/iio/consumer.h>
28#include <linux/extcon/extcon-adc-jack.h> 28#include <linux/extcon/extcon-adc-jack.h>
29#include <linux/extcon.h> 29#include <linux/extcon-provider.h>
30 30
31/** 31/**
32 * struct adc_jack_data - internal data for adc_jack device driver 32 * struct adc_jack_data - internal data for adc_jack device driver
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f84da4a17724..da0e9bc4262f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -27,7 +27,7 @@
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/property.h> 28#include <linux/property.h>
29#include <linux/regulator/consumer.h> 29#include <linux/regulator/consumer.h>
30#include <linux/extcon.h> 30#include <linux/extcon-provider.h>
31 31
32#include <sound/soc.h> 32#include <sound/soc.h>
33 33
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index f4fd03e58e37..981fba56bc18 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -22,7 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/property.h> 23#include <linux/property.h>
24#include <linux/notifier.h> 24#include <linux/notifier.h>
25#include <linux/extcon.h> 25#include <linux/extcon-provider.h>
26#include <linux/regmap.h> 26#include <linux/regmap.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/gpio/consumer.h> 28#include <linux/gpio/consumer.h>
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index ebed22f22d75..ab770adcca7e 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -17,7 +17,7 @@
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 */ 18 */
19 19
20#include <linux/extcon.h> 20#include <linux/extcon-provider.h>
21#include <linux/extcon/extcon-gpio.h> 21#include <linux/extcon/extcon-gpio.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/gpio/consumer.h> 23#include <linux/gpio/consumer.h>
diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
index 91a0023074af..7c4bc8c44c3f 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -15,7 +15,7 @@
15 * more details. 15 * more details.
16 */ 16 */
17 17
18#include <linux/extcon.h> 18#include <linux/extcon-provider.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/mfd/intel_soc_pmic.h> 21#include <linux/mfd/intel_soc_pmic.h>
diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index 1a45e745717d..c8691b5a9cb0 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21#include <linux/acpi.h> 21#include <linux/acpi.h>
22#include <linux/extcon.h> 22#include <linux/extcon-provider.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/module.h> 25#include <linux/module.h>
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index f6414b7fa5bc..6c2c9996eb71 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -23,7 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/mfd/max14577.h> 24#include <linux/mfd/max14577.h>
25#include <linux/mfd/max14577-private.h> 25#include <linux/mfd/max14577-private.h>
26#include <linux/extcon.h> 26#include <linux/extcon-provider.h>
27 27
28#define DELAY_MS_DEFAULT 17000 /* unit: millisecond */ 28#define DELAY_MS_DEFAULT 17000 /* unit: millisecond */
29 29
diff --git a/drivers/extcon/extcon-max3355.c b/drivers/extcon/extcon-max3355.c
index 533e16a952b8..0aa410836f4e 100644
--- a/drivers/extcon/extcon-max3355.c
+++ b/drivers/extcon/extcon-max3355.c
@@ -9,7 +9,7 @@
9 * may be copied, distributed, and modified under those terms. 9 * may be copied, distributed, and modified under those terms.
10 */ 10 */
11 11
12#include <linux/extcon.h> 12#include <linux/extcon-provider.h>
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <linux/gpio/consumer.h> 14#include <linux/gpio/consumer.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 7a5856809047..643411066ad9 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -26,7 +26,7 @@
26#include <linux/mfd/max77693.h> 26#include <linux/mfd/max77693.h>
27#include <linux/mfd/max77693-common.h> 27#include <linux/mfd/max77693-common.h>
28#include <linux/mfd/max77693-private.h> 28#include <linux/mfd/max77693-private.h>
29#include <linux/extcon.h> 29#include <linux/extcon-provider.h>
30#include <linux/regmap.h> 30#include <linux/regmap.h>
31#include <linux/irqdomain.h> 31#include <linux/irqdomain.h>
32 32
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 6e722d552cf1..28f251ff0fa2 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -11,7 +11,7 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#include <linux/extcon.h> 14#include <linux/extcon-provider.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 4a0612fb9c07..8152790d72e1 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -25,7 +25,7 @@
25#include <linux/kobject.h> 25#include <linux/kobject.h>
26#include <linux/mfd/max8997.h> 26#include <linux/mfd/max8997.h>
27#include <linux/mfd/max8997-private.h> 27#include <linux/mfd/max8997-private.h>
28#include <linux/extcon.h> 28#include <linux/extcon-provider.h>
29#include <linux/irqdomain.h> 29#include <linux/irqdomain.h>
30 30
31#define DEV_NAME "max8997-muic" 31#define DEV_NAME "max8997-muic"
diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
index b8cde096a808..660bbf163bf5 100644
--- a/drivers/extcon/extcon-qcom-spmi-misc.c
+++ b/drivers/extcon/extcon-qcom-spmi-misc.c
@@ -15,7 +15,7 @@
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 */ 16 */
17 17
18#include <linux/extcon.h> 18#include <linux/extcon-provider.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
index eaa355e7d9e4..e059bd5f2041 100644
--- a/drivers/extcon/extcon-rt8973a.c
+++ b/drivers/extcon/extcon-rt8973a.c
@@ -20,7 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/extcon.h> 23#include <linux/extcon-provider.h>
24 24
25#include "extcon-rt8973a.h" 25#include "extcon-rt8973a.h"
26 26
diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index 106ef0297b53..0cfb5a3efdf6 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -19,7 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/regmap.h> 20#include <linux/regmap.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/extcon.h> 22#include <linux/extcon-provider.h>
23 23
24#include "extcon-sm5502.h" 24#include "extcon-sm5502.h"
25 25
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index 9c925b05b7aa..53762864a9f7 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -14,7 +14,7 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#include <linux/extcon.h> 17#include <linux/extcon-provider.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio/consumer.h> 19#include <linux/gpio/consumer.h>
20#include <linux/init.h> 20#include <linux/init.h>
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
index 598956f1dcae..6187f731b29d 100644
--- a/drivers/extcon/extcon-usbc-cros-ec.c
+++ b/drivers/extcon/extcon-usbc-cros-ec.c
@@ -14,7 +14,7 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#include <linux/extcon.h> 17#include <linux/extcon-provider.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/mfd/cros_ec.h> 19#include <linux/mfd/cros_ec.h>
20#include <linux/module.h> 20#include <linux/module.h>
diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h
index dddddcfa0587..cc1b436eb66a 100644
--- a/drivers/extcon/extcon.h
+++ b/drivers/extcon/extcon.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_EXTCON_INTERNAL_H__ 1#ifndef __LINUX_EXTCON_INTERNAL_H__
2#define __LINUX_EXTCON_INTERNAL_H__ 2#define __LINUX_EXTCON_INTERNAL_H__
3 3
4#include <linux/extcon.h> 4#include <linux/extcon-provider.h>
5 5
6/** 6/**
7 * struct extcon_dev - An extcon device represents one external connector. 7 * struct extcon_dev - An extcon device represents one external connector.
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 1161e11fb3cf..ef34f97f214b 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -24,7 +24,7 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/extcon.h> 27#include <linux/extcon-provider.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
index d099a0c8cee5..7ceea5ae2704 100644
--- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
+++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/extcon.h> 15#include <linux/extcon-provider.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/gpio/consumer.h> 17#include <linux/gpio/consumer.h>
18#include <linux/init.h> 18#include <linux/init.h>
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 54c34298a000..b33e2994ccce 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -12,7 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/extcon.h> 15#include <linux/extcon-provider.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/module.h> 18#include <linux/module.h>
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index ee7ce5ee53f9..5049dac79bd0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -17,7 +17,7 @@
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/extcon.h> 20#include <linux/extcon-provider.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gpio/consumer.h> 23#include <linux/gpio/consumer.h>
diff --git a/drivers/power/supply/qcom_smbb.c b/drivers/power/supply/qcom_smbb.c
index f6a0d245731d..11de691b9a71 100644
--- a/drivers/power/supply/qcom_smbb.c
+++ b/drivers/power/supply/qcom_smbb.c
@@ -34,7 +34,7 @@
34#include <linux/power_supply.h> 34#include <linux/power_supply.h>
35#include <linux/regmap.h> 35#include <linux/regmap.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/extcon.h> 37#include <linux/extcon-provider.h>
38#include <linux/regulator/driver.h> 38#include <linux/regulator/driver.h>
39 39
40#define SMBB_CHG_VMAX 0x040 40#define SMBB_CHG_VMAX 0x040
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index df37c1e6e9d5..8b4d051fdbed 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -12,7 +12,7 @@
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/extcon.h> 15#include <linux/extcon-provider.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/module.h> 18#include <linux/module.h>
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 8babd318c0ed..354e8c98af05 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -23,7 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/usb.h> 25#include <linux/usb.h>
26#include <linux/extcon.h> 26#include <linux/extcon-provider.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/usb/otg.h> 29#include <linux/usb/otg.h>
diff --git a/include/linux/extcon-provider.h b/include/linux/extcon-provider.h
new file mode 100644
index 000000000000..2feca5881fa7
--- /dev/null
+++ b/include/linux/extcon-provider.h
@@ -0,0 +1,142 @@
1/*
2 * External Connector (extcon) framework
3 * - linux/include/linux/extcon-provider.h for extcon provider device driver.
4 *
5 * Copyright (C) 2017 Samsung Electronics
6 * Author: Chanwoo Choi <cw00.choi@samsung.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_EXTCON_PROVIDER_H__
19#define __LINUX_EXTCON_PROVIDER_H__
20
21#include <linux/extcon.h>
22
23struct extcon_dev;
24
25#if IS_ENABLED(CONFIG_EXTCON)
26
27/* Following APIs register/unregister the extcon device. */
28extern int extcon_dev_register(struct extcon_dev *edev);
29extern void extcon_dev_unregister(struct extcon_dev *edev);
30extern int devm_extcon_dev_register(struct device *dev,
31 struct extcon_dev *edev);
32extern void devm_extcon_dev_unregister(struct device *dev,
33 struct extcon_dev *edev);
34
35/* Following APIs allocate/free the memory of the extcon device. */
36extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
37extern void extcon_dev_free(struct extcon_dev *edev);
38extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
39 const unsigned int *cable);
40extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
41
42/* Synchronize the state and property value for each external connector. */
43extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
44
45/*
46 * Following APIs set the connected state of each external connector.
47 * The 'id' argument indicates the defined external connector.
48 */
49extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
50 bool state);
51extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
52 bool state);
53
54/*
55 * Following APIs set the property of each external connector.
56 * The 'id' argument indicates the defined external connector
57 * and the 'prop' indicates the extcon property.
58 *
59 * And extcon_set_property_capability() set the capability of the property
60 * for each external connector. They are used to set the capability of the
61 * property of each external connector based on the id and property.
62 */
63extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
64 unsigned int prop,
65 union extcon_property_value prop_val);
66extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
67 unsigned int prop,
68 union extcon_property_value prop_val);
69extern int extcon_set_property_capability(struct extcon_dev *edev,
70 unsigned int id, unsigned int prop);
71
72#else /* CONFIG_EXTCON */
73static inline int extcon_dev_register(struct extcon_dev *edev)
74{
75 return 0;
76}
77
78static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
79
80static inline int devm_extcon_dev_register(struct device *dev,
81 struct extcon_dev *edev)
82{
83 return -EINVAL;
84}
85
86static inline void devm_extcon_dev_unregister(struct device *dev,
87 struct extcon_dev *edev) { }
88
89static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
90{
91 return ERR_PTR(-ENOSYS);
92}
93
94static inline void extcon_dev_free(struct extcon_dev *edev) { }
95
96static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
97 const unsigned int *cable)
98{
99 return ERR_PTR(-ENOSYS);
100}
101
102static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
103
104
105static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
106 bool state)
107{
108 return 0;
109}
110
111static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
112 bool state)
113{
114 return 0;
115}
116
117static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
118{
119 return 0;
120}
121
122static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
123 unsigned int prop,
124 union extcon_property_value prop_val)
125{
126 return 0;
127}
128
129static inline int extcon_set_property_sync(struct extcon_dev *edev,
130 unsigned int id, unsigned int prop,
131 union extcon_property_value prop_val)
132{
133 return 0;
134}
135
136static inline int extcon_set_property_capability(struct extcon_dev *edev,
137 unsigned int id, unsigned int prop)
138{
139 return 0;
140}
141#endif /* CONFIG_EXTCON */
142#endif /* __LINUX_EXTCON_PROVIDER_H__ */
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 744d60ca80c3..6d94e82c8ad9 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * External Connector (extcon) framework 2 * External Connector (extcon) framework
3 * - linux/include/linux/extcon.h for extcon consumer device driver.
3 * 4 *
4 * Copyright (C) 2015 Samsung Electronics 5 * Copyright (C) 2015 Samsung Electronics
5 * Author: Chanwoo Choi <cw00.choi@samsung.com> 6 * Author: Chanwoo Choi <cw00.choi@samsung.com>
@@ -170,61 +171,29 @@ union extcon_property_value {
170 int intval; /* type : integer (intval) */ 171 int intval; /* type : integer (intval) */
171}; 172};
172 173
173struct extcon_cable;
174struct extcon_dev; 174struct extcon_dev;
175 175
176#if IS_ENABLED(CONFIG_EXTCON) 176#if IS_ENABLED(CONFIG_EXTCON)
177
178/* Following APIs register/unregister the extcon device. */
179extern int extcon_dev_register(struct extcon_dev *edev);
180extern void extcon_dev_unregister(struct extcon_dev *edev);
181extern int devm_extcon_dev_register(struct device *dev,
182 struct extcon_dev *edev);
183extern void devm_extcon_dev_unregister(struct device *dev,
184 struct extcon_dev *edev);
185
186/* Following APIs allocate/free the memory of the extcon device. */
187extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
188extern void extcon_dev_free(struct extcon_dev *edev);
189extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
190 const unsigned int *cable);
191extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
192
193/* Synchronize the state and property value for each external connector. */
194extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
195
196/* 177/*
197 * Following APIs get/set the connected state of each external connector. 178 * Following APIs get the connected state of each external connector.
198 * The 'id' argument indicates the defined external connector. 179 * The 'id' argument indicates the defined external connector.
199 */ 180 */
200extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); 181extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
201extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
202 bool state);
203extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
204 bool state);
205 182
206/* 183/*
207 * Following APIs get/set the property of each external connector. 184 * Following APIs get the property of each external connector.
208 * The 'id' argument indicates the defined external connector 185 * The 'id' argument indicates the defined external connector
209 * and the 'prop' indicates the extcon property. 186 * and the 'prop' indicates the extcon property.
210 * 187 *
211 * And extcon_get/set_property_capability() set the capability of the property 188 * And extcon_get_property_capability() get the capability of the property
212 * for each external connector. They are used to set the capability of the 189 * for each external connector. They are used to get the capability of the
213 * property of each external connector based on the id and property. 190 * property of each external connector based on the id and property.
214 */ 191 */
215extern int extcon_get_property(struct extcon_dev *edev, unsigned int id, 192extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
216 unsigned int prop, 193 unsigned int prop,
217 union extcon_property_value *prop_val); 194 union extcon_property_value *prop_val);
218extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
219 unsigned int prop,
220 union extcon_property_value prop_val);
221extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
222 unsigned int prop,
223 union extcon_property_value prop_val);
224extern int extcon_get_property_capability(struct extcon_dev *edev, 195extern int extcon_get_property_capability(struct extcon_dev *edev,
225 unsigned int id, unsigned int prop); 196 unsigned int id, unsigned int prop);
226extern int extcon_set_property_capability(struct extcon_dev *edev,
227 unsigned int id, unsigned int prop);
228 197
229/* 198/*
230 * Following APIs register the notifier block in order to detect 199 * 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,
268extern const char *extcon_get_edev_name(struct extcon_dev *edev); 237extern const char *extcon_get_edev_name(struct extcon_dev *edev);
269 238
270#else /* CONFIG_EXTCON */ 239#else /* CONFIG_EXTCON */
271static inline int extcon_dev_register(struct extcon_dev *edev)
272{
273 return 0;
274}
275
276static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
277
278static inline int devm_extcon_dev_register(struct device *dev,
279 struct extcon_dev *edev)
280{
281 return -EINVAL;
282}
283
284static inline void devm_extcon_dev_unregister(struct device *dev,
285 struct extcon_dev *edev) { }
286
287static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
288{
289 return ERR_PTR(-ENOSYS);
290}
291
292static inline void extcon_dev_free(struct extcon_dev *edev) { }
293
294static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
295 const unsigned int *cable)
296{
297 return ERR_PTR(-ENOSYS);
298}
299
300static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
301
302
303static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id) 240static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
304{ 241{
305 return 0; 242 return 0;
306} 243}
307 244
308static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
309 bool state)
310{
311 return 0;
312}
313
314static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
315 bool state)
316{
317 return 0;
318}
319
320static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
321{
322 return 0;
323}
324
325static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id, 245static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
326 unsigned int prop, 246 unsigned int prop,
327 union extcon_property_value *prop_val) 247 union extcon_property_value *prop_val)
328{ 248{
329 return 0; 249 return 0;
330} 250}
331static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
332 unsigned int prop,
333 union extcon_property_value prop_val)
334{
335 return 0;
336}
337
338static inline int extcon_set_property_sync(struct extcon_dev *edev,
339 unsigned int id, unsigned int prop,
340 union extcon_property_value prop_val)
341{
342 return 0;
343}
344 251
345static inline int extcon_get_property_capability(struct extcon_dev *edev, 252static inline int extcon_get_property_capability(struct extcon_dev *edev,
346 unsigned int id, unsigned int prop) 253 unsigned int id, unsigned int prop)
@@ -348,12 +255,6 @@ static inline int extcon_get_property_capability(struct extcon_dev *edev,
348 return 0; 255 return 0;
349} 256}
350 257
351static inline int extcon_set_property_capability(struct extcon_dev *edev,
352 unsigned int id, unsigned int prop)
353{
354 return 0;
355}
356
357static inline int extcon_register_notifier(struct extcon_dev *edev, 258static inline int extcon_register_notifier(struct extcon_dev *edev,
358 unsigned int id, struct notifier_block *nb) 259 unsigned int id, struct notifier_block *nb)
359{ 260{
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 6dec43826303..3c8568aa82a5 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -20,7 +20,7 @@
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
23#include <linux/extcon.h> 23#include <linux/extcon-provider.h>
24#include <linux/of_gpio.h> 24#include <linux/of_gpio.h>
25#include <linux/usb/phy_companion.h> 25#include <linux/usb/phy_companion.h>
26 26