Lines Matching full:chips

160 	struct davinci_gpio_controller *chips;  in davinci_gpio_probe()  local
195 chips = devm_kzalloc(dev, sizeof(*chips), GFP_KERNEL); in davinci_gpio_probe()
196 if (!chips) in davinci_gpio_probe()
204 chips->irqs[i] = platform_get_irq(pdev, i); in davinci_gpio_probe()
205 if (chips->irqs[i] < 0) in davinci_gpio_probe()
206 return chips->irqs[i]; in davinci_gpio_probe()
209 chips->chip.label = dev_name(dev); in davinci_gpio_probe()
211 chips->chip.direction_input = davinci_direction_in; in davinci_gpio_probe()
212 chips->chip.get = davinci_gpio_get; in davinci_gpio_probe()
213 chips->chip.direction_output = davinci_direction_out; in davinci_gpio_probe()
214 chips->chip.set = davinci_gpio_set; in davinci_gpio_probe()
216 chips->chip.ngpio = ngpio; in davinci_gpio_probe()
217 chips->chip.base = -1; in davinci_gpio_probe()
220 chips->chip.parent = dev; in davinci_gpio_probe()
221 chips->chip.request = gpiochip_generic_request; in davinci_gpio_probe()
222 chips->chip.free = gpiochip_generic_free; in davinci_gpio_probe()
224 spin_lock_init(&chips->lock); in davinci_gpio_probe()
226 chips->gpio_unbanked = gpio_unbanked; in davinci_gpio_probe()
230 chips->regs[bank] = gpio_base + offset_array[bank]; in davinci_gpio_probe()
232 ret = devm_gpiochip_add_data(dev, &chips->chip, chips); in davinci_gpio_probe()
236 platform_set_drvdata(pdev, chips); in davinci_gpio_probe()
400 struct davinci_gpio_controller *chips = in davinci_gpio_irq_map() local
402 struct davinci_gpio_regs __iomem *g = chips->regs[hw / 32]; in davinci_gpio_irq_map()
453 struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); in davinci_gpio_irq_setup() local
467 ngpio = chips->chip.ngpio; in davinci_gpio_irq_setup()
475 if (!chips->gpio_unbanked) { in davinci_gpio_irq_setup()
484 chips); in davinci_gpio_irq_setup()
497 chips->chip.to_irq = gpio_to_irq_banked; in davinci_gpio_irq_setup()
498 chips->irq_domain = irq_domain; in davinci_gpio_irq_setup()
505 if (chips->gpio_unbanked) { in davinci_gpio_irq_setup()
507 chips->chip.to_irq = gpio_to_irq_unbanked; in davinci_gpio_irq_setup()
509 binten = GENMASK(chips->gpio_unbanked / 16, 0); in davinci_gpio_irq_setup()
512 irq = chips->irqs[0]; in davinci_gpio_irq_setup()
518 g = chips->regs[0]; in davinci_gpio_irq_setup()
523 for (gpio = 0; gpio < chips->gpio_unbanked; gpio++) { in davinci_gpio_irq_setup()
524 irq_set_chip(chips->irqs[gpio], irq_chip); in davinci_gpio_irq_setup()
525 irq_set_handler_data(chips->irqs[gpio], chips); in davinci_gpio_irq_setup()
526 irq_set_status_flags(chips->irqs[gpio], in davinci_gpio_irq_setup()
542 g = chips->regs[bank / 2]; in davinci_gpio_irq_setup()
560 irqdata->chip = chips; in davinci_gpio_irq_setup()
562 irq_set_chained_handler_and_data(chips->irqs[bank], in davinci_gpio_irq_setup()
578 static void davinci_gpio_save_context(struct davinci_gpio_controller *chips, in davinci_gpio_save_context() argument
586 base = chips->regs[0] - offset_array[0]; in davinci_gpio_save_context()
587 chips->binten_context = readl_relaxed(base + BINTEN); in davinci_gpio_save_context()
590 g = chips->regs[bank]; in davinci_gpio_save_context()
591 context = &chips->context[bank]; in davinci_gpio_save_context()
602 static void davinci_gpio_restore_context(struct davinci_gpio_controller *chips, in davinci_gpio_restore_context() argument
610 base = chips->regs[0] - offset_array[0]; in davinci_gpio_restore_context()
612 if (readl_relaxed(base + BINTEN) != chips->binten_context) in davinci_gpio_restore_context()
613 writel_relaxed(chips->binten_context, base + BINTEN); in davinci_gpio_restore_context()
616 g = chips->regs[bank]; in davinci_gpio_restore_context()
617 context = &chips->context[bank]; in davinci_gpio_restore_context()
631 struct davinci_gpio_controller *chips = dev_get_drvdata(dev); in davinci_gpio_suspend() local
632 u32 nbank = DIV_ROUND_UP(chips->chip.ngpio, 32); in davinci_gpio_suspend()
634 davinci_gpio_save_context(chips, nbank); in davinci_gpio_suspend()
641 struct davinci_gpio_controller *chips = dev_get_drvdata(dev); in davinci_gpio_resume() local
642 u32 nbank = DIV_ROUND_UP(chips->chip.ngpio, 32); in davinci_gpio_resume()
644 davinci_gpio_restore_context(chips, nbank); in davinci_gpio_resume()