Lines Matching +full:on +full:- +full:chip
1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for the ps-mode pin configuration.
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
23 * @chip: gpio_chip instance to be worked on
28 * Return: 0 if the pin is low, 1 if pin is high, -EINVAL wrong pin configured
31 static int modepin_gpio_get_value(struct gpio_chip *chip, unsigned int pin) in modepin_gpio_get_value() argument
50 * modepin_gpio_set_value - Modify the state of the pin with specified value
51 * @chip: gpio_chip instance to be worked on
60 static int modepin_gpio_set_value(struct gpio_chip *chip, unsigned int pin, in modepin_gpio_set_value() argument
85 * modepin_gpio_dir_in - Set the direction of the specified GPIO pin as input
86 * @chip: gpio_chip instance to be worked on
91 static int modepin_gpio_dir_in(struct gpio_chip *chip, unsigned int pin) in modepin_gpio_dir_in() argument
97 * modepin_gpio_dir_out - Set the direction of the specified GPIO pin as output
98 * @chip: gpio_chip instance to be worked on
104 static int modepin_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, in modepin_gpio_dir_out() argument
107 return modepin_gpio_set_value(chip, pin, state); in modepin_gpio_dir_out()
111 * modepin_gpio_probe - Initialization method for modepin_gpio
114 * Return: 0 on success, negative error otherwise.
118 struct gpio_chip *chip; in modepin_gpio_probe() local
121 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); in modepin_gpio_probe()
122 if (!chip) in modepin_gpio_probe()
123 return -ENOMEM; in modepin_gpio_probe()
125 platform_set_drvdata(pdev, chip); in modepin_gpio_probe()
127 /* configure the gpio chip */ in modepin_gpio_probe()
128 chip->base = -1; in modepin_gpio_probe()
129 chip->ngpio = MODE_PINS; in modepin_gpio_probe()
130 chip->owner = THIS_MODULE; in modepin_gpio_probe()
131 chip->parent = &pdev->dev; in modepin_gpio_probe()
132 chip->get = modepin_gpio_get_value; in modepin_gpio_probe()
133 chip->set = modepin_gpio_set_value; in modepin_gpio_probe()
134 chip->direction_input = modepin_gpio_dir_in; in modepin_gpio_probe()
135 chip->direction_output = modepin_gpio_dir_out; in modepin_gpio_probe()
136 chip->label = dev_name(&pdev->dev); in modepin_gpio_probe()
139 status = devm_gpiochip_add_data(&pdev->dev, chip, chip); in modepin_gpio_probe()
141 return dev_err_probe(&pdev->dev, status, in modepin_gpio_probe()
142 "Failed to add GPIO chip\n"); in modepin_gpio_probe()
148 { .compatible = "xlnx,zynqmp-gpio-modepin", },
155 .name = "modepin-gpio",