linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
       [not found] ` <tencent_ED01C585DBD86EFB91CD8074FB0460C3BA06@qq.com>
@ 2022-07-23 20:05   ` Martin Blumenstingl
  2022-07-24 13:44   ` Sean Young
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2022-07-23 20:05 UTC (permalink / raw)
  To: Zhang Ning
  Cc: Neil Armstrong, sean, linux-amlogic, linux-arm-kernel, linux-media

Hi,

first of all: thank you for your patches!

On Sat, Jul 23, 2022 at 5:56 PM Zhang Ning <zhangn1985@qq.com> wrote:
>
I am not sure if the media subsystem requires it but most subsystem
maintainers want a description here.
See for example commit 7bb53f361c59b ("media: rc: add keymap for Tanix
TX5 max remote") which has been accepted previously.

> Signed-off-by: Zhang Ning <zhangn1985@qq.com>
> ---
>  .../dts/amlogic/meson-gxm-magicbox-m16s.dts   |  4 ++
This should be part of the .dts patch (patch #1)

>  drivers/media/rc/keymaps/Makefile             |  1 +
>  drivers/media/rc/keymaps/rc-magicbox.c        | 55 +++++++++++++++++++
>  include/media/rc-map.h                        |  1 +
Additionally we need a dt-bindings patch so the new value is
recognized by the .dts validation.
See commit d2fccf94495e57 ("media: dt-bindings: media: add new rc map
name") for an example.
dt-binding patches typically go first in the series.

[...]
> +static struct rc_map_table magicbox[] = {
> +       { 40791, KEY_POWER },
> +       { 40842, KEY_MUTE }, // M
> +
> +       { 40771, KEY_UP },
> +       { 40714, KEY_DOWN },
> +       { 40710, KEY_LEFT },
> +       { 40718, KEY_RIGHT },
> +       { 40706, KEY_OK },
> +
> +       { 40775, KEY_HOME },
> +       { 40783, KEY_BACK },
> +       { 40726, KEY_MENU },
> +
> +       { 40959, KEY_VOLUMEDOWN },
> +       { 40797, KEY_VOLUMEUP },
I checked a few other keymaps and they're using hex values for the key code.
That said, I am not familiar with the keymap code, so let's see what
the media maintainers think.


Best regards,
Martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
       [not found] ` <tencent_686082BF01D2C0E8027D8CB05DC1C649DA05@qq.com>
@ 2022-07-23 20:14   ` Martin Blumenstingl
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2022-07-23 20:14 UTC (permalink / raw)
  To: Zhang Ning
  Cc: Neil Armstrong, sean, linux-amlogic, linux-arm-kernel, linux-media

Hello,

great to see this patch!

On Sat, Jul 23, 2022 at 5:56 PM Zhang Ning <zhangn1985@qq.com> wrote:
>
> MagicBox M16S or MagicBox 3Pro is popular Tv box in China.
>
> it's q201_v1 according u-boot log.
> and it's almost same as Q201 reference design.
>
> add a simple dts to support this Tv box.
It would be great if you could add the hardware specs from the
cover-letter here.

[...]
> diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml
> index 61a6cabb375b..3eac16a4de68 100644
> --- a/Documentation/devicetree/bindings/arm/amlogic.yaml
> +++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
> @@ -123,6 +123,7 @@ properties:
>                - khadas,vim2
>                - kingnovel,r-box-pro
>                - libretech,aml-s912-pc
> +              - magicbox,m16s
>                - minix,neo-u9h
>                - nexbox,a1
>                - tronsmart,vega-s96
The change itself is fine (entries are sorted alphabetically). It
should go into a separate dt-binding patch though.
See commit 3f7dbd336f360a ("dt-bindings: arm: amlogic: add Vero 4K+
bindings") for an example with the correct title and commit message.

[...]
> +       gpio-keys-polled {
> +               compatible = "gpio-keys-polled";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
#address-cells and #size-cells will be dropped in Linux 5.20 in all
existing .dts files, see [0]
Please do the same.

> +               button-power {
Button/Key node labels are updated in 5.20 as well (see [1], but
button-power does match the recommended naming so no change is needed.


Thank you and best regards,
Martin


[0] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git/commit/?h=v5.20/arm64-dt&id=4956be9944d1fb23107f27bad8a2cca0fa167443
[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git/commit/?h=v5.20/arm64-dt&id=4fd9afd894ebe5831dbd737e6ca7b6de14da7fda

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
       [not found] ` <tencent_ED01C585DBD86EFB91CD8074FB0460C3BA06@qq.com>
  2022-07-23 20:05   ` [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S Martin Blumenstingl
@ 2022-07-24 13:44   ` Sean Young
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Young @ 2022-07-24 13:44 UTC (permalink / raw)
  To: Zhang Ning; +Cc: narmstrong, linux-amlogic, linux-arm-kernel, linux-media

