All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Patch] Fujitsu extra buttons not working on S6010
       [not found] <29964_1412366647_542F0137_29964_4513_9_542EFC10.7020508@math.tu-berlin.de>
@ 2014-10-06 14:38 ` Thomas Richter
  2014-10-06 22:47   ` Rafael J. Wysocki
       [not found]   ` <29964_1412634435_54331741_29964_16384_1_8031540.z3p2ny3Gns@vostro.rjw.lan>
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Richter @ 2014-10-06 14:38 UTC (permalink / raw)
  To: tianyu.lan, paul.s.diefenbaugh, jun.nakajima, gjohnson, lenb,
	rui.zhang, linux-acpi

Dear experts,
>
> following the bug report on bugzilla
>
> https://bugzilla.kernel.org/show_bug.cgi?id=84381
>
> the extra buttons (ACPI-driven buttons) on the R31 laptop do not work 
> since kernel 3.17.0.
> Kernel 3.16.x worked fine. The same problem (or at least a very 
> similar problem) exists
> on the Fujitsu-S6010 laptop.
>
> After debugging for a while, the culprit seems to be in 
> arch/x86/kernel/acpi/boot.c, in specific
> in acpi_gsi_to_irq(). The following changes fix this problem for at 
> least the S6010:
>
> static unsigned int gsi_to_irq(unsigned int gsi)
> {
>     unsigned int irq = gsi + NR_IRQS_LEGACY;
>     unsigned int i;
>
>     for (i = 0; i<  NR_IRQS_LEGACY; i++) {
>         if (isa_irq_to_gsi[i] == gsi) {
>             return i;
>         }
>     }
>
>     /* Provide an identity mapping of gsi == irq
>      * except on truly weird platforms that have
>      * non isa irqs in the first 16 gsis.
>      */
>     if (gsi>= NR_IRQS_LEGACY)
>         irq = gsi;
>     else
>         irq = gsi_top + gsi;
>
>     return irq;
> }
> /* THOR: Experimental end */
>
> int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
> {
>     int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | 
> IOAPIC_MAP_CHECK);
>
>     if (irq>= 0) {
>         *irqp = irq;
>         return 0;
>     }
>
>     /* THOR: Experimental start */
>     irq = gsi_to_irq(gsi);
>     if (irq>= 0) {
>       *irqp = irq;
>       return 0;
>     }
>     /* THOR Experimental end */
>
>     return -1;
> }
>
> Whether this works on the R31 is yet to be determined.


The above patch has now also been tested on the IBM R31, and yes, it 
also fixes the system keys there: Thinklight, volume up & down and
various other system-driven key-combinations now work again.

Could you please pick this patch up or comment on better alternatives?

Thank you,
     Thomas



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

* Re: [Patch] Fujitsu extra buttons not working on S6010
  2014-10-06 14:38 ` [Patch] Fujitsu extra buttons not working on S6010 Thomas Richter
@ 2014-10-06 22:47   ` Rafael J. Wysocki
       [not found]   ` <29964_1412634435_54331741_29964_16384_1_8031540.z3p2ny3Gns@vostro.rjw.lan>
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-10-06 22:47 UTC (permalink / raw)
  To: Thomas Richter
  Cc: tianyu.lan, paul.s.diefenbaugh, jun.nakajima, gjohnson, lenb,
	rui.zhang, linux-acpi

On Monday, October 06, 2014 04:38:15 PM Thomas Richter wrote:
> Dear experts,
> >
> > following the bug report on bugzilla
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=84381
> >
> > the extra buttons (ACPI-driven buttons) on the R31 laptop do not work 
> > since kernel 3.17.0.
> > Kernel 3.16.x worked fine. The same problem (or at least a very 
> > similar problem) exists
> > on the Fujitsu-S6010 laptop.
> >
> > After debugging for a while, the culprit seems to be in 
> > arch/x86/kernel/acpi/boot.c, in specific
> > in acpi_gsi_to_irq(). The following changes fix this problem for at 
> > least the S6010:
> >
> > static unsigned int gsi_to_irq(unsigned int gsi)
> > {
> >     unsigned int irq = gsi + NR_IRQS_LEGACY;
> >     unsigned int i;
> >
> >     for (i = 0; i<  NR_IRQS_LEGACY; i++) {
> >         if (isa_irq_to_gsi[i] == gsi) {
> >             return i;
> >         }
> >     }
> >
> >     /* Provide an identity mapping of gsi == irq
> >      * except on truly weird platforms that have
> >      * non isa irqs in the first 16 gsis.
> >      */
> >     if (gsi>= NR_IRQS_LEGACY)
> >         irq = gsi;
> >     else
> >         irq = gsi_top + gsi;
> >
> >     return irq;
> > }
> > /* THOR: Experimental end */
> >
> > int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
> > {
> >     int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | 
> > IOAPIC_MAP_CHECK);
> >
> >     if (irq>= 0) {
> >         *irqp = irq;
> >         return 0;
> >     }
> >
> >     /* THOR: Experimental start */
> >     irq = gsi_to_irq(gsi);
> >     if (irq>= 0) {
> >       *irqp = irq;
> >       return 0;
> >     }
> >     /* THOR Experimental end */
> >
> >     return -1;
> > }
> >
> > Whether this works on the R31 is yet to be determined.
> 
> 
> The above patch has now also been tested on the IBM R31, and yes, it 
> also fixes the system keys there: Thinklight, volume up & down and
> various other system-driven key-combinations now work again.
> 
> Could you please pick this patch up or comment on better alternatives?

