[PATCH] Mark ams driver as orphaned in MAINTAINERS

2018-01-29 Thread Michael Hanselmann
I no longer have any hardware with the Apple motion sensor and thus
relinquish maintainership of the driver.

Signed-off-by: Michael Hanselmann <linux-ker...@hansmi.ch>
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a9c9c9ff7..6a07de631 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -780,8 +780,8 @@ F:  drivers/net/ethernet/amd/xgbe/
 F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
 
 AMS (Apple Motion Sensor) DRIVER
-M: Michael Hanselmann <linux-ker...@hansmi.ch>
-S: Supported
+L: linuxppc-...@lists.ozlabs.org
+S: Orphan
 F: drivers/macintosh/ams/
 
 ANALOG DEVICES INC AD9389B DRIVER
-- 
2.11.0



[PATCH] Mark ams driver as orphaned in MAINTAINERS

2018-01-29 Thread Michael Hanselmann
I no longer have any hardware with the Apple motion sensor and thus
relinquish maintainership of the driver.

Signed-off-by: Michael Hanselmann 
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a9c9c9ff7..6a07de631 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -780,8 +780,8 @@ F:  drivers/net/ethernet/amd/xgbe/
 F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
 
 AMS (Apple Motion Sensor) DRIVER
-M: Michael Hanselmann 
-S: Supported
+L: linuxppc-...@lists.ozlabs.org
+S: Orphan
 F: drivers/macintosh/ams/
 
 ANALOG DEVICES INC AD9389B DRIVER
-- 
2.11.0



Re: [PATCH] macintosh/ams-input: Use true and false for boolean values

2018-01-23 Thread Michael Hanselmann
On 24.01.2018 02:48, Gustavo A. R. Silva wrote:
> Assign true or false to boolean variables instead of an integer value.
> 
> This issue was detected with the help of Coccinelle
> 
> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com>

Reviewed-by: Michael Hanselmann <pub...@hansmi.ch>



Re: [PATCH] macintosh/ams-input: Use true and false for boolean values

2018-01-23 Thread Michael Hanselmann
On 24.01.2018 02:48, Gustavo A. R. Silva wrote:
> Assign true or false to boolean variables instead of an integer value.
> 
> This issue was detected with the help of Coccinelle
> 
> Signed-off-by: Gustavo A. R. Silva 

Reviewed-by: Michael Hanselmann 



Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-06 Thread Michael Hanselmann
On Tue, Jun 05, 2007 at 10:24:14AM -0400, Alan Stern wrote:
> (Depending on which version of the kernel you are looking at -- [...]
> Earlier versions did behave the way you describe.)

I was looking at 2.6.22-rc3 which might explain the differences.

> So the system is behaving the way you want, but not for the reason you 
> think.  I bet you could remove the call to usb_root_hub_lost_power() 
> entirely and it wouldn't make any difference at all.

Actually, that's true. René Nussbaumer tried without that call and it
still works as intended. Should I leave that call out and drop the
changes on usb_root_hub_lost_power for CONFIG_PM?

Greets,
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-06 Thread Michael Hanselmann
On Tue, Jun 05, 2007 at 10:24:14AM -0400, Alan Stern wrote:
 (Depending on which version of the kernel you are looking at -- [...]
 Earlier versions did behave the way you describe.)

I was looking at 2.6.22-rc3 which might explain the differences.

 So the system is behaving the way you want, but not for the reason you 
 think.  I bet you could remove the call to usb_root_hub_lost_power() 
 entirely and it wouldn't make any difference at all.

Actually, that's true. René Nussbaumer tried without that call and it
still works as intended. Should I leave that call out and drop the
changes on usb_root_hub_lost_power for CONFIG_PM?

Greets,
Michael
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-04 Thread Michael Hanselmann
On Sat, Jun 02, 2007 at 10:49:44AM -0400, Alan Stern wrote:
> Then later on, when the hub driver is resumed it will see the flag and
> disconnect all the devices below the root hub.

