From: Sean Young <sean@mess.org>
To: Zhang Ning <zhangn1985@qq.com>
Cc: narmstrong@baylibre.com, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
Date: Sun, 24 Jul 2022 14:44:28 +0100 [thread overview]
Message-ID: <Yt1MvOQtRgxYFm7F@gofer.mess.org> (raw)
In-Reply-To: <tencent_ED01C585DBD86EFB91CD8074FB0460C3BA06@qq.com>
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 @@ ðmac {
> &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
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-07-24 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220723155502.127404-1-zhangn1985@qq.com>
2022-07-23 15:55 ` [PATCH 1/2] dts/amlogic: Add MagicBox M16S support Zhang Ning
2022-07-23 20:14 ` Martin Blumenstingl
2022-07-23 23:22 ` Zhang Ning
2022-07-23 15:55 ` [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S Zhang Ning
2022-07-23 20:05 ` Martin Blumenstingl
2022-07-24 13:44 ` Sean Young [this message]
2022-07-24 14:36 ` Zhang Ning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yt1MvOQtRgxYFm7F@gofer.mess.org \
--to=sean@mess.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=zhangn1985@qq.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox