VIM3: add support for checking 'Function' button state
A message that is not in the archive (sent off-list or not yet received): CGME20201216075203eucas1p2607f08a1d296c130a18177bb012642fd@eucas1p2.samsung.com
v3 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 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
if button Function
then
echo Selected alternative boot ...
fi
--->8---
The above script requires commit a6bfd71a96 ("cmd/button: return button status") already present in mainline tree.
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Changelog:
v3:
- 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 (6):
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
configs: khadas-vim3: enable Function button support
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 ++++++++++++++++++++++++ 7 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 drivers/button/button-adc.c create mode 100644 drivers/clk/meson/g12a-ao.c
Signature · 1 line
2.17.1
PATCH v3 1/6 clk: meson: add minimal driver for g12a-ao clocks
Add minimal driver AO clocks on meson G12A family. Only ADC related clocks are supported.
--- 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
drivers/clk/meson/Makefile +1 -0
@@ -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
drivers/clk/meson/g12a-ao.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/6 adc: meson-saradc: add G12A variant
In reply to Marek SzyprowskiAdd support for the SARADC variant found on the G12A SoCs family.
--- drivers/adc/meson-saradc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/adc/meson-saradc.c +2 -0
@@ -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 }, { } };
Signature · 1 line
2.17.1
PATCH v3 3/6 adc: meson-saradc: skip hardware init only if ADC is enabled
In reply to Marek SzyprowskiThe 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.
--- drivers/adc/meson-saradc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/adc/meson-saradc.c +5 -2
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 4/6 configs: khadas-vim3: enable ADC device support
In reply to Marek SzyprowskiAnalog to Digital Converter device (Meson SARADC) will be used for probing 'Function' button state.
--- configs/khadas-vim3_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/khadas-vim3_defconfig +2 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v3 5/6 button: add a simple ADC-based button driver
In reply to Marek SzyprowskiAdd 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 | 117 ++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 drivers/button/button-adc.c
drivers/button/Kconfig +8 -0
@@ -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
@@ -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 +117 -0
117 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 6/6 configs: khadas-vim3: enable Function button support
In reply to Marek SzyprowskiAdd options required to check the 'Function' button state.
--- configs/khadas-vim3_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/khadas-vim3_defconfig +2 -0
@@ -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
v3 cover VIM3: add support for checking 'Function' button state
In reply to Marek SzyprowskiQuoted 47 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 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
if button Function
thenecho Selected alternative boot ...fi
--->8---
The above script requires commita6bfd71a96("cmd/button: return button status") already present in mainline tree.Best regards
Marek Szyprowski
Samsung R&D Institute PolandChangelog:
v3:
- removed 'button' env variable
- extended kconfig and patch descriptionsv2: https://lists.denx.de/pipermail/u-boot/2020-December/434991.html
- removed Change-Id tags
- split defconfig changes into ADC and button relatedv1: https://lists.denx.de/pipermail/u-boot/2020-December/434875.html
- initial submissionPatch summary:
Marek Szyprowski (6):
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
configs: khadas-vim3: enable Function button support
Quoted 11 lines
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 ++++++++++++++++++++++++ 7 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 drivers/button/button-adc.c create mode 100644 drivers/clk/meson/g12a-ao.c
Applied patches 1 to 4 to u-boot-amlogic-next
Also updated khadas-vim3l_defconfig in the same time in patch 4.
Thx
Neil