Lines Matching +full:drive +full:- +full:open +full:- +full:drain
2 * Copyright (C) ST-Ericsson SA 2010
5 * Author: Hanumath Prasad <hanumath.prasad@stericsson.com> for ST-Ericsson
6 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
40 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_get()
55 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_set()
67 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_direction_output()
80 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_direction_input()
91 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_get_direction()
107 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_set_config()
110 * ODM bit 0 = drive to GND or Hi-Z (open drain) in tc3589x_gpio_set_config()
111 * ODM bit 1 = drive to VDD or Hi-Z (open source) in tc3589x_gpio_set_config()
120 /* Set open drain mode */ in tc3589x_gpio_set_config()
124 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
127 /* Set open source mode */ in tc3589x_gpio_set_config()
131 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
134 /* Disable open drain/source mode */ in tc3589x_gpio_set_config()
139 return -ENOTSUPP; in tc3589x_gpio_set_config()
158 int offset = d->hwirq; in tc3589x_gpio_irq_set_type()
163 tc3589x_gpio->regs[REG_IBE][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
167 tc3589x_gpio->regs[REG_IBE][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
170 tc3589x_gpio->regs[REG_IS][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
172 tc3589x_gpio->regs[REG_IS][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
175 tc3589x_gpio->regs[REG_IEV][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
177 tc3589x_gpio->regs[REG_IEV][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
187 mutex_lock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_lock()
194 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq_sync_unlock()
205 u8 old = tc3589x_gpio->oldregs[i][j]; in tc3589x_gpio_irq_sync_unlock()
206 u8 new = tc3589x_gpio->regs[i][j]; in tc3589x_gpio_irq_sync_unlock()
211 tc3589x_gpio->oldregs[i][j] = new; in tc3589x_gpio_irq_sync_unlock()
216 mutex_unlock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_sync_unlock()
223 int offset = d->hwirq; in tc3589x_gpio_irq_mask()
227 tc3589x_gpio->regs[REG_IE][regoffset] &= ~mask; in tc3589x_gpio_irq_mask()
234 int offset = d->hwirq; in tc3589x_gpio_irq_unmask()
238 tc3589x_gpio->regs[REG_IE][regoffset] |= mask; in tc3589x_gpio_irq_unmask()
242 .name = "tc3589x-gpio",
253 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq()
271 int irq = irq_find_mapping(tc3589x_gpio->chip.irq.domain, in tc3589x_gpio_irq()
286 struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); in tc3589x_gpio_probe()
287 struct device_node *np = pdev->dev.of_node; in tc3589x_gpio_probe()
293 dev_err(&pdev->dev, "No Device Tree node found\n"); in tc3589x_gpio_probe()
294 return -EINVAL; in tc3589x_gpio_probe()
301 tc3589x_gpio = devm_kzalloc(&pdev->dev, sizeof(struct tc3589x_gpio), in tc3589x_gpio_probe()
304 return -ENOMEM; in tc3589x_gpio_probe()
306 mutex_init(&tc3589x_gpio->irq_lock); in tc3589x_gpio_probe()
308 tc3589x_gpio->dev = &pdev->dev; in tc3589x_gpio_probe()
309 tc3589x_gpio->tc3589x = tc3589x; in tc3589x_gpio_probe()
311 tc3589x_gpio->chip = template_chip; in tc3589x_gpio_probe()
312 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; in tc3589x_gpio_probe()
313 tc3589x_gpio->chip.parent = &pdev->dev; in tc3589x_gpio_probe()
314 tc3589x_gpio->chip.base = -1; in tc3589x_gpio_probe()
315 tc3589x_gpio->chip.of_node = np; in tc3589x_gpio_probe()
323 ret = devm_request_threaded_irq(&pdev->dev, in tc3589x_gpio_probe()
325 IRQF_ONESHOT, "tc3589x-gpio", in tc3589x_gpio_probe()
328 dev_err(&pdev->dev, "unable to get irq: %d\n", ret); in tc3589x_gpio_probe()
332 ret = devm_gpiochip_add_data(&pdev->dev, &tc3589x_gpio->chip, in tc3589x_gpio_probe()
335 dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret); in tc3589x_gpio_probe()
339 ret = gpiochip_irqchip_add_nested(&tc3589x_gpio->chip, in tc3589x_gpio_probe()
345 dev_err(&pdev->dev, in tc3589x_gpio_probe()
350 gpiochip_set_nested_irqchip(&tc3589x_gpio->chip, in tc3589x_gpio_probe()
360 .driver.name = "tc3589x-gpio",