And can you please actually post a patch?  The above is just a piece of C code
entirely out of context.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH] Fujitsu extra buttons not working on S6010, Thinkpad Extra buttons not working on R31
       [not found]   ` <29964_1412634435_54331741_29964_16384_1_8031540.z3p2ny3Gns@vostro.rjw.lan>
@ 2014-10-07 14:17     ` Thomas Richter
  2014-10-12 17:26     ` [Patch] Fujitsu extra buttons not working on S6010 Thomas Richter
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Richter @ 2014-10-07 14:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tianyu.lan, paul.s.diefenbaugh, jun.nakajima, gjohnson, lenb,
	rui.zhang, linux-acpi

Hi Rafael,

> And can you please actually post a patch?  The above is just a piece of C code
> entirely out of context.
Actually, it was rather supposed to start a discussion because I have 
almost no experience with the ACPI subsystem.

Anyhow, here is the same in a (hopefully) well-formed patch file, tested 
on a Fujitsu S6010 and an IBM R31 running
the 3.17 kernel.

Thanks,
     Thomas


Signed-off-by: Thomas Richter <thor@math.tu-berlin.de>
--- linux-3.17/arch/x86/kernel/acpi/boot.c.old  2014-10-07 
15:43:44.000000000 +0200
+++ linux-3.17/arch/x86/kernel/acpi/boot.c      2014-10-07 
16:04:33.000000000 +0200
@@ -609,9 +609,23 @@
         if (irq >= 0) {
                 *irqp = irq;
                 return 0;
-       }
+       } else {
+               unsigned int i;
+
+               for (i = 0; i < NR_IRQS_LEGACY; i++) {
+                       if (isa_irq_to_gsi[i] == gsi) {
+                               *irqp = i;
+                               return 0;
+                       }
+               }
+
+               if (gsi >= NR_IRQS_LEGACY)
+                       *irqp = gsi;
+               else
+                       *irqp = gsi_top + gsi;

-       return -1;
+               return 0;
+       }
  }
  EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);


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

* Re: [Patch] Fujitsu extra buttons not working on S6010
       [not found]   ` <29964_1412634435_54331741_29964_16384_1_8031540.z3p2ny3Gns@vostro.rjw.lan>
  2014-10-07 14:17     ` [PATCH] Fujitsu extra buttons not working on S6010, Thinkpad Extra buttons not working on R31 Thomas Richter
@ 2014-10-12 17:26     ` Thomas Richter
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Richter @ 2014-10-12 17:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tianyu.lan, paul.s.diefenbaugh, jun.nakajima, gjohnson, lenb,
	rui.zhang, linux-acpi

Rafael,

you should now have a correctly formatted patch for this issue. Now what 
is next?

Greetings,
	Thomas

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

* [Patch] Fujitsu extra buttons not working on S6010
@ 2014-10-03 19:42 Thomas Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Richter @ 2014-10-03 19:42 UTC (permalink / raw)
  To: tianyu.lan, paul.s.diefenbaugh, jun.nakajima, gjohnson, lenb,
	rui.zhang, linux-acpi

Dear experts,

following the bug report on bugzilla

https://bugzilla.kernel.org/show_bug.cgi?id=84381

the extra buttons (ACPI-driven buttons) on the R31 laptop do not work 
since kernel 3.17.0.
Kernel 3.16.x worked fine. The same problem (or at least a very similar 
problem) exists
on the Fujitsu-S6010 laptop.

After debugging for a while, the culprit seems to be in 
arch/x86/kernel/acpi/boot.c, in specific
in acpi_gsi_to_irq(). The following changes fix this problem for at 
least the S6010:

static unsigned int gsi_to_irq(unsigned int gsi)
{
	unsigned int irq = gsi + NR_IRQS_LEGACY;
	unsigned int i;

	for (i = 0; i<  NR_IRQS_LEGACY; i++) {
		if (isa_irq_to_gsi[i] == gsi) {
			return i;
		}
	}

	/* Provide an identity mapping of gsi == irq
	 * except on truly weird platforms that have
	 * non isa irqs in the first 16 gsis.
	 */
	if (gsi>= NR_IRQS_LEGACY)
		irq = gsi;
	else
		irq = gsi_top + gsi;

	return irq;
}
/* THOR: Experimental end */

int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
{
	int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);

	if (irq>= 0) {
		*irqp = irq;
		return 0;
	}

	/* THOR: Experimental start */
	irq = gsi_to_irq(gsi);
	if (irq>= 0) {
	  *irqp = irq;
	  return 0;
	}
	/* THOR Experimental end */

	return -1;
}

Whether this works on the R31 is yet to be determined.

It would be great if you could integrate this patch into the next kernel release to get the laptop
buttons working again. With this patch, both the ACPI-buttons as well as the backlight control
device in sys/class/backlight/fujitsu-laptop works.

Thanks,
	Thomas




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

end of thread, other threads:[~2014-10-12 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <29964_1412366647_542F0137_29964_4513_9_542EFC10.7020508@math.tu-berlin.de>
2014-10-06 14:38 ` [Patch] Fujitsu extra buttons not working on S6010 Thomas Richter
2014-10-06 22:47   ` Rafael J. Wysocki
     [not found]   ` <29964_1412634435_54331741_29964_16384_1_8031540.z3p2ny3Gns@vostro.rjw.lan>
2014-10-07 14:17     ` [PATCH] Fujitsu extra buttons not working on S6010, Thinkpad Extra buttons not working on R31 Thomas Richter
2014-10-12 17:26     ` [Patch] Fujitsu extra buttons not working on S6010 Thomas Richter
2014-10-03 19:42 Thomas Richter

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.