From 9beacb6c026bc979e840f022098c36f175555539 Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Thu, 23 Jul 2020 07:01:38 -0500 Subject: dm: Fix build error when OF_CONTROL is not set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With OF_CONTROL disabled the build fails for include/dm/read.h:932:10: error: ‘ENOTSUPP’ undeclared (first use in this function) 932 | return -ENOTSUPP; Fixes: 45224e8f2691 ("dm: core: gracefully handle alias seq without of") Signed-off-by: Dan Murphy --- include/dm/read.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/dm/read.h b/include/dm/read.h index f02ec959541..b1a61085440 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -9,6 +9,8 @@ #ifndef _DM_READ_H #define _DM_READ_H +#include + #include #include #include -- cgit v1.2.3 From 30d66db78725e8396a3bd255cc51592c6cd7879d Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Fri, 24 Jul 2020 18:19:45 +0200 Subject: dm: button: add an uclass for button Add a new uclass for button that implements two functions: - button_get_by_label - button_get_status Reviewed-by: Simon Glass Signed-off-by: Philippe Reynes --- include/button.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + 2 files changed, 60 insertions(+) create mode 100644 include/button.h (limited to 'include') diff --git a/include/button.h b/include/button.h new file mode 100644 index 00000000000..688b63b082c --- /dev/null +++ b/include/button.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2020 Philippe Reynes + */ + +#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/uclass-id.h b/include/dm/uclass-id.h index 690a8ed4df4..dbc14ec3429 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 */ -- cgit v1.2.3 From b9390ce51cb46f4b4acda320e7ea8e0bd120e4b8 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 24 Jul 2020 18:39:43 +0200 Subject: dm: remove superfluous comment for union ofnode_union "future live tree" does not make sense anymore as we have CONFIG_OF_LIVE. Signed-off-by: Heinrich Schuchardt --- include/dm/ofnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index a0d3df77868..8df2facf998 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; -- cgit v1.2.3