Lines Matching refs:exar_gpio

37 exar_offset_to_sel_addr(struct exar_gpio_chip *exar_gpio, unsigned int offset)  in exar_offset_to_sel_addr()  argument
39 return (offset + exar_gpio->first_pin) / 8 ? EXAR_OFFSET_MPIOSEL_HI in exar_offset_to_sel_addr()
44 exar_offset_to_lvl_addr(struct exar_gpio_chip *exar_gpio, unsigned int offset) in exar_offset_to_lvl_addr() argument
46 return (offset + exar_gpio->first_pin) / 8 ? EXAR_OFFSET_MPIOLVL_HI in exar_offset_to_lvl_addr()
51 exar_offset_to_bit(struct exar_gpio_chip *exar_gpio, unsigned int offset) in exar_offset_to_bit() argument
53 return (offset + exar_gpio->first_pin) % 8; in exar_offset_to_bit()
58 struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); in exar_get_direction() local
59 unsigned int addr = exar_offset_to_sel_addr(exar_gpio, offset); in exar_get_direction()
60 unsigned int bit = exar_offset_to_bit(exar_gpio, offset); in exar_get_direction()
62 if (regmap_test_bits(exar_gpio->regmap, addr, BIT(bit))) in exar_get_direction()
70 struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); in exar_get_value() local
71 unsigned int addr = exar_offset_to_lvl_addr(exar_gpio, offset); in exar_get_value()
72 unsigned int bit = exar_offset_to_bit(exar_gpio, offset); in exar_get_value()
74 return !!(regmap_test_bits(exar_gpio->regmap, addr, BIT(bit))); in exar_get_value()
80 struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); in exar_set_value() local
81 unsigned int addr = exar_offset_to_lvl_addr(exar_gpio, offset); in exar_set_value()
82 unsigned int bit = exar_offset_to_bit(exar_gpio, offset); in exar_set_value()
85 regmap_set_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_set_value()
87 regmap_clear_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_set_value()
93 struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); in exar_direction_output() local
94 unsigned int addr = exar_offset_to_sel_addr(exar_gpio, offset); in exar_direction_output()
95 unsigned int bit = exar_offset_to_bit(exar_gpio, offset); in exar_direction_output()
98 regmap_clear_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_direction_output()
105 struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); in exar_direction_input() local
106 unsigned int addr = exar_offset_to_sel_addr(exar_gpio, offset); in exar_direction_input()
107 unsigned int bit = exar_offset_to_bit(exar_gpio, offset); in exar_direction_input()
109 regmap_set_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_direction_input()
116 struct exar_gpio_chip *exar_gpio = data; in exar_devm_ida_free() local
118 ida_free(&ida_index, exar_gpio->index); in exar_devm_ida_free()
131 struct exar_gpio_chip *exar_gpio; in gpio_exar_probe() local
152 exar_gpio = devm_kzalloc(dev, sizeof(*exar_gpio), GFP_KERNEL); in gpio_exar_probe()
153 if (!exar_gpio) in gpio_exar_probe()
160 exar_gpio->regmap = devm_regmap_init_mmio(dev, p, &exar_regmap_config); in gpio_exar_probe()
161 if (IS_ERR(exar_gpio->regmap)) in gpio_exar_probe()
162 return PTR_ERR(exar_gpio->regmap); in gpio_exar_probe()
168 ret = devm_add_action_or_reset(dev, exar_devm_ida_free, exar_gpio); in gpio_exar_probe()
172 sprintf(exar_gpio->name, "exar_gpio%d", index); in gpio_exar_probe()
173 exar_gpio->gpio_chip.label = exar_gpio->name; in gpio_exar_probe()
174 exar_gpio->gpio_chip.parent = dev; in gpio_exar_probe()
175 exar_gpio->gpio_chip.direction_output = exar_direction_output; in gpio_exar_probe()
176 exar_gpio->gpio_chip.direction_input = exar_direction_input; in gpio_exar_probe()
177 exar_gpio->gpio_chip.get_direction = exar_get_direction; in gpio_exar_probe()
178 exar_gpio->gpio_chip.get = exar_get_value; in gpio_exar_probe()
179 exar_gpio->gpio_chip.set = exar_set_value; in gpio_exar_probe()
180 exar_gpio->gpio_chip.base = -1; in gpio_exar_probe()
181 exar_gpio->gpio_chip.ngpio = ngpios; in gpio_exar_probe()
182 exar_gpio->index = index; in gpio_exar_probe()
183 exar_gpio->first_pin = first_pin; in gpio_exar_probe()
185 ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio); in gpio_exar_probe()
189 platform_set_drvdata(pdev, exar_gpio); in gpio_exar_probe()