Lines Matching +full:zynqmp +full:- +full:gpio +full:- +full:modepin

1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for the ps-mode pin configuration.
10 #include <linux/gpio/driver.h>
16 #include <linux/firmware/xlnx-zynqmp.h>
18 /* 4-bit boot mode pins */
22 * modepin_gpio_get_value - Get the state of the specified pin of GPIO device
24 * @pin: gpio pin number within the device
26 * This function reads the state of the specified pin of the GPIO device.
28 * Return: 0 if the pin is low, 1 if pin is high, -EINVAL wrong pin configured
50 * modepin_gpio_set_value - Modify the state of the pin with specified value
52 * @pin: gpio pin number within the device
55 * This function reads the state of the specified pin of the GPIO device, mask
56 * with the capture state of GPIO pin, and update pin of GPIO device.
79 pr_err("modepin: set value error %d for pin %d\n", ret, pin); in modepin_gpio_set_value()
83 * modepin_gpio_dir_in - Set the direction of the specified GPIO pin as input
85 * @pin: gpio pin number within the device
95 * modepin_gpio_dir_out - Set the direction of the specified GPIO pin as output
97 * @pin: gpio pin number within the device
109 * modepin_gpio_probe - Initialization method for modepin_gpio
119 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); in modepin_gpio_probe()
121 return -ENOMEM; in modepin_gpio_probe()
125 /* configure the gpio chip */ in modepin_gpio_probe()
126 chip->base = -1; in modepin_gpio_probe()
127 chip->ngpio = MODE_PINS; in modepin_gpio_probe()
128 chip->owner = THIS_MODULE; in modepin_gpio_probe()
129 chip->parent = &pdev->dev; in modepin_gpio_probe()
130 chip->get = modepin_gpio_get_value; in modepin_gpio_probe()
131 chip->set = modepin_gpio_set_value; in modepin_gpio_probe()
132 chip->direction_input = modepin_gpio_dir_in; in modepin_gpio_probe()
133 chip->direction_output = modepin_gpio_dir_out; in modepin_gpio_probe()
134 chip->label = dev_name(&pdev->dev); in modepin_gpio_probe()
136 /* modepin gpio registration */ in modepin_gpio_probe()
137 status = devm_gpiochip_add_data(&pdev->dev, chip, chip); in modepin_gpio_probe()
139 return dev_err_probe(&pdev->dev, status, in modepin_gpio_probe()
140 "Failed to add GPIO chip\n"); in modepin_gpio_probe()
146 { .compatible = "xlnx,zynqmp-gpio-modepin", },
153 .name = "modepin-gpio",
162 MODULE_DESCRIPTION("ZynqMP Boot PS_MODE Configuration");