All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
       [not found] <20220723155502.127404-1-zhangn1985@qq.com>
@ 2022-07-23 15:55   ` Zhang Ning
  2022-07-23 15:55   ` Zhang Ning
  1 sibling, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-23 15:55 UTC (permalink / raw)
  To: narmstrong, sean, linux-amlogic, linux-arm-kernel, linux-media; +Cc: Zhang Ning

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.

Signed-off-by: Zhang Ning <zhangn1985@qq.com>
---
 .../devicetree/bindings/arm/amlogic.yaml      |  1 +
 arch/arm64/boot/dts/amlogic/Makefile          |  1 +
 .../dts/amlogic/meson-gxm-magicbox-m16s.dts   | 36 +++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts

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
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 8773211df50e..e0907fb41829 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -44,6 +44,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-magicbox-m16s.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-minix-neo-u9h.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
new file mode 100644
index 000000000000..464de73d2f0f
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Zhang Ning <zhangn1985@qq.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "magicbox,m16s", "amlogic,s912", "amlogic,meson-gxm";
+	model = "MagicBox M16S";
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <100>;
+
+		button-power {
+			label = "power";
+			linux,code = <KEY_POWER>;
+			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+&ethmac {
+        phy-mode = "rmii";
+        phy-handle = <&internal_phy>;
+};
+
+&sdio_pwrseq {
+	reset-gpios = <&gpio GPIODV_2 GPIO_ACTIVE_LOW>;
+};
-- 
2.35.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
@ 2022-07-23 15:55   ` Zhang Ning
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-23 15:55 UTC (permalink / raw)
  To: narmstrong, sean, linux-amlogic, linux-arm-kernel, linux-media; +Cc: Zhang Ning

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.

Signed-off-by: Zhang Ning <zhangn1985@qq.com>
---
 .../devicetree/bindings/arm/amlogic.yaml      |  1 +
 arch/arm64/boot/dts/amlogic/Makefile          |  1 +
 .../dts/amlogic/meson-gxm-magicbox-m16s.dts   | 36 +++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts

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
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 8773211df50e..e0907fb41829 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -44,6 +44,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-magicbox-m16s.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-minix-neo-u9h.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
new file mode 100644
index 000000000000..464de73d2f0f
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-magicbox-m16s.dts
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Zhang Ning <zhangn1985@qq.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "magicbox,m16s", "amlogic,s912", "amlogic,meson-gxm";
+	model = "MagicBox M16S";
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <100>;
+
+		button-power {
+			label = "power";
+			linux,code = <KEY_POWER>;
+			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+&ethmac {
+        phy-mode = "rmii";
+        phy-handle = <&internal_phy>;
+};
+
+&sdio_pwrseq {
+	reset-gpios = <&gpio GPIODV_2 GPIO_ACTIVE_LOW>;
+};
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
       [not found] <20220723155502.127404-1-zhangn1985@qq.com>
@ 2022-07-23 15:55   ` Zhang Ning
  2022-07-23 15:55   ` Zhang Ning
  1 sibling, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-23 15:55 UTC (permalink / raw)
  To: narmstrong, sean, linux-amlogic, linux-arm-kernel, linux-media; +Cc: Zhang Ning

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";
+};
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
+
+	{ 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 },
+
+};
+
+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"
-- 
2.35.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-23 15:55   ` Zhang Ning
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-23 15:55 UTC (permalink / raw)
  To: narmstrong, sean, linux-amlogic, linux-arm-kernel, linux-media; +Cc: Zhang Ning

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";
+};
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
+
+	{ 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 },
+
+};
+
+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"
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
  2022-07-23 15:55   ` Zhang Ning
  (?)
@ 2022-07-23 20:05     ` Martin Blumenstingl
  -1 siblings, 0 replies; 17+ 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] 17+ messages in thread

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-23 20:05     ` Martin Blumenstingl
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-23 20:05     ` Martin Blumenstingl
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
  2022-07-23 15:55   ` Zhang Ning
  (?)
@ 2022-07-23 20:14     ` Martin Blumenstingl
  -1 siblings, 0 replies; 17+ 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] 17+ messages in thread

* Re: [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
@ 2022-07-23 20:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
@ 2022-07-23 20:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

thank you for review, I will send next version according your advises.

On Sat, Jul 23, 2022 at 10:14:40PM +0200, Martin Blumenstingl wrote:
> 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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/2] dts/amlogic: Add MagicBox M16S support
@ 2022-07-23 23:22       ` Zhang Ning
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-23 23:22 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Neil Armstrong, sean, linux-amlogic, linux-arm-kernel, linux-media

thank you for review, I will send next version according your advises.

On Sat, Jul 23, 2022 at 10:14:40PM +0200, Martin Blumenstingl wrote:
> 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
  2022-07-23 15:55   ` Zhang Ning
  (?)
@ 2022-07-24 13:44     ` Sean Young
  -1 siblings, 0 replies; 17+ 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] 17+ messages in thread

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-24 13:44     ` Sean Young
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-24 13:44     ` Sean Young
  0 siblings, 0 replies; 17+ 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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
  2022-07-24 13:44     ` Sean Young
@ 2022-07-24 14:36       ` Zhang Ning
  -1 siblings, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-24 14:36 UTC (permalink / raw)
  To: Sean Young; +Cc: narmstrong, linux-amlogic, linux-arm-kernel, linux-media

Hi Sean

thank you for review.

I sent v4 before see your review.



On Sun, Jul 24, 2022 at 02:44:28PM +0100, Sean Young wrote:
> 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.
already do it in v4
> 
> > 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?
this is answered in v4. a key labeled with "M" as Magic key in vendor
OS.
> 
> > +	{ 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.
in v4.
> 
> > +
> 
> Remove blank line.
will do it in v5.
> 
> > +};
> > +
> > +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.
alread do it in v4.
> 
> Thanks,
> 
> Sean

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 2/2] rc/keymap: add keymap for MagicBox M16S
@ 2022-07-24 14:36       ` Zhang Ning
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang Ning @ 2022-07-24 14:36 UTC (permalink / raw)
  To: Sean Young; +Cc: narmstrong, linux-amlogic, linux-arm-kernel, linux-media

Hi Sean

thank you for review.

I sent v4 before see your review.



On Sun, Jul 24, 2022 at 02:44:28PM +0100, Sean Young wrote:
> 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.
already do it in v4
> 
> > 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?
this is answered in v4. a key labeled with "M" as Magic key in vendor
OS.
> 
> > +	{ 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.
in v4.
> 
> > +
> 
> Remove blank line.
will do it in v5.
> 
> > +};
> > +
> > +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.
alread do it in v4.
> 
> Thanks,
> 
> Sean

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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 15:55   ` Zhang Ning
2022-07-23 20:14   ` Martin Blumenstingl
2022-07-23 20:14     ` Martin Blumenstingl
2022-07-23 20:14     ` Martin Blumenstingl
2022-07-23 23:22     ` Zhang Ning
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 15:55   ` Zhang Ning
2022-07-23 20:05   ` Martin Blumenstingl
2022-07-23 20:05     ` Martin Blumenstingl
2022-07-23 20:05     ` Martin Blumenstingl
2022-07-24 13:44   ` Sean Young
2022-07-24 13:44     ` Sean Young
2022-07-24 13:44     ` Sean Young
2022-07-24 14:36     ` Zhang Ning
2022-07-24 14:36       ` Zhang Ning

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.