linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h
@ 2022-09-17  6:40 Huacai Chen
  2022-09-17  6:40 ` [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h Huacai Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Huacai Chen @ 2022-09-17  6:40 UTC (permalink / raw)
  To: Arnd Bergmann, Huacai Chen, Dmitry Torokhov
  Cc: loongarch, linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-input, linux-kernel, Huacai Chen

Now i8042-x86ia64io.h is shared by X86 and IA64, but it can be shared
by more platforms (such as LoongArch) with ACPI firmware on which PNP
typed keyboard and mouse is configured in DSDT. So rename it to i8042-
acpipnpio.h.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 .../input/serio/{i8042-x86ia64io.h => i8042-acpipnpio.h}    | 6 +++---
 drivers/input/serio/i8042.h                                 | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
 rename drivers/input/serio/{i8042-x86ia64io.h => i8042-acpipnpio.h} (99%)

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-acpipnpio.h
similarity index 99%
rename from drivers/input/serio/i8042-x86ia64io.h
rename to drivers/input/serio/i8042-acpipnpio.h
index 4fbec7bbecca..d14b9fb59d6c 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef _I8042_X86IA64IO_H
-#define _I8042_X86IA64IO_H
+#ifndef _I8042_ACPIPNPIO_H
+#define _I8042_ACPIPNPIO_H
 
 
 #ifdef CONFIG_X86
@@ -1665,4 +1665,4 @@ static inline void i8042_platform_exit(void)
 	i8042_pnp_exit();
 }
 
-#endif /* _I8042_X86IA64IO_H */
+#endif /* _I8042_ACPIPNPIO_H */
diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index 55381783dc82..bf2592fa9a78 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -20,7 +20,7 @@
 #elif defined(CONFIG_SPARC)
 #include "i8042-sparcio.h"
 #elif defined(CONFIG_X86) || defined(CONFIG_IA64)
-#include "i8042-x86ia64io.h"
+#include "i8042-acpipnpio.h"
 #else
 #include "i8042-io.h"
 #endif
-- 
2.31.1


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

* [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h
  2022-09-17  6:40 [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Huacai Chen
@ 2022-09-17  6:40 ` Huacai Chen
  2022-09-22  8:32   ` Mattijs Korpershoek
  2022-09-22  8:04 ` [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Mattijs Korpershoek
  2022-10-01 22:11 ` Dmitry Torokhov
  2 siblings, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2022-09-17  6:40 UTC (permalink / raw)
  To: Arnd Bergmann, Huacai Chen, Dmitry Torokhov
  Cc: loongarch, linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-input, linux-kernel, Huacai Chen

LoongArch uses ACPI and nearly the same as X86/IA64 for 8042. So modify
i8042-acpipnpio.h slightly and enable it for LoongArch in i8042.h. Then
i8042 driver can work well under the ACPI firmware with PNP typed key-
board and mouse configured in DSDT.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 drivers/input/serio/i8042-acpipnpio.h | 8 ++++++--
 drivers/input/serio/i8042.h           | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index d14b9fb59d6c..c22151f180bb 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -2,6 +2,7 @@
 #ifndef _I8042_ACPIPNPIO_H
 #define _I8042_ACPIPNPIO_H
 
+#include <linux/acpi.h>
 
 #ifdef CONFIG_X86
 #include <asm/x86_init.h>
@@ -1449,16 +1450,19 @@ static int __init i8042_pnp_init(void)
 
 	if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
 		i8042_pnp_exit();
+		pr_info("PNP: No PS/2 controller found.\n");
 #if defined(__ia64__)
 		return -ENODEV;
+#elif defined(__loongarch__)
+		if (acpi_disabled == 0)
+			return -ENODEV;
 #else
-		pr_info("PNP: No PS/2 controller found.\n");
 		if (x86_platform.legacy.i8042 !=
 				X86_LEGACY_I8042_EXPECTED_PRESENT)
 			return -ENODEV;
+#endif
 		pr_info("Probing ports directly.\n");
 		return 0;
-#endif
 	}
 
 	if (i8042_pnp_kbd_devices)
diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index bf2592fa9a78..adb5173372d3 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -19,7 +19,7 @@
 #include "i8042-snirm.h"
 #elif defined(CONFIG_SPARC)
 #include "i8042-sparcio.h"
-#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
+#elif defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_LOONGARCH)
 #include "i8042-acpipnpio.h"
 #else
 #include "i8042-io.h"
-- 
2.31.1


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

* Re: [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h
  2022-09-17  6:40 [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Huacai Chen
  2022-09-17  6:40 ` [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h Huacai Chen
@ 2022-09-22  8:04 ` Mattijs Korpershoek
  2022-10-01 22:11 ` Dmitry Torokhov
  2 siblings, 0 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2022-09-22  8:04 UTC (permalink / raw)
  To: Huacai Chen, Arnd Bergmann, Huacai Chen, Dmitry Torokhov
  Cc: loongarch, linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-input, linux-kernel, Huacai Chen

On Sat, Sep 17, 2022 at 14:40, Huacai Chen <chenhuacai@loongson.cn> wrote:

> Now i8042-x86ia64io.h is shared by X86 and IA64, but it can be shared
> by more platforms (such as LoongArch) with ACPI firmware on which PNP
> typed keyboard and mouse is configured in DSDT. So rename it to i8042-
> acpipnpio.h.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  .../input/serio/{i8042-x86ia64io.h => i8042-acpipnpio.h}    | 6 +++---
>  drivers/input/serio/i8042.h                                 | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>  rename drivers/input/serio/{i8042-x86ia64io.h => i8042-acpipnpio.h} (99%)
>
> diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-acpipnpio.h
> similarity index 99%
> rename from drivers/input/serio/i8042-x86ia64io.h
> rename to drivers/input/serio/i8042-acpipnpio.h
> index 4fbec7bbecca..d14b9fb59d6c 100644
> --- a/drivers/input/serio/i8042-x86ia64io.h
> +++ b/drivers/input/serio/i8042-acpipnpio.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -#ifndef _I8042_X86IA64IO_H
> -#define _I8042_X86IA64IO_H
> +#ifndef _I8042_ACPIPNPIO_H
> +#define _I8042_ACPIPNPIO_H
>  
>  
>  #ifdef CONFIG_X86
> @@ -1665,4 +1665,4 @@ static inline void i8042_platform_exit(void)
>  	i8042_pnp_exit();
>  }
>  
> -#endif /* _I8042_X86IA64IO_H */
> +#endif /* _I8042_ACPIPNPIO_H */
> diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
> index 55381783dc82..bf2592fa9a78 100644
> --- a/drivers/input/serio/i8042.h
> +++ b/drivers/input/serio/i8042.h
> @@ -20,7 +20,7 @@
>  #elif defined(CONFIG_SPARC)
>  #include "i8042-sparcio.h"
>  #elif defined(CONFIG_X86) || defined(CONFIG_IA64)
> -#include "i8042-x86ia64io.h"
> +#include "i8042-acpipnpio.h"
>  #else
>  #include "i8042-io.h"
>  #endif
> -- 
> 2.31.1

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

* Re: [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h
  2022-09-17  6:40 ` [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h Huacai Chen
@ 2022-09-22  8:32   ` Mattijs Korpershoek
  2022-09-30  2:41     ` Huacai Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Mattijs Korpershoek @ 2022-09-22  8:32 UTC (permalink / raw)
  To: Huacai Chen, Arnd Bergmann, Huacai Chen, Dmitry Torokhov
  Cc: loongarch, linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-input, linux-kernel, Huacai Chen

On Sat, Sep 17, 2022 at 14:40, Huacai Chen <chenhuacai@loongson.cn> wrote:

> LoongArch uses ACPI and nearly the same as X86/IA64 for 8042. So modify
> i8042-acpipnpio.h slightly and enable it for LoongArch in i8042.h. Then
> i8042 driver can work well under the ACPI firmware with PNP typed key-
> board and mouse configured in DSDT.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

I would have split the pr_info() move in its own patch since it seems
like a "valid fix" on its own, but i'm probably too pedantic about this.

So, please take my:

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  drivers/input/serio/i8042-acpipnpio.h | 8 ++++++--
>  drivers/input/serio/i8042.h           | 2 +-
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
> index d14b9fb59d6c..c22151f180bb 100644
> --- a/drivers/input/serio/i8042-acpipnpio.h
> +++ b/drivers/input/serio/i8042-acpipnpio.h
> @@ -2,6 +2,7 @@
>  #ifndef _I8042_ACPIPNPIO_H
>  #define _I8042_ACPIPNPIO_H
>  
> +#include <linux/acpi.h>
>  
>  #ifdef CONFIG_X86
>  #include <asm/x86_init.h>
> @@ -1449,16 +1450,19 @@ static int __init i8042_pnp_init(void)
>  
>  	if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
>  		i8042_pnp_exit();
> +		pr_info("PNP: No PS/2 controller found.\n");
>  #if defined(__ia64__)
>  		return -ENODEV;
> +#elif defined(__loongarch__)
> +		if (acpi_disabled == 0)
> +			return -ENODEV;
>  #else
> -		pr_info("PNP: No PS/2 controller found.\n");
>  		if (x86_platform.legacy.i8042 !=
>  				X86_LEGACY_I8042_EXPECTED_PRESENT)
>  			return -ENODEV;
> +#endif
>  		pr_info("Probing ports directly.\n");
>  		return 0;
> -#endif
>  	}
>  
>  	if (i8042_pnp_kbd_devices)
> diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
> index bf2592fa9a78..adb5173372d3 100644
> --- a/drivers/input/serio/i8042.h
> +++ b/drivers/input/serio/i8042.h
> @@ -19,7 +19,7 @@
>  #include "i8042-snirm.h"
>  #elif defined(CONFIG_SPARC)
>  #include "i8042-sparcio.h"
> -#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
> +#elif defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_LOONGARCH)
>  #include "i8042-acpipnpio.h"
>  #else
>  #include "i8042-io.h"
> -- 
> 2.31.1

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

* Re: [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h
  2022-09-22  8:32   ` Mattijs Korpershoek
@ 2022-09-30  2:41     ` Huacai Chen
  2022-10-01 22:05       ` Dmitry Torokhov
  0 siblings, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2022-09-30  2:41 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Huacai Chen, Arnd Bergmann, Dmitry Torokhov, loongarch,
	linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang, Jiaxun Yang,
	linux-input, linux-kernel

Hi, Mattijs,

On Thu, Sep 22, 2022 at 4:32 PM Mattijs Korpershoek
<mkorpershoek@baylibre.com> wrote:
>
> On Sat, Sep 17, 2022 at 14:40, Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> > LoongArch uses ACPI and nearly the same as X86/IA64 for 8042. So modify
> > i8042-acpipnpio.h slightly and enable it for LoongArch in i8042.h. Then
> > i8042 driver can work well under the ACPI firmware with PNP typed key-
> > board and mouse configured in DSDT.
> >
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>
> I would have split the pr_info() move in its own patch since it seems
> like a "valid fix" on its own, but i'm probably too pedantic about this.
>
> So, please take my:
>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
I think the pr_info is needed for all architectures, and the moving is
very simple so I haven't split it. But anyway, if Dmitry also thinks
this patch should be split, I will send a new version. :)

Huacai
>
> > ---
> >  drivers/input/serio/i8042-acpipnpio.h | 8 ++++++--
> >  drivers/input/serio/i8042.h           | 2 +-
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
> > index d14b9fb59d6c..c22151f180bb 100644
> > --- a/drivers/input/serio/i8042-acpipnpio.h
> > +++ b/drivers/input/serio/i8042-acpipnpio.h
> > @@ -2,6 +2,7 @@
> >  #ifndef _I8042_ACPIPNPIO_H
> >  #define _I8042_ACPIPNPIO_H
> >
> > +#include <linux/acpi.h>
> >
> >  #ifdef CONFIG_X86
> >  #include <asm/x86_init.h>
> > @@ -1449,16 +1450,19 @@ static int __init i8042_pnp_init(void)
> >
> >       if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
> >               i8042_pnp_exit();
> > +             pr_info("PNP: No PS/2 controller found.\n");
> >  #if defined(__ia64__)
> >               return -ENODEV;
> > +#elif defined(__loongarch__)
> > +             if (acpi_disabled == 0)
> > +                     return -ENODEV;
> >  #else
> > -             pr_info("PNP: No PS/2 controller found.\n");
> >               if (x86_platform.legacy.i8042 !=
> >                               X86_LEGACY_I8042_EXPECTED_PRESENT)
> >                       return -ENODEV;
> > +#endif
> >               pr_info("Probing ports directly.\n");
> >               return 0;
> > -#endif
> >       }
> >
> >       if (i8042_pnp_kbd_devices)
> > diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
> > index bf2592fa9a78..adb5173372d3 100644
> > --- a/drivers/input/serio/i8042.h
> > +++ b/drivers/input/serio/i8042.h
> > @@ -19,7 +19,7 @@
> >  #include "i8042-snirm.h"
> >  #elif defined(CONFIG_SPARC)
> >  #include "i8042-sparcio.h"
> > -#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
> > +#elif defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_LOONGARCH)
> >  #include "i8042-acpipnpio.h"
> >  #else
> >  #include "i8042-io.h"
> > --
> > 2.31.1
>

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

