Lines Matching refs:tb10x_gpio

41 struct tb10x_gpio {  struct
48 static inline u32 tb10x_reg_read(struct tb10x_gpio *gpio, unsigned int offs) in tb10x_reg_read() argument
53 static inline void tb10x_reg_write(struct tb10x_gpio *gpio, unsigned int offs, in tb10x_reg_write()
59 static inline void tb10x_set_bits(struct tb10x_gpio *gpio, unsigned int offs, in tb10x_set_bits()
77 struct tb10x_gpio *tb10x_gpio = gpiochip_get_data(chip); in tb10x_gpio_to_irq() local
79 return irq_create_mapping(tb10x_gpio->domain, offset); in tb10x_gpio_to_irq()
96 struct tb10x_gpio *tb10x_gpio = data; in tb10x_gpio_irq_cascade() local
97 u32 r = tb10x_reg_read(tb10x_gpio, OFFSET_TO_REG_CHANGE); in tb10x_gpio_irq_cascade()
98 u32 m = tb10x_reg_read(tb10x_gpio, OFFSET_TO_REG_INT_EN); in tb10x_gpio_irq_cascade()
103 generic_handle_domain_irq(tb10x_gpio->domain, i); in tb10x_gpio_irq_cascade()
110 struct tb10x_gpio *tb10x_gpio; in tb10x_gpio_probe() local
122 tb10x_gpio = devm_kzalloc(dev, sizeof(*tb10x_gpio), GFP_KERNEL); in tb10x_gpio_probe()
123 if (tb10x_gpio == NULL) in tb10x_gpio_probe()
126 tb10x_gpio->base = devm_platform_ioremap_resource(pdev, 0); in tb10x_gpio_probe()
127 if (IS_ERR(tb10x_gpio->base)) in tb10x_gpio_probe()
128 return PTR_ERR(tb10x_gpio->base); in tb10x_gpio_probe()
130 tb10x_gpio->gc.label = in tb10x_gpio_probe()
132 if (!tb10x_gpio->gc.label) in tb10x_gpio_probe()
140 ret = bgpio_init(&tb10x_gpio->gc, dev, 4, in tb10x_gpio_probe()
141 tb10x_gpio->base + OFFSET_TO_REG_DATA, in tb10x_gpio_probe()
144 tb10x_gpio->base + OFFSET_TO_REG_DDR, in tb10x_gpio_probe()
151 tb10x_gpio->gc.base = -1; in tb10x_gpio_probe()
152 tb10x_gpio->gc.parent = dev; in tb10x_gpio_probe()
153 tb10x_gpio->gc.owner = THIS_MODULE; in tb10x_gpio_probe()
158 tb10x_gpio->gc.ngpio = ngpio; in tb10x_gpio_probe()
159 tb10x_gpio->gc.request = gpiochip_generic_request; in tb10x_gpio_probe()
160 tb10x_gpio->gc.free = gpiochip_generic_free; in tb10x_gpio_probe()
162 ret = devm_gpiochip_add_data(dev, &tb10x_gpio->gc, tb10x_gpio); in tb10x_gpio_probe()
168 platform_set_drvdata(pdev, tb10x_gpio); in tb10x_gpio_probe()
177 tb10x_gpio->gc.to_irq = tb10x_gpio_to_irq; in tb10x_gpio_probe()
178 tb10x_gpio->irq = ret; in tb10x_gpio_probe()
182 dev_name(dev), tb10x_gpio); in tb10x_gpio_probe()
186 tb10x_gpio->domain = irq_domain_add_linear(np, in tb10x_gpio_probe()
187 tb10x_gpio->gc.ngpio, in tb10x_gpio_probe()
189 if (!tb10x_gpio->domain) { in tb10x_gpio_probe()
193 ret = irq_alloc_domain_generic_chips(tb10x_gpio->domain, in tb10x_gpio_probe()
194 tb10x_gpio->gc.ngpio, 1, tb10x_gpio->gc.label, in tb10x_gpio_probe()
200 gc = tb10x_gpio->domain->gc->gc[0]; in tb10x_gpio_probe()
201 gc->reg_base = tb10x_gpio->base; in tb10x_gpio_probe()
214 irq_domain_remove(tb10x_gpio->domain); in tb10x_gpio_probe()
220 struct tb10x_gpio *tb10x_gpio = platform_get_drvdata(pdev); in tb10x_gpio_remove() local
222 if (tb10x_gpio->gc.to_irq) { in tb10x_gpio_remove()
223 irq_remove_generic_chip(tb10x_gpio->domain->gc->gc[0], in tb10x_gpio_remove()
224 BIT(tb10x_gpio->gc.ngpio) - 1, 0, 0); in tb10x_gpio_remove()
225 kfree(tb10x_gpio->domain->gc); in tb10x_gpio_remove()
226 irq_domain_remove(tb10x_gpio->domain); in tb10x_gpio_remove()