Lines Matching refs:bdgpio
20 static int bd70528_set_debounce(struct bd70528_gpio *bdgpio, in bd70528_set_debounce() argument
39 dev_err(bdgpio->dev, in bd70528_set_debounce()
43 return regmap_update_bits(bdgpio->regmap, GPIO_IN_REG(offset), in bd70528_set_debounce()
49 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_get_direction() local
53 ret = regmap_read(bdgpio->regmap, GPIO_OUT_REG(offset), &val); in bd70528_get_direction()
55 dev_err(bdgpio->dev, "Could not read gpio direction\n"); in bd70528_get_direction()
67 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_set_config() local
71 return regmap_update_bits(bdgpio->regmap, in bd70528_gpio_set_config()
77 return regmap_update_bits(bdgpio->regmap, in bd70528_gpio_set_config()
83 return bd70528_set_debounce(bdgpio, offset, in bd70528_gpio_set_config()
94 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_direction_input() local
97 return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), in bd70528_direction_input()
106 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_set() local
109 ret = regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), in bd70528_gpio_set()
112 dev_err(bdgpio->dev, "Could not set gpio to %d\n", value); in bd70528_gpio_set()
118 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_direction_output() local
121 return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), in bd70528_direction_output()
128 static int bd70528_gpio_get_o(struct bd70528_gpio *bdgpio, unsigned int offset) in bd70528_gpio_get_o() argument
133 ret = regmap_read(bdgpio->regmap, GPIO_OUT_REG(offset), &val); in bd70528_gpio_get_o()
137 dev_err(bdgpio->dev, "GPIO (out) state read failed\n"); in bd70528_gpio_get_o()
142 static int bd70528_gpio_get_i(struct bd70528_gpio *bdgpio, unsigned int offset) in bd70528_gpio_get_i() argument
147 ret = regmap_read(bdgpio->regmap, BD70528_REG_GPIO_STATE, &val); in bd70528_gpio_get_i()
152 dev_err(bdgpio->dev, "GPIO (in) state read failed\n"); in bd70528_gpio_get_i()
160 struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); in bd70528_gpio_get() local
173 ret = bd70528_gpio_get_o(bdgpio, offset); in bd70528_gpio_get()
175 ret = bd70528_gpio_get_i(bdgpio, offset); in bd70528_gpio_get()
177 dev_err(bdgpio->dev, "failed to read GPIO direction\n"); in bd70528_gpio_get()
185 struct bd70528_gpio *bdgpio; in bd70528_probe() local
188 bdgpio = devm_kzalloc(dev, sizeof(*bdgpio), GFP_KERNEL); in bd70528_probe()
189 if (!bdgpio) in bd70528_probe()
191 bdgpio->dev = dev; in bd70528_probe()
192 bdgpio->gpio.parent = dev->parent; in bd70528_probe()
193 bdgpio->gpio.label = "bd70528-gpio"; in bd70528_probe()
194 bdgpio->gpio.owner = THIS_MODULE; in bd70528_probe()
195 bdgpio->gpio.get_direction = bd70528_get_direction; in bd70528_probe()
196 bdgpio->gpio.direction_input = bd70528_direction_input; in bd70528_probe()
197 bdgpio->gpio.direction_output = bd70528_direction_output; in bd70528_probe()
198 bdgpio->gpio.set_config = bd70528_gpio_set_config; in bd70528_probe()
199 bdgpio->gpio.can_sleep = true; in bd70528_probe()
200 bdgpio->gpio.get = bd70528_gpio_get; in bd70528_probe()
201 bdgpio->gpio.set = bd70528_gpio_set; in bd70528_probe()
202 bdgpio->gpio.ngpio = 4; in bd70528_probe()
203 bdgpio->gpio.base = -1; in bd70528_probe()
205 bdgpio->gpio.of_node = dev->parent->of_node; in bd70528_probe()
207 bdgpio->regmap = dev_get_regmap(dev->parent, NULL); in bd70528_probe()
208 if (!bdgpio->regmap) in bd70528_probe()
211 ret = devm_gpiochip_add_data(dev, &bdgpio->gpio, bdgpio); in bd70528_probe()