Lines Matching +full:drive +full:- +full:open +full:- +full:drain
1 // SPDX-License-Identifier: GPL-2.0-only
3 * 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()
110 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_set_config()
113 * ODM bit 0 = drive to GND or Hi-Z (open drain) in tc3589x_gpio_set_config()
114 * ODM bit 1 = drive to VDD or Hi-Z (open source) in tc3589x_gpio_set_config()
123 /* Set open drain mode */ in tc3589x_gpio_set_config()
127 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
130 /* Set open source mode */ in tc3589x_gpio_set_config()
134 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
137 /* Disable open drain/source mode */ in tc3589x_gpio_set_config()
142 return -ENOTSUPP; in tc3589x_gpio_set_config()
161 int offset = d->hwirq; in tc3589x_gpio_irq_set_type()
166 tc3589x_gpio->regs[REG_IBE][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
170 tc3589x_gpio->regs[REG_IBE][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
173 tc3589x_gpio->regs[REG_IS][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
175 tc3589x_gpio->regs[REG_IS][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
178 tc3589x_gpio->regs[REG_IEV][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
180 tc3589x_gpio->regs[REG_IEV][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
190 mutex_lock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_lock()
197 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq_sync_unlock()
209 u8 old = tc3589x_gpio->oldregs[i][j]; in tc3589x_gpio_irq_sync_unlock()
210 u8 new = tc3589x_gpio->regs[i][j]; in tc3589x_gpio_irq_sync_unlock()
215 tc3589x_gpio->oldregs[i][j] = new; in tc3589x_gpio_irq_sync_unlock()
220 mutex_unlock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_sync_unlock()
227 int offset = d->hwirq; in tc3589x_gpio_irq_mask()
231 tc3589x_gpio->regs[REG_IE][regoffset] &= ~mask; in tc3589x_gpio_irq_mask()
232 tc3589x_gpio->regs[REG_DIRECT][regoffset] |= mask; in tc3589x_gpio_irq_mask()
240 int offset = d->hwirq; in tc3589x_gpio_irq_unmask()
245 tc3589x_gpio->regs[REG_IE][regoffset] |= mask; in tc3589x_gpio_irq_unmask()
246 tc3589x_gpio->regs[REG_DIRECT][regoffset] &= ~mask; in tc3589x_gpio_irq_unmask()
250 .name = "tc3589x-gpio",
263 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq()
281 int irq = irq_find_mapping(tc3589x_gpio->chip.irq.domain, in tc3589x_gpio_irq()
296 struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); in tc3589x_gpio_probe()
297 struct device_node *np = pdev->dev.of_node; in tc3589x_gpio_probe()
304 dev_err(&pdev->dev, "No Device Tree node found\n"); in tc3589x_gpio_probe()
305 return -EINVAL; in tc3589x_gpio_probe()
312 tc3589x_gpio = devm_kzalloc(&pdev->dev, sizeof(struct tc3589x_gpio), in tc3589x_gpio_probe()
315 return -ENOMEM; in tc3589x_gpio_probe()
317 mutex_init(&tc3589x_gpio->irq_lock); in tc3589x_gpio_probe()
319 tc3589x_gpio->dev = &pdev->dev; in tc3589x_gpio_probe()
320 tc3589x_gpio->tc3589x = tc3589x; in tc3589x_gpio_probe()
322 tc3589x_gpio->chip = template_chip; in tc3589x_gpio_probe()
323 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; in tc3589x_gpio_probe()
324 tc3589x_gpio->chip.parent = &pdev->dev; in tc3589x_gpio_probe()
325 tc3589x_gpio->chip.base = -1; in tc3589x_gpio_probe()
327 girq = &tc3589x_gpio->chip.irq; in tc3589x_gpio_probe()
330 girq->parent_handler = NULL; in tc3589x_gpio_probe()
331 girq->num_parents = 0; in tc3589x_gpio_probe()
332 girq->parents = NULL; in tc3589x_gpio_probe()
333 girq->default_type = IRQ_TYPE_NONE; in tc3589x_gpio_probe()
334 girq->handler = handle_simple_irq; in tc3589x_gpio_probe()
335 girq->threaded = true; in tc3589x_gpio_probe()
354 ret = devm_request_threaded_irq(&pdev->dev, in tc3589x_gpio_probe()
356 IRQF_ONESHOT, "tc3589x-gpio", in tc3589x_gpio_probe()
359 dev_err(&pdev->dev, "unable to get irq: %d\n", ret); in tc3589x_gpio_probe()
363 return devm_gpiochip_add_data(&pdev->dev, &tc3589x_gpio->chip, tc3589x_gpio); in tc3589x_gpio_probe()
367 .driver.name = "tc3589x-gpio",