Lines Matching +full:resume +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0-or-later
26 static int arizona_gpio_direction_in(struct gpio_chip *chip, unsigned offset) in arizona_gpio_direction_in() argument
29 struct arizona *arizona = arizona_gpio->arizona; in arizona_gpio_direction_in()
30 bool persistent = gpiochip_line_is_persistent(chip, offset); in arizona_gpio_direction_in()
34 ret = regmap_update_bits_check(arizona->regmap, in arizona_gpio_direction_in()
35 ARIZONA_GPIO1_CTRL + offset, in arizona_gpio_direction_in()
42 pm_runtime_mark_last_busy(chip->parent); in arizona_gpio_direction_in()
43 pm_runtime_put_autosuspend(chip->parent); in arizona_gpio_direction_in()
49 static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) in arizona_gpio_get() argument
52 struct arizona *arizona = arizona_gpio->arizona; in arizona_gpio_get()
56 reg = ARIZONA_GPIO1_CTRL + offset; in arizona_gpio_get()
57 ret = regmap_read(arizona->regmap, reg, &val); in arizona_gpio_get()
61 /* Resume to read actual registers for input pins */ in arizona_gpio_get()
63 ret = pm_runtime_get_sync(chip->parent); in arizona_gpio_get()
65 dev_err(chip->parent, "Failed to resume: %d\n", ret); in arizona_gpio_get()
66 pm_runtime_put_autosuspend(chip->parent); in arizona_gpio_get()
71 ret = regcache_drop_region(arizona->regmap, reg, reg); in arizona_gpio_get()
73 dev_err(chip->parent, "Failed to drop cache: %d\n", in arizona_gpio_get()
75 pm_runtime_put_autosuspend(chip->parent); in arizona_gpio_get()
79 ret = regmap_read(arizona->regmap, reg, &val); in arizona_gpio_get()
81 pm_runtime_put_autosuspend(chip->parent); in arizona_gpio_get()
85 pm_runtime_mark_last_busy(chip->parent); in arizona_gpio_get()
86 pm_runtime_put_autosuspend(chip->parent); in arizona_gpio_get()
96 unsigned offset, int value) in arizona_gpio_direction_out() argument
99 struct arizona *arizona = arizona_gpio->arizona; in arizona_gpio_direction_out()
100 bool persistent = gpiochip_line_is_persistent(chip, offset); in arizona_gpio_direction_out()
104 ret = regmap_read(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, &val); in arizona_gpio_direction_out()
109 ret = pm_runtime_get_sync(chip->parent); in arizona_gpio_direction_out()
111 dev_err(chip->parent, "Failed to resume: %d\n", ret); in arizona_gpio_direction_out()
112 pm_runtime_put(chip->parent); in arizona_gpio_direction_out()
120 return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, in arizona_gpio_direction_out()
124 static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value) in arizona_gpio_set() argument
127 struct arizona *arizona = arizona_gpio->arizona; in arizona_gpio_set()
132 regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, in arizona_gpio_set()
148 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); in arizona_gpio_probe()
149 struct arizona_pdata *pdata = &arizona->pdata; in arizona_gpio_probe()
153 device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); in arizona_gpio_probe()
155 arizona_gpio = devm_kzalloc(&pdev->dev, sizeof(*arizona_gpio), in arizona_gpio_probe()
158 return -ENOMEM; in arizona_gpio_probe()
160 arizona_gpio->arizona = arizona; in arizona_gpio_probe()
161 arizona_gpio->gpio_chip = template_chip; in arizona_gpio_probe()
162 arizona_gpio->gpio_chip.parent = &pdev->dev; in arizona_gpio_probe()
164 switch (arizona->type) { in arizona_gpio_probe()
171 arizona_gpio->gpio_chip.ngpio = 5; in arizona_gpio_probe()
175 arizona_gpio->gpio_chip.ngpio = 2; in arizona_gpio_probe()
178 dev_err(&pdev->dev, "Unknown chip variant %d\n", in arizona_gpio_probe()
179 arizona->type); in arizona_gpio_probe()
180 return -EINVAL; in arizona_gpio_probe()
183 if (pdata->gpio_base) in arizona_gpio_probe()
184 arizona_gpio->gpio_chip.base = pdata->gpio_base; in arizona_gpio_probe()
186 arizona_gpio->gpio_chip.base = -1; in arizona_gpio_probe()
188 pm_runtime_enable(&pdev->dev); in arizona_gpio_probe()
190 ret = devm_gpiochip_add_data(&pdev->dev, &arizona_gpio->gpio_chip, in arizona_gpio_probe()
193 pm_runtime_disable(&pdev->dev); in arizona_gpio_probe()
194 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", in arizona_gpio_probe()
203 .driver.name = "arizona-gpio",
212 MODULE_ALIAS("platform:arizona-gpio");