Lines Matching refs:ab8500_gpio
77 struct ab8500_gpio { struct
91 static inline struct ab8500_gpio *to_ab8500_gpio(struct gpio_chip *chip) in to_ab8500_gpio()
93 return container_of(chip, struct ab8500_gpio, chip); in to_ab8500_gpio()
99 struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); in ab8500_gpio_set_bits() local
104 ret = abx500_mask_and_set_register_interruptible(ab8500_gpio->dev, in ab8500_gpio_set_bits()
107 dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); in ab8500_gpio_set_bits()
117 struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); in ab8500_gpio_get() local
122 ret = abx500_get_register_interruptible(ab8500_gpio->dev, AB8500_MISC, in ab8500_gpio_get()
125 dev_err(ab8500_gpio->dev, "%s read failed\n", __func__); in ab8500_gpio_get()
133 struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); in ab8500_gpio_set() local
138 dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); in ab8500_gpio_set()
182 struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); in ab8500_gpio_to_irq() local
183 int base = ab8500_gpio->irq_base; in ab8500_gpio_to_irq()
211 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in irq_to_rising() local
212 int offset = irq - ab8500_gpio->irq_base; in irq_to_rising()
214 + ab8500_gpio->parent->irq_base; in irq_to_rising()
220 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in irq_to_falling() local
221 int offset = irq - ab8500_gpio->irq_base; in irq_to_falling()
223 + ab8500_gpio->parent->irq_base; in irq_to_falling()
230 struct ab8500_gpio *ab8500_gpio = dev; in rising_to_irq() local
232 - ab8500_gpio->parent->irq_base ; in rising_to_irq()
233 int new_irq = offset + ab8500_gpio->irq_base; in rising_to_irq()
239 struct ab8500_gpio *ab8500_gpio = dev; in falling_to_irq() local
241 - ab8500_gpio->parent->irq_base ; in falling_to_irq()
242 int new_irq = offset + ab8500_gpio->irq_base; in falling_to_irq()
267 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_lock() local
268 mutex_lock(&ab8500_gpio->lock); in ab8500_gpio_irq_lock()
273 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_sync_unlock() local
274 int offset = irq - ab8500_gpio->irq_base; in ab8500_gpio_irq_sync_unlock()
275 bool rising = ab8500_gpio->rising & BIT(offset); in ab8500_gpio_irq_sync_unlock()
276 bool falling = ab8500_gpio->falling & BIT(offset); in ab8500_gpio_irq_sync_unlock()
279 switch (ab8500_gpio->irq_action) { in ab8500_gpio_irq_sync_unlock()
285 "ab8500-gpio-r", ab8500_gpio); in ab8500_gpio_irq_sync_unlock()
290 "ab8500-gpio-f", ab8500_gpio); in ab8500_gpio_irq_sync_unlock()
294 free_irq(irq_to_rising(irq), ab8500_gpio); in ab8500_gpio_irq_sync_unlock()
296 free_irq(irq_to_falling(irq), ab8500_gpio); in ab8500_gpio_irq_sync_unlock()
313 ab8500_gpio->irq_action = NONE; in ab8500_gpio_irq_sync_unlock()
314 ab8500_gpio->rising &= ~(BIT(offset)); in ab8500_gpio_irq_sync_unlock()
315 ab8500_gpio->falling &= ~(BIT(offset)); in ab8500_gpio_irq_sync_unlock()
316 mutex_unlock(&ab8500_gpio->lock); in ab8500_gpio_irq_sync_unlock()
322 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_mask() local
323 ab8500_gpio->irq_action = MASK; in ab8500_gpio_irq_mask()
328 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_unmask() local
329 ab8500_gpio->irq_action = UNMASK; in ab8500_gpio_irq_unmask()
334 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_set_type() local
335 int offset = irq - ab8500_gpio->irq_base; in ab8500_gpio_irq_set_type()
338 ab8500_gpio->rising = BIT(offset); in ab8500_gpio_irq_set_type()
339 ab8500_gpio->falling = BIT(offset); in ab8500_gpio_irq_set_type()
341 ab8500_gpio->rising = BIT(offset); in ab8500_gpio_irq_set_type()
343 ab8500_gpio->falling = BIT(offset); in ab8500_gpio_irq_set_type()
350 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_startup() local
351 ab8500_gpio->irq_action = STARTUP; in ab8500_gpio_irq_startup()
357 struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); in ab8500_gpio_irq_shutdown() local
358 ab8500_gpio->irq_action = SHUTDOWN; in ab8500_gpio_irq_shutdown()
372 static int ab8500_gpio_irq_init(struct ab8500_gpio *ab8500_gpio) in ab8500_gpio_irq_init() argument
374 u32 base = ab8500_gpio->irq_base; in ab8500_gpio_irq_init()
378 set_irq_chip_data(irq, ab8500_gpio); in ab8500_gpio_irq_init()
392 static void ab8500_gpio_irq_remove(struct ab8500_gpio *ab8500_gpio) in ab8500_gpio_irq_remove() argument
394 int base = ab8500_gpio->irq_base; in ab8500_gpio_irq_remove()
411 struct ab8500_gpio *ab8500_gpio; in ab8500_gpio_probe() local
421 ab8500_gpio = kzalloc(sizeof(struct ab8500_gpio), GFP_KERNEL); in ab8500_gpio_probe()
422 if (ab8500_gpio == NULL) { in ab8500_gpio_probe()
426 ab8500_gpio->dev = &pdev->dev; in ab8500_gpio_probe()
427 ab8500_gpio->parent = dev_get_drvdata(pdev->dev.parent); in ab8500_gpio_probe()
428 ab8500_gpio->chip = ab8500gpio_chip; in ab8500_gpio_probe()
429 ab8500_gpio->chip.ngpio = AB8500_NUM_GPIO; in ab8500_gpio_probe()
430 ab8500_gpio->chip.dev = &pdev->dev; in ab8500_gpio_probe()
431 ab8500_gpio->chip.base = pdata->gpio_base; in ab8500_gpio_probe()
432 ab8500_gpio->irq_base = pdata->irq_base; in ab8500_gpio_probe()
434 mutex_init(&ab8500_gpio->lock); in ab8500_gpio_probe()
442 ret = abx500_set_register_interruptible(ab8500_gpio->dev, in ab8500_gpio_probe()
448 ret = abx500_set_register_interruptible(ab8500_gpio->dev, AB8500_MISC, in ab8500_gpio_probe()
454 ret = ab8500_gpio_irq_init(ab8500_gpio); in ab8500_gpio_probe()
457 ret = gpiochip_add(&ab8500_gpio->chip); in ab8500_gpio_probe()
463 platform_set_drvdata(pdev, ab8500_gpio); in ab8500_gpio_probe()
467 ab8500_gpio_irq_remove(ab8500_gpio); in ab8500_gpio_probe()
469 mutex_destroy(&ab8500_gpio->lock); in ab8500_gpio_probe()
470 kfree(ab8500_gpio); in ab8500_gpio_probe()
480 struct ab8500_gpio *ab8500_gpio = platform_get_drvdata(pdev); in ab8500_gpio_remove() local
483 ret = gpiochip_remove(&ab8500_gpio->chip); in ab8500_gpio_remove()
485 dev_err(ab8500_gpio->dev, "unable to remove gpiochip:\ in ab8500_gpio_remove()
491 mutex_destroy(&ab8500_gpio->lock); in ab8500_gpio_remove()
492 kfree(ab8500_gpio); in ab8500_gpio_remove()