On Sat, Jul 23, 2022 at 11:55:02PM +0800, Zhang Ning wrote:
> Signed-off-by: Zhang Ning <zhangn1985@qq.com>
> ---
>  .../dts/amlogic/meson-gxm-magicbox-m16s.dts   |  4 ++
>  drivers/media/rc/keymaps/Makefile             |  1 +
>  drivers/media/rc/keymaps/rc-magicbox.c        | 55 +++++++++++++++++++
>  include/media/rc-map.h                        |  1 +
>  4 files changed, 61 insertions(+)
>  create mode 100644 drivers/media/rc/keymaps/rc-magicbox.c
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
> index 464de73d2f0f..69e72687ac9c 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
> @@ -34,3 +34,7 @@ &ethmac {
>  &sdio_pwrseq {
>  	reset-gpios = <&gpio GPIODV_2 GPIO_ACTIVE_LOW>;
>  };
> +
> +&ir {
> +        linux,rc-map-name = "rc-magicbox";
> +};

As has been pointed out already, this should go a in a different patch.

> diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> index f513ff5caf4e..02c1c2150f03 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -71,6 +71,7 @@ obj-$(CONFIG_RC_MAP) += \
>  			rc-kworld-plus-tv-analog.o \
>  			rc-leadtek-y04g0051.o \
>  			rc-lme2510.o \
> +			rc-magicbox.o \
>  			rc-manli.o \
>  			rc-mecool-kiii-pro.o \
>  			rc-mecool-kii-pro.o \
> diff --git a/drivers/media/rc/keymaps/rc-magicbox.c b/drivers/media/rc/keymaps/rc-magicbox.c
> new file mode 100644
> index 000000000000..7dd3afd8a42c
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-magicbox.c
> @@ -0,0 +1,55 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +//
> +// Copyright (C) 2022 Zhang Ning <zhangn1985@qq.com>
> +
> +/*
> + * Keytable for the MagicBox M16S remote control
> + */
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +
> +static struct rc_map_table magicbox[] = {
> +	{ 40791, KEY_POWER },
> +	{ 40842, KEY_MUTE }, // M

This comment needs elaboration. What does M mean?

> +	{ 40771, KEY_UP },
> +	{ 40714, KEY_DOWN },
> +	{ 40710, KEY_LEFT },
> +	{ 40718, KEY_RIGHT },
> +	{ 40706, KEY_OK },
> +
> +	{ 40775, KEY_HOME },
> +	{ 40783, KEY_BACK },
> +	{ 40726, KEY_MENU },
> +
> +	{ 40959, KEY_VOLUMEDOWN },
> +	{ 40797, KEY_VOLUMEUP },

Please use hex values here, they make much more sense for nec protocol.

> +

Remove blank line.

> +};
> +
> +static struct rc_map_list magicbox_map = {
> +	.map = {
> +		.scan     = magicbox,
> +		.size     = ARRAY_SIZE(magicbox),
> +		.rc_proto = RC_PROTO_NEC,
> +		.name     = RC_MAP_MAGICBOX,
> +	}
> +};
> +
> +static int __init init_rc_map_magicbox(void)
> +{
> +	return rc_map_register(&magicbox_map);
> +}
> +
> +static void __exit exit_rc_map_magicbox(void)
> +{
> +	rc_map_unregister(&magicbox_map);
> +}
> +
> +module_init(init_rc_map_magicbox)
> +module_exit(exit_rc_map_magicbox)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Zhang Ning <zhangn1985@qq.com>");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index 793b54342dff..656217b8e91b 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name);
>  #define RC_MAP_KWORLD_PLUS_TV_ANALOG     "rc-kworld-plus-tv-analog"
>  #define RC_MAP_LEADTEK_Y04G0051          "rc-leadtek-y04g0051"
>  #define RC_MAP_LME2510                   "rc-lme2510"
> +#define RC_MAP_MAGICBOX                  "rc-magicbox"
>  #define RC_MAP_MANLI                     "rc-manli"
>  #define RC_MAP_MECOOL_KII_PRO            "rc-mecool-kii-pro"
>  #define RC_MAP_MECOOL_KIII_PRO           "rc-mecool-kiii-pro"

You should update Documentation/devicetree/bindings/media/rc.yaml as well.

Thanks,

Sean

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-24 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220723155502.127404-1-zhangn1985@qq.com>
     [not found] ` <tencent_ED01C585DBD86EFB91CD8074FB0460C3BA06@qq.com>
2022-07-23 20:05   ` [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S Martin Blumenstingl
2022-07-24 13:44   ` Sean Young
     [not found] ` <tencent_686082BF01D2C0E8027D8CB05DC1C649DA05@qq.com>
2022-07-23 20:14   ` [PATCH 1/2] dts/amlogic: Add MagicBox M16S support Martin Blumenstingl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).