0001 =====================
0002 Kernel driver w1-gpio
0003 =====================
0004
0005 Author: Ville Syrjala <syrjala@sci.fi>
0006
0007
0008 Description
0009 -----------
0010
0011 GPIO 1-wire bus master driver. The driver uses the GPIO API to control the
0012 wire and the GPIO pin can be specified using GPIO machine descriptor tables.
0013 It is also possible to define the master using device tree, see
0014 Documentation/devicetree/bindings/w1/w1-gpio.yaml
0015
0016
0017 Example (mach-at91)
0018 -------------------
0019
0020 ::
0021
0022 #include <linux/gpio/machine.h>
0023 #include <linux/w1-gpio.h>
0024
0025 static struct gpiod_lookup_table foo_w1_gpiod_table = {
0026 .dev_id = "w1-gpio",
0027 .table = {
0028 GPIO_LOOKUP_IDX("at91-gpio", AT91_PIN_PB20, NULL, 0,
0029 GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN),
0030 },
0031 };
0032
0033 static struct w1_gpio_platform_data foo_w1_gpio_pdata = {
0034 .ext_pullup_enable_pin = -EINVAL,
0035 };
0036
0037 static struct platform_device foo_w1_device = {
0038 .name = "w1-gpio",
0039 .id = -1,
0040 .dev.platform_data = &foo_w1_gpio_pdata,
0041 };
0042
0043 ...
0044 at91_set_GPIO_periph(foo_w1_gpio_pdata.pin, 1);
0045 at91_set_multi_drive(foo_w1_gpio_pdata.pin, 1);
0046 gpiod_add_lookup_table(&foo_w1_gpiod_table);
0047 platform_device_register(&foo_w1_device);