Lines Matching +full:data +full:- +full:gpios
1 // SPDX-License-Identifier: GPL-2.0+
23 /* Number of the GPIO to read the SC data from */
25 /* Number of the GPIO to read the CON data from */
29 * struct board_gazerbeam_priv - Private data structure for the gazerbeam board
31 * @reset_gpios: GPIOs for the board's reset GPIOs.
32 * @var_gpios: GPIOs for the board's hardware variant GPIOs
33 * @ver_gpios: GPIOs for the board's hardware version GPIOs
48 * _read_board_variant_data() - Read variant information from the hardware.
52 * The data read from the board's hardware (mostly hard-wired GPIOs) is stored
53 * in the private data structure of the driver to be used by other driver
56 * Return: 0 if OK, -ve on error.
71 dev->name, I2C_BUS_SEQ_NO, res); in _read_board_variant_data()
77 dev->name, I2C_BUS_SEQ_NO); in _read_board_variant_data()
78 return -EIO; in _read_board_variant_data()
86 dev->name); in _read_board_variant_data()
87 return -EINVAL; in _read_board_variant_data()
90 listname = mc2 ? "var-gpios-mc2" : "var-gpios-mc4"; in _read_board_variant_data()
92 gpio_num = gpio_request_list_by_name(dev, listname, priv->var_gpios, in _read_board_variant_data()
93 ARRAY_SIZE(priv->var_gpios), in _read_board_variant_data()
97 dev->name, listname, gpio_num); in _read_board_variant_data()
101 sc = dm_gpio_get_value(&priv->var_gpios[SC_GPIO_NO]); in _read_board_variant_data()
104 dev->name, sc); in _read_board_variant_data()
108 con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]); in _read_board_variant_data()
111 dev->name, con); in _read_board_variant_data()
117 dev->name); in _read_board_variant_data()
118 return -EINVAL; in _read_board_variant_data()
121 priv->variant = con ? VAR_CON : VAR_CPU; in _read_board_variant_data()
123 priv->multichannel = mc4 ? 4 : (mc2 ? 2 : (sc ? 1 : 0)); in _read_board_variant_data()
129 * _read_hwversion() - Read the hardware version from the board.
132 * The hardware version read from the board (from hard-wired GPIOs) is stored
133 * in the private data structure of the driver to be used by other driver
136 * Return: 0 if OK, -ve on error.
143 res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios, in _read_hwversion()
144 ARRAY_SIZE(priv->ver_gpios), in _read_hwversion()
147 debug("%s: Error getting GPIO list 'ver-gpios' (err = %d)\n", in _read_hwversion()
148 dev->name, res); in _read_hwversion()
149 return -ENODEV; in _read_hwversion()
152 res = dm_gpio_get_values_as_int(priv->ver_gpios, in _read_hwversion()
153 ARRAY_SIZE(priv->ver_gpios)); in _read_hwversion()
156 dev->name, res); in _read_hwversion()
160 priv->hwversion = res; in _read_hwversion()
162 res = gpio_free_list(dev, priv->ver_gpios, ARRAY_SIZE(priv->ver_gpios)); in _read_hwversion()
165 dev->name, res); in _read_hwversion()
179 dev->name, res); in board_gazerbeam_detect()
186 dev->name, res); in board_gazerbeam_detect()
199 *val = priv->multichannel; in board_gazerbeam_get_int()
202 *val = priv->variant; in board_gazerbeam_get_int()
205 *val = priv->hwversion; in board_gazerbeam_get_int()
208 debug("%s: Integer value %d unknown\n", dev->name, id); in board_gazerbeam_get_int()
209 return -EINVAL; in board_gazerbeam_get_int()
230 gpio_num = gpio_request_list_by_name(dev, "reset-gpios", in board_gazerbeam_probe()
231 priv->reset_gpios, in board_gazerbeam_probe()
232 ARRAY_SIZE(priv->reset_gpios), in board_gazerbeam_probe()
236 debug("%s: Error getting GPIO list 'reset-gpios' (err = %d)\n", in board_gazerbeam_probe()
237 dev->name, gpio_num); in board_gazerbeam_probe()
241 /* Set startup-finished GPIOs */ in board_gazerbeam_probe()
242 for (i = 0; i < ARRAY_SIZE(priv->reset_gpios); i++) { in board_gazerbeam_probe()
243 int res = dm_gpio_set_value(&priv->reset_gpios[i], 0); in board_gazerbeam_probe()
247 dev->name, i, res); in board_gazerbeam_probe()