> For instance, you could force ohci-hcd to report connect-change events
> on all the ports. Perhaps it does something like that anyway, in which
> case you wouldn't have to worry about it.

After studying the code for two evenings, I'm quite sure it does that
already.

A comment in ohci-hcd.c:ohci_restart reads:
  /* mark any devices gone, so they do nothing till khubd disconnects.
   * recycle any "live" eds/tds (and urbs) right away.
   * later, khubd disconnect processing will recycle the other state,
   * (either as disconnect/reconnect, or maybe someday as a reset).
   */

usb_root_hub_lost_power marks the ports as gone, khubd will disconnect them.
After restarting the chip, khubd will cause them to be detected again.

This is also what I can watch in the logs:
  ohci_hcd 0001:10:15.1: OHCI Unrecoverable Error, scheduling NEC chip restart
  usb usb2: root hub lost power or was reset
  usb 2-2: USB disconnect, address 2
  input: appletouch disconnected
  usb 2-2: new full speed USB device using ohci_hcd and address 3
  usb 2-2: configuration #1 chosen from 1 choice
  input: Apple Computer Apple Internal Keyboard / Trackpad as 
/class/input/input16 on usb-0001:10:15.1-2
  input: appletouch as /class/input/input17
  input: Apple Computer Apple Internal Keyboard / Trackpad as 
/class/input/input18 on usb-0001:10:15.1-2

(Actually, I added some code to trigger the error handling code, reliably
reproducing it otherwise is impossible.)

Thanks,
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-04 Thread Michael Hanselmann
On Sat, Jun 02, 2007 at 10:49:44AM -0400, Alan Stern wrote:
 Then later on, when the hub driver is resumed it will see the flag and
 disconnect all the devices below the root hub.

 For instance, you could force ohci-hcd to report connect-change events
 on all the ports. Perhaps it does something like that anyway, in which
 case you wouldn't have to worry about it.

After studying the code for two evenings, I'm quite sure it does that
already.

A comment in ohci-hcd.c:ohci_restart reads:
  /* mark any devices gone, so they do nothing till khubd disconnects.
   * recycle any live eds/tds (and urbs) right away.
   * later, khubd disconnect processing will recycle the other state,
   * (either as disconnect/reconnect, or maybe someday as a reset).
   */

usb_root_hub_lost_power marks the ports as gone, khubd will disconnect them.
After restarting the chip, khubd will cause them to be detected again.

This is also what I can watch in the logs:
  ohci_hcd 0001:10:15.1: OHCI Unrecoverable Error, scheduling NEC chip restart
  usb usb2: root hub lost power or was reset
  usb 2-2: USB disconnect, address 2
  input: appletouch disconnected
  usb 2-2: new full speed USB device using ohci_hcd and address 3
  usb 2-2: configuration #1 chosen from 1 choice
  input: Apple Computer Apple Internal Keyboard / Trackpad as 
/class/input/input16 on usb-0001:10:15.1-2
  input: appletouch as /class/input/input17
  input: Apple Computer Apple Internal Keyboard / Trackpad as 
/class/input/input18 on usb-0001:10:15.1-2

(Actually, I added some code to trigger the error handling code, reliably
reproducing it otherwise is impossible.)

Thanks,
Michael
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-02 Thread Michael Hanselmann
On Fri, Jun 01, 2007 at 10:19:30AM -0400, Alan Stern wrote:
> > @@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
> >  */
> > spin_lock_irq(>lock);
> > disable (ohci);
> > +
> > +#ifdef CONFIG_PM
> > usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub);
> > +#endif
> > +

> Suppose CONFIG_PM isn't defined.  How are you going to let usbcore 
> know about all the old connections which no longer exist?

