Skip to contentSkip to conversation

VIM3: add support for checking 'Function' button state

PATCH New Marek Szyprowski 3 participants 9 messages Feb 18, 2021 1 message not in the archive Arm/Amlogic Meson SoC support

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20210218103327eucas1p21cbeb2ae82a75cb350e1b1a683e30a73@eucas1p2.samsung.com

#1 lore raw

v7 cover VIM3: add support for checking 'Function' button state

Hi All,

This patchset adds all building blocks needed for checking the 'Function' button state in the boot script on Amlogic A311D based VIM3 board. This button is connected to the ADC line of the SoC, so it required to enable meson SARADC, the clocks needed for it and a simple button-adc drivers.

Once applied, one can use following commands in the boot scripts:
-->8---
echo Checking Func button state: \\c
if button Function
then

	echo Selected alternative boot
	...

fi
--->8---

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Changelog:
v7:
- added linux,code properties to the test.dts

v6: https://lists.denx.de/pipermail/u-boot/2021-February/441039.html
- added a simple sandbox test for adc-keys
- use of_to_plat and adc_raw_to_uV to simplify code in the adc button driver

v5: https://lists.denx.de/pipermail/u-boot/2021-January/438751.html
- rebased onto latest uboot-amlogic/u-boot-amlogic-next branch
- synchronized adc-keys binding with the recent version from the Linux kernel
- updated adc-keys driver to match behavior from dt-bindings
- added a patch for meson-saradc driver to register vdd reference supply to the ADC framework

v4: https://lists.denx.de/pipermail/u-boot/2020-December/435641.html
- rebased onto uboot-amlogic/u-boot-amlogic-next and dropped merged patches
- added adc-keys bindings docs (copied from Linux kernel)
- minor code adjustments pointed by Simon
- enabled driver also in khadas-vim3l_defconfig

v3: https://lists.denx.de/pipermail/u-boot/2020-December/435072.html
- removed 'button' env variable
- extended kconfig and patch descriptions

v2: https://lists.denx.de/pipermail/u-boot/2020-December/434991.html
- removed Change-Id tags
- split defconfig changes into ADC and button related

v1: https://lists.denx.de/pipermail/u-boot/2020-December/434875.html
- initial submission

Patch summary:

Marek Szyprowski (5):
dt-bindings: input: adc-keys bindings documentation
button: add a simple Analog to Digital Converter device based button
driver
adc: meson-saradc: add support for getting reference voltage value
configs: khadas-vim3(l): enable Function button support
test: add a simple test for the adc-keys button driver

 arch/sandbox/dts/test.dts                   |  27 +++-
 configs/khadas-vim3_defconfig               |   2 +
 configs/khadas-vim3l_defconfig              |   2 +
 configs/sandbox_defconfig                   |   1 +
 doc/device-tree-bindings/input/adc-keys.txt |  67 +++++++++
 drivers/adc/meson-saradc.c                  |  21 +++
 drivers/button/Kconfig                      |   8 ++
 drivers/button/Makefile                     |   1 +
 drivers/button/button-adc.c                 | 146 ++++++++++++++++++++
 test/dm/button.c                            |  50 ++++++-
 10 files changed, 322 insertions(+), 3 deletions(-)
 create mode 100644 doc/device-tree-bindings/input/adc-keys.txt
 create mode 100644 drivers/button/button-adc.c
Signature · 1 line
2.17.1
#2 lore raw

PATCH v7 1/5 dt-bindings: input: adc-keys bindings documentation

Dump adc-keys bindings documentation from Linux kernel source tree from commit 698dc0cf9447 ("dt-bindings: input: adc-keys: clarify description").

---
 doc/device-tree-bindings/input/adc-keys.txt | 67 +++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 doc/device-tree-bindings/input/adc-keys.txt
