summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-axp288.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-12-18 19:13:06 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2017-01-08 20:04:09 -0500
commit768842413997c3c946a716427b78cc308a4fdae0 (patch)
treec134ed0ae494b069e48e2ade6f4b6e9d539cc8e8 /drivers/extcon/extcon-axp288.c
parent9fe172b9be532acc23e35ba693700383ab775e66 (diff)
extcon: axp288: Remove dependency on non-existing platform_data
When the extcon_axp288 driver was originally merged, it was merged with a dependency on some other driver providing platform data for it. However such another driver was never merged, so the extcon_axp288 as merged upstream has never worked, its probe method simply always returns -ENODEV. This commit drops the dependency on the pdata always being there, instead it treats not having pdata as the pdata having a NULL gpio_mux_control, something which the code was already prepared to handle. Note that the code for controlling the mux_control gpio is left in place, as this may be necessary to allow the axp288 pmic to properly detect the charger type (instead of assuming 500mA max charge current) on some tablets. This will make it easier for future patches to add support for this gpio by getting the gpio info from somewhere. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-axp288.c')
-rw-r--r--drivers/extcon/extcon-axp288.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 42f41e808292..a84fab87e201 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -112,7 +112,7 @@ struct axp288_extcon_info {
112 struct device *dev; 112 struct device *dev;
113 struct regmap *regmap; 113 struct regmap *regmap;
114 struct regmap_irq_chip_data *regmap_irqc; 114 struct regmap_irq_chip_data *regmap_irqc;
115 struct axp288_extcon_pdata *pdata; 115 struct gpio_desc *gpio_mux_cntl;
116 int irq[EXTCON_IRQ_END]; 116 int irq[EXTCON_IRQ_END];
117 struct extcon_dev *edev; 117 struct extcon_dev *edev;
118 struct notifier_block extcon_nb; 118 struct notifier_block extcon_nb;
@@ -216,8 +216,8 @@ notify_otg:
216 * If VBUS is absent Connect D+/D- lines to PMIC for BC 216 * If VBUS is absent Connect D+/D- lines to PMIC for BC
217 * detection. Else connect them to SOC for USB communication. 217 * detection. Else connect them to SOC for USB communication.
218 */ 218 */
219 if (info->pdata->gpio_mux_cntl) 219 if (info->gpio_mux_cntl)
220 gpiod_set_value(info->pdata->gpio_mux_cntl, 220 gpiod_set_value(info->gpio_mux_cntl,
221 vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC 221 vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
222 : EXTCON_GPIO_MUX_SEL_PMIC); 222 : EXTCON_GPIO_MUX_SEL_PMIC);
223 223
@@ -271,6 +271,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
271{ 271{
272 struct axp288_extcon_info *info; 272 struct axp288_extcon_info *info;
273 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); 273 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
274 struct axp288_extcon_pdata *pdata = pdev->dev.platform_data;
274 int ret, i, pirq, gpio; 275 int ret, i, pirq, gpio;
275 276
276 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 277 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -280,15 +281,9 @@ static int axp288_extcon_probe(struct platform_device *pdev)
280 info->dev = &pdev->dev; 281 info->dev = &pdev->dev;
281 info->regmap = axp20x->regmap; 282 info->regmap = axp20x->regmap;
282 info->regmap_irqc = axp20x->regmap_irqc; 283 info->regmap_irqc = axp20x->regmap_irqc;
283 info->pdata = pdev->dev.platform_data; 284 if (pdata)
284 285 info->gpio_mux_cntl = pdata->gpio_mux_cntl;
285 if (!info->pdata) { 286
286 /* Try ACPI provided pdata via device properties */
287 if (!device_property_present(&pdev->dev,
288 "axp288_extcon_data\n"))
289 dev_err(&pdev->dev, "failed to get platform data\n");
290 return -ENODEV;
291 }
292 platform_set_drvdata(pdev, info); 287 platform_set_drvdata(pdev, info);
293 288
294 axp288_extcon_log_rsi(info); 289 axp288_extcon_log_rsi(info);
@@ -316,15 +311,15 @@ static int axp288_extcon_probe(struct platform_device *pdev)
316 } 311 }
317 312
318 /* Set up gpio control for USB Mux */ 313 /* Set up gpio control for USB Mux */
319 if (info->pdata->gpio_mux_cntl) { 314 if (info->gpio_mux_cntl) {
320 gpio = desc_to_gpio(info->pdata->gpio_mux_cntl); 315 gpio = desc_to_gpio(info->gpio_mux_cntl);
321 ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX"); 316 ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX");
322 if (ret < 0) { 317 if (ret < 0) {
323 dev_err(&pdev->dev, 318 dev_err(&pdev->dev,
324 "failed to request the gpio=%d\n", gpio); 319 "failed to request the gpio=%d\n", gpio);
325 return ret; 320 return ret;
326 } 321 }
327 gpiod_direction_output(info->pdata->gpio_mux_cntl, 322 gpiod_direction_output(info->gpio_mux_cntl,
328 EXTCON_GPIO_MUX_SEL_PMIC); 323 EXTCON_GPIO_MUX_SEL_PMIC);
329 } 324 }
330 325