Lines Matching +full:com +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
4 * Keerthy <j-keerthy@ti.com>
25 unsigned int offset) in lp873x_gpio_get_direction() argument
32 unsigned int offset) in lp873x_gpio_direction_input() argument
35 return -EINVAL; in lp873x_gpio_direction_input()
39 unsigned int offset, int value) in lp873x_gpio_direction_output() argument
44 return regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL, in lp873x_gpio_direction_output()
45 BIT(offset * BITS_PER_GPO), in lp873x_gpio_direction_output()
46 value ? BIT(offset * BITS_PER_GPO) : 0); in lp873x_gpio_direction_output()
49 static int lp873x_gpio_get(struct gpio_chip *chip, unsigned int offset) in lp873x_gpio_get() argument
54 ret = regmap_read(gpio->lp873->regmap, LP873X_REG_GPO_CTRL, &val); in lp873x_gpio_get()
58 return val & BIT(offset * BITS_PER_GPO); in lp873x_gpio_get()
61 static void lp873x_gpio_set(struct gpio_chip *chip, unsigned int offset, in lp873x_gpio_set() argument
66 regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL, in lp873x_gpio_set()
67 BIT(offset * BITS_PER_GPO), in lp873x_gpio_set()
68 value ? BIT(offset * BITS_PER_GPO) : 0); in lp873x_gpio_set()
71 static int lp873x_gpio_request(struct gpio_chip *gc, unsigned int offset) in lp873x_gpio_request() argument
76 switch (offset) { in lp873x_gpio_request()
82 ret = regmap_update_bits(gpio->lp873->regmap, LP873X_REG_CONFIG, in lp873x_gpio_request()
89 return -EINVAL; in lp873x_gpio_request()
95 static int lp873x_gpio_set_config(struct gpio_chip *gc, unsigned offset, in lp873x_gpio_set_config() argument
102 return regmap_update_bits(gpio->lp873->regmap, in lp873x_gpio_set_config()
104 BIT(offset * BITS_PER_GPO + in lp873x_gpio_set_config()
106 BIT(offset * BITS_PER_GPO + in lp873x_gpio_set_config()
110 return regmap_update_bits(gpio->lp873->regmap, in lp873x_gpio_set_config()
112 BIT(offset * BITS_PER_GPO + in lp873x_gpio_set_config()
115 return -ENOTSUPP; in lp873x_gpio_set_config()
120 .label = "lp873x-gpio",
129 .base = -1,
139 gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); in lp873x_gpio_probe()
141 return -ENOMEM; in lp873x_gpio_probe()
145 gpio->lp873 = dev_get_drvdata(pdev->dev.parent); in lp873x_gpio_probe()
146 gpio->chip = template_chip; in lp873x_gpio_probe()
147 gpio->chip.parent = gpio->lp873->dev; in lp873x_gpio_probe()
149 ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); in lp873x_gpio_probe()
151 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); in lp873x_gpio_probe()
159 { "lp873x-gpio", },
166 .name = "lp873x-gpio",
173 MODULE_AUTHOR("Keerthy <j-keerthy@ti.com>");