doc/device-tree-bindings/input/adc-keys.txt new file +67 -0
new file mode 100644
index 0000000000..6c8be6a9ac
@@ -0,0 +1,67 @@
+ADC attached resistor ladder buttons
+------------------------------------
+
+Required properties:
+ - compatible: "adc-keys"
+ - io-channels: Phandle to an ADC channel
+ - io-channel-names = "buttons";
+ - keyup-threshold-microvolt: Voltage above or equal to which all the keys are
+			      considered up.
+
+Optional properties:
+	- poll-interval: Poll interval time in milliseconds
+	- autorepeat: Boolean, Enable auto repeat feature of Linux input
+	  subsystem.
+
+Each button (key) is represented as a sub-node of "adc-keys":
+
+Required subnode-properties:
+	- label: Descriptive name of the key.
+	- linux,code: Keycode to emit.
+	- press-threshold-microvolt: voltage above or equal to which this key is
+				     considered pressed.
+
+No two values of press-threshold-microvolt may be the same.
+All values of press-threshold-microvolt must be less than
+keyup-threshold-microvolt.
+
+Example:
+
+#include <dt-bindings/input/input.h>
+
+	adc-keys {
+		compatible = "adc-keys";
+		io-channels = <&lradc 0>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <2000000>;
+
+		button-up {
+			label = "Volume Up";
+			linux,code = <KEY_VOLUMEUP>;
+			press-threshold-microvolt = <1500000>;
+		};
+
+		button-down {
+			label = "Volume Down";
+			linux,code = <KEY_VOLUMEDOWN>;
+			press-threshold-microvolt = <1000000>;
+		};
+
+		button-enter {
+			label = "Enter";
+			linux,code = <KEY_ENTER>;
+			press-threshold-microvolt = <500000>;
+		};
+	};
+
++--------------------------------+------------------------+
+| 2.000.000 <= value             | no key pressed         |
++--------------------------------+------------------------+
+| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
++--------------------------------+------------------------+
+| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
++--------------------------------+------------------------+
+|   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
++--------------------------------+------------------------+
+|              value <   500.000 | no key pressed         |
++--------------------------------+------------------------+
Signature · 1 line
2.17.1
#3 lore raw

PATCH v7 2/5 button: add a simple Analog to Digital Converter device based button driver

In reply to Marek Szyprowski

Add a simple Analog to Digital Converter device based button driver. This driver binds to the 'adc-keys' device tree node.

---
 drivers/button/Kconfig      |   8 ++
 drivers/button/Makefile     |   1 +
 drivers/button/button-adc.c | 146 ++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 drivers/button/button-adc.c
drivers/button/Kconfig +8 -0
index 6b3ec7e55d..6db3c5e93a 100644
@@ -9,6 +9,14 @@ config BUTTON
 	  can provide access to board-specific buttons. Use of the device tree
 	  for configuration is encouraged.
 
+config BUTTON_ADC
+	bool "Button adc"
+	depends on BUTTON
+	help
+	  Enable support for buttons which are connected to Analog to Digital
+	  Converter device. The ADC driver must use driver model. Buttons are
+	  configured using the device tree.
+
 config BUTTON_GPIO
 	bool "Button gpio"
 	depends on BUTTON
drivers/button/Makefile +1 -0
index fcc10ebe8d..bbd18af149 100644
@@ -3,4 +3,5 @@
 # Copyright (C) 2020 Philippe Reynes <[email protected]>
 
 obj-$(CONFIG_BUTTON) += button-uclass.o
+obj-$(CONFIG_BUTTON_ADC) += button-adc.o
 obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o
drivers/button/button-adc.c new file +146 -0

146 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v7 3/5 adc: meson-saradc: add support for getting reference voltage value

In reply to Marek Szyprowski

Add support for getting the 'vref-supply' regulator and register it as ADC's reference voltage regulator, so clients can translate sampled ADC values to the voltage.

---
 drivers/adc/meson-saradc.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/adc/meson-saradc.c +21 -0
index 21db55831d..1a45a3a265 100644
@@ -18,6 +18,7 @@
 #include <linux/delay.h>
 #include <linux/math64.h>
 #include <linux/bitfield.h>
+#include <power/regulator.h>
 
 #define MESON_SAR_ADC_REG0					0x00
 	#define MESON_SAR_ADC_REG0_PANEL_DETECT			BIT(31)
@@ -656,7 +657,10 @@ static int meson_saradc_stop(struct udevice *dev)
 
 static int meson_saradc_probe(struct udevice *dev)
 {
+	struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev);
 	struct meson_saradc_priv *priv = dev_get_priv(dev);
+	struct udevice *vref;
+	int vref_uv;
 	int ret;
 
 	ret = regmap_init_mem(dev_ofnode(dev), &priv->regmap);
@@ -675,6 +679,23 @@ static int meson_saradc_probe(struct udevice *dev)
 
 	priv->active_channel = -1;
 
