2008-02-06 17:39:01 +08:00
|
|
|
Kernel driver w1-gpio
|
|
|
|
=====================
|
|
|
|
|
|
|
|
Author: Ville Syrjala <syrjala@sci.fi>
|
|
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
|
|
|
|
GPIO 1-wire bus master driver. The driver uses the GPIO API to control the
|
2017-09-27 02:27:09 +08:00
|
|
|
wire and the GPIO pin can be specified using GPIO machine descriptor tables.
|
|
|
|
It is also possible to define the master using device tree, see
|
|
|
|
Documentation/devicetree/bindings/w1/w1-gpio.txt
|
2008-02-06 17:39:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
Example (mach-at91)
|
|
|
|
-------------------
|
|
|
|
|
2017-09-27 02:27:09 +08:00
|
|
|
#include <linux/gpio/machine.h>
|
2008-02-06 17:39:01 +08:00
|
|
|
#include <linux/w1-gpio.h>
|
|
|
|
|
2017-09-27 02:27:09 +08:00
|
|
|
static struct gpiod_lookup_table foo_w1_gpiod_table = {
|
|
|
|
.dev_id = "w1-gpio",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP_IDX("at91-gpio", AT91_PIN_PB20, NULL, 0,
|
|
|
|
GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-02-06 17:39:01 +08:00
|
|
|
static struct w1_gpio_platform_data foo_w1_gpio_pdata = {
|
2017-09-27 02:27:09 +08:00
|
|
|
.ext_pullup_enable_pin = -EINVAL,
|
2008-02-06 17:39:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device foo_w1_device = {
|
|
|
|
.name = "w1-gpio",
|
|
|
|
.id = -1,
|
|
|
|
.dev.platform_data = &foo_w1_gpio_pdata,
|
|
|
|
};
|
|
|
|
|
|
|
|
...
|
|
|
|
at91_set_GPIO_periph(foo_w1_gpio_pdata.pin, 1);
|
|
|
|
at91_set_multi_drive(foo_w1_gpio_pdata.pin, 1);
|
2017-09-27 02:27:09 +08:00
|
|
|
gpiod_add_lookup_table(&foo_w1_gpiod_table);
|
2008-02-06 17:39:01 +08:00
|
|
|
platform_device_register(&foo_w1_device);
|