Lines Matching +full:bcm2835 +full:- +full:vc4

1 // SPDX-License-Identifier: GPL-2.0+
15 #include <soc/bcm2835/raspberrypi-firmware.h>
17 #define MODULE_NAME "raspberrypi-exp-gpio"
30 /* VC4 firmware mailbox interface data structures */
64 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_GET_GPIO_CONFIG, in rpi_exp_gpio_get_polarity()
67 dev_err(gc->parent, "Failed to get GPIO %u config (%d %x)\n", in rpi_exp_gpio_get_polarity()
69 return ret ? ret : -EIO; in rpi_exp_gpio_get_polarity()
93 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_SET_GPIO_CONFIG, in rpi_exp_gpio_dir_in()
96 dev_err(gc->parent, "Failed to set GPIO %u to input (%d %x)\n", in rpi_exp_gpio_dir_in()
98 return ret ? ret : -EIO; in rpi_exp_gpio_dir_in()
122 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_SET_GPIO_CONFIG, in rpi_exp_gpio_dir_out()
125 dev_err(gc->parent, "Failed to set GPIO %u to output (%d %x)\n", in rpi_exp_gpio_dir_out()
127 return ret ? ret : -EIO; in rpi_exp_gpio_dir_out()
142 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_GET_GPIO_CONFIG, in rpi_exp_gpio_get_direction()
145 dev_err(gc->parent, in rpi_exp_gpio_get_direction()
148 return ret ? ret : -EIO; in rpi_exp_gpio_get_direction()
167 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_GET_GPIO_STATE, in rpi_exp_gpio_get()
170 dev_err(gc->parent, in rpi_exp_gpio_get()
173 return ret ? ret : -EIO; in rpi_exp_gpio_get()
189 ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_SET_GPIO_STATE, in rpi_exp_gpio_set()
192 dev_err(gc->parent, in rpi_exp_gpio_set()
199 struct device *dev = &pdev->dev; in rpi_exp_gpio_probe()
200 struct device_node *np = dev->of_node; in rpi_exp_gpio_probe()
208 return -ENOENT; in rpi_exp_gpio_probe()
211 fw = devm_rpi_firmware_get(&pdev->dev, fw_node); in rpi_exp_gpio_probe()
214 return -EPROBE_DEFER; in rpi_exp_gpio_probe()
218 return -ENOMEM; in rpi_exp_gpio_probe()
220 rpi_gpio->fw = fw; in rpi_exp_gpio_probe()
221 rpi_gpio->gc.parent = dev; in rpi_exp_gpio_probe()
222 rpi_gpio->gc.label = MODULE_NAME; in rpi_exp_gpio_probe()
223 rpi_gpio->gc.owner = THIS_MODULE; in rpi_exp_gpio_probe()
224 rpi_gpio->gc.base = -1; in rpi_exp_gpio_probe()
225 rpi_gpio->gc.ngpio = NUM_GPIO; in rpi_exp_gpio_probe()
227 rpi_gpio->gc.direction_input = rpi_exp_gpio_dir_in; in rpi_exp_gpio_probe()
228 rpi_gpio->gc.direction_output = rpi_exp_gpio_dir_out; in rpi_exp_gpio_probe()
229 rpi_gpio->gc.get_direction = rpi_exp_gpio_get_direction; in rpi_exp_gpio_probe()
230 rpi_gpio->gc.get = rpi_exp_gpio_get; in rpi_exp_gpio_probe()
231 rpi_gpio->gc.set = rpi_exp_gpio_set; in rpi_exp_gpio_probe()
232 rpi_gpio->gc.can_sleep = true; in rpi_exp_gpio_probe()
234 return devm_gpiochip_add_data(dev, &rpi_gpio->gc, rpi_gpio); in rpi_exp_gpio_probe()
238 { .compatible = "raspberrypi,firmware-gpio" },
255 MODULE_ALIAS("platform:rpi-exp-gpio");