summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/extcon/extcon-palmas.txt1
-rw-r--r--drivers/extcon/extcon-palmas.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt
index 7dab6a8f4a0e..723aaf798a08 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt
@@ -8,6 +8,7 @@ Optional Properties:
- ti,wakeup : To enable the wakeup comparator in probe
- ti,enable-id-detection: Perform ID detection.
- ti,enable-vbus-detection: Perform VBUS detection.
+ - extcon-name: Name of extcon connection.
palmas-usb {
compatible = "ti,twl6035-usb", "ti,palmas-usb";
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index c84f36216f7b..627623a8f4a0 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -311,6 +311,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node;
struct palmas_usb *palmas_usb;
int status;
+ const char *ext_name = NULL;
palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
@@ -326,6 +327,9 @@ static int palmas_usb_probe(struct platform_device *pdev)
"ti,enable-id-detection");
palmas_usb->enable_vbus_detection = of_property_read_bool(node,
"ti,enable-vbus-detection");
+ status = of_property_read_string(node, "extcon-name", &ext_name);
+ if (status < 0)
+ ext_name = NULL;
} else {
palmas_usb->wakeup = true;
palmas_usb->enable_id_detection = true;
@@ -339,6 +343,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
epdata->enable_vbus_detection;
if (palmas_usb->enable_id_detection)
palmas_usb->wakeup = true;
+ ext_name = epdata->connection_name;
}
}
@@ -358,8 +363,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->edev.supported_cable = palmas_extcon_cable;
palmas_usb->edev.mutually_exclusive = mutually_exclusive;
- palmas_usb->edev.name = (epdata && epdata->connection_name) ?
- epdata->connection_name : pdev->name;
+ palmas_usb->edev.name = (ext_name) ? ext_name : dev_name(&pdev->dev);
status = extcon_dev_register(&palmas_usb->edev, palmas_usb->dev);
if (status < 0) {