diff options
author | Tom Rini <trini@konsulko.com> | 2020-07-30 04:16:08 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-30 04:16:08 +0300 |
commit | 719f42190d5f0238cb01ef2ffba8af2285f7bc7a (patch) | |
tree | c789716a82ab552e0d0c1a9242fda7c41b04c238 /include | |
parent | 7cb2060b4e63a89c50739dc8a9fcd5d73f86f0be (diff) | |
parent | b9390ce51cb46f4b4acda320e7ea8e0bd120e4b8 (diff) | |
download | u-boot-719f42190d5f0238cb01ef2ffba8af2285f7bc7a.tar.xz |
Merge tag 'dm-pull-28jul20' of git://git.denx.de/u-boot-dm
Use binman instead of one of the Rockchip build scripts
Refactor to allow any arch to create SPI-flash images
New button uclass
Diffstat (limited to 'include')
-rw-r--r-- | include/button.h | 59 | ||||
-rw-r--r-- | include/dm/ofnode.h | 2 | ||||
-rw-r--r-- | include/dm/read.h | 2 | ||||
-rw-r--r-- | include/dm/uclass-id.h | 1 |
4 files changed, 63 insertions, 1 deletions
diff --git a/include/button.h b/include/button.h new file mode 100644 index 0000000000..688b63b082 --- /dev/null +++ b/include/button.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com> + */ + +#ifndef __BUTTON_H +#define __BUTTON_H + +/** + * struct button_uc_plat - Platform data the uclass stores about each device + * + * @label: Button label + */ +struct button_uc_plat { + const char *label; +}; + +/** + * enum button_state_t - State used for button + * - BUTTON_OFF - Button is not pressed + * - BUTTON_ON - Button is pressed + * - BUTTON_COUNT - Number of button state + */ +enum button_state_t { + BUTTON_OFF = 0, + BUTTON_ON = 1, + BUTTON_COUNT, +}; + +struct button_ops { + /** + * get_state() - get the state of a button + * + * @dev: button device to change + * @return button state button_state_t, or -ve on error + */ + enum button_state_t (*get_state)(struct udevice *dev); +}; + +#define button_get_ops(dev) ((struct button_ops *)(dev)->driver->ops) + +/** + * button_get_by_label() - Find a button device by label + * + * @label: button label to look up + * @devp: Returns the associated device, if found + * @return 0 if found, -ENODEV if not found, other -ve on error + */ +int button_get_by_label(const char *label, struct udevice **devp); + +/** + * button_get_state() - get the state of a button + * + * @dev: button device to change + * @return button state button_state_t, or -ve on error + */ +enum button_state_t button_get_state(struct udevice *dev); + +#endif diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index a0d3df7786..8df2facf99 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -48,7 +48,7 @@ struct resource; * is not a really a pointer to a node: it is an offset value. See above. */ typedef union ofnode_union { - const struct device_node *np; /* will be used for future live tree */ + const struct device_node *np; long of_offset; } ofnode; diff --git a/include/dm/read.h b/include/dm/read.h index f02ec95954..b1a6108544 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -9,6 +9,8 @@ #ifndef _DM_READ_H #define _DM_READ_H +#include <linux/errno.h> + #include <dm/fdtaddr.h> #include <dm/ofnode.h> #include <dm/uclass.h> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 690a8ed4df..dbc14ec342 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -38,6 +38,7 @@ enum uclass_id { UCLASS_BLK, /* Block device */ UCLASS_BOARD, /* Device information from hardware */ UCLASS_BOOTCOUNT, /* Bootcount backing store */ + UCLASS_BUTTON, /* Button */ UCLASS_CACHE, /* Cache controller */ UCLASS_CLK, /* Clock source, e.g. used by peripherals */ UCLASS_CPU, /* CPU, typically part of an SoC */ |