* Re: [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h
  2022-09-30  2:41     ` Huacai Chen
@ 2022-10-01 22:05       ` Dmitry Torokhov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2022-10-01 22:05 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Mattijs Korpershoek, Huacai Chen, Arnd Bergmann, loongarch,
	linux-arch, Xuefeng Li, Guo Ren, Xuerui Wang, Jiaxun Yang,
	linux-input, linux-kernel

On Fri, Sep 30, 2022 at 10:41:59AM +0800, Huacai Chen wrote:
> Hi, Mattijs,
> 
> On Thu, Sep 22, 2022 at 4:32 PM Mattijs Korpershoek
> <mkorpershoek@baylibre.com> wrote:
> >
> > On Sat, Sep 17, 2022 at 14:40, Huacai Chen <chenhuacai@loongson.cn> wrote:
> >
> > > LoongArch uses ACPI and nearly the same as X86/IA64 for 8042. So modify
> > > i8042-acpipnpio.h slightly and enable it for LoongArch in i8042.h. Then
> > > i8042 driver can work well under the ACPI firmware with PNP typed key-
> > > board and mouse configured in DSDT.
> > >
> > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> >
> > I would have split the pr_info() move in its own patch since it seems
> > like a "valid fix" on its own, but i'm probably too pedantic about this.
> >
> > So, please take my:
> >
> > Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> I think the pr_info is needed for all architectures, and the moving is
> very simple so I haven't split it. But anyway, if Dmitry also thinks
> this patch should be split, I will send a new version. :)