+	ret = device_get_supply_regulator(dev, "vref-supply", &vref);
+	if (ret) {
+		printf("can't get vref-supply: %d\n", ret);
+		return ret;
+	}
+
+	vref_uv = regulator_get_value(vref);
+	if (vref_uv < 0) {
+		printf("can't get vref-supply value: %d\n", vref_uv);
+		return vref_uv;
+	}
+
+	/* VDD supplied by common vref pin */
+	uc_pdata->vdd_supply = vref;
+	uc_pdata->vdd_microvolts = vref_uv;
+	uc_pdata->vss_microvolts = 0;
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH v7 4/5 configs: khadas-vim3(l): enable Function button support

In reply to Marek Szyprowski

Add options required to check the 'Function' button state.

---
 configs/khadas-vim3_defconfig  | 2 ++
 configs/khadas-vim3l_defconfig | 2 ++
 2 files changed, 4 insertions(+)
configs/khadas-vim3_defconfig +2 -0
index 5d16652fd6..bc17430569 100644
@@ -31,6 +31,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ADC=y
 CONFIG_SARADC_MESON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_ADC=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
 CONFIG_DM_MMC=y
configs/khadas-vim3l_defconfig +2 -0
index 6b13ce045c..c1877922c7 100644
@@ -31,6 +31,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ADC=y
 CONFIG_SARADC_MESON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_ADC=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
 CONFIG_DM_MMC=y
Signature · 1 line
2.17.1
#6 lore raw

PATCH v7 5/5 test: add a simple test for the adc-keys button driver

In reply to Marek Szyprowski

Add adc-keys device to the sandbox/test.dts and connect it to the channel #3 of the sandbox_adc driver. The default values sampled by sandbox_adc driver determines that button3 and button4 are released and button5 is pressed.

---
 arch/sandbox/dts/test.dts | 28 +++++++++++++++++++++-
 configs/sandbox_defconfig |  1 +
 test/dm/button.c          | 50 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 76 insertions(+), 3 deletions(-)
arch/sandbox/dts/test.dts +27 -1
index e95f4631bf..202e091841 100644
@@ -2,6 +2,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/gpio/sandbox-gpio.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/sandbox-pinmux.h>
 #include <dt-bindings/mux/mux.h>
 
@@ -69,6 +70,30 @@
 		};
 	};
 
+	buttons2 {
+		compatible = "adc-keys";
+		io-channels = <&adc 3>;
+		keyup-threshold-microvolt = <3000000>;
+
+		button-up {
+			label = "button3";
+			linux,code = <KEY_F3>;
+			press-threshold-microvolt = <1500000>;
+		};
+
+		button-down {
+			label = "button4";
+			linux,code = <KEY_F4>;
+			press-threshold-microvolt = <1000000>;
+		};
+
+		button-enter {
+			label = "button5";
+			linux,code = <KEY_F5>;
+			press-threshold-microvolt = <500000>;
+		};
+	};
+
 	cros_ec: cros-ec {
 		reg = <0 0>;
 		compatible = "google,cros-ec-sandbox";
@@ -587,8 +612,9 @@
 		i2c-eeprom = <&bootcount_i2c>;
 	};
 
