Lines Matching refs:bdgpio
19 static int bd70528_set_debounce(struct bd70528_gpio *bdgpio, in bd70528_set_debounce() argument
38 dev_err(bdgpio->chip.dev, in bd70528_set_debounce()
42 return regmap_update_bits(bdgpio->chip.regmap, GPIO_IN_REG(offset), in bd70528_set_debounce()
48 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_get_direction() local
52 ret = regmap_read(bdgpio->chip.regmap, GPIO_OUT_REG(offset), &val); in bd70528_get_direction()
54 dev_err(bdgpio->chip.dev, "Could not read gpio direction\n"); in bd70528_get_direction()
66 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_set_config() local
70 return regmap_update_bits(bdgpio->chip.regmap, in bd70528_gpio_set_config()
76 return regmap_update_bits(bdgpio->chip.regmap, in bd70528_gpio_set_config()
82 return bd70528_set_debounce(bdgpio, offset, in bd70528_gpio_set_config()
93 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_direction_input() local
96 return regmap_update_bits(bdgpio->chip.regmap, GPIO_OUT_REG(offset), in bd70528_direction_input()
105 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_set() local
108 ret = regmap_update_bits(bdgpio->chip.regmap, GPIO_OUT_REG(offset), in bd70528_gpio_set()
111 dev_err(bdgpio->chip.dev, "Could not set gpio to %d\n", value); in bd70528_gpio_set()
117 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_direction_output() local
120 return regmap_update_bits(bdgpio->chip.regmap, GPIO_OUT_REG(offset), in bd70528_direction_output()
127 static int bd70528_gpio_get_o(struct bd70528_gpio *bdgpio, unsigned int offset) in bd70528_gpio_get_o() argument
132 ret = regmap_read(bdgpio->chip.regmap, GPIO_OUT_REG(offset), &val); in bd70528_gpio_get_o()
136 dev_err(bdgpio->chip.dev, "GPIO (out) state read failed\n"); in bd70528_gpio_get_o()
141 static int bd70528_gpio_get_i(struct bd70528_gpio *bdgpio, unsigned int offset) in bd70528_gpio_get_i() argument
146 ret = regmap_read(bdgpio->chip.regmap, BD70528_REG_GPIO_STATE, &val); in bd70528_gpio_get_i()
151 dev_err(bdgpio->chip.dev, "GPIO (in) state read failed\n"); in bd70528_gpio_get_i()
159 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_get() local
172 ret = bd70528_gpio_get_o(bdgpio, offset); in bd70528_gpio_get()
174 ret = bd70528_gpio_get_i(bdgpio, offset); in bd70528_gpio_get()
176 dev_err(bdgpio->chip.dev, "failed to read GPIO direction\n"); in bd70528_gpio_get()
183 struct bd70528_gpio *bdgpio; in bd70528_probe() local
193 bdgpio = devm_kzalloc(&pdev->dev, sizeof(*bdgpio), in bd70528_probe()
195 if (!bdgpio) in bd70528_probe()
197 bdgpio->chip.dev = &pdev->dev; in bd70528_probe()
198 bdgpio->gpio.parent = pdev->dev.parent; in bd70528_probe()
199 bdgpio->gpio.label = "bd70528-gpio"; in bd70528_probe()
200 bdgpio->gpio.owner = THIS_MODULE; in bd70528_probe()
201 bdgpio->gpio.get_direction = bd70528_get_direction; in bd70528_probe()
202 bdgpio->gpio.direction_input = bd70528_direction_input; in bd70528_probe()
203 bdgpio->gpio.direction_output = bd70528_direction_output; in bd70528_probe()
204 bdgpio->gpio.set_config = bd70528_gpio_set_config; in bd70528_probe()
205 bdgpio->gpio.can_sleep = true; in bd70528_probe()
206 bdgpio->gpio.get = bd70528_gpio_get; in bd70528_probe()
207 bdgpio->gpio.set = bd70528_gpio_set; in bd70528_probe()
208 bdgpio->gpio.ngpio = 4; in bd70528_probe()
209 bdgpio->gpio.base = -1; in bd70528_probe()
211 bdgpio->gpio.of_node = pdev->dev.parent->of_node; in bd70528_probe()
213 bdgpio->chip.regmap = bd70528->regmap; in bd70528_probe()
215 ret = devm_gpiochip_add_data(&pdev->dev, &bdgpio->gpio, in bd70528_probe()
216 bdgpio); in bd70528_probe()