The reason for ia64 not emitting this message is because we "trust" ia64
firmware and it is quite normal for it not to have i8042 implementation,
whereas there are a lot of legacy devices on x86 and not having PS/2
keyboard is still not very common.

I moved the pr_info() back into x86/loongarch branch and applied.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h
  2022-09-17  6:40 [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Huacai Chen
  2022-09-17  6:40 ` [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h Huacai Chen
  2022-09-22  8:04 ` [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Mattijs Korpershoek
@ 2022-10-01 22:11 ` Dmitry Torokhov
  2 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2022-10-01 22:11 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Arnd Bergmann, Huacai Chen, loongarch, linux-arch, Xuefeng Li,
	Guo Ren, Xuerui Wang, Jiaxun Yang, linux-input, linux-kernel

On Sat, Sep 17, 2022 at 02:40:19PM +0800, Huacai Chen wrote:
> Now i8042-x86ia64io.h is shared by X86 and IA64, but it can be shared
> by more platforms (such as LoongArch) with ACPI firmware on which PNP
> typed keyboard and mouse is configured in DSDT. So rename it to i8042-
> acpipnpio.h.
> 
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Applied, thank you.

-- 
Dmitry

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

end of thread, other threads:[~2022-10-01 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  6:40 [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Huacai Chen
2022-09-17  6:40 ` [PATCH 2/2] Input: i8042: Add LoongArch support in i8042-acpipnpio.h Huacai Chen
2022-09-22  8:32   ` Mattijs Korpershoek
2022-09-30  2:41     ` Huacai Chen
2022-10-01 22:05       ` Dmitry Torokhov
2022-09-22  8:04 ` [PATCH 1/2] Input: i8042: Rename i8042-x86ia64io.h to i8042-acpipnpio.h Mattijs Korpershoek
2022-10-01 22:11 ` Dmitry Torokhov

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