-	adc at 0 {
+	adc: adc at 0 {
 		compatible = "sandbox,adc";
+		#io-channel-cells = <1>;
 		vdd-supply = <&buck2>;
 		vss-microvolts = <0>;
 	};
configs/sandbox_defconfig +1 -0
index 0c7674efc9..3731bf05ff 100644
@@ -122,6 +122,7 @@ CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_RTC=y
 CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y
 CONFIG_BUTTON=y
+CONFIG_BUTTON_ADC=y
 CONFIG_BUTTON_GPIO=y
 CONFIG_CLK=y
 CONFIG_CLK_COMPOSITE_CCF=y
test/dm/button.c +48 -2

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#7 lore raw

v7 cover VIM3: add support for checking 'Function' button state

In reply to Marek Szyprowski
Quoted 66 lines · Marek Szyprowski

Hi All,

This patchset adds all building blocks needed for checking the 'Function' button state in the boot script on Amlogic A311D based VIM3 board. This button is connected to the ADC line of the SoC, so it required to enable meson SARADC, the clocks needed for it and a simple button-adc drivers.

Once applied, one can use following commands in the boot scripts:
-->8---
echo Checking Func button state: \\c
if button Function
then

	echo Selected alternative boot
	...

fi
--->8---

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Changelog:
v7:
- added linux,code properties to the test.dts

v6: https://lists.denx.de/pipermail/u-boot/2021-February/441039.html
- added a simple sandbox test for adc-keys
- use of_to_plat and adc_raw_to_uV to simplify code in the adc button driver

v5: https://lists.denx.de/pipermail/u-boot/2021-January/438751.html
- rebased onto latest uboot-amlogic/u-boot-amlogic-next branch
- synchronized adc-keys binding with the recent version from the Linux kernel
- updated adc-keys driver to match behavior from dt-bindings
- added a patch for meson-saradc driver to register vdd reference supply to the ADC framework

v4: https://lists.denx.de/pipermail/u-boot/2020-December/435641.html
- rebased onto uboot-amlogic/u-boot-amlogic-next and dropped merged patches
- added adc-keys bindings docs (copied from Linux kernel)
- minor code adjustments pointed by Simon
- enabled driver also in khadas-vim3l_defconfig

v3: https://lists.denx.de/pipermail/u-boot/2020-December/435072.html
- removed 'button' env variable
- extended kconfig and patch descriptions

v2: https://lists.denx.de/pipermail/u-boot/2020-December/434991.html
- removed Change-Id tags
- split defconfig changes into ADC and button related

v1: https://lists.denx.de/pipermail/u-boot/2020-December/434875.html
- initial submission

Patch summary:

Marek Szyprowski (5):
dt-bindings: input: adc-keys bindings documentation
button: add a simple Analog to Digital Converter device based button
driver
adc: meson-saradc: add support for getting reference voltage value
configs: khadas-vim3(l): enable Function button support
test: add a simple test for the adc-keys button driver

Quoted 14 lines
 arch/sandbox/dts/test.dts                   |  27 +++-
 configs/khadas-vim3_defconfig               |   2 +
 configs/khadas-vim3l_defconfig              |   2 +
 configs/sandbox_defconfig                   |   1 +
 doc/device-tree-bindings/input/adc-keys.txt |  67 +++++++++
 drivers/adc/meson-saradc.c                  |  21 +++
 drivers/button/Kconfig                      |   8 ++
 drivers/button/Makefile                     |   1 +
 drivers/button/button-adc.c                 | 146 ++++++++++++++++++++
 test/dm/button.c                            |  50 ++++++-
 10 files changed, 322 insertions(+), 3 deletions(-)
 create mode 100644 doc/device-tree-bindings/input/adc-keys.txt
 create mode 100644 drivers/button/button-adc.c

Applying to u-boot-amlogic !

Thanks,
Neil

#8 lore raw

v7 cover VIM3: add support for checking 'Function' button state

Quoted 82 lines · Neil Armstrong
Quoted 66 lines · Marek Szyprowski

Hi All,

This patchset adds all building blocks needed for checking the 'Function' button state in the boot script on Amlogic A311D based VIM3 board. This button is connected to the ADC line of the SoC, so it required to enable meson SARADC, the clocks needed for it and a simple button-adc drivers.

Once applied, one can use following commands in the boot scripts:
-->8---
echo Checking Func button state: \\c
if button Function
then

	echo Selected alternative boot
	...

fi
--->8---

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Changelog:
v7:
- added linux,code properties to the test.dts

v6: https://lists.denx.de/pipermail/u-boot/2021-February/441039.html
- added a simple sandbox test for adc-keys
- use of_to_plat and adc_raw_to_uV to simplify code in the adc button driver

v5: https://lists.denx.de/pipermail/u-boot/2021-January/438751.html
- rebased onto latest uboot-amlogic/u-boot-amlogic-next branch
- synchronized adc-keys binding with the recent version from the Linux kernel
- updated adc-keys driver to match behavior from dt-bindings
- added a patch for meson-saradc driver to register vdd reference supply to the ADC framework

v4: https://lists.denx.de/pipermail/u-boot/2020-December/435641.html
- rebased onto uboot-amlogic/u-boot-amlogic-next and dropped merged patches
- added adc-keys bindings docs (copied from Linux kernel)
- minor code adjustments pointed by Simon
- enabled driver also in khadas-vim3l_defconfig

v3: https://lists.denx.de/pipermail/u-boot/2020-December/435072.html
- removed 'button' env variable
- extended kconfig and patch descriptions

v2: https://lists.denx.de/pipermail/u-boot/2020-December/434991.html
- removed Change-Id tags
- split defconfig changes into ADC and button related

v1: https://lists.denx.de/pipermail/u-boot/2020-December/434875.html
- initial submission

Patch summary:

Marek Szyprowski (5):
dt-bindings: input: adc-keys bindings documentation
button: add a simple Analog to Digital Converter device based button
driver
adc: meson-saradc: add support for getting reference voltage value
configs: khadas-vim3(l): enable Function button support
test: add a simple test for the adc-keys button driver

Quoted 14 lines
 arch/sandbox/dts/test.dts                   |  27 +++-
 configs/khadas-vim3_defconfig               |   2 +
 configs/khadas-vim3l_defconfig              |   2 +
 configs/sandbox_defconfig                   |   1 +
 doc/device-tree-bindings/input/adc-keys.txt |  67 +++++++++
 drivers/adc/meson-saradc.c                  |  21 +++
 drivers/button/Kconfig                      |   8 ++
 drivers/button/Makefile                     |   1 +
 drivers/button/button-adc.c                 | 146 ++++++++++++++++++++
 test/dm/button.c                            |  50 ++++++-
 10 files changed, 322 insertions(+), 3 deletions(-)
 create mode 100644 doc/device-tree-bindings/input/adc-keys.txt
 create mode 100644 drivers/button/button-adc.c
Quoted 5 lines

Applying to u-boot-amlogic !

Thanks,
Neil

Doesn't seem related to this patchset but one of my builder gets this error:
In file included from ../drivers/button/button-uclass.c:9:0:
973../include/button.h:37:42: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 974 enum button_state_t (*get_state)(struct udevice *dev);
975 ^~~~~~~
976../include/button.h:49:51: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 977 int button_get_by_label(const char *label, struct udevice **devp);
978 ^~~~~~~
979../include/button.h:57:45: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 980 enum button_state_t button_get_state(struct udevice *dev);
981 ^~~~~~~
982../drivers/button/button-uclass.c:13:5: error: conflicting types for 'button_get_by_label'
983 int button_get_by_label(const char *label, struct udevice **devp)
984 ^~~~~~~~~~~~~~~~~~~
985In file included from ../drivers/button/button-uclass.c:9:0:
986../include/button.h:49:5: note: previous declaration of 'button_get_by_label' was here
987 int button_get_by_label(const char *label, struct udevice **devp);
988 ^~~~~~~~~~~~~~~~~~~
989../drivers/button/button-uclass.c:29:21: error: conflicting types for 'button_get_state'
990 enum button_state_t button_get_state(struct udevice *dev)
991 ^~~~~~~~~~~~~~~~
992In file included from ../drivers/button/button-uclass.c:9:0:
993../include/button.h:57:21: note: previous declaration of 'button_get_state' was here
994 enum button_state_t button_get_state(struct udevice *dev);
995 ^~~~~~~~~~~~~~~~
996../drivers/button/button-uclass.c: In function 'button_get_state':
997../drivers/button/button-uclass.c:36:24: warning: passing argument 1 of 'ops->get_state' from incompatible pointer type [-Wincompatible-pointer-types] 998 return ops->get_state(dev);
999 ^~~
1000../drivers/button/button-uclass.c:36:24: note: expected 'struct udevice *' but argument is of type 'struct udevice *' 1001make[3]: *** [../scripts/Makefile.build:265: drivers/button/button-uclass.o] Error 1
1002make[2]: *** [../scripts/Makefile.build:419: drivers/button] Error 2
1003make[1]: *** [/tmp/u-boot/Makefile:1791: drivers] Error 2

did I miss a dependency ?

Neil

#9 lore raw

v7 cover VIM3: add support for checking 'Function' button state

Quoted 85 lines · Neil Armstrong
Quoted 84 lines · Neil Armstrong
Quoted 66 lines · Marek Szyprowski

Hi All,

This patchset adds all building blocks needed for checking the 'Function' button state in the boot script on Amlogic A311D based VIM3 board. This button is connected to the ADC line of the SoC, so it required to enable meson SARADC, the clocks needed for it and a simple button-adc drivers.

Once applied, one can use following commands in the boot scripts:
-->8---
echo Checking Func button state: \\c
if button Function
then

	echo Selected alternative boot
	...

fi
--->8---

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Changelog:
v7:
- added linux,code properties to the test.dts

v6: https://lists.denx.de/pipermail/u-boot/2021-February/441039.html
- added a simple sandbox test for adc-keys
- use of_to_plat and adc_raw_to_uV to simplify code in the adc button driver

v5: https://lists.denx.de/pipermail/u-boot/2021-January/438751.html
- rebased onto latest uboot-amlogic/u-boot-amlogic-next branch
- synchronized adc-keys binding with the recent version from the Linux kernel
- updated adc-keys driver to match behavior from dt-bindings
- added a patch for meson-saradc driver to register vdd reference supply to the ADC framework

v4: https://lists.denx.de/pipermail/u-boot/2020-December/435641.html
- rebased onto uboot-amlogic/u-boot-amlogic-next and dropped merged patches
- added adc-keys bindings docs (copied from Linux kernel)
- minor code adjustments pointed by Simon
- enabled driver also in khadas-vim3l_defconfig

v3: https://lists.denx.de/pipermail/u-boot/2020-December/435072.html
- removed 'button' env variable
- extended kconfig and patch descriptions

v2: https://lists.denx.de/pipermail/u-boot/2020-December/434991.html
- removed Change-Id tags
- split defconfig changes into ADC and button related

v1: https://lists.denx.de/pipermail/u-boot/2020-December/434875.html
- initial submission

Patch summary:

Marek Szyprowski (5):
dt-bindings: input: adc-keys bindings documentation
button: add a simple Analog to Digital Converter device based button
driver
adc: meson-saradc: add support for getting reference voltage value
configs: khadas-vim3(l): enable Function button support
test: add a simple test for the adc-keys button driver

Quoted 14 lines
 arch/sandbox/dts/test.dts                   |  27 +++-
 configs/khadas-vim3_defconfig               |   2 +
 configs/khadas-vim3l_defconfig              |   2 +
 configs/sandbox_defconfig                   |   1 +
 doc/device-tree-bindings/input/adc-keys.txt |  67 +++++++++
 drivers/adc/meson-saradc.c                  |  21 +++
 drivers/button/Kconfig                      |   8 ++
 drivers/button/Makefile                     |   1 +
 drivers/button/button-adc.c                 | 146 ++++++++++++++++++++
 test/dm/button.c                            |  50 ++++++-
 10 files changed, 322 insertions(+), 3 deletions(-)
 create mode 100644 doc/device-tree-bindings/input/adc-keys.txt
 create mode 100644 drivers/button/button-adc.c

Applying to u-boot-amlogic !

Quoted 8 lines
Quoted 3 lines

Thanks,
Neil

Doesn't seem related to this patchset but one of my builder gets this error:
In file included from ../drivers/button/button-uclass.c:9:0:
973../include/button.h:37:42: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 974 enum button_state_t (*get_state)(struct udevice *dev);

Hello Neil,

this is probably a side effect of

401d1c4f5d2d ("common: Drop asm/global_data.h from common header")

Adding a line

struct udevice;

to include/button.h should fix it.

Best regards

Heinrich

Quoted 34 lines

975 ^~~~~~~
976../include/button.h:49:51: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 977 int button_get_by_label(const char *label, struct udevice **devp);
978 ^~~~~~~
979../include/button.h:57:45: warning: 'struct udevice' declared inside parameter list will not be visible outside of this definition or declaration 980 enum button_state_t button_get_state(struct udevice *dev);
981 ^~~~~~~
982../drivers/button/button-uclass.c:13:5: error: conflicting types for 'button_get_by_label'
983 int button_get_by_label(const char *label, struct udevice **devp)
984 ^~~~~~~~~~~~~~~~~~~
985In file included from ../drivers/button/button-uclass.c:9:0:
986../include/button.h:49:5: note: previous declaration of 'button_get_by_label' was here
987 int button_get_by_label(const char *label, struct udevice **devp);
988 ^~~~~~~~~~~~~~~~~~~
989../drivers/button/button-uclass.c:29:21: error: conflicting types for 'button_get_state'
990 enum button_state_t button_get_state(struct udevice *dev)
991 ^~~~~~~~~~~~~~~~
992In file included from ../drivers/button/button-uclass.c:9:0:
993../include/button.h:57:21: note: previous declaration of 'button_get_state' was here
994 enum button_state_t button_get_state(struct udevice *dev);
995 ^~~~~~~~~~~~~~~~
996../drivers/button/button-uclass.c: In function 'button_get_state':
997../drivers/button/button-uclass.c:36:24: warning: passing argument 1 of 'ops->get_state' from incompatible pointer type [-Wincompatible-pointer-types] 998 return ops->get_state(dev);
999 ^~~
1000../drivers/button/button-uclass.c:36:24: note: expected 'struct udevice *' but argument is of type 'struct udevice *' 1001make[3]: *** [../scripts/Makefile.build:265: drivers/button/button-uclass.o] Error 1
1002make[2]: *** [../scripts/Makefile.build:419: drivers/button] Error 2
1003make[1]: *** [/tmp/u-boot/Makefile:1791: drivers] Error 2

did I miss a dependency ?

Neil