• Home
  • Raw
  • Download

Lines Matching +full:data +full:- +full:lines

1 // SPDX-License-Identifier: GPL-2.0-only
3 * GPIO tools - helpers library for the GPIO tools
18 #include "gpio-utils.h"
20 #define CONSUMER "gpio-utils"
27 * ioctl, including request and release for lines of gpio, read/write
29 * lines of gpio, user should use this type of api.
32 * following api will request gpio lines, do the operation and then
33 * release these lines.
36 * gpiotools_request_linehandle() - request gpio lines in a gpiochip
39 * @lines: An array desired lines, specified by offset
41 * @num_lines: The number of lines to request.
44 * @data: Default value will be set to gpio when flag is
50 * Request gpio lines through the ioctl provided by chardev. User
53 * gpiotools_release_linehandle() to release these lines after that.
58 int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, in gpiotools_request_linehandle() argument
60 struct gpiohandle_data *data, in gpiotools_request_linehandle() argument
71 return -ENOMEM; in gpiotools_request_linehandle()
74 if (fd == -1) { in gpiotools_request_linehandle()
75 ret = -errno; in gpiotools_request_linehandle()
82 req.lineoffsets[i] = lines[i]; in gpiotools_request_linehandle()
86 req.lines = num_lines; in gpiotools_request_linehandle()
88 memcpy(req.default_values, data, sizeof(req.default_values)); in gpiotools_request_linehandle()
91 if (ret == -1) { in gpiotools_request_linehandle()
92 ret = -errno; in gpiotools_request_linehandle()
97 if (close(fd) == -1) in gpiotools_request_linehandle()
105 * gpiotools_request_line() - request gpio lines in a gpiochip
108 * @lines: An array desired lines, specified by offset
110 * @num_lines: The number of lines to request.
117 * Request gpio lines through the ioctl provided by chardev. User
120 * gpiotools_release_line() to release these lines after that.
125 int gpiotools_request_line(const char *device_name, unsigned int *lines, in gpiotools_request_line() argument
138 return -ENOMEM; in gpiotools_request_line()
141 if (fd == -1) { in gpiotools_request_line()
142 ret = -errno; in gpiotools_request_line()
150 req.offsets[i] = lines[i]; in gpiotools_request_line()
157 if (ret == -1) { in gpiotools_request_line()
158 ret = -errno; in gpiotools_request_line()
163 if (close(fd) == -1) in gpiotools_request_line()
184 if (ret == -1) { in gpiotools_set_values()
185 ret = -errno; in gpiotools_set_values()
208 if (ret == -1) { in gpiotools_get_values()
209 ret = -errno; in gpiotools_get_values()
231 if (ret == -1) { in gpiotools_release_linehandle()
233 ret = -errno; in gpiotools_release_linehandle()
252 if (ret == -1) { in gpiotools_release_line()
254 ret = -errno; in gpiotools_release_line()
273 unsigned int lines[] = {line}; in gpiotools_get() local
275 ret = gpiotools_gets(device_name, lines, 1, &value); in gpiotools_get()
283 * gpiotools_gets(): Get values from specific lines.
286 * @lines: An array desired lines, specified by offset
288 * @num_lines: The number of lines to request.
294 int gpiotools_gets(const char *device_name, unsigned int *lines, in gpiotools_gets() argument
305 ret = gpiotools_request_line(device_name, lines, num_lines, in gpiotools_gets()
334 unsigned int lines[] = {line}; in gpiotools_set() local
336 return gpiotools_sets(device_name, lines, 1, &value); in gpiotools_set()
340 * gpiotools_sets(): Set values to specific lines.
343 * @lines: An array desired lines, specified by offset
345 * @num_lines: The number of lines to request.
352 int gpiotools_sets(const char *device_name, unsigned int *lines, in gpiotools_sets() argument
367 ret = gpiotools_request_line(device_name, lines, num_lines, in gpiotools_sets()