Lines Matching +full:hard +full:- +full:wired

1 // SPDX-License-Identifier: GPL-2.0
39 if (chip->desc->in_mask & BIT(offset)) { in moxtet_gpio_get_value()
40 ret = moxtet_device_read(chip->dev); in moxtet_gpio_get_value()
41 } else if (chip->desc->out_mask & BIT(offset)) { in moxtet_gpio_get_value()
42 ret = moxtet_device_written(chip->dev); in moxtet_gpio_get_value()
46 return -EINVAL; in moxtet_gpio_get_value()
61 state = moxtet_device_written(chip->dev); in moxtet_gpio_set_value()
65 offset -= MOXTET_GPIO_INPUTS; in moxtet_gpio_set_value()
72 moxtet_device_write(chip->dev, state); in moxtet_gpio_set_value()
79 /* All lines are hard wired to be either input or output, not both. */ in moxtet_gpio_get_direction()
80 if (chip->desc->in_mask & BIT(offset)) in moxtet_gpio_get_direction()
82 else if (chip->desc->out_mask & BIT(offset)) in moxtet_gpio_get_direction()
85 return -EINVAL; in moxtet_gpio_get_direction()
93 if (chip->desc->in_mask & BIT(offset)) in moxtet_gpio_direction_input()
95 else if (chip->desc->out_mask & BIT(offset)) in moxtet_gpio_direction_input()
96 return -ENOTSUPP; in moxtet_gpio_direction_input()
98 return -EINVAL; in moxtet_gpio_direction_input()
106 if (chip->desc->out_mask & BIT(offset)) in moxtet_gpio_direction_output()
108 else if (chip->desc->in_mask & BIT(offset)) in moxtet_gpio_direction_output()
109 return -ENOTSUPP; in moxtet_gpio_direction_output()
111 return -EINVAL; in moxtet_gpio_direction_output()
119 struct device_node *nc = dev->of_node; in moxtet_gpio_probe()
122 id = to_moxtet_device(dev)->id; in moxtet_gpio_probe()
125 dev_err(dev, "%pOF Moxtet device id 0x%x is not supported by gpio-moxtet driver\n", in moxtet_gpio_probe()
127 return -ENOTSUPP; in moxtet_gpio_probe()
132 return -ENOMEM; in moxtet_gpio_probe()
134 chip->dev = dev; in moxtet_gpio_probe()
135 chip->gpio_chip.parent = dev; in moxtet_gpio_probe()
136 chip->desc = &descs[id]; in moxtet_gpio_probe()
140 chip->gpio_chip.label = dev_name(dev); in moxtet_gpio_probe()
141 chip->gpio_chip.get_direction = moxtet_gpio_get_direction; in moxtet_gpio_probe()
142 chip->gpio_chip.direction_input = moxtet_gpio_direction_input; in moxtet_gpio_probe()
143 chip->gpio_chip.direction_output = moxtet_gpio_direction_output; in moxtet_gpio_probe()
144 chip->gpio_chip.get = moxtet_gpio_get_value; in moxtet_gpio_probe()
145 chip->gpio_chip.set = moxtet_gpio_set_value; in moxtet_gpio_probe()
146 chip->gpio_chip.base = -1; in moxtet_gpio_probe()
148 chip->gpio_chip.ngpio = MOXTET_GPIO_NGPIOS; in moxtet_gpio_probe()
150 chip->gpio_chip.can_sleep = true; in moxtet_gpio_probe()
151 chip->gpio_chip.owner = THIS_MODULE; in moxtet_gpio_probe()
153 return devm_gpiochip_add_data(dev, &chip->gpio_chip, chip); in moxtet_gpio_probe()
157 { .compatible = "cznic,moxtet-gpio", },
169 .name = "moxtet-gpio",