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

1 // SPDX-License-Identifier: GPL-2.0
5 * Author: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
8 * Author: yanglsh@embest-tech.com
18 #include <linux/mfd/rohm-bd71815.h>
28 static int bd71815gpo_get(struct gpio_chip *chip, unsigned int offset) in bd71815gpo_get() argument
33 ret = regmap_read(bd71815->regmap, BD71815_REG_GPO, &val); in bd71815gpo_get()
37 return (val >> offset) & 1; in bd71815gpo_get()
40 static void bd71815gpo_set(struct gpio_chip *chip, unsigned int offset, in bd71815gpo_set() argument
46 bit = BIT(offset); in bd71815gpo_set()
49 ret = regmap_set_bits(bd71815->regmap, BD71815_REG_GPO, bit); in bd71815gpo_set()
51 ret = regmap_clear_bits(bd71815->regmap, BD71815_REG_GPO, bit); in bd71815gpo_set()
54 dev_warn(bd71815->dev, "failed to toggle GPO\n"); in bd71815gpo_set()
57 static int bd71815_gpio_set_config(struct gpio_chip *chip, unsigned int offset, in bd71815_gpio_set_config() argument
64 return regmap_update_bits(bdgpio->regmap, in bd71815_gpio_set_config()
66 BD71815_GPIO_DRIVE_MASK << offset, in bd71815_gpio_set_config()
67 BD71815_GPIO_OPEN_DRAIN << offset); in bd71815_gpio_set_config()
69 return regmap_update_bits(bdgpio->regmap, in bd71815_gpio_set_config()
71 BD71815_GPIO_DRIVE_MASK << offset, in bd71815_gpio_set_config()
72 BD71815_GPIO_CMOS << offset); in bd71815_gpio_set_config()
76 return -ENOTSUPP; in bd71815_gpio_set_config()
80 static int bd71815gpo_direction_get(struct gpio_chip *gc, unsigned int offset) in bd71815gpo_direction_get() argument
106 * OTOH - the original driver written by colleagues at Embest did support
112 * "rohm,enable-hidden-gpo".
121 if (gc->parent && device_property_present(gc->parent, in bd71815_init_valid_mask()
122 "rohm,enable-hidden-gpo")) in bd71815_init_valid_mask()
139 dev = &pdev->dev; in gpo_bd71815_probe()
140 /* The device-tree and regmap come from MFD => use parent for that */ in gpo_bd71815_probe()
141 parent = dev->parent; in gpo_bd71815_probe()
145 return -ENOMEM; in gpo_bd71815_probe()
147 g->chip = bd71815gpo_chip; in gpo_bd71815_probe()
152 * to 1 if "rohm,enable-hidden-gpo" is not given. in gpo_bd71815_probe()
159 if (device_property_present(parent, "rohm,enable-hidden-gpo")) in gpo_bd71815_probe()
160 g->chip.ngpio = 2; in gpo_bd71815_probe()
162 g->chip.ngpio = 1; in gpo_bd71815_probe()
164 g->chip.init_valid_mask = bd71815_init_valid_mask; in gpo_bd71815_probe()
165 g->chip.base = -1; in gpo_bd71815_probe()
166 g->chip.parent = parent; in gpo_bd71815_probe()
167 g->regmap = dev_get_regmap(parent, NULL); in gpo_bd71815_probe()
168 g->dev = dev; in gpo_bd71815_probe()
170 return devm_gpiochip_add_data(dev, &g->chip, g); in gpo_bd71815_probe()
175 .name = "bd71815-gpo",
181 MODULE_ALIAS("platform:bd71815-gpo");
182 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
183 MODULE_AUTHOR("Peter Yang <yanglsh@embest-tech.com>");