mbox series

[v7,0/5] VIM3: add support for checking 'Function' button state

Message ID 20210218103318.18915-1-m.szyprowski@samsung.com
Headers show
Series VIM3: add support for checking 'Function' button state | expand

Message

Marek Szyprowski Feb. 18, 2021, 10:33 a.m. UTC
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

-- 
2.17.1

Comments

Neil Armstrong Feb. 18, 2021, 10:35 a.m. UTC | #1
On 18/02/2021 11:33, Marek Szyprowski wrote:
> 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

> 


Applying to u-boot-amlogic !

Thanks,
Neil
Neil Armstrong Feb. 18, 2021, 3:06 p.m. UTC | #2
On 18/02/2021 11:35, Neil Armstrong wrote:
> On 18/02/2021 11:33, Marek Szyprowski wrote:

>> 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

>>

> 

> 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
Heinrich Schuchardt Feb. 18, 2021, 3:32 p.m. UTC | #3
On 18.02.21 16:06, Neil Armstrong wrote:
> On 18/02/2021 11:35, Neil Armstrong wrote:

>> On 18/02/2021 11:33, Marek Szyprowski wrote:

>>> 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

>>>

>>

>> 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);


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

> 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

>