1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
10 * struct button_uc_plat - Platform data the uclass stores about each device
12 * @label: Button label
14 struct button_uc_plat {
19 * enum button_state_t - State used for button
20 * - BUTTON_OFF - Button is not pressed
21 * - BUTTON_ON - Button is pressed
22 * - BUTTON_COUNT - Number of button state
32 * get_state() - get the state of a button
34 * @dev: button device to change
35 * @return button state button_state_t, or -ve on error
37 enum button_state_t (*get_state)(struct udevice *dev);
40 #define button_get_ops(dev) ((struct button_ops *)(dev)->driver->ops)
43 * button_get_by_label() - Find a button device by label
45 * @label: button label to look up
46 * @devp: Returns the associated device, if found
47 * @return 0 if found, -ENODEV if not found, other -ve on error
49 int button_get_by_label(const char *label, struct udevice **devp);
52 * button_get_state() - get the state of a button
54 * @dev: button device to change
55 * @return button state button_state_t, or -ve on error
57 enum button_state_t button_get_state(struct udevice *dev);