You're right, something is wrong there. The patch below uses
usb_root_hub_lost_power again but disables CONFIG_PM specific code in it
when CONFIG_PM isn't defined. It seems to work for me with and without
CONFIG_PM, but I have to confess I might not know enough about Linux'
USB core. Is it better now?

Signed-off-by: Michael Hanselmann <[EMAIL PROTECTED]>

---
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/core/hub.c 
linux-2.6.22-rc3/drivers/usb/core/hub.c
--- linux-2.6.22-rc3.orig/drivers/usb/core/hub.c2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/core/hub.c 2007-06-02 14:34:13.0 
+0200
@@ -1089,9 +1089,6 @@ void usb_set_device_state(struct usb_dev
spin_unlock_irqrestore(_state_lock, flags);
 }
 
-
-#ifdef CONFIG_PM
-
 /**
  * usb_root_hub_lost_power - called by HCD if the root hub lost Vbus power
  * @rhdev: struct usb_device for the root hub
@@ -1109,10 +1106,12 @@ void usb_root_hub_lost_power(struct usb_
 
dev_warn(>dev, "root hub lost power or was reset\n");
 
+#ifdef CONFIG_PM
/* Make sure no potential wakeup events get lost,
 * by forcing the root hub to be resumed.
 */
rhdev->dev.power.prev_state.event = PM_EVENT_ON;
+#endif /* CONFIG_PM */
 
spin_lock_irqsave(_state_lock, flags);
hub = hdev_to_hub(rhdev);
@@ -1127,8 +1126,6 @@ void usb_root_hub_lost_power(struct usb_
 }
 EXPORT_SYMBOL_GPL(usb_root_hub_lost_power);
 
