* [PATCH v2 0/7] VIM3: add support for checking 'Function' button state
[not found] <CGME20201215144242eucas1p1c837ea82b7365808b5384c9eb204b593@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
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 lines 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
button Function
if test ${button} = on
then
echo Selected alternative boot
...
fi
--->8---
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Changelog:
v2:
- 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 (7):
clk: meson: add minimal driver for g12a-ao clocks
adc: meson-saradc: add G12A variant
adc: meson-saradc: skip hardware init only if ADC is enabled
configs: khadas-vim3: enable ADC device support
button: add a simple ADC-based button driver
cmd: button: store button state in the 'button' env
configs: khadas-vim3: enable Function button support
cmd/button.c | 4 +-
configs/khadas-vim3_defconfig | 4 ++
drivers/adc/meson-saradc.c | 9 ++-
drivers/button/Kconfig | 8 +++
drivers/button/Makefile | 1 +
drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++
drivers/clk/meson/Makefile | 1 +
drivers/clk/meson/g12a-ao.c | 83 ++++++++++++++++++++++++
8 files changed, 224 insertions(+), 3 deletions(-)
create mode 100644 drivers/button/button-adc.c
create mode 100644 drivers/clk/meson/g12a-ao.c
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 0/7] VIM3: add support for checking 'Function' button state
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
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 lines 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
button Function
if test ${button} = on
then
echo Selected alternative boot
...
fi
--->8---
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Changelog:
v2:
- 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 (7):
clk: meson: add minimal driver for g12a-ao clocks
adc: meson-saradc: add G12A variant
adc: meson-saradc: skip hardware init only if ADC is enabled
configs: khadas-vim3: enable ADC device support
button: add a simple ADC-based button driver
cmd: button: store button state in the 'button' env
configs: khadas-vim3: enable Function button support
cmd/button.c | 4 +-
configs/khadas-vim3_defconfig | 4 ++
drivers/adc/meson-saradc.c | 9 ++-
drivers/button/Kconfig | 8 +++
drivers/button/Makefile | 1 +
drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++
drivers/clk/meson/Makefile | 1 +
drivers/clk/meson/g12a-ao.c | 83 ++++++++++++++++++++++++
8 files changed, 224 insertions(+), 3 deletions(-)
create mode 100644 drivers/button/button-adc.c
create mode 100644 drivers/clk/meson/g12a-ao.c
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 1/7] clk: meson: add minimal driver for g12a-ao clocks
[not found] ` <CGME20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
Add minimal driver AO clocks on meson G12A family. Only ADC related clocks
are supported.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/clk/meson/Makefile | 1 +
drivers/clk/meson/g12a-ao.c | 83 +++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
create mode 100644 drivers/clk/meson/g12a-ao.c
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index c873d6976f..7204383e17 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -6,4 +6,5 @@
obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
obj-$(CONFIG_CLK_MESON_AXG) += axg.o
obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
+obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
new file mode 100644
index 0000000000..7a0abea77c
--- /dev/null
+++ b/drivers/clk/meson/g12a-ao.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <log.h>
+#include <asm/io.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <dt-bindings/clock/g12a-aoclkc.h>
+
+#include "clk_meson.h"
+
+struct meson_clk {
+ struct regmap *map;
+};
+
+#define AO_CLK_GATE0 0x4c
+#define AO_SAR_CLK 0x90
+
+static struct meson_gate gates[] = {
+ MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 8),
+ MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 8),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+ struct meson_clk *priv = dev_get_priv(clk->dev);
+ struct meson_gate *gate;
+
+ if (clk->id >= ARRAY_SIZE(gates))
+ return -ENOENT;
+
+ gate = &gates[clk->id];
+
+ if (gate->reg == 0)
+ return 0;
+
+ regmap_update_bits(priv->map, gate->reg,
+ BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+ return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+ return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+ return meson_set_gate(clk, false);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+ struct meson_clk *priv = dev_get_priv(dev);
+
+ priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+ if (IS_ERR(priv->map))
+ return PTR_ERR(priv->map);
+
+ return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+ .disable = meson_clk_disable,
+ .enable = meson_clk_enable,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+ { .compatible = "amlogic,meson-g12a-aoclkc" },
+ { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg) = {
+ .name = "meson_clk_g12a_ao",
+ .id = UCLASS_CLK,
+ .of_match = meson_clk_ids,
+ .priv_auto_alloc_size = sizeof(struct meson_clk),
+ .ops = &meson_clk_ops,
+ .probe = meson_clk_probe,
+};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 1/7] clk: meson: add minimal driver for g12a-ao clocks
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Add minimal driver AO clocks on meson G12A family. Only ADC related clocks
are supported.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/clk/meson/Makefile | 1 +
drivers/clk/meson/g12a-ao.c | 83 +++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
create mode 100644 drivers/clk/meson/g12a-ao.c
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index c873d6976f..7204383e17 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -6,4 +6,5 @@
obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
obj-$(CONFIG_CLK_MESON_AXG) += axg.o
obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
+obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
new file mode 100644
index 0000000000..7a0abea77c
--- /dev/null
+++ b/drivers/clk/meson/g12a-ao.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <log.h>
+#include <asm/io.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <dt-bindings/clock/g12a-aoclkc.h>
+
+#include "clk_meson.h"
+
+struct meson_clk {
+ struct regmap *map;
+};
+
+#define AO_CLK_GATE0 0x4c
+#define AO_SAR_CLK 0x90
+
+static struct meson_gate gates[] = {
+ MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 8),
+ MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 8),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+ struct meson_clk *priv = dev_get_priv(clk->dev);
+ struct meson_gate *gate;
+
+ if (clk->id >= ARRAY_SIZE(gates))
+ return -ENOENT;
+
+ gate = &gates[clk->id];
+
+ if (gate->reg == 0)
+ return 0;
+
+ regmap_update_bits(priv->map, gate->reg,
+ BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+ return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+ return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+ return meson_set_gate(clk, false);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+ struct meson_clk *priv = dev_get_priv(dev);
+
+ priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+ if (IS_ERR(priv->map))
+ return PTR_ERR(priv->map);
+
+ return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+ .disable = meson_clk_disable,
+ .enable = meson_clk_enable,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+ { .compatible = "amlogic,meson-g12a-aoclkc" },
+ { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg) = {
+ .name = "meson_clk_g12a_ao",
+ .id = UCLASS_CLK,
+ .of_match = meson_clk_ids,
+ .priv_auto_alloc_size = sizeof(struct meson_clk),
+ .ops = &meson_clk_ops,
+ .probe = meson_clk_probe,
+};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 2/7] adc: meson-saradc: add G12A variant
[not found] ` <CGME20201215144243eucas1p281404c3b46cd0b32811c1af3a2ef2ba4@eucas1p2.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
Add support for the SARADC variant found on the G12A SoCs family.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/adc/meson-saradc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 72b0cc4e5b..998cef24d8 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -711,6 +711,8 @@ static const struct udevice_id meson_saradc_ids[] = {
.data = (ulong)&gxl_saradc_data },
{ .compatible = "amlogic,meson-gxm-saradc",
.data = (ulong)&gxl_saradc_data },
+ { .compatible = "amlogic,meson-g12a-saradc",
+ .data = (ulong)&gxl_saradc_data },
{ }
};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 2/7] adc: meson-saradc: add G12A variant
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Add support for the SARADC variant found on the G12A SoCs family.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/adc/meson-saradc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 72b0cc4e5b..998cef24d8 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -711,6 +711,8 @@ static const struct udevice_id meson_saradc_ids[] = {
.data = (ulong)&gxl_saradc_data },
{ .compatible = "amlogic,meson-gxm-saradc",
.data = (ulong)&gxl_saradc_data },
+ { .compatible = "amlogic,meson-g12a-saradc",
+ .data = (ulong)&gxl_saradc_data },
{ }
};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 3/7] adc: meson-saradc: skip hardware init only if ADC is enabled
[not found] ` <CGME20201215144243eucas1p1d1a361740f20097fd2db505c9bdfee7d@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
The driver skips hardware initialization if it is already configured by
the earlier bootloader stage (BL30). Skip the initialization only if the
hardware is really initialized and enabled.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/adc/meson-saradc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 998cef24d8..ce7ae990ad 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -512,8 +512,11 @@ static int meson_saradc_init(struct meson_saradc_priv *priv)
* reading the temperature sensor.
*/
regmap_read(priv->regmap, MESON_SAR_ADC_REG3, ®val);
- if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)
- return 0;
+ if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {
+ regmap_read(priv->regmap, MESON_SAR_ADC_REG3, ®val);
+ if (regval & MESON_SAR_ADC_REG3_ADC_EN)
+ return 0;
+ }
meson_saradc_stop_sample_engine(priv);
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 3/7] adc: meson-saradc: skip hardware init only if ADC is enabled
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
The driver skips hardware initialization if it is already configured by
the earlier bootloader stage (BL30). Skip the initialization only if the
hardware is really initialized and enabled.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/adc/meson-saradc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 998cef24d8..ce7ae990ad 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -512,8 +512,11 @@ static int meson_saradc_init(struct meson_saradc_priv *priv)
* reading the temperature sensor.
*/
regmap_read(priv->regmap, MESON_SAR_ADC_REG3, ®val);
- if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)
- return 0;
+ if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {
+ regmap_read(priv->regmap, MESON_SAR_ADC_REG3, ®val);
+ if (regval & MESON_SAR_ADC_REG3_ADC_EN)
+ return 0;
+ }
meson_saradc_stop_sample_engine(priv);
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 4/7] configs: khadas-vim3: enable ADC device support
[not found] ` <CGME20201215144244eucas1p2a581daac51d792e119f8db88bdda7086@eucas1p2.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
ADC device (Meson SARADC) will be used for probing 'Function' button state.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
configs/khadas-vim3_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index 9d7ba72d44..5d16652fd6 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -29,6 +29,8 @@ CONFIG_CMD_REGULATOR=y
CONFIG_OF_CONTROL=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MESON=y
CONFIG_DM_MMC=y
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 4/7] configs: khadas-vim3: enable ADC device support
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
ADC device (Meson SARADC) will be used for probing 'Function' button state.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
configs/khadas-vim3_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index 9d7ba72d44..5d16652fd6 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -29,6 +29,8 @@ CONFIG_CMD_REGULATOR=y
CONFIG_OF_CONTROL=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MESON=y
CONFIG_DM_MMC=y
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 5/7] button: add a simple ADC-based button driver
[not found] ` <CGME20201215144244eucas1p12404d7047f032e03ebcad27b88f23a25@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
Add a simple ADC-based button driver. This driver binds to the 'adc-keys'
device tree node.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/button/Kconfig | 8 +++
drivers/button/Makefile | 1 +
drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++++
3 files changed, 126 insertions(+)
create mode 100644 drivers/button/button-adc.c
diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig
index 6b3ec7e55d..283367f2bd 100644
--- a/drivers/button/Kconfig
+++ b/drivers/button/Kconfig
@@ -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 ADC lines. The ADC
+ driver must use driver model. Buttons are configured using the device
+ tree.
+
config BUTTON_GPIO
bool "Button gpio"
depends on BUTTON
diff --git a/drivers/button/Makefile b/drivers/button/Makefile
index fcc10ebe8d..bbd18af149 100644
--- a/drivers/button/Makefile
+++ b/drivers/button/Makefile
@@ -3,4 +3,5 @@
# Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
obj-$(CONFIG_BUTTON) += button-uclass.o
+obj-$(CONFIG_BUTTON_ADC) += button-adc.o
obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o
diff --git a/drivers/button/button-adc.c b/drivers/button/button-adc.c
new file mode 100644
index 0000000000..086c676c02
--- /dev/null
+++ b/drivers/button/button-adc.c
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ * Author: Marek Szyprowski <m.szyprowski@samsung.com>
+ */
+
+#include <common.h>
+#include <button.h>
+#include <dm.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <log.h>
+#include <adc.h>
+
+struct button_adc_priv {
+ struct udevice *adc;
+ int channel;
+};
+
+static enum button_state_t button_adc_get_state(struct udevice *dev)
+{
+ struct button_adc_priv *priv = dev_get_priv(dev);
+ unsigned int val, mask;
+ int ret;
+
+ ret = adc_start_channel(priv->adc, priv->channel);
+ if (ret)
+ return ret;
+
+ ret = adc_channel_data(priv->adc, priv->channel, &val);
+ if (ret)
+ return ret;
+
+ ret = adc_data_mask(priv->adc, &mask);
+ if (ret)
+ return ret;
+
+ /* getting state is simplified a bit */
+ if (ret == 0)
+ return (val < mask / 2) ? BUTTON_ON : BUTTON_OFF;
+
+ return ret;
+}
+
+static int button_adc_probe(struct udevice *dev)
+{
+ struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
+ struct button_adc_priv *priv = dev_get_priv(dev);
+ struct ofnode_phandle_args args;
+ int ret;
+
+ /* Ignore the top-level button node */
+ if (!uc_plat->label)
+ return 0;
+
+ ret = dev_read_phandle_with_args(dev->parent, "io-channels",
+ "#io-channel-cells", 0, 0, &args);
+ if (ret)
+ return ret;
+
+ ret = uclass_get_device_by_name(UCLASS_ADC, ofnode_get_name(args.node),
+ &priv->adc);
+ if (ret)
+ return ret;
+
+ priv->channel = args.args[0];
+
+ return ret;
+}
+
+static int button_adc_bind(struct udevice *parent)
+{
+ struct udevice *dev;
+ ofnode node;
+ int ret;
+
+ dev_for_each_subnode(node, parent) {
+ struct button_uc_plat *uc_plat;
+ const char *label;
+
+ label = ofnode_read_string(node, "label");
+ if (!label) {
+ debug("%s: node %s has no label\n", __func__,
+ ofnode_get_name(node));
+ return -EINVAL;
+ }
+ ret = device_bind_driver_to_node(parent, "button_adc",
+ ofnode_get_name(node),
+ node, &dev);
+ if (ret)
+ return ret;
+ uc_plat = dev_get_uclass_platdata(dev);
+ uc_plat->label = label;
+ }
+
+ return 0;
+}
+
+static const struct button_ops button_adc_ops = {
+ .get_state = button_adc_get_state,
+};
+
+static const struct udevice_id button_adc_ids[] = {
+ { .compatible = "adc-keys" },
+ { }
+};
+
+U_BOOT_DRIVER(button_adc) = {
+ .name = "button_adc",
+ .id = UCLASS_BUTTON,
+ .of_match = button_adc_ids,
+ .ops = &button_adc_ops,
+ .priv_auto_alloc_size = sizeof(struct button_adc_priv),
+ .bind = button_adc_bind,
+ .probe = button_adc_probe,
+};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 5/7] button: add a simple ADC-based button driver
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Add a simple ADC-based button driver. This driver binds to the 'adc-keys'
device tree node.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/button/Kconfig | 8 +++
drivers/button/Makefile | 1 +
drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++++
3 files changed, 126 insertions(+)
create mode 100644 drivers/button/button-adc.c
diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig
index 6b3ec7e55d..283367f2bd 100644
--- a/drivers/button/Kconfig
+++ b/drivers/button/Kconfig
@@ -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 ADC lines. The ADC
+ driver must use driver model. Buttons are configured using the device
+ tree.
+
config BUTTON_GPIO
bool "Button gpio"
depends on BUTTON
diff --git a/drivers/button/Makefile b/drivers/button/Makefile
index fcc10ebe8d..bbd18af149 100644
--- a/drivers/button/Makefile
+++ b/drivers/button/Makefile
@@ -3,4 +3,5 @@
# Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
obj-$(CONFIG_BUTTON) += button-uclass.o
+obj-$(CONFIG_BUTTON_ADC) += button-adc.o
obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o
diff --git a/drivers/button/button-adc.c b/drivers/button/button-adc.c
new file mode 100644
index 0000000000..086c676c02
--- /dev/null
+++ b/drivers/button/button-adc.c
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ * Author: Marek Szyprowski <m.szyprowski@samsung.com>
+ */
+
+#include <common.h>
+#include <button.h>
+#include <dm.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <log.h>
+#include <adc.h>
+
+struct button_adc_priv {
+ struct udevice *adc;
+ int channel;
+};
+
+static enum button_state_t button_adc_get_state(struct udevice *dev)
+{
+ struct button_adc_priv *priv = dev_get_priv(dev);
+ unsigned int val, mask;
+ int ret;
+
+ ret = adc_start_channel(priv->adc, priv->channel);
+ if (ret)
+ return ret;
+
+ ret = adc_channel_data(priv->adc, priv->channel, &val);
+ if (ret)
+ return ret;
+
+ ret = adc_data_mask(priv->adc, &mask);
+ if (ret)
+ return ret;
+
+ /* getting state is simplified a bit */
+ if (ret == 0)
+ return (val < mask / 2) ? BUTTON_ON : BUTTON_OFF;
+
+ return ret;
+}
+
+static int button_adc_probe(struct udevice *dev)
+{
+ struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
+ struct button_adc_priv *priv = dev_get_priv(dev);
+ struct ofnode_phandle_args args;
+ int ret;
+
+ /* Ignore the top-level button node */
+ if (!uc_plat->label)
+ return 0;
+
+ ret = dev_read_phandle_with_args(dev->parent, "io-channels",
+ "#io-channel-cells", 0, 0, &args);
+ if (ret)
+ return ret;
+
+ ret = uclass_get_device_by_name(UCLASS_ADC, ofnode_get_name(args.node),
+ &priv->adc);
+ if (ret)
+ return ret;
+
+ priv->channel = args.args[0];
+
+ return ret;
+}
+
+static int button_adc_bind(struct udevice *parent)
+{
+ struct udevice *dev;
+ ofnode node;
+ int ret;
+
+ dev_for_each_subnode(node, parent) {
+ struct button_uc_plat *uc_plat;
+ const char *label;
+
+ label = ofnode_read_string(node, "label");
+ if (!label) {
+ debug("%s: node %s has no label\n", __func__,
+ ofnode_get_name(node));
+ return -EINVAL;
+ }
+ ret = device_bind_driver_to_node(parent, "button_adc",
+ ofnode_get_name(node),
+ node, &dev);
+ if (ret)
+ return ret;
+ uc_plat = dev_get_uclass_platdata(dev);
+ uc_plat->label = label;
+ }
+
+ return 0;
+}
+
+static const struct button_ops button_adc_ops = {
+ .get_state = button_adc_get_state,
+};
+
+static const struct udevice_id button_adc_ids[] = {
+ { .compatible = "adc-keys" },
+ { }
+};
+
+U_BOOT_DRIVER(button_adc) = {
+ .name = "button_adc",
+ .id = UCLASS_BUTTON,
+ .of_match = button_adc_ids,
+ .ops = &button_adc_ops,
+ .priv_auto_alloc_size = sizeof(struct button_adc_priv),
+ .bind = button_adc_bind,
+ .probe = button_adc_probe,
+};
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 6/7] cmd: button: store button state in the 'button' env
[not found] ` <CGME20201215144245eucas1p174ae2f6945b84f7f67528f76d0ff5939@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
Save examined button state in 'button' environment variable to enable
checking button state in the scripts.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I78b539e1516573fcfea4401f75469291844daae4
---
cmd/button.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmd/button.c b/cmd/button.c
index 64c5a8fa04..8da911068a 100644
--- a/cmd/button.c
+++ b/cmd/button.c
@@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
ret = button_get_state(dev);
if (ret >= BUTTON_COUNT)
ret = -EINVAL;
- if (ret >= 0)
+ if (ret >= 0) {
printf("%s\n", state_label[ret]);
+ env_set("button", state_label[ret]);
+ }
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 6/7] cmd: button: store button state in the 'button' env
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Save examined button state in 'button' environment variable to enable
checking button state in the scripts.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I78b539e1516573fcfea4401f75469291844daae4
---
cmd/button.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmd/button.c b/cmd/button.c
index 64c5a8fa04..8da911068a 100644
--- a/cmd/button.c
+++ b/cmd/button.c
@@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
ret = button_get_state(dev);
if (ret >= BUTTON_COUNT)
ret = -EINVAL;
- if (ret >= 0)
+ if (ret >= 0) {
printf("%s\n", state_label[ret]);
+ env_set("button", state_label[ret]);
+ }
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 7/7] configs: khadas-vim3: enable Function button support
[not found] ` <CGME20201215144245eucas1p112636015eaba5f50cc79044080ce9fed@eucas1p1.samsung.com>
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot
Add options needed to check the 'Function' button state.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
configs/khadas-vim3_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index 5d16652fd6..bc17430569 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 7/7] configs: khadas-vim3: enable Function button support
@ 2020-12-15 14:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 14:42 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Add options needed to check the 'Function' button state.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
configs/khadas-vim3_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index 5d16652fd6..bc17430569 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
[not found] ` <CGME20201215165446eucas1p1c627adde04ee9da682e665756c5e934c@eucas1p1.samsung.com>
@ 2020-12-15 16:54 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 16:54 UTC (permalink / raw)
To: u-boot
Save examined button state in 'button' environment variable to enable
checking button state in the scripts.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
Resend reason: get rid of the Change-Id tag, that was still in v2.
---
cmd/button.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmd/button.c b/cmd/button.c
index 64c5a8fa04..8da911068a 100644
--- a/cmd/button.c
+++ b/cmd/button.c
@@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
ret = button_get_state(dev);
if (ret >= BUTTON_COUNT)
ret = -EINVAL;
- if (ret >= 0)
+ if (ret >= 0) {
printf("%s\n", state_label[ret]);
+ env_set("button", state_label[ret]);
+ }
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-15 16:54 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-15 16:54 UTC (permalink / raw)
To: u-boot, u-boot-amlogic
Cc: Marek Szyprowski, Neil Armstrong, Lukasz Majewski,
Philippe Reynes, Simon Glass, Heinrich Schuchardt, Jaehoon Chung,
Bartlomiej Zolnierkiewicz
Save examined button state in 'button' environment variable to enable
checking button state in the scripts.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
Resend reason: get rid of the Change-Id tag, that was still in v2.
---
cmd/button.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmd/button.c b/cmd/button.c
index 64c5a8fa04..8da911068a 100644
--- a/cmd/button.c
+++ b/cmd/button.c
@@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
ret = button_get_state(dev);
if (ret >= BUTTON_COUNT)
ret = -EINVAL;
- if (ret >= 0)
+ if (ret >= 0) {
printf("%s\n", state_label[ret]);
+ env_set("button", state_label[ret]);
+ }
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
2020-12-15 16:54 ` Marek Szyprowski
@ 2020-12-15 19:07 ` Heinrich Schuchardt
-1 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-15 19:07 UTC (permalink / raw)
To: u-boot
On 12/15/20 5:54 PM, Marek Szyprowski wrote:
> Save examined button state in 'button' environment variable to enable
> checking button state in the scripts.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Resend reason: get rid of the Change-Id tag, that was still in v2.
> ---
> cmd/button.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/button.c b/cmd/button.c
> index 64c5a8fa04..8da911068a 100644
> --- a/cmd/button.c
> +++ b/cmd/button.c
> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
> ret = button_get_state(dev);
> if (ret >= BUTTON_COUNT)
> ret = -EINVAL;
> - if (ret >= 0)
> + if (ret >= 0) {
> printf("%s\n", state_label[ret]);
> + env_set("button", state_label[ret]);
Using a hard coded environment variable does not make much sense to me.
The button command has a return value. So just use
button mybutton; setenv myvar $?
Best regards
Heinrich
> + }
>
> return ret;
> }
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-15 19:07 ` Heinrich Schuchardt
0 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-15 19:07 UTC (permalink / raw)
To: Marek Szyprowski, u-boot, u-boot-amlogic
Cc: Neil Armstrong, Lukasz Majewski, Philippe Reynes, Simon Glass,
Heinrich Schuchardt, Jaehoon Chung, Bartlomiej Zolnierkiewicz
On 12/15/20 5:54 PM, Marek Szyprowski wrote:
> Save examined button state in 'button' environment variable to enable
> checking button state in the scripts.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Resend reason: get rid of the Change-Id tag, that was still in v2.
> ---
> cmd/button.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/button.c b/cmd/button.c
> index 64c5a8fa04..8da911068a 100644
> --- a/cmd/button.c
> +++ b/cmd/button.c
> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
> ret = button_get_state(dev);
> if (ret >= BUTTON_COUNT)
> ret = -EINVAL;
> - if (ret >= 0)
> + if (ret >= 0) {
> printf("%s\n", state_label[ret]);
> + env_set("button", state_label[ret]);
Using a hard coded environment variable does not make much sense to me.
The button command has a return value. So just use
button mybutton; setenv myvar $?
Best regards
Heinrich
> + }
>
> return ret;
> }
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 5/7] button: add a simple ADC-based button driver
2020-12-15 14:42 ` Marek Szyprowski
@ 2020-12-15 19:19 ` Heinrich Schuchardt
-1 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-15 19:19 UTC (permalink / raw)
To: u-boot
On 12/15/20 3:42 PM, Marek Szyprowski wrote:
> Add a simple ADC-based button driver. This driver binds to the 'adc-keys'
> device tree node.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/button/Kconfig | 8 +++
> drivers/button/Makefile | 1 +
> drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 126 insertions(+)
> create mode 100644 drivers/button/button-adc.c
>
> diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig
> index 6b3ec7e55d..283367f2bd 100644
> --- a/drivers/button/Kconfig
> +++ b/drivers/button/Kconfig
> @@ -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 ADC lines. The ADC
ADC might stand for "Analog to Digital Converter", or "Automated Data
Collection", or "Automatic Distance Control, or something else. Please,
replace the abbreviation by the full expression.
Best regards
Heinrich
> + driver must use driver model. Buttons are configured using the device
> + tree.
> +
> config BUTTON_GPIO
> bool "Button gpio"
> depends on BUTTON
> diff --git a/drivers/button/Makefile b/drivers/button/Makefile
> index fcc10ebe8d..bbd18af149 100644
> --- a/drivers/button/Makefile
> +++ b/drivers/button/Makefile
> @@ -3,4 +3,5 @@
> # Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
>
> obj-$(CONFIG_BUTTON) += button-uclass.o
> +obj-$(CONFIG_BUTTON_ADC) += button-adc.o
> obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o
> diff --git a/drivers/button/button-adc.c b/drivers/button/button-adc.c
> new file mode 100644
> index 0000000000..086c676c02
> --- /dev/null
> +++ b/drivers/button/button-adc.c
> @@ -0,0 +1,117 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 Samsung Electronics Co., Ltd.
> + * http://www.samsung.com
> + * Author: Marek Szyprowski <m.szyprowski@samsung.com>
> + */
> +
> +#include <common.h>
> +#include <button.h>
> +#include <dm.h>
> +#include <dm/lists.h>
> +#include <dm/uclass-internal.h>
> +#include <log.h>
> +#include <adc.h>
> +
> +struct button_adc_priv {
> + struct udevice *adc;
> + int channel;
> +};
> +
> +static enum button_state_t button_adc_get_state(struct udevice *dev)
> +{
> + struct button_adc_priv *priv = dev_get_priv(dev);
> + unsigned int val, mask;
> + int ret;
> +
> + ret = adc_start_channel(priv->adc, priv->channel);
> + if (ret)
> + return ret;
> +
> + ret = adc_channel_data(priv->adc, priv->channel, &val);
> + if (ret)
> + return ret;
> +
> + ret = adc_data_mask(priv->adc, &mask);
> + if (ret)
> + return ret;
> +
> + /* getting state is simplified a bit */
> + if (ret == 0)
> + return (val < mask / 2) ? BUTTON_ON : BUTTON_OFF;
> +
> + return ret;
> +}
> +
> +static int button_adc_probe(struct udevice *dev)
> +{
> + struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
> + struct button_adc_priv *priv = dev_get_priv(dev);
> + struct ofnode_phandle_args args;
> + int ret;
> +
> + /* Ignore the top-level button node */
> + if (!uc_plat->label)
> + return 0;
> +
> + ret = dev_read_phandle_with_args(dev->parent, "io-channels",
> + "#io-channel-cells", 0, 0, &args);
> + if (ret)
> + return ret;
> +
> + ret = uclass_get_device_by_name(UCLASS_ADC, ofnode_get_name(args.node),
> + &priv->adc);
> + if (ret)
> + return ret;
> +
> + priv->channel = args.args[0];
> +
> + return ret;
> +}
> +
> +static int button_adc_bind(struct udevice *parent)
> +{
> + struct udevice *dev;
> + ofnode node;
> + int ret;
> +
> + dev_for_each_subnode(node, parent) {
> + struct button_uc_plat *uc_plat;
> + const char *label;
> +
> + label = ofnode_read_string(node, "label");
> + if (!label) {
> + debug("%s: node %s has no label\n", __func__,
> + ofnode_get_name(node));
> + return -EINVAL;
> + }
> + ret = device_bind_driver_to_node(parent, "button_adc",
> + ofnode_get_name(node),
> + node, &dev);
> + if (ret)
> + return ret;
> + uc_plat = dev_get_uclass_platdata(dev);
> + uc_plat->label = label;
> + }
> +
> + return 0;
> +}
> +
> +static const struct button_ops button_adc_ops = {
> + .get_state = button_adc_get_state,
> +};
> +
> +static const struct udevice_id button_adc_ids[] = {
> + { .compatible = "adc-keys" },
> + { }
> +};
> +
> +U_BOOT_DRIVER(button_adc) = {
> + .name = "button_adc",
> + .id = UCLASS_BUTTON,
> + .of_match = button_adc_ids,
> + .ops = &button_adc_ops,
> + .priv_auto_alloc_size = sizeof(struct button_adc_priv),
> + .bind = button_adc_bind,
> + .probe = button_adc_probe,
> +};
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 5/7] button: add a simple ADC-based button driver
@ 2020-12-15 19:19 ` Heinrich Schuchardt
0 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-15 19:19 UTC (permalink / raw)
To: Marek Szyprowski, u-boot, u-boot-amlogic
Cc: Neil Armstrong, Lukasz Majewski, Philippe Reynes, Simon Glass,
Jaehoon Chung, Bartlomiej Zolnierkiewicz
On 12/15/20 3:42 PM, Marek Szyprowski wrote:
> Add a simple ADC-based button driver. This driver binds to the 'adc-keys'
> device tree node.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/button/Kconfig | 8 +++
> drivers/button/Makefile | 1 +
> drivers/button/button-adc.c | 117 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 126 insertions(+)
> create mode 100644 drivers/button/button-adc.c
>
> diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig
> index 6b3ec7e55d..283367f2bd 100644
> --- a/drivers/button/Kconfig
> +++ b/drivers/button/Kconfig
> @@ -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 ADC lines. The ADC
ADC might stand for "Analog to Digital Converter", or "Automated Data
Collection", or "Automatic Distance Control, or something else. Please,
replace the abbreviation by the full expression.
Best regards
Heinrich
> + driver must use driver model. Buttons are configured using the device
> + tree.
> +
> config BUTTON_GPIO
> bool "Button gpio"
> depends on BUTTON
> diff --git a/drivers/button/Makefile b/drivers/button/Makefile
> index fcc10ebe8d..bbd18af149 100644
> --- a/drivers/button/Makefile
> +++ b/drivers/button/Makefile
> @@ -3,4 +3,5 @@
> # Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
>
> obj-$(CONFIG_BUTTON) += button-uclass.o
> +obj-$(CONFIG_BUTTON_ADC) += button-adc.o
> obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o
> diff --git a/drivers/button/button-adc.c b/drivers/button/button-adc.c
> new file mode 100644
> index 0000000000..086c676c02
> --- /dev/null
> +++ b/drivers/button/button-adc.c
> @@ -0,0 +1,117 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 Samsung Electronics Co., Ltd.
> + * http://www.samsung.com
> + * Author: Marek Szyprowski <m.szyprowski@samsung.com>
> + */
> +
> +#include <common.h>
> +#include <button.h>
> +#include <dm.h>
> +#include <dm/lists.h>
> +#include <dm/uclass-internal.h>
> +#include <log.h>
> +#include <adc.h>
> +
> +struct button_adc_priv {
> + struct udevice *adc;
> + int channel;
> +};
> +
> +static enum button_state_t button_adc_get_state(struct udevice *dev)
> +{
> + struct button_adc_priv *priv = dev_get_priv(dev);
> + unsigned int val, mask;
> + int ret;
> +
> + ret = adc_start_channel(priv->adc, priv->channel);
> + if (ret)
> + return ret;
> +
> + ret = adc_channel_data(priv->adc, priv->channel, &val);
> + if (ret)
> + return ret;
> +
> + ret = adc_data_mask(priv->adc, &mask);
> + if (ret)
> + return ret;
> +
> + /* getting state is simplified a bit */
> + if (ret == 0)
> + return (val < mask / 2) ? BUTTON_ON : BUTTON_OFF;
> +
> + return ret;
> +}
> +
> +static int button_adc_probe(struct udevice *dev)
> +{
> + struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
> + struct button_adc_priv *priv = dev_get_priv(dev);
> + struct ofnode_phandle_args args;
> + int ret;
> +
> + /* Ignore the top-level button node */
> + if (!uc_plat->label)
> + return 0;
> +
> + ret = dev_read_phandle_with_args(dev->parent, "io-channels",
> + "#io-channel-cells", 0, 0, &args);
> + if (ret)
> + return ret;
> +
> + ret = uclass_get_device_by_name(UCLASS_ADC, ofnode_get_name(args.node),
> + &priv->adc);
> + if (ret)
> + return ret;
> +
> + priv->channel = args.args[0];
> +
> + return ret;
> +}
> +
> +static int button_adc_bind(struct udevice *parent)
> +{
> + struct udevice *dev;
> + ofnode node;
> + int ret;
> +
> + dev_for_each_subnode(node, parent) {
> + struct button_uc_plat *uc_plat;
> + const char *label;
> +
> + label = ofnode_read_string(node, "label");
> + if (!label) {
> + debug("%s: node %s has no label\n", __func__,
> + ofnode_get_name(node));
> + return -EINVAL;
> + }
> + ret = device_bind_driver_to_node(parent, "button_adc",
> + ofnode_get_name(node),
> + node, &dev);
> + if (ret)
> + return ret;
> + uc_plat = dev_get_uclass_platdata(dev);
> + uc_plat->label = label;
> + }
> +
> + return 0;
> +}
> +
> +static const struct button_ops button_adc_ops = {
> + .get_state = button_adc_get_state,
> +};
> +
> +static const struct udevice_id button_adc_ids[] = {
> + { .compatible = "adc-keys" },
> + { }
> +};
> +
> +U_BOOT_DRIVER(button_adc) = {
> + .name = "button_adc",
> + .id = UCLASS_BUTTON,
> + .of_match = button_adc_ids,
> + .ops = &button_adc_ops,
> + .priv_auto_alloc_size = sizeof(struct button_adc_priv),
> + .bind = button_adc_bind,
> + .probe = button_adc_probe,
> +};
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
2020-12-15 19:07 ` Heinrich Schuchardt
@ 2020-12-16 7:08 ` Marek Szyprowski
-1 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-16 7:08 UTC (permalink / raw)
To: u-boot
On 15.12.2020 20:07, Heinrich Schuchardt wrote:
> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>> Save examined button state in 'button' environment variable to enable
>> checking button state in the scripts.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>> ---
>> ? cmd/button.c | 4 +++-
>> ? 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/button.c b/cmd/button.c
>> index 64c5a8fa04..8da911068a 100644
>> --- a/cmd/button.c
>> +++ b/cmd/button.c
>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>> ????? ret = button_get_state(dev);
>> ????? if (ret >= BUTTON_COUNT)
>> ????????? ret = -EINVAL;
>> -??? if (ret >= 0)
>> +??? if (ret >= 0) {
>> ????????? printf("%s\n", state_label[ret]);
>> +??????? env_set("button", state_label[ret]);
>
> Using a hard coded environment variable does not make much sense to me.
> The button command has a return value. So just use
>
> button mybutton; setenv myvar $?
>
Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
the 'button' env variable I've tried to mimic the behavior of the
various network and file related commands, which sets 'filesize' env
variable.
I will need to add the return value propagation to the button command
anyway to make it usable from the scripts.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-16 7:08 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-16 7:08 UTC (permalink / raw)
To: Heinrich Schuchardt, u-boot, u-boot-amlogic
Cc: Neil Armstrong, Lukasz Majewski, Philippe Reynes, Simon Glass,
Jaehoon Chung, Bartlomiej Zolnierkiewicz
On 15.12.2020 20:07, Heinrich Schuchardt wrote:
> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>> Save examined button state in 'button' environment variable to enable
>> checking button state in the scripts.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>> ---
>> cmd/button.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/button.c b/cmd/button.c
>> index 64c5a8fa04..8da911068a 100644
>> --- a/cmd/button.c
>> +++ b/cmd/button.c
>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>> ret = button_get_state(dev);
>> if (ret >= BUTTON_COUNT)
>> ret = -EINVAL;
>> - if (ret >= 0)
>> + if (ret >= 0) {
>> printf("%s\n", state_label[ret]);
>> + env_set("button", state_label[ret]);
>
> Using a hard coded environment variable does not make much sense to me.
> The button command has a return value. So just use
>
> button mybutton; setenv myvar $?
>
Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
the 'button' env variable I've tried to mimic the behavior of the
various network and file related commands, which sets 'filesize' env
variable.
I will need to add the return value propagation to the button command
anyway to make it usable from the scripts.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
2020-12-16 7:08 ` Marek Szyprowski
@ 2020-12-16 7:29 ` Heinrich Schuchardt
-1 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-16 7:29 UTC (permalink / raw)
To: u-boot
On 12/16/20 8:08 AM, Marek Szyprowski wrote:
> On 15.12.2020 20:07, Heinrich Schuchardt wrote:
>> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>>> Save examined button state in 'button' environment variable to enable
>>> checking button state in the scripts.
>>>
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> ---
>>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>>> ---
>>> ? cmd/button.c | 4 +++-
>>> ? 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/cmd/button.c b/cmd/button.c
>>> index 64c5a8fa04..8da911068a 100644
>>> --- a/cmd/button.c
>>> +++ b/cmd/button.c
>>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>>> ????? ret = button_get_state(dev);
>>> ????? if (ret >= BUTTON_COUNT)
>>> ????????? ret = -EINVAL;
>>> -??? if (ret >= 0)
>>> +??? if (ret >= 0) {
>>> ????????? printf("%s\n", state_label[ret]);
>>> +??????? env_set("button", state_label[ret]);
>>
>> Using a hard coded environment variable does not make much sense to me.
>> The button command has a return value. So just use
>>
>> button mybutton; setenv myvar $?
>>
> Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
> the 'button' env variable I've tried to mimic the behavior of the
> various network and file related commands, which sets 'filesize' env
> variable.
>
> I will need to add the return value propagation to the button command
> anyway to make it usable from the scripts.
Nothing to be done for the button command. Since
a6bfd71a96201127836d59736abcb54dc2d5e1a5
cmd/button: return button status
the button command returns
0 (true) - pressed, on
1 (false) - not pressed, off
Best regards
Heinrich
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-16 7:29 ` Heinrich Schuchardt
0 siblings, 0 replies; 30+ messages in thread
From: Heinrich Schuchardt @ 2020-12-16 7:29 UTC (permalink / raw)
To: Marek Szyprowski, u-boot, u-boot-amlogic
Cc: Neil Armstrong, Lukasz Majewski, Philippe Reynes, Simon Glass,
Jaehoon Chung, Bartlomiej Zolnierkiewicz
On 12/16/20 8:08 AM, Marek Szyprowski wrote:
> On 15.12.2020 20:07, Heinrich Schuchardt wrote:
>> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>>> Save examined button state in 'button' environment variable to enable
>>> checking button state in the scripts.
>>>
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> ---
>>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>>> ---
>>> cmd/button.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/cmd/button.c b/cmd/button.c
>>> index 64c5a8fa04..8da911068a 100644
>>> --- a/cmd/button.c
>>> +++ b/cmd/button.c
>>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>>> ret = button_get_state(dev);
>>> if (ret >= BUTTON_COUNT)
>>> ret = -EINVAL;
>>> - if (ret >= 0)
>>> + if (ret >= 0) {
>>> printf("%s\n", state_label[ret]);
>>> + env_set("button", state_label[ret]);
>>
>> Using a hard coded environment variable does not make much sense to me.
>> The button command has a return value. So just use
>>
>> button mybutton; setenv myvar $?
>>
> Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
> the 'button' env variable I've tried to mimic the behavior of the
> various network and file related commands, which sets 'filesize' env
> variable.
>
> I will need to add the return value propagation to the button command
> anyway to make it usable from the scripts.
Nothing to be done for the button command. Since
a6bfd71a96201127836d59736abcb54dc2d5e1a5
cmd/button: return button status
the button command returns
0 (true) - pressed, on
1 (false) - not pressed, off
Best regards
Heinrich
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
2020-12-16 7:29 ` Heinrich Schuchardt
@ 2020-12-16 7:42 ` Marek Szyprowski
-1 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-16 7:42 UTC (permalink / raw)
To: u-boot
On 16.12.2020 08:29, Heinrich Schuchardt wrote:
> On 12/16/20 8:08 AM, Marek Szyprowski wrote:
>> On 15.12.2020 20:07, Heinrich Schuchardt wrote:
>>> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>>>> Save examined button state in 'button' environment variable to enable
>>>> checking button state in the scripts.
>>>>
>>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>>> ---
>>>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>>>> ---
>>>> ?? cmd/button.c | 4 +++-
>>>> ?? 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/cmd/button.c b/cmd/button.c
>>>> index 64c5a8fa04..8da911068a 100644
>>>> --- a/cmd/button.c
>>>> +++ b/cmd/button.c
>>>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>>>> ?????? ret = button_get_state(dev);
>>>> ?????? if (ret >= BUTTON_COUNT)
>>>> ?????????? ret = -EINVAL;
>>>> -??? if (ret >= 0)
>>>> +??? if (ret >= 0) {
>>>> ?????????? printf("%s\n", state_label[ret]);
>>>> +??????? env_set("button", state_label[ret]);
>>>
>>> Using a hard coded environment variable does not make much sense to me.
>>> The button command has a return value. So just use
>>>
>>> button mybutton; setenv myvar $?
>>>
>> Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
>> the 'button' env variable I've tried to mimic the behavior of the
>> various network and file related commands, which sets 'filesize' env
>> variable.
>>
>> I will need to add the return value propagation to the button command
>> anyway to make it usable from the scripts.
>
> Nothing to be done for the button command. Since
>
> ??? a6bfd71a96201127836d59736abcb54dc2d5e1a5
> ??? cmd/button: return button status
>
> the button command returns
>
> ??? 0 (true) - pressed, on
> ??? 1 (false) - not pressed, off
>
Right, I've missed that commit. I've developed my code on top of
v2020.10 release.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-16 7:42 ` Marek Szyprowski
0 siblings, 0 replies; 30+ messages in thread
From: Marek Szyprowski @ 2020-12-16 7:42 UTC (permalink / raw)
To: Heinrich Schuchardt, u-boot, u-boot-amlogic
Cc: Neil Armstrong, Lukasz Majewski, Philippe Reynes, Simon Glass,
Jaehoon Chung, Bartlomiej Zolnierkiewicz
On 16.12.2020 08:29, Heinrich Schuchardt wrote:
> On 12/16/20 8:08 AM, Marek Szyprowski wrote:
>> On 15.12.2020 20:07, Heinrich Schuchardt wrote:
>>> On 12/15/20 5:54 PM, Marek Szyprowski wrote:
>>>> Save examined button state in 'button' environment variable to enable
>>>> checking button state in the scripts.
>>>>
>>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>>> ---
>>>> Resend reason: get rid of the Change-Id tag, that was still in v2.
>>>> ---
>>>> cmd/button.c | 4 +++-
>>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/cmd/button.c b/cmd/button.c
>>>> index 64c5a8fa04..8da911068a 100644
>>>> --- a/cmd/button.c
>>>> +++ b/cmd/button.c
>>>> @@ -23,8 +23,10 @@ static int show_button_state(struct udevice *dev)
>>>> ret = button_get_state(dev);
>>>> if (ret >= BUTTON_COUNT)
>>>> ret = -EINVAL;
>>>> - if (ret >= 0)
>>>> + if (ret >= 0) {
>>>> printf("%s\n", state_label[ret]);
>>>> + env_set("button", state_label[ret]);
>>>
>>> Using a hard coded environment variable does not make much sense to me.
>>> The button command has a return value. So just use
>>>
>>> button mybutton; setenv myvar $?
>>>
>> Thanks for the hint, I wasn't aware that uboot supports '$?'. By setting
>> the 'button' env variable I've tried to mimic the behavior of the
>> various network and file related commands, which sets 'filesize' env
>> variable.
>>
>> I will need to add the return value propagation to the button command
>> anyway to make it usable from the scripts.
>
> Nothing to be done for the button command. Since
>
> a6bfd71a96201127836d59736abcb54dc2d5e1a5
> cmd/button: return button status
>
> the button command returns
>
> 0 (true) - pressed, on
> 1 (false) - not pressed, off
>
Right, I've missed that commit. I've developed my code on top of
v2020.10 release.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
2020-12-15 16:54 ` Marek Szyprowski
@ 2020-12-19 2:29 ` Simon Glass
-1 siblings, 0 replies; 30+ messages in thread
From: Simon Glass @ 2020-12-19 2:29 UTC (permalink / raw)
To: u-boot
Hi Marek,
On Tue, 15 Dec 2020 at 09:55, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> Save examined button state in 'button' environment variable to enable
> checking button state in the scripts.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Resend reason: get rid of the Change-Id tag, that was still in v2.
If you use patman it does that for you.
Regards,
Simon
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 6/7 RESEND] cmd: button: store button state in the 'button' env
@ 2020-12-19 2:29 ` Simon Glass
0 siblings, 0 replies; 30+ messages in thread
From: Simon Glass @ 2020-12-19 2:29 UTC (permalink / raw)
To: Marek Szyprowski
Cc: U-Boot Mailing List, u-boot-amlogic, Neil Armstrong,
Lukasz Majewski, Philippe Reynes, Heinrich Schuchardt,
Jaehoon Chung, Bartlomiej Zolnierkiewicz
Hi Marek,
On Tue, 15 Dec 2020 at 09:55, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> Save examined button state in 'button' environment variable to enable
> checking button state in the scripts.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Resend reason: get rid of the Change-Id tag, that was still in v2.
If you use patman it does that for you.
Regards,
Simon
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2020-12-19 2:30 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20201215144242eucas1p1c837ea82b7365808b5384c9eb204b593@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 0/7] VIM3: add support for checking 'Function' button state Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 1/7] clk: meson: add minimal driver for g12a-ao clocks Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215144243eucas1p281404c3b46cd0b32811c1af3a2ef2ba4@eucas1p2.samsung.com>
2020-12-15 14:42 ` [PATCH v2 2/7] adc: meson-saradc: add G12A variant Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215144243eucas1p1d1a361740f20097fd2db505c9bdfee7d@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 3/7] adc: meson-saradc: skip hardware init only if ADC is enabled Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215144244eucas1p2a581daac51d792e119f8db88bdda7086@eucas1p2.samsung.com>
2020-12-15 14:42 ` [PATCH v2 4/7] configs: khadas-vim3: enable ADC device support Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215144244eucas1p12404d7047f032e03ebcad27b88f23a25@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 5/7] button: add a simple ADC-based button driver Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
2020-12-15 19:19 ` Heinrich Schuchardt
2020-12-15 19:19 ` Heinrich Schuchardt
[not found] ` <CGME20201215144245eucas1p174ae2f6945b84f7f67528f76d0ff5939@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 6/7] cmd: button: store button state in the 'button' env Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
[not found] ` <CGME20201215165446eucas1p1c627adde04ee9da682e665756c5e934c@eucas1p1.samsung.com>
2020-12-15 16:54 ` [PATCH v2 6/7 RESEND] " Marek Szyprowski
2020-12-15 16:54 ` Marek Szyprowski
2020-12-15 19:07 ` Heinrich Schuchardt
2020-12-15 19:07 ` Heinrich Schuchardt
2020-12-16 7:08 ` Marek Szyprowski
2020-12-16 7:08 ` Marek Szyprowski
2020-12-16 7:29 ` Heinrich Schuchardt
2020-12-16 7:29 ` Heinrich Schuchardt
2020-12-16 7:42 ` Marek Szyprowski
2020-12-16 7:42 ` Marek Szyprowski
2020-12-19 2:29 ` Simon Glass
2020-12-19 2:29 ` Simon Glass
[not found] ` <CGME20201215144245eucas1p112636015eaba5f50cc79044080ce9fed@eucas1p1.samsung.com>
2020-12-15 14:42 ` [PATCH v2 7/7] configs: khadas-vim3: enable Function button support Marek Szyprowski
2020-12-15 14:42 ` Marek Szyprowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.