* [merged] w1-gpio-add-external-pull-up-enable-callback.patch removed from -mm tree
@ 2009-06-18 22:48 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2009-06-18 22:48 UTC (permalink / raw)
To: daniel, johnpol, syrjala, mm-commits
The patch titled
w1-gpio: add external pull-up enable callback
has been removed from the -mm tree. Its filename was
w1-gpio-add-external-pull-up-enable-callback.patch
This patch was dropped because it was merged into mainline or a subsystem tree
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: w1-gpio: add external pull-up enable callback
From: Daniel Mack <daniel@caiaq.de>
On embedded devices, sleep mode conditions can be tricky to handle,
Especially when processors tend to pull-down the w1 bus during sleep. Bus
slaves (such as the ds2760) may interpret this as a reason for power-down
conditions and entirely switch off the device.
This patch adds a callback function pointer to let users switch on and off
the external pull-up resistor. This lets the outside world know whether
the processor is currently actively driving the bus or not.
When this callback is not provided, the code behaviour won't change.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Ville Syrjala <syrjala@sci.fi>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/w1/masters/w1-gpio.c | 35 +++++++++++++++++++++++++++++++++
include/linux/w1-gpio.h | 1
2 files changed, 36 insertions(+)
diff -puN drivers/w1/masters/w1-gpio.c~w1-gpio-add-external-pull-up-enable-callback drivers/w1/masters/w1-gpio.c
--- a/drivers/w1/masters/w1-gpio.c~w1-gpio-add-external-pull-up-enable-callback
+++ a/drivers/w1/masters/w1-gpio.c
@@ -74,6 +74,9 @@ static int __init w1_gpio_probe(struct p
if (err)
goto free_gpio;
+ if (pdata->enable_external_pullup)
+ pdata->enable_external_pullup(1);
+
platform_set_drvdata(pdev, master);
return 0;
@@ -91,6 +94,9 @@ static int __exit w1_gpio_remove(struct
struct w1_bus_master *master = platform_get_drvdata(pdev);
struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
+ if (pdata->enable_external_pullup)
+ pdata->enable_external_pullup(0);
+
w1_remove_master_device(master);
gpio_free(pdata->pin);
kfree(master);
@@ -98,12 +104,41 @@ static int __exit w1_gpio_remove(struct
return 0;
}
+#ifdef CONFIG_PM
+
+static int w1_gpio_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
+
+ if (pdata->enable_external_pullup)
+ pdata->enable_external_pullup(0);
+
+ return 0;
+}
+
+static int w1_gpio_resume(struct platform_device *pdev)
+{
+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
+
+ if (pdata->enable_external_pullup)
+ pdata->enable_external_pullup(1);
+
+ return 0;
+}
+
+#else
+#define w1_gpio_suspend NULL
+#define w1_gpio_resume NULL
+#endif
+
static struct platform_driver w1_gpio_driver = {
.driver = {
.name = "w1-gpio",
.owner = THIS_MODULE,
},
.remove = __exit_p(w1_gpio_remove),
+ .suspend = w1_gpio_suspend,
+ .resume = w1_gpio_resume,
};
static int __init w1_gpio_init(void)
diff -puN include/linux/w1-gpio.h~w1-gpio-add-external-pull-up-enable-callback include/linux/w1-gpio.h
--- a/include/linux/w1-gpio.h~w1-gpio-add-external-pull-up-enable-callback
+++ a/include/linux/w1-gpio.h
@@ -18,6 +18,7 @@
struct w1_gpio_platform_data {
unsigned int pin;
unsigned int is_open_drain:1;
+ void (*enable_external_pullup)(int enable);
};
#endif /* _LINUX_W1_GPIO_H */
_
Patches currently in -mm which might be from daniel@caiaq.de are
origin.patch
linux-next.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-18 22:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 22:48 [merged] w1-gpio-add-external-pull-up-enable-callback.patch removed from -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.