From 6190633bb7e59e588daae7ef23b0c0d2ade13508 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 25 Jul 2012 22:54:29 +0200 Subject: [PATCH] --- yaml --- r: 324319 b: refs/heads/master c: d2323cf77308d6aa13a3a5287310ef93c4919d1e h: refs/heads/master i: 324317: 3ac99ba13bd3c7ea3362174ce4235fd6b4cdb903 324315: 4f793995546eeef45811d59c710626757c786bfc 324311: be71d61e85530bc593ba636c66df540e92e64500 324303: cfe2e180caa194da294b13b64f2478e4c82e6ba2 324287: 901c993e8d23bee55176756b2a22f263e49f8ace v: v3 --- [refs] | 2 +- trunk/drivers/w1/masters/w1-gpio.c | 18 +++++++++++++++++- trunk/include/linux/w1-gpio.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 393f1bc99db1..aa9b8429421e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5f3d1382e3ca39a54032784414f0ad4e7078b37e +refs/heads/master: d2323cf77308d6aa13a3a5287310ef93c4919d1e diff --git a/trunk/drivers/w1/masters/w1-gpio.c b/trunk/drivers/w1/masters/w1-gpio.c index f01c336233da..6012c4ea3206 100644 --- a/trunk/drivers/w1/masters/w1-gpio.c +++ b/trunk/drivers/w1/masters/w1-gpio.c @@ -104,6 +104,13 @@ static int __init w1_gpio_probe(struct platform_device *pdev) if (err) goto free_master; + if (gpio_is_valid(pdata->ext_pullup_enable_pin)) { + err = gpio_request_one(pdata->ext_pullup_enable_pin, + GPIOF_INIT_LOW, "w1 pullup"); + if (err < 0) + goto free_gpio; + } + master->data = pdata; master->read_bit = w1_gpio_read_bit; @@ -117,15 +124,21 @@ static int __init w1_gpio_probe(struct platform_device *pdev) err = w1_add_master_device(master); if (err) - goto free_gpio; + goto free_gpio_ext_pu; if (pdata->enable_external_pullup) pdata->enable_external_pullup(1); + if (gpio_is_valid(pdata->ext_pullup_enable_pin)) + gpio_set_value(pdata->ext_pullup_enable_pin, 1); + platform_set_drvdata(pdev, master); return 0; + free_gpio_ext_pu: + if (gpio_is_valid(pdata->ext_pullup_enable_pin)) + gpio_free(pdata->ext_pullup_enable_pin); free_gpio: gpio_free(pdata->pin); free_master: @@ -142,6 +155,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev) if (pdata->enable_external_pullup) pdata->enable_external_pullup(0); + if (gpio_is_valid(pdata->ext_pullup_enable_pin)) + gpio_set_value(pdata->ext_pullup_enable_pin, 0); + w1_remove_master_device(master); gpio_free(pdata->pin); kfree(master); diff --git a/trunk/include/linux/w1-gpio.h b/trunk/include/linux/w1-gpio.h index 3adeff82212f..065e3ae79ab0 100644 --- a/trunk/include/linux/w1-gpio.h +++ b/trunk/include/linux/w1-gpio.h @@ -19,6 +19,7 @@ struct w1_gpio_platform_data { unsigned int pin; unsigned int is_open_drain:1; void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; }; #endif /* _LINUX_W1_GPIO_H */