Lines Matching +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()
83 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_direction_input()
94 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_get_direction()
113 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_set_config()
116 * ODM bit 0 = drive to GND or Hi-Z (open drain) in tc3589x_gpio_set_config()
117 * ODM bit 1 = drive to VDD or Hi-Z (open source) in tc3589x_gpio_set_config()
126 /* Set open drain mode */ in tc3589x_gpio_set_config()
130 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
133 /* Set open source mode */ in tc3589x_gpio_set_config()
137 /* Enable open drain/source mode */ in tc3589x_gpio_set_config()
140 /* Disable open drain/source mode */ in tc3589x_gpio_set_config()
145 return -ENOTSUPP; in tc3589x_gpio_set_config()
164 int offset = d->hwirq; in tc3589x_gpio_irq_set_type()
169 tc3589x_gpio->regs[REG_IBE][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
173 tc3589x_gpio->regs[REG_IBE][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
176 tc3589x_gpio->regs[REG_IS][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
178 tc3589x_gpio->regs[REG_IS][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
181 tc3589x_gpio->regs[REG_IEV][regoffset] |= mask; in tc3589x_gpio_irq_set_type()
183 tc3589x_gpio->regs[REG_IEV][regoffset] &= ~mask; in tc3589x_gpio_irq_set_type()
193 mutex_lock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_lock()
200 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq_sync_unlock()
212 u8 old = tc3589x_gpio->oldregs[i][j]; in tc3589x_gpio_irq_sync_unlock()
213 u8 new = tc3589x_gpio->regs[i][j]; in tc3589x_gpio_irq_sync_unlock()
218 tc3589x_gpio->oldregs[i][j] = new; in tc3589x_gpio_irq_sync_unlock()
223 mutex_unlock(&tc3589x_gpio->irq_lock); in tc3589x_gpio_irq_sync_unlock()
230 int offset = d->hwirq; in tc3589x_gpio_irq_mask()
234 tc3589x_gpio->regs[REG_IE][regoffset] &= ~mask; in tc3589x_gpio_irq_mask()
235 tc3589x_gpio->regs[REG_DIRECT][regoffset] |= mask; in tc3589x_gpio_irq_mask()
243 int offset = d->hwirq; in tc3589x_gpio_irq_unmask()
248 tc3589x_gpio->regs[REG_IE][regoffset] |= mask; in tc3589x_gpio_irq_unmask()
249 tc3589x_gpio->regs[REG_DIRECT][regoffset] &= ~mask; in tc3589x_gpio_irq_unmask()
253 .name = "tc3589x-gpio",
266 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; in tc3589x_gpio_irq()
284 int irq = irq_find_mapping(tc3589x_gpio->chip.irq.domain, in tc3589x_gpio_irq()
299 struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); in tc3589x_gpio_probe()
300 struct device_node *np = pdev->dev.of_node; in tc3589x_gpio_probe()
307 dev_err(&pdev->dev, "No Device Tree node found\n"); in tc3589x_gpio_probe()
308 return -EINVAL; in tc3589x_gpio_probe()
315 tc3589x_gpio = devm_kzalloc(&pdev->dev, sizeof(struct tc3589x_gpio), in tc3589x_gpio_probe()
318 return -ENOMEM; in tc3589x_gpio_probe()
320 mutex_init(&tc3589x_gpio->irq_lock); in tc3589x_gpio_probe()
322 tc3589x_gpio->dev = &pdev->dev; in tc3589x_gpio_probe()
323 tc3589x_gpio->tc3589x = tc3589x; in tc3589x_gpio_probe()
325 tc3589x_gpio->chip = template_chip; in tc3589x_gpio_probe()
326 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; in tc3589x_gpio_probe()
327 tc3589x_gpio->chip.parent = &pdev->dev; in tc3589x_gpio_probe()
328 tc3589x_gpio->chip.base = -1; in tc3589x_gpio_probe()
330 girq = &tc3589x_gpio->chip.irq; in tc3589x_gpio_probe()
333 girq->parent_handler = NULL; in tc3589x_gpio_probe()
334 girq->num_parents = 0; in tc3589x_gpio_probe()
335 girq->parents = NULL; in tc3589x_gpio_probe()
336 girq->default_type = IRQ_TYPE_NONE; in tc3589x_gpio_probe()
337 girq->handler = handle_simple_irq; in tc3589x_gpio_probe()
338 girq->threaded = true; in tc3589x_gpio_probe()
357 ret = devm_request_threaded_irq(&pdev->dev, in tc3589x_gpio_probe()
359 IRQF_ONESHOT, "tc3589x-gpio", in tc3589x_gpio_probe()
362 dev_err(&pdev->dev, "unable to get irq: %d\n", ret); in tc3589x_gpio_probe()
366 return devm_gpiochip_add_data(&pdev->dev, &tc3589x_gpio->chip, tc3589x_gpio); in tc3589x_gpio_probe()
370 .driver.name = "tc3589x-gpio",