Commit | Line | Data |
---|---|---|
ad8dc96e VS |
1 | Kernel driver w1-gpio |
2 | ===================== | |
3 | ||
4 | Author: Ville Syrjala <syrjala@sci.fi> | |
5 | ||
6 | ||
7 | Description | |
8 | ----------- | |
9 | ||
10 | GPIO 1-wire bus master driver. The driver uses the GPIO API to control the | |
e0fc62a6 LW |
11 | wire and the GPIO pin can be specified using GPIO machine descriptor tables. |
12 | It is also possible to define the master using device tree, see | |
13 | Documentation/devicetree/bindings/w1/w1-gpio.txt | |
ad8dc96e VS |
14 | |
15 | ||
16 | Example (mach-at91) | |
17 | ------------------- | |
18 | ||
e0fc62a6 | 19 | #include <linux/gpio/machine.h> |
ad8dc96e VS |
20 | #include <linux/w1-gpio.h> |
21 | ||
e0fc62a6 LW |
22 | static struct gpiod_lookup_table foo_w1_gpiod_table = { |
23 | .dev_id = "w1-gpio", | |
24 | .table = { | |
25 | GPIO_LOOKUP_IDX("at91-gpio", AT91_PIN_PB20, NULL, 0, | |
26 | GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN), | |
27 | }, | |
28 | }; | |
29 | ||
ad8dc96e | 30 | static struct w1_gpio_platform_data foo_w1_gpio_pdata = { |
e0fc62a6 | 31 | .ext_pullup_enable_pin = -EINVAL, |
ad8dc96e VS |
32 | }; |
33 | ||
34 | static struct platform_device foo_w1_device = { | |
35 | .name = "w1-gpio", | |
36 | .id = -1, | |
37 | .dev.platform_data = &foo_w1_gpio_pdata, | |
38 | }; | |
39 | ||
40 | ... | |
41 | at91_set_GPIO_periph(foo_w1_gpio_pdata.pin, 1); | |
42 | at91_set_multi_drive(foo_w1_gpio_pdata.pin, 1); | |
e0fc62a6 | 43 | gpiod_add_lookup_table(&foo_w1_gpiod_table); |
ad8dc96e | 44 | platform_device_register(&foo_w1_device); |