Lines Matching +full:com +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
4 * Keerthy <j-keerthy@ti.com>
21 static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset) in lp87565_gpio_get() argument
26 ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val); in lp87565_gpio_get()
30 return !!(val & BIT(offset)); in lp87565_gpio_get()
33 static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset, in lp87565_gpio_set() argument
38 regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT, in lp87565_gpio_set()
39 BIT(offset), value ? BIT(offset) : 0); in lp87565_gpio_set()
43 unsigned int offset) in lp87565_gpio_get_direction() argument
48 ret = regmap_read(gpio->map, LP87565_REG_GPIO_CONFIG, &val); in lp87565_gpio_get_direction()
52 if (val & BIT(offset)) in lp87565_gpio_get_direction()
59 unsigned int offset) in lp87565_gpio_direction_input() argument
63 return regmap_update_bits(gpio->map, in lp87565_gpio_direction_input()
65 BIT(offset), 0); in lp87565_gpio_direction_input()
69 unsigned int offset, int value) in lp87565_gpio_direction_output() argument
73 lp87565_gpio_set(chip, offset, value); in lp87565_gpio_direction_output()
75 return regmap_update_bits(gpio->map, in lp87565_gpio_direction_output()
77 BIT(offset), BIT(offset)); in lp87565_gpio_direction_output()
80 static int lp87565_gpio_request(struct gpio_chip *gc, unsigned int offset) in lp87565_gpio_request() argument
85 switch (offset) { in lp87565_gpio_request()
94 ret = regmap_update_bits(gpio->map, in lp87565_gpio_request()
96 BIT(offset), BIT(offset)); in lp87565_gpio_request()
102 return -EINVAL; in lp87565_gpio_request()
108 static int lp87565_gpio_set_config(struct gpio_chip *gc, unsigned int offset, in lp87565_gpio_set_config() argument
115 return regmap_update_bits(gpio->map, in lp87565_gpio_set_config()
117 BIT(offset + in lp87565_gpio_set_config()
119 BIT(offset + in lp87565_gpio_set_config()
122 return regmap_update_bits(gpio->map, in lp87565_gpio_set_config()
124 BIT(offset + in lp87565_gpio_set_config()
127 return -ENOTSUPP; in lp87565_gpio_set_config()
132 .label = "lp87565-gpio",
141 .base = -1,
152 gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); in lp87565_gpio_probe()
154 return -ENOMEM; in lp87565_gpio_probe()
156 lp87565 = dev_get_drvdata(pdev->dev.parent); in lp87565_gpio_probe()
157 gpio->chip = template_chip; in lp87565_gpio_probe()
158 gpio->chip.parent = lp87565->dev; in lp87565_gpio_probe()
159 gpio->map = lp87565->regmap; in lp87565_gpio_probe()
161 ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); in lp87565_gpio_probe()
163 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); in lp87565_gpio_probe()
171 { "lp87565-q1-gpio", },
178 .name = "lp87565-gpio",
185 MODULE_AUTHOR("Keerthy <j-keerthy@ti.com>");