-#endif /* CONFIG_PM */
-
 static void choose_address(struct usb_device *udev)
 {
int devnum;
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h 
linux-2.6.22-rc3/drivers/usb/host/ohci.h
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci.h2007-05-31 22:54:27.0 
+0200
@@ -397,8 +397,10 @@ struct ohci_hcd {
 #defineOHCI_QUIRK_BE_DESC  0x08/* BE 
descriptors */
 #defineOHCI_QUIRK_BE_MMIO  0x10/* BE registers 
*/
 #defineOHCI_QUIRK_ZFMICRO  0x20/* Compaq 
ZFMicro chipset*/
+#defineOHCI_QUIRK_NEC  0x40/* lost 
interrupts */
// there are also chip quirks/bugs in init logic
 
+   struct work_struct  nec_work;   /* Worker for NEC quirk */
 };
 
 /* convert between an hcd pointer and the corresponding ohci_hcd */
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c 
linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c2007-06-02 
14:35:18.0 +0200
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -82,6 +83,8 @@ static const char hcd_name [] = "ohci_hc
 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
 static int ohci_init (struct ohci_hcd *ohci);
 static void ohci_stop (struct usb_hcd *hcd);
+static int ohci_restart (struct ohci_hcd *ohci);
+static void ohci_quirk_nec_worker (struct work_struct *work);
 
 #include "ohci-hub.c"
 #include "ohci-dbg.c"
@@ -659,9 +662,20 @@ static irqreturn_t ohci_irq (struct usb_
}
 
if (ints & OHCI_INTR_UE) {
-   disable (ohci);
-   ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
// e.g. due to PCI Master/Target Abort
+   if (ohci->flags & OHCI_QUIRK_NEC) {
+   /* Workaround for a silicon bug in some NEC chips used
+* in Apple's PowerBooks. Adapted from Darwin code.
+*/
+   ohci_err (ohci, "OHCI Unrecoverable Error, scheduling 
NEC chip restart\n");
+
+   ohci_writel (ohci, OHCI_INTR_UE, >intrdisable);
+
+   schedule_work (>nec_work);
+   } else {
+   disable (ohci);
+   ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
+   }
 
ohci_dump (ohci, 1);
ohci_usb_reset (ohci);
@@ -763,9 +777,6 @@ static void ohci_stop (struct usb_hcd *h
 /*-

Re: [linux-usb-devel] [PATCH] Fix NEC OHCI chip silicon bug

2007-06-02 Thread Michael Hanselmann
On Fri, Jun 01, 2007 at 10:19:30AM -0400, Alan Stern wrote:
  @@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
   */
  spin_lock_irq(ohci-lock);
  disable (ohci);
  +
  +#ifdef CONFIG_PM
  usb_root_hub_lost_power(ohci_to_hcd(ohci)-self.root_hub);
  +#endif
  +

 Suppose CONFIG_PM isn't defined.  How are you going to let usbcore 
 know about all the old connections which no longer exist?

You're right, something is wrong there. The patch below uses
usb_root_hub_lost_power again but disables CONFIG_PM specific code in it
when CONFIG_PM isn't defined. It seems to work for me with and without
CONFIG_PM, but I have to confess I might not know enough about Linux'
USB core. Is it better now?

Signed-off-by: Michael Hanselmann [EMAIL PROTECTED]

---
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/core/hub.c 
linux-2.6.22-rc3/drivers/usb/core/hub.c
--- linux-2.6.22-rc3.orig/drivers/usb/core/hub.c2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/core/hub.c 2007-06-02 14:34:13.0 
+0200
@@ -1089,9 +1089,6 @@ void usb_set_device_state(struct usb_dev
spin_unlock_irqrestore(device_state_lock, flags);
 }
 
-
-#ifdef CONFIG_PM
-
 /**
  * usb_root_hub_lost_power - called by HCD if the root hub lost Vbus power
  * @rhdev: struct usb_device for the root hub
@@ -1109,10 +1106,12 @@ void usb_root_hub_lost_power(struct usb_
 
dev_warn(rhdev-dev, root hub lost power or was reset\n);
 
+#ifdef CONFIG_PM
/* Make sure no potential wakeup events get lost,
 * by forcing the root hub to be resumed.
 */
rhdev-dev.power.prev_state.event = PM_EVENT_ON;
+#endif /* CONFIG_PM */
 
spin_lock_irqsave(device_state_lock, flags);
hub = hdev_to_hub(rhdev);
@@ -1127,8 +1126,6 @@ void usb_root_hub_lost_power(struct usb_
 }
 EXPORT_SYMBOL_GPL(usb_root_hub_lost_power);
 
-#endif /* CONFIG_PM */
-
 static void choose_address(struct usb_device *udev)
 {
int devnum;
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h 
linux-2.6.22-rc3/drivers/usb/host/ohci.h
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci.h2007-05-31 22:54:27.0 
+0200
@@ -397,8 +397,10 @@ struct ohci_hcd {
 #defineOHCI_QUIRK_BE_DESC  0x08/* BE 
descriptors */
 #defineOHCI_QUIRK_BE_MMIO  0x10/* BE registers 
*/
 #defineOHCI_QUIRK_ZFMICRO  0x20/* Compaq 
ZFMicro chipset*/
+#defineOHCI_QUIRK_NEC  0x40/* lost 
interrupts */
// there are also chip quirks/bugs in init logic
 
+   struct work_struct  nec_work;   /* Worker for NEC quirk */
 };
 
 /* convert between an hcd pointer and the corresponding ohci_hcd */
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c 
linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c2007-06-02 
14:35:18.0 +0200
@@ -35,6 +35,7 @@
 #include linux/dma-mapping.h
 #include linux/dmapool.h
 #include linux/reboot.h
+#include linux/workqueue.h
 
 #include asm/io.h
 #include asm/irq.h
@@ -82,6 +83,8 @@ static const char hcd_name [] = ohci_hc
 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
 static int ohci_init (struct ohci_hcd *ohci);
 static void ohci_stop (struct usb_hcd *hcd);
+static int ohci_restart (struct ohci_hcd *ohci);
+static void ohci_quirk_nec_worker (struct work_struct *work);
 
 #include ohci-hub.c
 #include ohci-dbg.c
@@ -659,9 +662,20 @@ static irqreturn_t ohci_irq (struct usb_
}
 
if (ints  OHCI_INTR_UE) {
-   disable (ohci);
-   ohci_err (ohci, OHCI Unrecoverable Error, disabled\n);
// e.g. due to PCI Master/Target Abort
+   if (ohci-flags  OHCI_QUIRK_NEC) {
+   /* Workaround for a silicon bug in some NEC chips used
+* in Apple's PowerBooks. Adapted from Darwin code.
+*/
+   ohci_err (ohci, OHCI Unrecoverable Error, scheduling 
NEC chip restart\n);
+
+   ohci_writel (ohci, OHCI_INTR_UE, regs-intrdisable);
+
+   schedule_work (ohci-nec_work);
+   } else {
+   disable (ohci);
+   ohci_err (ohci, OHCI Unrecoverable Error, disabled\n);
+   }
 
ohci_dump (ohci, 1);
ohci_usb_reset (ohci);
@@ -763,9 +777,6 @@ static void ohci_stop (struct usb_hcd *h
 /*-*/
 
 /* must not be called from interrupt context */
-
-#ifdef CONFIG_PM

[PATCH] Fix NEC OHCI chip silicon bug

2007-05-31 Thread Michael Hanselmann
This patch fixes a silicon bug in some NEC OHCI chips. The bug appears
at random times and is very, very difficult to reproduce. Without the
following patch, Linux would shut the chip and its associated devices
down. In Apple PowerBooks this leads to an unusable keyboard and mouse
(SSH still working). The idea of restarting the chip is taken from
public Darwin code.

Signed-off-by: Michael Hanselmann <[EMAIL PROTECTED]>

---
The OHCI driver uses inconsistent code formatting. I tried to stay with
the used style where I modified functions while using Doc/CodingStyle
for new functions.

diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h 
linux-2.6.22-rc3/drivers/usb/host/ohci.h
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci.h2007-05-31 22:54:27.0 
+0200
@@ -397,8 +397,10 @@ struct ohci_hcd {
 #defineOHCI_QUIRK_BE_DESC  0x08/* BE 
descriptors */
 #defineOHCI_QUIRK_BE_MMIO  0x10/* BE registers 
*/
 #defineOHCI_QUIRK_ZFMICRO  0x20/* Compaq 
ZFMicro chipset*/
+#defineOHCI_QUIRK_NEC  0x40/* lost 
interrupts */
// there are also chip quirks/bugs in init logic
 
+   struct work_struct  nec_work;   /* Worker for NEC quirk */
 };
 
 /* convert between an hcd pointer and the corresponding ohci_hcd */
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c 
linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c2007-05-31 
23:24:56.0 +0200
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -82,6 +83,8 @@ static const char hcd_name [] = "ohci_hc
 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
 static int ohci_init (struct ohci_hcd *ohci);
 static void ohci_stop (struct usb_hcd *hcd);
+static int ohci_restart (struct ohci_hcd *ohci);
+static void ohci_quirk_nec_worker (struct work_struct *work);
 
 #include "ohci-hub.c"
 #include "ohci-dbg.c"
@@ -659,9 +662,20 @@ static irqreturn_t ohci_irq (struct usb_
}
 
if (ints & OHCI_INTR_UE) {
-   disable (ohci);
-   ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
// e.g. due to PCI Master/Target Abort
+   if (ohci->flags & OHCI_QUIRK_NEC) {
+   /* Workaround for a silicon bug in some NEC chips used
+* in Apple's PowerBooks. Adapted from Darwin code.
+*/
+   ohci_err (ohci, "OHCI Unrecoverable Error, scheduling 
NEC chip restart\n");
+
+   ohci_writel (ohci, OHCI_INTR_UE, >intrdisable);
+
+   schedule_work (>nec_work);
+   } else {
+   disable (ohci);
+   ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
+   }
 
ohci_dump (ohci, 1);
ohci_usb_reset (ohci);
@@ -763,9 +777,6 @@ static void ohci_stop (struct usb_hcd *h
 /*-*/
 
 /* must not be called from interrupt context */
-
-#ifdef CONFIG_PM
-
 static int ohci_restart (struct ohci_hcd *ohci)
 {
int temp;
@@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
 */
spin_lock_irq(>lock);
disable (ohci);
+
+#ifdef CONFIG_PM
usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub);
+#endif
+
if (!list_empty (>pending))
ohci_dbg(ohci, "abort schedule...\n");
list_for_each_entry (priv, >pending, pending) {
@@ -839,7 +854,27 @@ static int ohci_restart (struct ohci_hcd
}
return 0;
 }
-#endif
+
+/*-*/
+
+/* NEC workaround */
+static void ohci_quirk_nec_worker(struct work_struct *work)
+{
+   struct ohci_hcd *ohci = container_of(work, struct ohci_hcd, nec_work);
+   int status;
+
+   status = ohci_init(ohci);
+   if (status != 0) {
+   ohci_err(ohci, "Restarting NEC controller failed "
+"in ohci_init, %d\n", status);
+   return;
+   }
+
+   status = ohci_restart(ohci);
+   if (status != 0)
+   ohci_err(ohci, "Restarting NEC controller failed "
+"in ohci_restart, %d\n", status);
+}
 
 /*-*/
 
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/

[PATCH] Fix NEC OHCI chip silicon bug

2007-05-31 Thread Michael Hanselmann
This patch fixes a silicon bug in some NEC OHCI chips. The bug appears
at random times and is very, very difficult to reproduce. Without the
following patch, Linux would shut the chip and its associated devices
down. In Apple PowerBooks this leads to an unusable keyboard and mouse
(SSH still working). The idea of restarting the chip is taken from
public Darwin code.

Signed-off-by: Michael Hanselmann [EMAIL PROTECTED]

---
The OHCI driver uses inconsistent code formatting. I tried to stay with
the used style where I modified functions while using Doc/CodingStyle
for new functions.

diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h 
linux-2.6.22-rc3/drivers/usb/host/ohci.h
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci.h   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci.h2007-05-31 22:54:27.0 
+0200
@@ -397,8 +397,10 @@ struct ohci_hcd {
 #defineOHCI_QUIRK_BE_DESC  0x08/* BE 
descriptors */
 #defineOHCI_QUIRK_BE_MMIO  0x10/* BE registers 
*/
 #defineOHCI_QUIRK_ZFMICRO  0x20/* Compaq 
ZFMicro chipset*/
+#defineOHCI_QUIRK_NEC  0x40/* lost 
interrupts */
// there are also chip quirks/bugs in init logic
 
+   struct work_struct  nec_work;   /* Worker for NEC quirk */
 };
 
 /* convert between an hcd pointer and the corresponding ohci_hcd */
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c 
linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c
--- linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hcd.c   2007-05-31 
22:53:54.0 +0200
+++ linux-2.6.22-rc3/drivers/usb/host/ohci-hcd.c2007-05-31 
23:24:56.0 +0200
@@ -35,6 +35,7 @@
 #include linux/dma-mapping.h
 #include linux/dmapool.h
 #include linux/reboot.h
+#include linux/workqueue.h
 
 #include asm/io.h
 #include asm/irq.h
@@ -82,6 +83,8 @@ static const char hcd_name [] = ohci_hc
 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
 static int ohci_init (struct ohci_hcd *ohci);
 static void ohci_stop (struct usb_hcd *hcd);
+static int ohci_restart (struct ohci_hcd *ohci);
+static void ohci_quirk_nec_worker (struct work_struct *work);
 
 #include ohci-hub.c
 #include ohci-dbg.c
@@ -659,9 +662,20 @@ static irqreturn_t ohci_irq (struct usb_
}
 
if (ints  OHCI_INTR_UE) {
-   disable (ohci);
-   ohci_err (ohci, OHCI Unrecoverable Error, disabled\n);
// e.g. due to PCI Master/Target Abort
+   if (ohci-flags  OHCI_QUIRK_NEC) {
+   /* Workaround for a silicon bug in some NEC chips used
+* in Apple's PowerBooks. Adapted from Darwin code.
+*/
+   ohci_err (ohci, OHCI Unrecoverable Error, scheduling 
NEC chip restart\n);
+
+   ohci_writel (ohci, OHCI_INTR_UE, regs-intrdisable);
+
+   schedule_work (ohci-nec_work);
+   } else {
+   disable (ohci);
+   ohci_err (ohci, OHCI Unrecoverable Error, disabled\n);
+   }
 
ohci_dump (ohci, 1);
ohci_usb_reset (ohci);
@@ -763,9 +777,6 @@ static void ohci_stop (struct usb_hcd *h
 /*-*/
 
 /* must not be called from interrupt context */
-
-#ifdef CONFIG_PM
-
 static int ohci_restart (struct ohci_hcd *ohci)
 {
int temp;
@@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
 */
spin_lock_irq(ohci-lock);
disable (ohci);
+
+#ifdef CONFIG_PM
usb_root_hub_lost_power(ohci_to_hcd(ohci)-self.root_hub);
+#endif
+
if (!list_empty (ohci-pending))
ohci_dbg(ohci, abort schedule...\n);
list_for_each_entry (priv, ohci-pending, pending) {
@@ -839,7 +854,27 @@ static int ohci_restart (struct ohci_hcd
}
return 0;
 }
-#endif
+
+/*-*/
+
+/* NEC workaround */
+static void ohci_quirk_nec_worker(struct work_struct *work)
+{
+   struct ohci_hcd *ohci = container_of(work, struct ohci_hcd, nec_work);
+   int status;
+
+   status = ohci_init(ohci);
+   if (status != 0) {
+   ohci_err(ohci, Restarting NEC controller failed 
+in ohci_init, %d\n, status);
+   return;
+   }
+
+   status = ohci_restart(ohci);
+   if (status != 0)
+   ohci_err(ohci, Restarting NEC controller failed 
+in ohci_restart, %d\n, status);
+}
 
 /*-*/
 
diff -Nurp --exclude-from=linux-exclude-from 
linux-2.6.22-rc3.orig/drivers/usb/host/ohci-hub.c 
linux-2.6.22-rc3/drivers/usb/host/ohci

Re: fix implicit declaration in nv_backlight.

2007-02-28 Thread Michael Hanselmann
On Wed, Feb 28, 2007 at 12:36:25PM -0500, Dave Jones wrote:
> +#ifdef __powerpc__

Is __powerpc__ defined when cross compiling? I'd rather use
CONFIG_PMAC_BACKLIGHT instead of it.

Greets,
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: fix implicit declaration in nv_backlight.

2007-02-28 Thread Michael Hanselmann
On Wed, Feb 28, 2007 at 12:36:25PM -0500, Dave Jones wrote:
 +#ifdef __powerpc__

Is __powerpc__ defined when cross compiling? I'd rather use
CONFIG_PMAC_BACKLIGHT instead of it.

Greets,
Michael
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fix null pointer dereference in appledisplay driver

2007-02-09 Thread Michael Hanselmann
Commit 40b20c257a13c5a526ac540bc5e43d0fdf29792a by Len Brown introduced
a null pointer dereference in the appledisplay driver. This patch fixes
it.

Signed-off-by: Michael Hanselmann <[EMAIL PROTECTED]>

---
I suggest adding this to 2.6.20.1 because this bug causes the kernel to
panic on boot when the driver is compiled in.

diff -Nrup --exclude-from linux-exclude-from 
linux-2.6.20.orig/drivers/usb/misc/appledisplay.c 
linux-2.6.20/drivers/usb/misc/appledisplay.c
--- linux-2.6.20.orig/drivers/usb/misc/appledisplay.c   2007-02-09 
22:35:56.0 +0100
+++ linux-2.6.20/drivers/usb/misc/appledisplay.c2007-02-10 
01:00:28.0 +0100
@@ -281,8 +281,8 @@ static int appledisplay_probe(struct usb
/* Register backlight device */
snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
atomic_inc_return(_displays) - 1);
-   pdata->bd = backlight_device_register(bl_name, NULL, NULL,
-   _bl_data);
+   pdata->bd = backlight_device_register(bl_name, NULL,
+   pdata, _bl_data);
if (IS_ERR(pdata->bd)) {
err("appledisplay: Backlight registration failed");
goto error;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fix null pointer dereference in appledisplay driver

2007-02-09 Thread Michael Hanselmann
Commit 40b20c257a13c5a526ac540bc5e43d0fdf29792a by Len Brown introduced
a null pointer dereference in the appledisplay driver. This patch fixes
it.

Signed-off-by: Michael Hanselmann [EMAIL PROTECTED]

---
I suggest adding this to 2.6.20.1 because this bug causes the kernel to
panic on boot when the driver is compiled in.

diff -Nrup --exclude-from linux-exclude-from 
linux-2.6.20.orig/drivers/usb/misc/appledisplay.c 
linux-2.6.20/drivers/usb/misc/appledisplay.c
--- linux-2.6.20.orig/drivers/usb/misc/appledisplay.c   2007-02-09 
22:35:56.0 +0100
+++ linux-2.6.20/drivers/usb/misc/appledisplay.c2007-02-10 
01:00:28.0 +0100
@@ -281,8 +281,8 @@ static int appledisplay_probe(struct usb
/* Register backlight device */
snprintf(bl_name, sizeof(bl_name), appledisplay%d,
atomic_inc_return(count_displays) - 1);
-   pdata-bd = backlight_device_register(bl_name, NULL, NULL,
-   appledisplay_bl_data);
+   pdata-bd = backlight_device_register(bl_name, NULL,
+   pdata, appledisplay_bl_data);
if (IS_ERR(pdata-bd)) {
err(appledisplay: Backlight registration failed);
goto error;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: drivers/video/aty/radeon_backlight.c

2006-12-13 Thread Michael Hanselmann
On Wed, Dec 13, 2006 at 08:46:24AM -0500, James Cloos wrote:
> Are there any dependencies in $subject which would preclude changing
> drivers/video/Kconfig with:

Yes.

> or is radeon_backlight.c only functional when -DCONFIG_PMAC_BACKLIGHT,
> even though the pmac routines are all ifdef'ed?

Did you actually test wether it works? As far as I know, only Apple
(PowerPC) hardware uses these registers yet and have no use anywhere
else.

Greets,
Michael

-- 
Gentoo Linux developer, http://hansmi.ch/, http://forkbomb.ch/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: drivers/video/aty/radeon_backlight.c

2006-12-13 Thread Michael Hanselmann
On Wed, Dec 13, 2006 at 08:46:24AM -0500, James Cloos wrote:
 Are there any dependencies in $subject which would preclude changing
 drivers/video/Kconfig with:

Yes.

 or is radeon_backlight.c only functional when -DCONFIG_PMAC_BACKLIGHT,
 even though the pmac routines are all ifdef'ed?

Did you actually test wether it works? As far as I know, only Apple
(PowerPC) hardware uses these registers yet and have no use anywhere
else.

Greets,
Michael

-- 
Gentoo Linux developer, http://hansmi.ch/, http://forkbomb.ch/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/