Lines Matching refs:lg

100 	struct lp_gpio *lg = gpiochip_get_data(chip);  in lp_gpio_reg()  local
110 return lg->reg_base + reg + reg_offset; in lp_gpio_reg()
115 struct lp_gpio *lg = gpiochip_get_data(chip); in lp_gpio_request() local
120 pm_runtime_get(&lg->pdev->dev); /* should we put if failed */ in lp_gpio_request()
124 dev_err(&lg->pdev->dev, "gpio %d reserved for ACPI\n", offset); in lp_gpio_request()
140 struct lp_gpio *lg = gpiochip_get_data(chip); in lp_gpio_free() local
146 pm_runtime_put(&lg->pdev->dev); in lp_gpio_free()
152 struct lp_gpio *lg = gpiochip_get_data(gc); in lp_irq_type() local
156 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_CONFIG1); in lp_irq_type()
158 if (hwirq >= lg->chip.ngpio) in lp_irq_type()
161 spin_lock_irqsave(&lg->lock, flags); in lp_irq_type()
181 spin_unlock_irqrestore(&lg->lock, flags); in lp_irq_type()
194 struct lp_gpio *lg = gpiochip_get_data(chip); in lp_gpio_set() local
198 spin_lock_irqsave(&lg->lock, flags); in lp_gpio_set()
205 spin_unlock_irqrestore(&lg->lock, flags); in lp_gpio_set()
210 struct lp_gpio *lg = gpiochip_get_data(chip); in lp_gpio_direction_input() local
214 spin_lock_irqsave(&lg->lock, flags); in lp_gpio_direction_input()
216 spin_unlock_irqrestore(&lg->lock, flags); in lp_gpio_direction_input()
224 struct lp_gpio *lg = gpiochip_get_data(chip); in lp_gpio_direction_output() local
230 spin_lock_irqsave(&lg->lock, flags); in lp_gpio_direction_output()
232 spin_unlock_irqrestore(&lg->lock, flags); in lp_gpio_direction_output()
241 struct lp_gpio *lg = gpiochip_get_data(gc); in lp_gpio_irq_handler() local
247 for (base = 0; base < lg->chip.ngpio; base += 32) { in lp_gpio_irq_handler()
248 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT); in lp_gpio_irq_handler()
249 ena = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE); in lp_gpio_irq_handler()
258 irq = irq_find_mapping(lg->chip.irq.domain, base + pin); in lp_gpio_irq_handler()
276 struct lp_gpio *lg = gpiochip_get_data(gc); in lp_irq_enable() local
278 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE); in lp_irq_enable()
281 spin_lock_irqsave(&lg->lock, flags); in lp_irq_enable()
283 spin_unlock_irqrestore(&lg->lock, flags); in lp_irq_enable()
289 struct lp_gpio *lg = gpiochip_get_data(gc); in lp_irq_disable() local
291 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE); in lp_irq_disable()
294 spin_lock_irqsave(&lg->lock, flags); in lp_irq_disable()
296 spin_unlock_irqrestore(&lg->lock, flags); in lp_irq_disable()
309 static void lp_gpio_irq_init_hw(struct lp_gpio *lg) in lp_gpio_irq_init_hw() argument
314 for (base = 0; base < lg->chip.ngpio; base += 32) { in lp_gpio_irq_init_hw()
316 reg = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE); in lp_gpio_irq_init_hw()
319 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT); in lp_gpio_irq_init_hw()
326 struct lp_gpio *lg; in lp_gpio_probe() local
333 lg = devm_kzalloc(dev, sizeof(struct lp_gpio), GFP_KERNEL); in lp_gpio_probe()
334 if (!lg) in lp_gpio_probe()
337 lg->pdev = pdev; in lp_gpio_probe()
338 platform_set_drvdata(pdev, lg); in lp_gpio_probe()
348 lg->reg_base = io_rc->start; in lp_gpio_probe()
351 if (!devm_request_region(dev, lg->reg_base, reg_len, "lp-gpio")) { in lp_gpio_probe()
353 (unsigned int)lg->reg_base); in lp_gpio_probe()
357 spin_lock_init(&lg->lock); in lp_gpio_probe()
359 gc = &lg->chip; in lp_gpio_probe()
373 ret = devm_gpiochip_add_data(dev, gc, lg); in lp_gpio_probe()
381 lp_gpio_irq_init_hw(lg); in lp_gpio_probe()
412 struct lp_gpio *lg = platform_get_drvdata(pdev); in lp_gpio_resume() local
417 for (i = 0; i < lg->chip.ngpio; i++) { in lp_gpio_resume()
418 if (gpiochip_is_requested(&lg->chip, i) != NULL) { in lp_gpio_resume()
419 reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2); in lp_gpio_resume()