• Home
  • Raw
  • Download

Lines Matching +full:delay +full:- +full:line

2  * w1-gpio - GPIO w1 bus master driver
15 #include <linux/w1-gpio.h>
20 #include <linux/delay.h>
24 static u8 w1_gpio_set_pullup(void *data, int delay) in w1_gpio_set_pullup() argument
28 if (delay) { in w1_gpio_set_pullup()
29 pdata->pullup_duration = delay; in w1_gpio_set_pullup()
31 if (pdata->pullup_duration) { in w1_gpio_set_pullup()
33 * This will OVERRIDE open drain emulation and force-pull in w1_gpio_set_pullup()
34 * the line high for some time. in w1_gpio_set_pullup()
36 gpiod_set_raw_value(pdata->gpiod, 1); in w1_gpio_set_pullup()
37 msleep(pdata->pullup_duration); in w1_gpio_set_pullup()
39 * This will simply set the line as input since we are doing in w1_gpio_set_pullup()
42 gpiod_set_value(pdata->gpiod, 1); in w1_gpio_set_pullup()
44 pdata->pullup_duration = 0; in w1_gpio_set_pullup()
54 gpiod_set_value(pdata->gpiod, bit); in w1_gpio_write_bit()
61 return gpiod_get_value(pdata->gpiod) ? 1 : 0; in w1_gpio_read_bit()
66 { .compatible = "w1-gpio" },
76 struct device *dev = &pdev->dev; in w1_gpio_probe()
77 struct device_node *np = dev->of_node; in w1_gpio_probe()
83 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in w1_gpio_probe()
85 return -ENOMEM; in w1_gpio_probe()
89 * already set the line into open drain mode, so we should just in w1_gpio_probe()
90 * driver it high/low like we are in full control of the line and in w1_gpio_probe()
93 if (of_get_property(np, "linux,open-drain", NULL)) in w1_gpio_probe()
96 pdev->dev.platform_data = pdata; in w1_gpio_probe()
102 return -ENXIO; in w1_gpio_probe()
109 return -ENOMEM; in w1_gpio_probe()
112 pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags); in w1_gpio_probe()
113 if (IS_ERR(pdata->gpiod)) { in w1_gpio_probe()
115 return PTR_ERR(pdata->gpiod); in w1_gpio_probe()
118 pdata->pullup_gpiod = in w1_gpio_probe()
120 if (IS_ERR(pdata->pullup_gpiod)) { in w1_gpio_probe()
123 return PTR_ERR(pdata->pullup_gpiod); in w1_gpio_probe()
126 master->data = pdata; in w1_gpio_probe()
127 master->read_bit = w1_gpio_read_bit; in w1_gpio_probe()
128 gpiod_direction_output(pdata->gpiod, 1); in w1_gpio_probe()
129 master->write_bit = w1_gpio_write_bit; in w1_gpio_probe()
133 * we need to use this pullup function that hammers the line in w1_gpio_probe()
134 * high using a raw accessor to provide pull-up for the w1 in w1_gpio_probe()
135 * line. in w1_gpio_probe()
138 master->set_pullup = w1_gpio_set_pullup; in w1_gpio_probe()
146 if (pdata->enable_external_pullup) in w1_gpio_probe()
147 pdata->enable_external_pullup(1); in w1_gpio_probe()
149 if (pdata->pullup_gpiod) in w1_gpio_probe()
150 gpiod_set_value(pdata->pullup_gpiod, 1); in w1_gpio_probe()
160 struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); in w1_gpio_remove()
162 if (pdata->enable_external_pullup) in w1_gpio_remove()
163 pdata->enable_external_pullup(0); in w1_gpio_remove()
165 if (pdata->pullup_gpiod) in w1_gpio_remove()
166 gpiod_set_value(pdata->pullup_gpiod, 0); in w1_gpio_remove()
177 if (pdata->enable_external_pullup) in w1_gpio_suspend()
178 pdata->enable_external_pullup(0); in w1_gpio_suspend()
187 if (pdata->enable_external_pullup) in w1_gpio_resume()
188 pdata->enable_external_pullup(1); in w1_gpio_resume()
197 .name = "w1-gpio",