ieee1394: eth1394: send async streams at S100 on 1394b buses

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21b2c5647b05762462857f0e2246538a80b1
Commit: 21b2c5647b05762462857f0e2246538a80b1
Parent: 809e905ce73eaa13972c2617959f8ec16e7d0d6f
Author: Stefan Richter [EMAIL PROTECTED]
AuthorDate: Mon Apr 23 21:28:47 2007 +0200
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:32 2007 +0200

ieee1394: eth1394: send async streams at S100 on 1394b buses

eth1394 did not work on buses consisting of S100B...S400B hardware
because it attempted to send GASP packets at S800.

Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/eth1394.c |   18 +-
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index bd67c86..2296d43 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -475,9 +475,18 @@ static void ether1394_reset_priv(struct net_device *dev, 
int set_mtu)
priv-bc_maxpayload = 512;
 
/* Determine speed limit */
-   for (i = 0; i  host-node_count; i++)
+   /* FIXME: This is broken for nodes with link speed  PHY speed,
+* and it is suboptimal for S200B...S800B hardware.
+* The result of nodemgr's speed probe should be used somehow. */
+   for (i = 0; i  host-node_count; i++) {
+   /* take care of S100B...S400B PHY ports */
+   if (host-speed[i] == SELFID_SPEED_UNKNOWN) {
+   max_speed = IEEE1394_SPEED_100;
+   break;
+   }
if (max_speed  host-speed[i])
max_speed = host-speed[i];
+   }
priv-bc_sspd = max_speed;
 
if (set_mtu) {
@@ -1420,11 +1429,10 @@ static void ether1394_prep_gasp_packet(struct 
hpsb_packet *p,
p-data[1] = cpu_to_be32(ETHER1394_GASP_SPECIFIER_ID_LO  24 |
 ETHER1394_GASP_VERSION);
 
-   /* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES)
-* prevents hpsb_send_packet() from setting the speed to an arbitrary
-* value based on packet-node_id if packet-node_id is not set. */
-   p-node_id = ALL_NODES;
p-speed_code = priv-bc_sspd;
+
+   /* prevent hpsb_send_packet() from overriding our speed code */
+   p-node_id = LOCAL_BUS | ALL_NODES;
 }
 
 static void ether1394_free_packet(struct hpsb_packet *packet)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ieee1394: ohci1394: fix cosmetic problem in error logging

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c13596b0e5db1135ca22d068eca16ffe1e0ea912
Commit: c13596b0e5db1135ca22d068eca16ffe1e0ea912
Parent: 21b2c5647b05762462857f0e2246538a80b1
Author: Stefan Richter [EMAIL PROTECTED]
AuthorDate: Thu Apr 12 22:21:55 2007 +0200
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:32 2007 +0200

ieee1394: ohci1394: fix cosmetic problem in error logging

If posted write failed, an Unhandled interrupt(s) 0x0100 message
was logged by mistake.

Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/ohci1394.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 6833b98..d91ef33 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -2377,6 +2377,7 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id)
if (event  OHCI1394_postedWriteErr) {
PRINT(KERN_ERR, physical posted write error);
/* no recovery strategy yet, had to involve protocol drivers */
+   event = ~OHCI1394_postedWriteErr;
}
if (event  OHCI1394_cycleTooLong) {
if(printk_ratelimit())
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ieee1394: eth1394: reduce excessive function inlining

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e00f04a70fa387b3accc81b5c346200f836e2a52
Commit: e00f04a70fa387b3accc81b5c346200f836e2a52
Parent: 2cd556ae61c862f4d00bb63863c6e5c67fd55bd4
Author: Stefan Richter [EMAIL PROTECTED]
AuthorDate: Sun Mar 18 12:23:11 2007 +0100
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:30 2007 +0200

ieee1394: eth1394: reduce excessive function inlining

Shrinks eth1394.ko by about 5%.

Many of these functions have only one caller and are therefore auto-
inlined anyway.

Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/eth1394.c |   74 +--
 1 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 63fca14..d056c59 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -820,8 +820,7 @@ static int ether1394_mac_addr(struct net_device *dev, void 
*p)
  **/
 
 /* Copied from net/ethernet/eth.c */
-static inline u16 ether1394_type_trans(struct sk_buff *skb,
-  struct net_device *dev)
+static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
struct eth1394hdr *eth;
unsigned char *rawp;
@@ -855,10 +854,9 @@ static inline u16 ether1394_type_trans(struct sk_buff *skb,
 
 /* Parse an encapsulated IP1394 header into an ethernet frame packet.
  * We also perform ARP translation here, if need be.  */
-static inline u16 ether1394_parse_encap(struct sk_buff *skb,
-   struct net_device *dev,
-   nodeid_t srcid, nodeid_t destid,
-   u16 ether_type)
+static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
+nodeid_t srcid, nodeid_t destid,
+u16 ether_type)
 {
struct eth1394_priv *priv = netdev_priv(dev);
u64 dest_hw;
@@ -939,7 +937,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
return ret;
 }
 
-static inline int fragment_overlap(struct list_head *frag_list, int offset, 
int len)
+static int fragment_overlap(struct list_head *frag_list, int offset, int len)
 {
struct fragment_info *fi;
 
@@ -951,7 +949,7 @@ static inline int fragment_overlap(struct list_head 
*frag_list, int offset, int
return 0;
 }
 
-static inline struct list_head *find_partial_datagram(struct list_head *pdgl, 
int dgl)
+static struct list_head *find_partial_datagram(struct list_head *pdgl, int dgl)
 {
struct partial_datagram *pd;
 
@@ -963,7 +961,7 @@ static inline struct list_head 
*find_partial_datagram(struct list_head *pdgl, in
 }
 
 /* Assumes that new fragment does not overlap any existing fragments */
-static inline int new_fragment(struct list_head *frag_info, int offset, int 
len)
+static int new_fragment(struct list_head *frag_info, int offset, int len)
 {
struct list_head *lh;
struct fragment_info *fi, *fi2, *new;
@@ -1015,10 +1013,9 @@ static inline int new_fragment(struct list_head 
*frag_info, int offset, int len)
return 0;
 }
 
-static inline int new_partial_datagram(struct net_device *dev,
-  struct list_head *pdgl, int dgl,
-  int dg_size, char *frag_buf,
-  int frag_off, int frag_len)
+static int new_partial_datagram(struct net_device *dev, struct list_head *pdgl,
+   int dgl, int dg_size, char *frag_buf,
+   int frag_off, int frag_len)
 {
struct partial_datagram *new;
 
@@ -1055,8 +1052,8 @@ static inline int new_partial_datagram(struct net_device 
*dev,
return 0;
 }
 
-static inline int update_partial_datagram(struct list_head *pdgl, struct 
list_head *lh,
- char *frag_buf, int frag_off, int 
frag_len)
+static int update_partial_datagram(struct list_head *pdgl, struct list_head 
*lh,
+  char *frag_buf, int frag_off, int frag_len)
 {
struct partial_datagram *pd = list_entry(lh, struct partial_datagram, 
list);
 
@@ -1073,11 +1070,13 @@ static inline int update_partial_datagram(struct 
list_head *pdgl, struct list_he
return 0;
 }
 
-static inline int is_datagram_complete(struct list_head *lh, int dg_size)
+static int is_datagram_complete(struct list_head *lh, int dg_size)
 {
-   struct partial_datagram *pd = list_entry(lh, struct partial_datagram, 
list);
-   struct fragment_info *fi = list_entry(pd-frag_info.next,
- struct fragment_info, list);
+   struct partial_datagram *pd;
+   struct fragment_info *fi;
+
+   pd = 

ieee1394: ohci1394: Fix mistake in printk message.

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=749cf76620a8f0d1ab4ff83c8e8f18028045a094
Commit: 749cf76620a8f0d1ab4ff83c8e8f18028045a094
Parent: 2ab77524693ab855fc756faff0d1d26cb11a89e8
Author: Simon Arlott [EMAIL PROTECTED]
AuthorDate: Tue Apr 24 23:44:57 2007 +0100
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:32 2007 +0200

ieee1394: ohci1394: Fix mistake in printk message.

Fix the attempting to setting message in ohci1394.

Signed-off-by: Simon Arlott [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/ohci1394.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 0df8970..5dadfd2 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -613,7 +613,7 @@ static void ohci_initialize(struct ti_ohci *ohci)
 #endif
 
PRINT(KERN_DEBUG, Serial EEPROM has suspicious values, 
-  attempting to setting max_packet_size to 512 bytes);
+  attempting to set max_packet_size to 512 bytes);
reg_write(ohci, OHCI1394_BusOptions,
  (reg_read(ohci, OHCI1394_BusOptions)  0xf007) | 
0x8002);
ohci-max_packet_size = 512;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ieee1394: ohci1394: remove unnecessary rcvPhyPkt bit flipping in LinkControl register

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ab77524693ab855fc756faff0d1d26cb11a89e8
Commit: 2ab77524693ab855fc756faff0d1d26cb11a89e8
Parent: c13596b0e5db1135ca22d068eca16ffe1e0ea912
Author: Bernhard Kauer [EMAIL PROTECTED]
AuthorDate: Fri Apr 20 13:59:54 2007 +0200
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:32 2007 +0200

ieee1394: ohci1394: remove unnecessary rcvPhyPkt bit flipping in 
LinkControl register

Remove the unneeded code that clears, sets and again clears the
rcvPhyPkt bit in the ohci1394 LinkControl register in ohci_initialize().

Signed-off-by: Bernhard Kauer [EMAIL PROTECTED]
Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/ohci1394.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index d91ef33..0df8970 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -507,9 +507,8 @@ static void ohci_initialize(struct ti_ohci *ohci)
/* Set up self-id dma buffer */
reg_write(ohci, OHCI1394_SelfIDBuffer, ohci-selfid_buf_bus);
 
-   /* enable self-id and phys */
-   reg_write(ohci, OHCI1394_LinkControlSet, OHCI1394_LinkControl_RcvSelfID 
|
- OHCI1394_LinkControl_RcvPhyPkt);
+   /* enable self-id */
+   reg_write(ohci, OHCI1394_LinkControlSet, 
OHCI1394_LinkControl_RcvSelfID);
 
/* Set the Config ROM mapping register */
reg_write(ohci, OHCI1394_ConfigROMmap, ohci-csr_config_rom_bus);
@@ -518,9 +517,6 @@ static void ohci_initialize(struct ti_ohci *ohci)
ohci-max_packet_size =
1(((reg_read(ohci, OHCI1394_BusOptions)12)0xf)+1);

-   /* Don't accept phy packets into AR request context */
-   reg_write(ohci, OHCI1394_LinkControlClear, 0x0400);
-
/* Clear the interrupt mask */
reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0x);
reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0x);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ieee1394: more help in Kconfig

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f94aa4d69bb9837857bac2755090a3cd28bfdc1
Commit: 3f94aa4d69bb9837857bac2755090a3cd28bfdc1
Parent: 749cf76620a8f0d1ab4ff83c8e8f18028045a094
Author: Stefan Richter [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 20:54:37 2007 +0200
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:33 2007 +0200

ieee1394: more help in Kconfig

  - s/Device Drivers/Controllers/
  - clarify who needs pcilynx
  - don't recommend Y for raw1394; M is typically used

Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/Kconfig |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index 5c0b522..f9c4abe 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -34,7 +34,7 @@ config IEEE1394_VERBOSEDEBUG
  Say Y if you really want or need the debugging output, everyone
  else says N.
 
-comment Device Drivers
+comment Controllers
depends on IEEE1394
 
 comment Texas Instruments PCILynx requires I2C
@@ -52,6 +52,10 @@ config IEEE1394_PCILYNX
  To compile this driver as a module, say M here: the
  module will be called pcilynx.
 
+ Only some old and now very rare PCI and CardBus cards and
+ PowerMacs G3 BW contain the PCILynx controller.  Therefore
+ almost everybody can say N here.
+
 config IEEE1394_OHCI1394
tristate OHCI-1394 support
depends on PCI  IEEE1394
@@ -65,7 +69,7 @@ config IEEE1394_OHCI1394
  To compile this driver as a module, say M here: the
  module will be called ohci1394.
 
-comment Protocol Drivers
+comment Protocols
depends on IEEE1394
 
 config IEEE1394_VIDEO1394
@@ -134,12 +138,12 @@ config IEEE1394_RAWIO
tristate Raw IEEE1394 I/O support
depends on IEEE1394
help
- Say Y here if you want support for the raw device. This is generally
- a good idea, so you should say Y here. The raw device enables
- direct communication of user programs with the IEEE 1394 bus and
- thus with the attached peripherals.
+ This option adds support for the raw1394 device file which enables
+ direct communication of user programs with the IEEE 1394 bus and thus
+ with the attached peripherals.  Almost all application programs which
+ access FireWire require this option.
 
- To compile this driver as a module, say M here: the
- module will be called raw1394.
+ To compile this driver as a module, say M here: the module will be
+ called raw1394.
 
 endmenu
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ieee1394: remove garbage from Kconfig

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bcfd09ee48f77a4fe903dbc3757e7af931998ce1
Commit: bcfd09ee48f77a4fe903dbc3757e7af931998ce1
Parent: 3f94aa4d69bb9837857bac2755090a3cd28bfdc1
Author: Stefan Richter [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 21:02:52 2007 +0200
Committer:  Stefan Richter [EMAIL PROTECTED]
CommitDate: Mon Apr 30 00:00:33 2007 +0200

ieee1394: remove garbage from Kconfig

Signed-off-by: Stefan Richter [EMAIL PROTECTED]
---
 drivers/ieee1394/Kconfig |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index f9c4abe..61d7809 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -1,5 +1,3 @@
-# -*- shell-script -*-
-
 menu IEEE 1394 (FireWire) support
 
 config IEEE1394
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


USB HID: consolidate vendor/product ids

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=48b4554aca28f721d3dfbab077c05032b3d1cd31
Commit: 48b4554aca28f721d3dfbab077c05032b3d1cd31
Parent: 6db3dfefa28739e7c9c60809c3a5aef7cc088b97
Author: Jiri Kosina [EMAIL PROTECTED]
AuthorDate: Tue Apr 3 23:39:37 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed Apr 11 10:36:02 2007 +0200

USB HID: consolidate vendor/product ids

The vendor/product IDs for the purposes of hid_blacklist got
scathered around the hid-core.c in a rather random way over the
time.

Move all the related definitions at the beginning of the file,
and make them sorted again. Sort also hid_blacklist properly.

Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/usbhid/hid-core.c |  821 -
 1 files changed, 410 insertions(+), 411 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 827a75a..7c0fc11 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -53,6 +53,416 @@ static unsigned int hid_mousepoll_interval;
 module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
 MODULE_PARM_DESC(mousepoll, Polling interval of mice);
 
+#define USB_VENDOR_ID_A4TECH   0x09da
+#define USB_DEVICE_ID_A4TECH_WCP32PU   0x0006
+
+#define USB_VENDOR_ID_AASHIMA  0x06d6
+#define USB_DEVICE_ID_AASHIMA_GAMEPAD  0x0025
+#define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026
+
+#define USB_VENDOR_ID_ACECAD   0x0460
+#define USB_DEVICE_ID_ACECAD_FLAIR 0x0004
+#define USB_DEVICE_ID_ACECAD_302   0x0008
+
+#define USB_VENDOR_ID_AIPTEK   0x08ca
+#define USB_DEVICE_ID_AIPTEK_010x0001
+#define USB_DEVICE_ID_AIPTEK_100x0010
+#define USB_DEVICE_ID_AIPTEK_200x0020
+#define USB_DEVICE_ID_AIPTEK_210x0021
+#define USB_DEVICE_ID_AIPTEK_220x0022
+#define USB_DEVICE_ID_AIPTEK_230x0023
+#define USB_DEVICE_ID_AIPTEK_240x0024
+
+#define USB_VENDOR_ID_AIRCABLE 0x16CA
+#define USB_DEVICE_ID_AIRCABLE10x1502
+
+#define USB_VENDOR_ID_ALCOR0x058f
+#define USB_DEVICE_ID_ALCOR_USBRS232   0x9720
+
+#define USB_VENDOR_ID_ALPS 0x0433
+#define USB_DEVICE_ID_IBM_GAMEPAD  0x1101
+
+#define USB_VENDOR_ID_APPLE0x05ac
+#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
+#define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
+#define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
+#define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
+#define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215
+#define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216
+#define USB_DEVICE_ID_APPLE_GEYSER3_ANSI   0x0217
+#define USB_DEVICE_ID_APPLE_GEYSER3_ISO0x0218
+#define USB_DEVICE_ID_APPLE_GEYSER3_JIS0x0219
+#define USB_DEVICE_ID_APPLE_GEYSER4_ANSI   0x021a
+#define USB_DEVICE_ID_APPLE_GEYSER4_ISO0x021b
+#define USB_DEVICE_ID_APPLE_GEYSER4_JIS0x021c
+#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY   0x030a
+#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY0x030b
+#define USB_DEVICE_ID_APPLE_IR 0x8240
+
+#define USB_VENDOR_ID_ATEN 0x0557
+#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
+#define USB_DEVICE_ID_ATEN_CS124U  0x2202
+#define USB_DEVICE_ID_ATEN_2PORTKVM0x2204
+#define USB_DEVICE_ID_ATEN_4PORTKVM0x2205
+#define USB_DEVICE_ID_ATEN_4PORTKVMC   0x2208
+
+#define USB_VENDOR_ID_BERKSHIRE0x0c98
+#define USB_DEVICE_ID_BERKSHIRE_PCWD   0x1140
+
+#define USB_VENDOR_ID_CHERRY   0x046a
+#define USB_DEVICE_ID_CHERRY_CYMOTION  0x0023
+
+#define USB_VENDOR_ID_CHIC 0x05fe
+#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014
+
+#define USB_VENDOR_ID_CIDC 0x1677
+
+#define USB_VENDOR_ID_CODEMERCS0x07c0
+#define USB_DEVICE_ID_CODEMERCS_IOW_FIRST  0x1500
+#define USB_DEVICE_ID_CODEMERCS_IOW_LAST   0x15ff
+
+#define USB_VENDOR_ID_CYPRESS  0x04b4
+#define USB_DEVICE_ID_CYPRESS_MOUSE0x0001
+#define USB_DEVICE_ID_CYPRESS_HIDCOM   0x5500
+#define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE   0x7417
+
+#define USB_VENDOR_ID_DELORME  0x1163
+#define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
+#define USB_DEVICE_ID_DELORME_EM_LT20  0x0200
+
+#define USB_VENDOR_ID_ESSENTIAL_REALITY0x0d7f
+#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
+
+#define USB_VENDOR_ID_GLAB 0x06c2
+#define USB_DEVICE_ID_4_PHIDGETSERVO_300x0038
+#define USB_DEVICE_ID_1_PHIDGETSERVO_300x0039
+#define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040
+#define USB_DEVICE_ID_0_16_16_IF_KIT   0x0044
+#define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045
+#define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051
+#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053
+#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058
+
+#define USB_VENDOR_ID_GRIFFIN  

[IPV4] UDP: Fix endianness bugs in hashing changes.

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b7b5f487ab39bc10ed0694af35651a03d9cb97ff
Commit: b7b5f487ab39bc10ed0694af35651a03d9cb97ff
Parent: 40caf5ea5a7d47f8a33e26b63ca81dea4b5109d2
Author: David S. Miller [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 13:35:29 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Apr 30 13:35:29 2007 -0700

[IPV4] UDP: Fix endianness bugs in hashing changes.

I accidently applied an earlier version of Eric Dumazet's patch, from
March 21st.  His version from March 30th didn't have these bugs, so
this just interdiffs to the correct patch.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/udp.c |   36 ++--
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1449707..db313d9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -270,10 +270,10 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, 
__be16 sport,
struct sock *sk, *result = NULL;
struct hlist_node *node;
unsigned int hash, hashwild;
-   int score, best = -1;
+   int score, best = -1, hport = ntohs(dport);
 
-   hash = hash_port_and_addr(ntohs(dport), daddr);
-   hashwild = hash_port_and_addr(ntohs(dport), 0);
+   hash = hash_port_and_addr(hport, daddr);
+   hashwild = hash_port_and_addr(hport, 0);
 
read_lock(udp_hash_lock);
 
@@ -283,7 +283,7 @@ lookup:
struct inet_sock *inet = inet_sk(sk);
 
if (sk-sk_hash != hash || ipv6_only_sock(sk) ||
-   inet-num != dport)
+   inet-num != hport)
continue;
 
score = (sk-sk_family == PF_INET ? 1 : 0);
@@ -327,11 +327,10 @@ found:
return result;
 }
 
-static inline struct sock *udp_v4_mcast_next(
-   struct sock *sk,
-   unsigned int hnum, __be16 loc_port, __be32 loc_addr,
-   __be16 rmt_port, __be32 rmt_addr,
-   int dif)
+static inline struct sock *udp_v4_mcast_next(struct sock *sk, unsigned int 
hnum,
+int hport, __be32 loc_addr,
+__be16 rmt_port, __be32 rmt_addr,
+int dif)
 {
struct hlist_node *node;
struct sock *s = sk;
@@ -340,7 +339,7 @@ static inline struct sock *udp_v4_mcast_next(
struct inet_sock *inet = inet_sk(s);
 
if (s-sk_hash != hnum  ||
-   inet-num != loc_port   ||
+   inet-num != hport  ||
(inet-daddr  inet-daddr != rmt_addr)||
(inet-dport != rmt_port  inet-dport)||
(inet-rcv_saddr  inet-rcv_saddr != loc_addr)||
@@ -1173,8 +1172,9 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
 {
struct sock *sk, *skw, *sknext;
int dif;
-   unsigned int hash = hash_port_and_addr(ntohs(uh-dest), daddr);
-   unsigned int hashwild = hash_port_and_addr(ntohs(uh-dest), 0);
+   int hport = ntohs(uh-dest);
+   unsigned int hash = hash_port_and_addr(hport, daddr);
+   unsigned int hashwild = hash_port_and_addr(hport, 0);
 
dif = skb-dev-ifindex;
 
@@ -1183,20 +1183,20 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
sk = sk_head(udptable[hash  (UDP_HTABLE_SIZE - 1)]);
skw = sk_head(udptable[hashwild  (UDP_HTABLE_SIZE - 1)]);
 
-   sk = udp_v4_mcast_next(sk, hash, uh-dest, daddr, uh-source, saddr, 
dif);
+   sk = udp_v4_mcast_next(sk, hash, hport, daddr, uh-source, saddr, dif);
if (!sk) {
hash = hashwild;
-   sk = udp_v4_mcast_next(skw, hash, uh-dest, daddr, uh-source,
+   sk = udp_v4_mcast_next(skw, hash, hport, daddr, uh-source,
saddr, dif);
}
if (sk) {
do {
struct sk_buff *skb1 = skb;
-   sknext = udp_v4_mcast_next(sk_next(sk), hash, uh-dest,
-   daddr, uh-source, saddr, dif);
+   sknext = udp_v4_mcast_next(sk_next(sk), hash, hport,
+   daddr, uh-source, saddr, dif);
if (!sknext  hash != hashwild) {
hash = hashwild;
-   sknext = udp_v4_mcast_next(skw, hash, uh-dest,
+   sknext = udp_v4_mcast_next(skw, hash, hport,
daddr, uh-source, saddr, dif);
}
if (sknext)
@@ -1295,7 +1295,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, 

[UDP]: Do not allow specific bind when wildcard bind exists.

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=de34ed91c4ffa4727964a832c46e624dd1495cf5
Commit: de34ed91c4ffa4727964a832c46e624dd1495cf5
Parent: b7b5f487ab39bc10ed0694af35651a03d9cb97ff
Author: David S. Miller [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 14:51:58 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Apr 30 14:51:58 2007 -0700

[UDP]: Do not allow specific bind when wildcard bind exists.

When allocating local ports, do not allow a bind to a port
with a specific local address when a bind to that port with
a wildcard local address already exists.

Noticed by Linus.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/udp.c |   41 +
 1 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index db313d9..113e0c4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -203,6 +203,13 @@ int __udp_lib_get_port(struct sock *sk, unsigned short 
snum,
result = sysctl_local_port_range[0]
+ ((result - 
sysctl_local_port_range[0]) 
   (UDP_HTABLE_SIZE - 1));
+   hash = hash_port_and_addr(result, 0);
+   if (__udp_lib_port_inuse(hash, result,
+0, udptable))
+   continue;
+   if (!inet_sk(sk)-rcv_saddr)
+   break;
+
hash = hash_port_and_addr(result,
inet_sk(sk)-rcv_saddr);
if (! __udp_lib_port_inuse(hash, result,
@@ -214,18 +221,36 @@ int __udp_lib_get_port(struct sock *sk, unsigned short 
snum,
 gotit:
*port_rover = snum = result;
} else {
-   hash = hash_port_and_addr(snum, inet_sk(sk)-rcv_saddr);
+   hash = hash_port_and_addr(snum, 0);
head = udptable[hash  (UDP_HTABLE_SIZE - 1)];
 
sk_for_each(sk2, node, head)
-   if (sk2-sk_hash == hash 
-   sk2 != sk
-   inet_sk(sk2)-num == snum
-   (!sk2-sk_reuse|| !sk-sk_reuse) 
-   (!sk2-sk_bound_dev_if || !sk-sk_bound_dev_if
-|| sk2-sk_bound_dev_if == sk-sk_bound_dev_if) 
-   (*saddr_comp)(sk, sk2) )
+   if (sk2-sk_hash == hash 
+   sk2 != sk 
+   inet_sk(sk2)-num == snum 
+   (!sk2-sk_reuse || !sk-sk_reuse) 
+   (!sk2-sk_bound_dev_if || !sk-sk_bound_dev_if ||
+sk2-sk_bound_dev_if == sk-sk_bound_dev_if) 
+   (*saddr_comp)(sk, sk2))
goto fail;
+
+   if (inet_sk(sk)-rcv_saddr) {
+   hash = hash_port_and_addr(snum,
+ inet_sk(sk)-rcv_saddr);
+   head = udptable[hash  (UDP_HTABLE_SIZE - 1)];
+
+   sk_for_each(sk2, node, head)
+   if (sk2-sk_hash == hash 
+   sk2 != sk 
+   inet_sk(sk2)-num == snum 
+   (!sk2-sk_reuse || !sk-sk_reuse) 
+   (!sk2-sk_bound_dev_if ||
+!sk-sk_bound_dev_if ||
+sk2-sk_bound_dev_if ==
+sk-sk_bound_dev_if) 
+   (*saddr_comp)(sk, sk2))
+   goto fail;
+   }
}
inet_sk(sk)-num = snum;
sk-sk_hash = hash;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Extend print_symbol capability

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=42e380832a6911c8a3173ee0172fbc0e4864d80b
Commit: 42e380832a6911c8a3173ee0172fbc0e4864d80b
Parent: de34ed91c4ffa4727964a832c46e624dd1495cf5
Author: Robert Peterson [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:48 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:39 2007 -0700

Extend print_symbol capability

Today's print_symbol function dumps a kernel symbol with printk.  This
patch extends the functionality of kallsyms.c so that the symbol lookup
function may be used without the printk.  This is useful for modules that
want to dump symbols elsewhere, for example, to debugfs.  I intend to use
the new function call in the GFS2 file system (which will be a separate
patch).

[EMAIL PROTECTED]: build fix]
[EMAIL PROTECTED]: sprint_symbol should return length of string like 
sprintf]
Signed-off-by: Robert Peterson [EMAIL PROTECTED]
Cc: Rusty Russell [EMAIL PROTECTED]
Cc: Roman Zippel [EMAIL PROTECTED]
Cc: Randy.Dunlap [EMAIL PROTECTED]
Cc: Sam Ravnborg [EMAIL PROTECTED]
Acked-by: Paulo Marques [EMAIL PROTECTED]
Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/kallsyms.h |   13 -
 kernel/kallsyms.c|   23 +++
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 1cebcbc..3e3b92d 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -7,6 +7,8 @@
 
 
 #define KSYM_NAME_LEN 127
+#define KSYM_SYMBOL_LEN (sizeof(%s+%#lx/%#lx [%s]) + KSYM_NAME_LEN + \
+2*(BITS_PER_LONG*3/10) + MODULE_NAME_LEN + 1)
 
 #ifdef CONFIG_KALLSYMS
 /* Lookup the address for a symbol. Returns 0 if not found. */
@@ -22,7 +24,10 @@ const char *kallsyms_lookup(unsigned long addr,
unsigned long *offset,
char **modname, char *namebuf);
 
-/* Replace %s in format with address, if found */
+/* Look up a kernel symbol and return it in a text buffer. */
+extern int sprint_symbol(char *buffer, unsigned long address);
+
+/* Look up a kernel symbol and print it to the kernel messages. */
 extern void __print_symbol(const char *fmt, unsigned long address);
 
 #else /* !CONFIG_KALLSYMS */
@@ -47,6 +52,12 @@ static inline const char *kallsyms_lookup(unsigned long addr,
return NULL;
 }
 
+static inline int sprint_symbol(char *buffer, unsigned long addr)
+{
+   *buffer = '\0';
+   return 0;
+}
+
 /* Stupid that this does nothing, but I didn't create this mess. */
 #define __print_symbol(fmt, addr)
 #endif /*CONFIG_KALLSYMS*/
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 6f294ff..5a0de84 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -267,27 +267,33 @@ const char *kallsyms_lookup(unsigned long addr,
return NULL;
 }
 
-/* Replace %s in format with address, or returns -errno. */
-void __print_symbol(const char *fmt, unsigned long address)
+/* Look up a kernel symbol and return it in a text buffer. */
+int sprint_symbol(char *buffer, unsigned long address)
 {
char *modname;
const char *name;
unsigned long offset, size;
char namebuf[KSYM_NAME_LEN+1];
-   char buffer[sizeof(%s+%#lx/%#lx [%s]) + KSYM_NAME_LEN +
-   2*(BITS_PER_LONG*3/10) + MODULE_NAME_LEN + 1];
 
name = kallsyms_lookup(address, size, offset, modname, namebuf);
-
if (!name)
-   sprintf(buffer, 0x%lx, address);
+   return sprintf(buffer, 0x%lx, address);
else {
if (modname)
-   sprintf(buffer, %s+%#lx/%#lx [%s], name, offset,
+   return sprintf(buffer, %s+%#lx/%#lx [%s], name, 
offset,
size, modname);
else
-   sprintf(buffer, %s+%#lx/%#lx, name, offset, size);
+   return sprintf(buffer, %s+%#lx/%#lx, name, offset, 
size);
}
+}
+
+/* Look up a kernel symbol and print it to the kernel messages. */
+void __print_symbol(const char *fmt, unsigned long address)
+{
+   char buffer[KSYM_SYMBOL_LEN];
+
+   sprint_symbol(buffer, address);
+
printk(fmt, buffer);
 }
 
@@ -452,3 +458,4 @@ static int __init kallsyms_init(void)
 __initcall(kallsyms_init);
 
 EXPORT_SYMBOL(__print_symbol);
+EXPORT_SYMBOL_GPL(sprint_symbol);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


reiserfs: suppress lockdep warning

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1173a729fc3ce2fa0d698bd39be8ff7bf6c70bf1
Commit: 1173a729fc3ce2fa0d698bd39be8ff7bf6c70bf1
Parent: 42e380832a6911c8a3173ee0172fbc0e4864d80b
Author: Jeff Mahoney [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:50 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

reiserfs: suppress lockdep warning

We're getting lockdep warnings due to a post-2.6.21-rc7 bugfix.

The xattr_sem can never be taken in the manner described. Internal inodes
are protected by I_PRIVATE.  Add the appropriate annotation.

Cc: [EMAIL PROTECTED]
Cc: Antonino A. Daplas [EMAIL PROTECTED]
Cc: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/reiserfs/xattr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index c8178b7..2cac562 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -68,7 +68,7 @@ static struct dentry *get_xa_root(struct super_block *sb, int 
flags)
if (!privroot)
return ERR_PTR(-ENODATA);
 
-   mutex_lock(privroot-d_inode-i_mutex);
+   mutex_lock_nested(privroot-d_inode-i_mutex, I_MUTEX_XATTR);
if (REISERFS_SB(sb)-xattr_root) {
xaroot = dget(REISERFS_SB(sb)-xattr_root);
goto out;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rework pm_ops pm_disk_mode, kill misuse

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fe0c935a6cbf25d72a27c7a345df8a2151de0b74
Commit: fe0c935a6cbf25d72a27c7a345df8a2151de0b74
Parent: 1173a729fc3ce2fa0d698bd39be8ff7bf6c70bf1
Author: Johannes Berg [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:51 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

rework pm_ops pm_disk_mode, kill misuse

This patch series cleans up some misconceptions about pm_ops.  Some users of
the pm_ops structure attempt to use it to stop the user from entering 
suspend
to disk, this, however, is not possible since the user can always use
shutdown in /sys/power/disk and then the pm_ops are never invoked.  Also,
platforms that don't support suspend to disk simply should not allow
configuring SOFTWARE_SUSPEND (read the help text on it, it only selects
suspend to disk and nothing else, all the other stuff depends on PM).

The pm_ops structure is actually intended to provide a way to enter
platform-defined sleep states (currently supported states are standby and
mem (suspend to ram)) and additionally (if SOFTWARE_SUSPEND is configured)
allows a platform to support a platform specific way to enter low-power mode
once everything has been saved to disk.  This is currently only used by ACPI
(S4).

This patch:

The pm_ops.pm_disk_mode is used in totally bogus ways since nobody really
seems to understand what it actually does.

This patch clarifies the pm_disk_mode description.

It also removes all the arm and sh users that think they can veto suspend to
disk via pm_ops; not so since the user can always do echo shutdown 
/sys/power/disk, they need to find a better way involving Kconfig or such.

ACPI is the only user left with a non-zero pm_disk_mode.

The patch also sets the default mode to shutdown again, but when a new 
pm_ops
is registered its pm_disk_mode is selected as default, that way the default
stays for ACPI where it is apparently required.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Acked-by: Pavel Machek [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Len Brown [EMAIL PROTECTED]
Acked-by: Russell King [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Cc: Rafael J. Wysocki [EMAIL PROTECTED]
Acked-by: Paul Mundt [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/arm/common/sharpsl_pm.c |1 -
 arch/arm/mach-at91/pm.c  |1 -
 arch/arm/mach-omap1/pm.c |1 -
 arch/arm/mach-omap2/pm.c |1 -
 arch/arm/mach-pxa/pm.c   |4 ---
 arch/arm/mach-sa1100/pm.c|7 -
 arch/arm/plat-s3c24xx/pm.c   |9 --
 arch/sh/boards/hp6xx/pm.c|7 -
 include/linux/pm.h   |   23 ---
 kernel/power/disk.c  |   60 +++--
 kernel/power/main.c  |6 +++-
 11 files changed, 56 insertions(+), 64 deletions(-)

diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index a9bc5b5..4cb895d 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -766,7 +766,6 @@ static void sharpsl_apm_get_power_status(struct 
apm_power_info *info)
 }
 
 static struct pm_ops sharpsl_pm_ops = {
-   .pm_disk_mode   = PM_DISK_FIRMWARE,
.prepare= pxa_pm_prepare,
.enter  = corgi_pxa_pm_enter,
.finish = pxa_pm_finish,
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index b49bfda..ff8db29 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -201,7 +201,6 @@ error:
 
 
 static struct pm_ops at91_pm_ops ={
-   .pm_disk_mode   = 0,
.valid  = at91_pm_valid_state,
.prepare= at91_pm_prepare,
.enter  = at91_pm_enter,
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 49efe90..4248117 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -698,7 +698,6 @@ static struct irqaction omap_wakeup_irq = {
 
 
 static struct pm_ops omap_pm_ops ={
-   .pm_disk_mode   = 0,
.prepare= omap_pm_prepare,
.enter  = omap_pm_enter,
.finish = omap_pm_finish,
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index d7eee99..3e9a128 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -370,7 +370,6 @@ static int omap2_pm_finish(suspend_state_t state)
 }
 
 static struct pm_ops omap_pm_ops = {
-   .pm_disk_mode   = 0,
.prepare= omap2_pm_prepare,
.enter  = omap2_pm_enter,
.finish = omap2_pm_finish,
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index b4d8276..0a99ef4 100644
--- 

power management: remove firmware disk mode

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11d77d0c01b80e44c7aceb21928508dafce774f9
Commit: 11d77d0c01b80e44c7aceb21928508dafce774f9
Parent: fe0c935a6cbf25d72a27c7a345df8a2151de0b74
Author: Johannes Berg [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:53 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

power management: remove firmware disk mode

This patch removes the firmware disk suspend mode which is the wrong 
approach,
it is supposed to be used for implementing firmware-based disk suspend but
cannot actually be used for that.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Acked-by: Pavel Machek [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Cc: Len Brown [EMAIL PROTECTED]
Acked-by: Russell King [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Cc: Rafael J. Wysocki [EMAIL PROTECTED]
Cc: Paul Mundt [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 Documentation/power/interface.txt |   21 +
 Documentation/power/states.txt|   13 +++--
 Documentation/power/swsusp.txt|   14 +-
 include/linux/pm.h|   13 ++---
 kernel/power/disk.c   |   27 +++
 5 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/Documentation/power/interface.txt 
b/Documentation/power/interface.txt
index 74311d7..8c5b41b 100644
--- a/Documentation/power/interface.txt
+++ b/Documentation/power/interface.txt
@@ -18,17 +18,10 @@ states.
 
 
 /sys/power/disk controls the operating mode of the suspend-to-disk
-mechanism. Suspend-to-disk can be handled in several ways. The
-greatest distinction is who writes memory to disk - the firmware or
-the kernel. If the firmware does it, we assume that it also handles
-suspending the system. 
-
-If the kernel does it, then we have three options for putting the system
-to sleep - using the platform driver (e.g. ACPI or other PM
-registers), powering off the system or rebooting the system (for
-testing). The system will support either 'firmware' or 'platform', and
-that is known a priori. But, the user may choose 'shutdown' or
-'reboot' as alternatives. 
+mechanism. Suspend-to-disk can be handled in several ways. We have a
+few options for putting the system to sleep - using the platform driver
+(e.g. ACPI or other pm_ops), powering off the system or rebooting the
+system (for testing).
 
 Additionally, /sys/power/disk can be used to turn on one of the two testing
 modes of the suspend-to-disk mechanism: 'testproc' or 'test'.  If the
@@ -44,16 +37,12 @@ is being slow and which device drivers are misbehaving.
 Reading from this file will display what the mode is currently set
 to. Writing to this file will accept one of
 
-   'firmware'
-   'platform'
+   'platform' (only if the platform supports it)
'shutdown'
'reboot'
'testproc'
'test'
 
-It will only change to 'firmware' or 'platform' if the system supports
-it. 
-
 /sys/power/image_size controls the size of the image created by
 the suspend-to-disk mechanism.  It can be written a string
 representing a non-negative integer that will be used as an upper
diff --git a/Documentation/power/states.txt b/Documentation/power/states.txt
index 0931a33..34800cc 100644
--- a/Documentation/power/states.txt
+++ b/Documentation/power/states.txt
@@ -62,17 +62,18 @@ setup via another operating system for it to use. Despite 
the
 inconvenience, this method requires minimal work by the kernel, since
 the firmware will also handle restoring memory contents on resume. 
 
-If the kernel is responsible for persistently saving state, a mechanism
-called 'swsusp' (Swap Suspend) is used to write memory contents to
-free swap space. swsusp has some restrictive requirements, but should
-work in most cases. Some, albeit outdated, documentation can be found
-in Documentation/power/swsusp.txt. 
+For suspend-to-disk, a mechanism called swsusp called 'swsusp' (Swap
+Suspend) is used to write memory contents to free swap space.
+swsusp has some restrictive requirements, but should work in most
+cases. Some, albeit outdated, documentation can be found in
+Documentation/power/swsusp.txt. Alternatively, userspace can do most
+of the actual suspend to disk work, see userland-swsusp.txt.
 
 Once memory state is written to disk, the system may either enter a
 low-power state (like ACPI S4), or it may simply power down. Powering
 down offers greater savings, and allows this mechanism to work on any
 system. However, entering a real low-power state allows the user to
-trigger wake up events (e.g. pressing a key or opening a laptop lid). 
+trigger wake up events (e.g. pressing a key or opening a laptop lid).
 
 A transition from Suspend-to-Disk to the On state 

power management: implement pm_ops.valid for everybody

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e8c9c502690efd24b7055bf608e7a3c34216848b
Commit: e8c9c502690efd24b7055bf608e7a3c34216848b
Parent: 11d77d0c01b80e44c7aceb21928508dafce774f9
Author: Johannes Berg [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:54 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

power management: implement pm_ops.valid for everybody

Almost all users of pm_ops only support mem sleep, don't check in .valid and
don't reject any others in .prepare so users can be confused if they check
/sys/power/state, especially when new states are added (these would then
result in s-t-r although they're supposed to be something different).

This patch implements a generic pm_valid_only_mem function that is then
exported for users and puts it to use in almost all existing pm_ops.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Acked-by: Pavel Machek [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Len Brown [EMAIL PROTECTED]
Acked-by: Russell King [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Cc: Rafael J. Wysocki [EMAIL PROTECTED]
Cc: Paul Mundt [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/arm/common/sharpsl_pm.c |1 +
 arch/arm/mach-omap1/pm.c |1 +
 arch/arm/mach-omap2/pm.c |1 +
 arch/arm/mach-pnx4008/pm.c   |   39 ---
 arch/arm/mach-pxa/pm.c   |1 +
 arch/arm/mach-sa1100/pm.c|1 +
 arch/arm/plat-s3c24xx/pm.c   |   19 +--
 arch/sh/boards/hp6xx/pm.c|1 +
 drivers/acpi/sleep/main.c|   13 +++--
 include/linux/pm.h   |4 
 kernel/power/main.c  |   13 +
 11 files changed, 39 insertions(+), 55 deletions(-)

diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 4cb895d..5972df2 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -769,6 +769,7 @@ static struct pm_ops sharpsl_pm_ops = {
.prepare= pxa_pm_prepare,
.enter  = corgi_pxa_pm_enter,
.finish = pxa_pm_finish,
+   .valid  = pm_valid_only_mem,
 };
 
 static int __init sharpsl_pm_probe(struct platform_device *pdev)
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 4248117..0383ab3 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -701,6 +701,7 @@ static struct pm_ops omap_pm_ops ={
.prepare= omap_pm_prepare,
.enter  = omap_pm_enter,
.finish = omap_pm_finish,
+   .valid  = pm_valid_only_mem,
 };
 
 static int __init omap_pm_init(void)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 3e9a128..6f4a543 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -373,6 +373,7 @@ static struct pm_ops omap_pm_ops = {
.prepare= omap2_pm_prepare,
.enter  = omap2_pm_enter,
.finish = omap2_pm_finish,
+   .valid  = pm_valid_only_mem,
 };
 
 int __init omap2_pm_init(void)
diff --git a/arch/arm/mach-pnx4008/pm.c b/arch/arm/mach-pnx4008/pm.c
index 3649cd3..2a137f3 100644
--- a/arch/arm/mach-pnx4008/pm.c
+++ b/arch/arm/mach-pnx4008/pm.c
@@ -107,50 +107,19 @@ static int pnx4008_pm_enter(suspend_state_t state)
case PM_SUSPEND_MEM:
pnx4008_suspend();
break;
-   case PM_SUSPEND_DISK:
-   return -ENOTSUPP;
-   default:
-   return -EINVAL;
}
return 0;
 }
 
-/*
- * Called after processes are frozen, but before we shut down devices.
- */
-static int pnx4008_pm_prepare(suspend_state_t state)
-{
-   switch (state) {
-   case PM_SUSPEND_STANDBY:
-   case PM_SUSPEND_MEM:
-   break;
-
-   case PM_SUSPEND_DISK:
-   return -ENOTSUPP;
-   break;
-
-   default:
-   return -EINVAL;
-   break;
-   }
-   return 0;
-}
-
-/*
- * Called after devices are re-setup, but before processes are thawed.
- */
-static int pnx4008_pm_finish(suspend_state_t state)
+static int pnx4008_pm_valid(suspend_state_t state)
 {
-   return 0;
+   return (state == PM_SUSPEND_STANDBY) ||
+  (state == PM_SUSPEND_MEM);
 }
 
-/*
- * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
- */
 static struct pm_ops pnx4008_pm_ops = {
-   .prepare = pnx4008_pm_prepare,
.enter = pnx4008_pm_enter,
-   .finish = pnx4008_pm_finish,
+   .valid = pnx4008_pm_valid,
 };
 
 static int __init pnx4008_pm_init(void)
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 0a99ef4..6bf15ae 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ 

power management: force pm_ops.valid callback to be assigned

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9684e51cd157607f0727c1550e7df6e31de40808
Commit: 9684e51cd157607f0727c1550e7df6e31de40808
Parent: e8c9c502690efd24b7055bf608e7a3c34216848b
Author: Johannes Berg [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:55 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

power management: force pm_ops.valid callback to be assigned

This patch changes the docs and behaviour from all states valid to no
states valid if no .valid callback is assigned.  Users of pm_ops that only
need mem sleep can assign pm_valid_only_mem without any overhead, others
will require more elaborate callbacks.

Now that all users of pm_ops have a .valid callback this is a safe thing to
do and prevents things from getting messy again as they were before.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Acked-by: Pavel Machek [EMAIL PROTECTED]
Looks-okay-to: Rafael J. Wysocki [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/pm.h  |   12 ++--
 kernel/power/main.c |4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 6035209..7a51669 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -125,12 +125,12 @@ typedef int __bitwise suspend_disk_method_t;
  * struct pm_ops - Callbacks for managing platform dependent suspend states.
  * @valid: Callback to determine whether the given state can be entered.
  * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is
- * always valid and never passed to this call.
- * If not assigned, all suspend states are advertised as valid
- * in /sys/power/state (but can still be rejected by prepare or enter.)
- * Since new states can be added for other platforms, you should
- * assign this callback. There is a %pm_valid_only_mem function
- * available if you only implemented mem sleep.
+ * always valid and never passed to this call. If not assigned,
+ * no suspend states are valid.
+ * Valid states are advertised in /sys/power/state but can still
+ * be rejected by prepare or enter if the conditions aren't right.
+ * There is a %pm_valid_only_mem function available that can be assigned
+ * to this if you only implement mem sleep.
  *
  * @prepare: Prepare the platform for the given suspend state. Can return a
  * negative error code if necessary.
diff --git a/kernel/power/main.c b/kernel/power/main.c
index f94f4e2..72419a3 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -198,8 +198,8 @@ static inline int valid_state(suspend_state_t state)
 
/* all other states need lowlevel support and need to be
 * valid to the lowlevel implementation, no valid callback
-* implies that all are valid. */
-   if (!pm_ops || (pm_ops-valid  !pm_ops-valid(state)))
+* implies that none are valid. */
+   if (!pm_ops || !pm_ops-valid || !pm_ops-valid(state))
return 0;
return 1;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Add kvasprintf()

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11443ec7d9286dd25663516436a14edfb5f43857
Commit: 11443ec7d9286dd25663516436a14edfb5f43857
Parent: 9684e51cd157607f0727c1550e7df6e31de40808
Author: Jeremy Fitzhardinge [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:56 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:40 2007 -0700

Add kvasprintf()

Add a kvasprintf() function to complement kasprintf().

No in-tree users yet, but I have some coming up.

[EMAIL PROTECTED]: EXPORT it]
Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Keir Fraser [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/kernel.h |1 +
 lib/vsprintf.c |   26 +++---
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9ddf25c..e2f41b0 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -121,6 +121,7 @@ extern int vscnprintf(char *buf, size_t size, const char 
*fmt, va_list args)
__attribute__ ((format (printf, 3, 0)));
 extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
+extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
 
 extern int sscanf(const char *, const char *, ...)
__attribute__ ((format (scanf, 2, 3)));
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b025864..cbab1df 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -851,23 +851,35 @@ EXPORT_SYMBOL(sscanf);
 
 
 /* Simplified asprintf. */
-char *kasprintf(gfp_t gfp, const char *fmt, ...)
+char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
 {
-   va_list ap;
unsigned int len;
char *p;
+   va_list aq;
 
-   va_start(ap, fmt);
-   len = vsnprintf(NULL, 0, fmt, ap);
-   va_end(ap);
+   va_copy(aq, ap);
+   len = vsnprintf(NULL, 0, fmt, aq);
+   va_end(aq);
 
p = kmalloc(len+1, gfp);
if (!p)
return NULL;
-   va_start(ap, fmt);
+
vsnprintf(p, len+1, fmt, ap);
-   va_end(ap);
+
return p;
 }
+EXPORT_SYMBOL(kvasprintf);
+
+char *kasprintf(gfp_t gfp, const char *fmt, ...)
+{
+   va_list ap;
+   char *p;
 
+   va_start(ap, fmt);
+   p = kvasprintf(gfp, fmt, ap);
+   va_end(ap);
+
+   return p;
+}
 EXPORT_SYMBOL(kasprintf);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pm: include EIO from errno-base.h

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=14e38ac823b7b25e3f4e563c182f93fde78167d6
Commit: 14e38ac823b7b25e3f4e563c182f93fde78167d6
Parent: 11443ec7d9286dd25663516436a14edfb5f43857
Author: David Rientjes [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 15:09:56 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 16:40:41 2007 -0700

pm: include EIO from errno-base.h

For backwards compatibility, call_platform_enable_wakeup() can return 0
instead of -EIO since we aren't guaranteed to have errno defined.

Cc: David Brownell [EMAIL PROTECTED]
Signed-off-by: David Rientjes [EMAIL PROTECTED]
Cc: Randy.Dunlap [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/pm.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 7a51669..6e8fa30 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -332,7 +332,7 @@ static inline void dpm_runtime_resume(struct device * dev)
 
 static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
 {
-   return -EIO;
+   return 0;
 }
 
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: honour host controllers that want just one host

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dc87c3985e9b442c60994308a96f887579addc39
Commit: dc87c3985e9b442c60994308a96f887579addc39
Parent: 14e38ac823b7b25e3f4e563c182f93fde78167d6
Author: Linus Torvalds [EMAIL PROTECTED]
AuthorDate: Mon Apr 30 17:43:48 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Apr 30 17:43:48 2007 -0700

libata: honour host controllers that want just one host

The Marvell IDE interface on my machine would hit a BUG_ON() in
lib/iomem.c because it was calling ata_pci_init_one() specifying just a
single port on the host, but that would actually end up trying to
initialize two ports, the second one with bogus information.

This fixes ata_pci_init_one() so that it actually passes down the
n_ports variable that it got from the low-level driver to the host
allocation routine (ata_host_alloc_pinfo()), which results in the ATA
layer actually having the correct port number information.

And in order to make it all work, I also needed to fix a few places that
had incorrectly hard-coded the fact that a host always had exactly two
ports (both ata_pci_init_bmdma() and ata_request_legacy_irqs() would
just always iterate over both ports).

Acked-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/ata/libata-sff.c |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 8af18ad..d211db6 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -566,7 +566,7 @@ static int ata_pci_init_bmdma(struct ata_host *host)
}
host-iomap = pcim_iomap_table(pdev);
 
-   for (i = 0; i  2; i++) {
+   for (i = 0; i  host-n_ports; i++) {
struct ata_port *ap = host-ports[i];
void __iomem *bmdma = host-iomap[4] + 8 * i;
 
@@ -875,7 +875,7 @@ static int ata_request_legacy_irqs(struct ata_host *host,
legacy_dr = devres_find(host-dev, ata_legacy_release, NULL, NULL);
BUG_ON(!legacy_dr);
 
-   for (i = 0; i  2; i++) {
+   for (i = 0; i  host-n_ports; i++) {
unsigned int irq;
 
/* FIXME: ATA_*_IRQ() should take generic device not pci_dev */
@@ -963,10 +963,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct 
ata_port_info **port_info,
BUG_ON(n_ports  1 || n_ports  2);
 
port[0] = port_info[0];
-   if (n_ports  1)
-   port[1] = port_info[1];
-   else
-   port[1] = port[0];
+   port[1] = (n_ports  1) ? port_info[1] : NULL;
 
/* FIXME: Really for ATA it isn't safe because the device may be
   multi-purpose and we want to leave it alone if it was already
@@ -1001,7 +998,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct 
ata_port_info **port_info,
}
 
/* alloc and init host */
-   host = ata_host_alloc_pinfo(dev, port, 2);
+   host = ata_host_alloc_pinfo(dev, port, n_ports);
if (!host) {
dev_printk(KERN_ERR, pdev-dev,
   failed to allocate ATA host\n);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: add camera enable/disable parameter, better handle possible infinite loop

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5f3d2898d79520bc8d8706ed3859060f9cbb969e
Commit: 5f3d2898d79520bc8d8706ed3859060f9cbb969e
Parent: 7b153f366867a3b70daeaf3c6074e4a0594057a7
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:18:45 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:05:48 2007 -0400

sony-laptop: add camera enable/disable parameter, better handle possible 
infinite loop

Use a parameter to enable/disable motion eye camera (for C1VE/C1VN models)
controls and avoid entering an infinite loop if the camera is not present
and the HW doesn't answer as we expect on io commands.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   51 +++-
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 8cc0411..09e7539 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -107,6 +107,12 @@ module_param(mask, ulong, 0644);
 MODULE_PARM_DESC(mask,
 set this to the mask of event you want to enable (see doc));
 
+static int camera; /* = 0 */
+module_param(camera, int, 0444);
+MODULE_PARM_DESC(camera,
+set this to 1 to enable Motion Eye camera controls 
+(only use it if you have a C1VE or C1VN model));
+
 #ifdef CONFIG_SONY_LAPTOP_OLD
 static int minor = -1;
 module_param(minor, int, 0);
@@ -1226,29 +1232,39 @@ static int sony_pic_camera_ready(void)
return (v != 0xff  (v  SONYPI_CAMERA_STATUS_READY));
 }
 
-static void sony_pic_camera_off(void)
+static int sony_pic_camera_off(void)
 {
+   if (!camera) {
+   printk(KERN_WARNING DRV_PFX camera control not enabled\n);
+   return -ENODEV;
+   }
+
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
SONYPI_CAMERA_MUTE_MASK),
ITERATIONS_SHORT);
 
-   if (!spic_dev.camera_power)
-   return;
-
-   sony_pic_call2(0x91, 0);
-   spic_dev.camera_power = 0;
+   if (spic_dev.camera_power) {
+   sony_pic_call2(0x91, 0);
+   spic_dev.camera_power = 0;
+   }
+   return 0;
 }
 
-static void sony_pic_camera_on(void)
+static int sony_pic_camera_on(void)
 {
-   int i, j;
+   int i, j, x;
+
+   if (!camera) {
+   printk(KERN_WARNING DRV_PFX camera control not enabled\n);
+   return -ENODEV;
+   }
 
if (spic_dev.camera_power)
-   return;
+   return 0;
 
for (j = 5; j  0; j--) {
 
-   while (sony_pic_call2(0x91, 0x1))
+   for (x = 0; x  100  sony_pic_call2(0x91, 0x1); x++)
msleep(10);
sony_pic_call1(0x93);
 
@@ -1262,8 +1278,8 @@ static void sony_pic_camera_on(void)
}
 
if (j == 0) {
-   printk(KERN_WARNING sonypi: failed to power on camera\n);
-   return;
+   printk(KERN_WARNING DRV_PFX failed to power on camera\n);
+   return -ENODEV;
}
 
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1271,6 +1287,7 @@ static void sony_pic_camera_on(void)
ITERATIONS_SHORT);
 
spic_dev.camera_power = 1;
+   return 0;
 }
 
 static ssize_t sony_pic_camerapower_store(struct device *dev,
@@ -1278,14 +1295,18 @@ static ssize_t sony_pic_camerapower_store(struct device 
*dev,
const char *buffer, size_t count)
 {
unsigned long value;
+   int result;
if (count  31)
return -EINVAL;
 
value = simple_strtoul(buffer, NULL, 10);
if (value)
-   sony_pic_camera_on();
+   result = sony_pic_camera_on();
else
-   sony_pic_camera_off();
+   result = sony_pic_camera_off();
+
+   if (result)
+   return result;
 
return count;
 }
@@ -1662,7 +1683,7 @@ static int sonypi_compat_init(void)
goto err_free_kfifo;
}
if (minor == -1)
-   printk(KERN_INFO sonypi: device allocated minor is %d\n,
+   printk(KERN_INFO DRV_PFX device allocated minor is %d\n,
   sonypi_misc_device.minor);
 
return 0;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: add edge modem support (also called WWAN)

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9476cdfae61a3c3fa61d06c18dd002b03671ca9f
Commit: 9476cdfae61a3c3fa61d06c18dd002b03671ca9f
Parent: 9f9f0761712928768198278c6cbc5cafe5502d38
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:21:42 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:05:55 2007 -0400

sony-laptop: add edge modem support (also called WWAN)

Some SZ Vaios have a gsm built-in modem. Allow powering on/off this device.
Thanks to Joshua Wise for the base code.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   41 +
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 5641343..141284d 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -923,6 +923,7 @@ struct sony_pic_dev {
int model;
u8  camera_power;
u8  bluetooth_power;
+   u8  wwan_power;
struct acpi_device  *acpi_dev;
struct sony_pic_irq *cur_irq;
struct sony_pic_ioport  *cur_ioport;
@@ -1330,6 +1331,44 @@ static ssize_t sony_pic_camerapower_show(struct device 
*dev,
return count;
 }
 
+/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
+static void sony_pic_set_wwanpower(u8 state)
+{
+   state = !!state;
+   mutex_lock(spic_dev.lock);
+   if (spic_dev.wwan_power == state) {
+   mutex_unlock(spic_dev.lock);
+   return;
+   }
+   sony_pic_call2(0xB0, state);
+   spic_dev.wwan_power = state;
+   mutex_unlock(spic_dev.lock);
+}
+
+static ssize_t sony_pic_wwanpower_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buffer, size_t count)
+{
+   unsigned long value;
+   if (count  31)
+   return -EINVAL;
+
+   value = simple_strtoul(buffer, NULL, 10);
+   sony_pic_set_wwanpower(value);
+
+   return count;
+}
+
+static ssize_t sony_pic_wwanpower_show(struct device *dev,
+   struct device_attribute *attr, char *buffer)
+{
+   ssize_t count;
+   mutex_lock(spic_dev.lock);
+   count = snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.wwan_power);
+   mutex_unlock(spic_dev.lock);
+   return count;
+}
+
 /* bluetooth subsystem power state */
 static void __sony_pic_set_bluetoothpower(u8 state)
 {
@@ -1412,11 +1451,13 @@ struct device_attribute spic_attr_##_name = 
__ATTR(_name,   \
 
 static SPIC_ATTR(camerapower, 0644);
 static SPIC_ATTR(bluetoothpower, 0644);
+static SPIC_ATTR(wwanpower, 0644);
 static SPIC_ATTR(fanspeed, 0644);
 
 static struct attribute *spic_attributes[] = {
spic_attr_camerapower.attr,
spic_attr_bluetoothpower.attr,
+   spic_attr_wwanpower.attr,
spic_attr_fanspeed.attr,
NULL
 };
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: add locking on accesses to the ioport and global vars

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9f9f0761712928768198278c6cbc5cafe5502d38
Commit: 9f9f0761712928768198278c6cbc5cafe5502d38
Parent: 5f3d2898d79520bc8d8706ed3859060f9cbb969e
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:19:36 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:05:53 2007 -0400

sony-laptop: add locking on accesses to the ioport and global vars

Better avoid having ioport commands mixing and global variables 
reading/writing.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   43 +++
 1 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 09e7539..5641343 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -928,6 +928,7 @@ struct sony_pic_dev {
struct sony_pic_ioport  *cur_ioport;
struct list_headinterrupts;
struct list_headioports;
+   struct mutexlock;
 };
 
 static struct sony_pic_dev spic_dev = {
@@ -1224,7 +1225,7 @@ static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
 #define SONYPI_CAMERA_STATUS_READY 0x2
 #define SONYPI_CAMERA_STATUS_POSITION  0x4
 
-static int sony_pic_camera_ready(void)
+static int __sony_pic_camera_ready(void)
 {
u8 v;
 
@@ -1239,6 +1240,7 @@ static int sony_pic_camera_off(void)
return -ENODEV;
}
 
+   mutex_lock(spic_dev.lock);
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
SONYPI_CAMERA_MUTE_MASK),
ITERATIONS_SHORT);
@@ -1247,20 +1249,23 @@ static int sony_pic_camera_off(void)
sony_pic_call2(0x91, 0);
spic_dev.camera_power = 0;
}
+   mutex_unlock(spic_dev.lock);
return 0;
 }
 
 static int sony_pic_camera_on(void)
 {
int i, j, x;
+   int result = 0;
 
if (!camera) {
printk(KERN_WARNING DRV_PFX camera control not enabled\n);
return -ENODEV;
}
 
+   mutex_lock(spic_dev.lock);
if (spic_dev.camera_power)
-   return 0;
+   goto out_unlock;
 
for (j = 5; j  0; j--) {
 
@@ -1269,7 +1274,7 @@ static int sony_pic_camera_on(void)
sony_pic_call1(0x93);
 
for (i = 400; i  0; i--) {
-   if (sony_pic_camera_ready())
+   if (__sony_pic_camera_ready())
break;
msleep(10);
}
@@ -1279,7 +1284,8 @@ static int sony_pic_camera_on(void)
 
if (j == 0) {
printk(KERN_WARNING DRV_PFX failed to power on camera\n);
-   return -ENODEV;
+   result = -ENODEV;
+   goto out_unlock;
}
 
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1287,6 +1293,9 @@ static int sony_pic_camera_on(void)
ITERATIONS_SHORT);
 
spic_dev.camera_power = 1;
+
+out_unlock:
+   mutex_unlock(spic_dev.lock);
return 0;
 }
 
@@ -1314,11 +1323,15 @@ static ssize_t sony_pic_camerapower_store(struct device 
*dev,
 static ssize_t sony_pic_camerapower_show(struct device *dev,
struct device_attribute *attr, char *buffer)
 {
-   return snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.camera_power);
+   ssize_t count;
+   mutex_lock(spic_dev.lock);
+   count = snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.camera_power);
+   mutex_unlock(spic_dev.lock);
+   return count;
 }
 
 /* bluetooth subsystem power state */
-static void sony_pic_set_bluetoothpower(u8 state)
+static void __sony_pic_set_bluetoothpower(u8 state)
 {
state = !!state;
if (spic_dev.bluetooth_power == state)
@@ -1337,7 +1350,9 @@ static ssize_t sony_pic_bluetoothpower_store(struct 
device *dev,
return -EINVAL;
 
value = simple_strtoul(buffer, NULL, 10);
-   sony_pic_set_bluetoothpower(value);
+   mutex_lock(spic_dev.lock);
+   __sony_pic_set_bluetoothpower(value);
+   mutex_unlock(spic_dev.lock);
 
return count;
 }
@@ -1345,7 +1360,11 @@ static ssize_t sony_pic_bluetoothpower_store(struct 
device *dev,
 static ssize_t sony_pic_bluetoothpower_show(struct device *dev,
struct device_attribute *attr, char *buffer)
 {
-   return snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.bluetooth_power);
+   ssize_t count = 0;
+   mutex_lock(spic_dev.lock);
+   count = snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.bluetooth_power);
+   mutex_unlock(spic_dev.lock);
+   return count;
 }
 
 /* fan speed */
@@ -1518,7 +1537,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct 
file *fp,
u16 val16;
int 

ACPI: ibm-acpi: update documentation

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=38f996ed21089fa4ae40526a5f428e3c792ea561
Commit: 38f996ed21089fa4ae40526a5f428e3c792ea561
Parent: a62bc916cf48caaf9efa2fed20440fd617647c6c
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:59 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: update documentation

Update documentation header, and relocate a hunk of text that was 
missplaced.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/ibm-acpi.txt |   85 +---
 1 files changed, 25 insertions(+), 60 deletions(-)

diff --git a/Documentation/ibm-acpi.txt b/Documentation/ibm-acpi.txt
index cdcef01..f409f4b 100644
--- a/Documentation/ibm-acpi.txt
+++ b/Documentation/ibm-acpi.txt
@@ -1,16 +1,17 @@
IBM ThinkPad ACPI Extras Driver
 
-Version 0.12
-   17 August 2005
+Version 0.13
+   31 December 2006
 
Borislav Deianov [EMAIL PROTECTED]
+Henrique de Moraes Holschuh [EMAIL PROTECTED]
  http://ibm-acpi.sf.net/
 
 
 This is a Linux ACPI driver for the IBM ThinkPad laptops. It supports
 various features of these laptops which are accessible through the
-ACPI framework but not otherwise supported by the generic Linux ACPI
-drivers.
+ACPI framework but not otherwise fully supported by the generic Linux
+ACPI drivers.
 
 
 Status
@@ -638,6 +639,26 @@ The ThinkPad's ACPI DSDT code will reprogram the fan on 
its own when
 certain conditions are met.  It will override any fan programming done
 through ibm-acpi.
 
+The ibm-acpi kernel driver can be programmed to revert the fan level
+to a safe setting if userspace does not issue one of the fan commands:
+enable, disable, level or watchdog within a configurable
+ammount of time.  To do this, use the watchdog command.
+
+   echo 'watchdog interval'  /proc/acpi/ibm/fan
+
+Interval is the ammount of time in seconds to wait for one of the
+above mentioned fan commands before reseting the fan level to a safe
+one.  If set to zero, the watchdog is disabled (default).  When the
+watchdog timer runs out, it does the exact equivalent of the enable
+fan command.
+
+Note that the watchdog timer stops after it enables the fan.  It will
+be rearmed again automatically (using the same interval) when one of
+the above mentioned fan commands is received.  The fan watchdog is,
+therefore, not suitable to protect against fan mode changes made
+through means other than the enable, disable, and level fan
+commands.
+
 EXPERIMENTAL: WAN -- /proc/acpi/ibm/wan
 ---
 
@@ -670,59 +691,3 @@ example:
 
modprobe ibm_acpi hotkey=enable,0x video=auto_disable
 
-The ibm-acpi kernel driver can be programmed to revert the fan level
-to a safe setting if userspace does not issue one of the fan commands:
-enable, disable, level or watchdog within a configurable
-ammount of time.  To do this, use the watchdog command.
-
-   echo 'watchdog interval'  /proc/acpi/ibm/fan
-
-Interval is the ammount of time in seconds to wait for one of the
-above mentioned fan commands before reseting the fan level to a safe
-one.  If set to zero, the watchdog is disabled (default).  When the
-watchdog timer runs out, it does the exact equivalent of the enable
-fan command.
-
-Note that the watchdog timer stops after it enables the fan.  It will
-be rearmed again automatically (using the same interval) when one of
-the above mentioned fan commands is received.  The fan watchdog is,
-therefore, not suitable to protect against fan mode changes made
-through means other than the enable, disable, and level fan
-commands.
-
-
-Example Configuration
--
-
-The ACPI support in the kernel is intended to be used in conjunction
-with a user-space daemon, acpid. The configuration files for this
-daemon control what actions are taken in response to various ACPI
-events. An example set of configuration files are included in the
-config/ directory of the tarball package available on the web
-site. Note that these are provided for illustration purposes only and
-may need to be adapted to your particular setup.
-
-The following utility scripts are used by the example action
-scripts (included with ibm-acpi for completeness):
-
-   /usr/local/sbin/idectl -- from the hdparm source distribution,
-   see http://www.ibiblio.org/pub/Linux/system/hardware
-   /usr/local/sbin/laptop_mode -- from the Linux kernel source
-   distribution, see Documentation/laptop-mode.txt
-   /sbin/service -- comes with Redhat/Fedora distributions
-   /usr/sbin/hibernate -- from the Software Suspend 2 

meye: make meye use sony-laptop instead of sonypi

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cbefb762b67fa6d3eb2a48ae3380358a940e8c9d
Commit: cbefb762b67fa6d3eb2a48ae3380358a940e8c9d
Parent: 1ce82c14d06ff68380d7c647f768858e077930c5
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:36:26 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:06:02 2007 -0400

meye: make meye use sony-laptop instead of sonypi

Change sonypi_camera_command() calls to sony_pic_camera_command() and use
the renamed macros.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/video4linux/meye.txt |7 ++--
 drivers/media/video/Kconfig|6 ++--
 drivers/media/video/meye.c |   62 ++--
 drivers/media/video/meye.h |2 +-
 4 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/Documentation/video4linux/meye.txt 
b/Documentation/video4linux/meye.txt
index ecb3416..5e51c59 100644
--- a/Documentation/video4linux/meye.txt
+++ b/Documentation/video4linux/meye.txt
@@ -5,10 +5,9 @@ Vaio Picturebook Motion Eye Camera Driver Readme
Copyright (C) 2000 Andrew Tridgell [EMAIL PROTECTED]
 
 This driver enable the use of video4linux compatible applications with the
-Motion Eye camera. This driver requires the Sony Vaio Programmable I/O
-Control Device driver (which can be found in the Character drivers
-section of the kernel configuration utility) to be compiled and installed
-(using its camera=1 parameter).
+Motion Eye camera. This driver requires the Sony Laptop Extras driver (which
+can be found in the Misc devices section of the kernel configuration utility)
+to be compiled and installed (using its camera=1 parameter).
 
 It can do at maximum 30 fps @ 320x240 or 15 fps @ 640x480.
 
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 7a61051..ff6aefd 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -577,14 +577,14 @@ config VIDEO_ZORAN_AVS6EYES
 
 config VIDEO_MEYE
tristate Sony Vaio Picturebook Motion Eye Video For Linux
-   depends on PCI  SONYPI  VIDEO_V4L1
+   depends on PCI  SONY_LAPTOP  VIDEO_V4L1
---help---
  This is the video4linux driver for the Motion Eye camera found
  in the Vaio Picturebook laptops. Please read the material in
  file:Documentation/video4linux/meye.txt for more information.
 
- If you say Y or M here, you need to say Y or M to Sony Programmable
- I/O Control Device in the character device section.
+ If you say Y or M here, you need to say Y or M to Sony Laptop
+ Extras in the misc device section.
 
  To compile this driver as a module, choose M here: the
  module will be called meye.
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 98681da..664aba8 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -925,13 +925,13 @@ static int meye_do_ioctl(struct inode *inode, struct file 
*file,
if (p-palette != VIDEO_PALETTE_YUV422  p-palette != 
VIDEO_PALETTE_YUYV)
return -EINVAL;
mutex_lock(meye.lock);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERABRIGHTNESS,
  p-brightness  10);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAHUE,
  p-hue  10);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERACOLOR,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACOLOR,
  p-colour  10);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACONTRAST,
  p-contrast  10);
meye.picture = *p;
mutex_unlock(meye.lock);
@@ -1043,11 +1043,11 @@ static int meye_do_ioctl(struct inode *inode, struct 
file *file,
meye.params.quality != jp-quality)
mchip_hic_stop();   /* need restart */
meye.params = *jp;
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERASHARPNESS,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERASHARPNESS,
  meye.params.sharpness);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERAAGC,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC,
  meye.params.agc);
-   sonypi_camera_command(SONYPI_COMMAND_SETCAMERAPICTURE,
+   sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE,
   

sony-laptop: remove user visible camera controls as platform attributes

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b20d34406775369d50fc2ffe27a64a0d6fd313e
Commit: 1b20d34406775369d50fc2ffe27a64a0d6fd313e
Parent: cbefb762b67fa6d3eb2a48ae3380358a940e8c9d
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:36:40 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:06:03 2007 -0400

sony-laptop: remove user visible camera controls as platform attributes

Avoid giving the user the possibility to shoot his own foot and let
the meye driver enable/disable the camera wisely (PCI_ID based).

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   36 
 1 files changed, 0 insertions(+), 36 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 9c2e80b..c15c1f6 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1317,40 +1317,6 @@ static int __sony_pic_camera_on(void)
return 0;
 }
 
-static ssize_t sony_pic_camerapower_store(struct device *dev,
-   struct device_attribute *attr,
-   const char *buffer, size_t count)
-{
-   unsigned long value;
-   int result;
-   if (count  31)
-   return -EINVAL;
-
-   value = simple_strtoul(buffer, NULL, 10);
-
-   mutex_lock(spic_dev.lock);
-   if (value)
-   result = __sony_pic_camera_on();
-   else
-   result = __sony_pic_camera_off();
-   mutex_unlock(spic_dev.lock);
-
-   if (result)
-   return result;
-
-   return count;
-}
-
-static ssize_t sony_pic_camerapower_show(struct device *dev,
-   struct device_attribute *attr, char *buffer)
-{
-   ssize_t count;
-   mutex_lock(spic_dev.lock);
-   count = snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.camera_power);
-   mutex_unlock(spic_dev.lock);
-   return count;
-}
-
 /* External camera command (exported to the motion eye v4l driver) */
 int sony_pic_camera_command(int command, u8 value)
 {
@@ -1522,13 +1488,11 @@ struct device_attribute spic_attr_##_name = 
__ATTR(_name,   \
_mode, sony_pic_## _name ##_show,   \
sony_pic_## _name ##_store)
 
-static SPIC_ATTR(camerapower, 0644);
 static SPIC_ATTR(bluetoothpower, 0644);
 static SPIC_ATTR(wwanpower, 0644);
 static SPIC_ATTR(fanspeed, 0644);
 
 static struct attribute *spic_attributes[] = {
-   spic_attr_camerapower.attr,
spic_attr_bluetoothpower.attr,
spic_attr_wwanpower.attr,
spic_attr_fanspeed.attr,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: add a meye-usable include file for camera ops

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1ce82c14d06ff68380d7c647f768858e077930c5
Commit: 1ce82c14d06ff68380d7c647f768858e077930c5
Parent: e364632e740fe9fcb401e5ece3be69e4d81c5a80
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:34:36 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:06:01 2007 -0400

sony-laptop: add a meye-usable include file for camera ops

Copy and rename (for easier co-existence) the MEYE-wise exported interface.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c  |   17 +
 include/linux/sony-laptop.h |   34 ++
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index bc863f5..9c2e80b 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -62,6 +62,7 @@
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
 #include linux/sonypi.h
+#include linux/sony-laptop.h
 #ifdef CONFIG_SONY_LAPTOP_OLD
 #include linux/poll.h
 #include linux/miscdevice.h
@@ -1359,37 +1360,37 @@ int sony_pic_camera_command(int command, u8 value)
mutex_lock(spic_dev.lock);
 
switch (command) {
-   case SONYPI_COMMAND_SETCAMERA:
+   case SONY_PIC_COMMAND_SETCAMERA:
if (value)
__sony_pic_camera_on();
else
__sony_pic_camera_off();
break;
-   case SONYPI_COMMAND_SETCAMERABRIGHTNESS:
+   case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_BRIGHTNESS, 
value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERACONTRAST:
+   case SONY_PIC_COMMAND_SETCAMERACONTRAST:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTRAST, 
value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERAHUE:
+   case SONY_PIC_COMMAND_SETCAMERAHUE:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_HUE, value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERACOLOR:
+   case SONY_PIC_COMMAND_SETCAMERACOLOR:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_COLOR, 
value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERASHARPNESS:
+   case SONY_PIC_COMMAND_SETCAMERASHARPNESS:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_SHARPNESS, 
value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERAPICTURE:
+   case SONY_PIC_COMMAND_SETCAMERAPICTURE:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE, 
value),
ITERATIONS_SHORT);
break;
-   case SONYPI_COMMAND_SETCAMERAAGC:
+   case SONY_PIC_COMMAND_SETCAMERAAGC:
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_AGC, value),
ITERATIONS_SHORT);
break;
diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h
new file mode 100644
index 000..e2e036d
--- /dev/null
+++ b/include/linux/sony-laptop.h
@@ -0,0 +1,34 @@
+#ifndef _SONYLAPTOP_H_
+#define _SONYLAPTOP_H_
+
+#include linux/types.h
+
+#ifdef __KERNEL__
+
+/* used only for communication between v4l and sony-laptop */
+
+#define SONY_PIC_COMMAND_GETCAMERA  1  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERA  2
+#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS3  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS4
+#define SONY_PIC_COMMAND_GETCAMERACONTRAST  5  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERACONTRAST  6
+#define SONY_PIC_COMMAND_GETCAMERAHUE   7  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAHUE   8
+#define SONY_PIC_COMMAND_GETCAMERACOLOR 9  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERACOLOR10
+#define SONY_PIC_COMMAND_GETCAMERASHARPNESS11  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERASHARPNESS12
+#define SONY_PIC_COMMAND_GETCAMERAPICTURE  13  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAPICTURE  14
+#define SONY_PIC_COMMAND_GETCAMERAAGC  15  /* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAAGC  16
+#define SONY_PIC_COMMAND_GETCAMERADIRECTION17  /* obsolete */
+#define SONY_PIC_COMMAND_GETCAMERAROMVERSION   18  /* obsolete */
+#define SONY_PIC_COMMAND_GETCAMERAREVISION 19  /* obsolete */
+
+int sony_pic_camera_command(int command, u8 value);
+
+#endif /* __KERNEL__ */
+

sonypi: use mutex instead of semaphore

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c6c60106b9584f17c55e4c5e0ce9b905a1a6cdb6
Commit: c6c60106b9584f17c55e4c5e0ce9b905a1a6cdb6
Parent: 1b20d34406775369d50fc2ffe27a64a0d6fd313e
Author: Matthias Kaehlcke [EMAIL PROTECTED]
AuthorDate: Tue Apr 24 22:02:35 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:13:34 2007 -0400

sonypi: use mutex instead of semaphore

the Sony Programmable I/O Control driver uses a semaphore as
mutex. use the mutex API instead of the (binary) semaphore

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Acked-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/char/sonypi.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index b699890..3ef593a 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -484,7 +484,7 @@ static struct sonypi_device {
u16 evtype_offset;
int camera_power;
int bluetooth_power;
-   struct semaphore lock;
+   struct mutex lock;
struct kfifo *fifo;
spinlock_t fifo_lock;
wait_queue_head_t fifo_proc_list;
@@ -891,7 +891,7 @@ int sonypi_camera_command(int command, u8 value)
if (!camera)
return -EIO;
 
-   down(sonypi_device.lock);
+   mutex_lock(sonypi_device.lock);
 
switch (command) {
case SONYPI_COMMAND_SETCAMERA:
@@ -926,7 +926,7 @@ int sonypi_camera_command(int command, u8 value)
   command);
break;
}
-   up(sonypi_device.lock);
+   mutex_unlock(sonypi_device.lock);
return 0;
 }
 
@@ -945,20 +945,20 @@ static int sonypi_misc_fasync(int fd, struct file *filp, 
int on)
 static int sonypi_misc_release(struct inode *inode, struct file *file)
 {
sonypi_misc_fasync(-1, file, 0);
-   down(sonypi_device.lock);
+   mutex_lock(sonypi_device.lock);
sonypi_device.open_count--;
-   up(sonypi_device.lock);
+   mutex_unlock(sonypi_device.lock);
return 0;
 }
 
 static int sonypi_misc_open(struct inode *inode, struct file *file)
 {
-   down(sonypi_device.lock);
+   mutex_lock(sonypi_device.lock);
/* Flush input queue on first open */
if (!sonypi_device.open_count)
kfifo_reset(sonypi_device.fifo);
sonypi_device.open_count++;
-   up(sonypi_device.lock);
+   mutex_unlock(sonypi_device.lock);
return 0;
 }
 
@@ -1008,7 +1008,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct 
file *fp,
u8 val8;
u16 val16;
 
-   down(sonypi_device.lock);
+   mutex_lock(sonypi_device.lock);
switch (cmd) {
case SONYPI_IOCGBRT:
if (sonypi_ec_read(SONYPI_LCD_LIGHT, val8)) {
@@ -1108,7 +1108,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct 
file *fp,
default:
ret = -EINVAL;
}
-   up(sonypi_device.lock);
+   mutex_unlock(sonypi_device.lock);
return ret;
 }
 
@@ -1363,7 +1363,7 @@ static int __devinit sonypi_probe(struct platform_device 
*dev)
}
 
init_waitqueue_head(sonypi_device.fifo_proc_list);
-   init_MUTEX(sonypi_device.lock);
+   mutex_init(sonypi_device.lock);
sonypi_device.bluetooth_power = -1;
 
if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sonypi: suggest sonypi users to try sony-laptop instead

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=74a882e4857414a98ca5904b3be90fb6aba2f25e
Commit: 74a882e4857414a98ca5904b3be90fb6aba2f25e
Parent: 9476cdfae61a3c3fa61d06c18dd002b03671ca9f
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:22:11 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:05:56 2007 -0400

sonypi: suggest sonypi users to try sony-laptop instead

Try to migrate sonypi users to sony-laptop gracefully.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/char/sonypi.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 7823757..72cdddb 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1,6 +1,8 @@
 /*
  * Sony Programmable I/O Control Device driver for VAIO
  *
+ * Copyright (C) 2007 Mattia Dongili [EMAIL PROTECTED]
+ *
  * Copyright (C) 2001-2005 Stelian Pop [EMAIL PROTECTED]
  *
  * Copyright (C) 2005 Narayanan R S [EMAIL PROTECTED]
@@ -1321,6 +1323,10 @@ static int __devinit sonypi_probe(struct platform_device 
*dev)
struct pci_dev *pcidev;
int error;
 
+   printk(KERN_WARNING sonypi: please try the sony-laptop module instead 
+   and report failures, see also 
+   
http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n;);
+
spin_lock_init(sonypi_device.fifo_lock);
sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
 sonypi_device.fifo_lock);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sonypi: try to detect if sony-laptop has already taken one of the known ioports

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1a3e323907dc5991cba2d715d5db3ae2eac78280
Commit: 1a3e323907dc5991cba2d715d5db3ae2eac78280
Parent: 74a882e4857414a98ca5904b3be90fb6aba2f25e
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:34:10 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:05:59 2007 -0400

sonypi: try to detect if sony-laptop has already taken one of the known 
ioports

Get the IO resources list in sony-laptop in the same order as listed
in sonypi and make sonypi check if one of those is already busy.
The sonypi check can be disabled by a module parameter in case the user
thinks we are plainly wrong (check_ioport=0).

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/char/sonypi.c  |   27 +++
 drivers/misc/sony-laptop.c |4 ++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 72cdddb..b699890 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -97,6 +97,11 @@ module_param(useinput, int, 0444);
 MODULE_PARM_DESC(useinput,
 set this if you would like sonypi to feed events to the input 
subsystem);
 
+static int check_ioport = 1;
+module_param(check_ioport, int, 0444);
+MODULE_PARM_DESC(check_ioport,
+set this to 0 if you think the automatic ioport check for 
sony-laptop is wrong);
+
 #define SONYPI_DEVICE_MODEL_TYPE1  1
 #define SONYPI_DEVICE_MODEL_TYPE2  2
 #define SONYPI_DEVICE_MODEL_TYPE3  3
@@ -1262,6 +1267,28 @@ static int __devinit sonypi_create_input_devices(void)
 static int __devinit sonypi_setup_ioports(struct sonypi_device *dev,
const struct sonypi_ioport_list *ioport_list)
 {
+   /* try to detect if sony-laptop is being used and thus
+* has already requested one of the known ioports.
+* As in the deprecated check_region this is racy has we have
+* multiple ioports available and one of them can be requested
+* between this check and the subsequent request. Anyway, as an
+* attempt to be some more user-friendly as we currently are,
+* this is enough.
+*/
+   const struct sonypi_ioport_list *check = ioport_list;
+   while (check_ioport  check-port1) {
+   if (!request_region(check-port1,
+  sonypi_device.region_size,
+  Sony Programable I/O Device Check)) {
+   printk(KERN_ERR sonypi: ioport 0x%.4x busy, using 
sony-laptop? 
+   if not use check_ioport=0\n,
+   check-port1);
+   return -EBUSY;
+   }
+   release_region(check-port1, sonypi_device.region_size);
+   check++;
+   }
+
while (ioport_list-port1) {
 
if (request_region(ioport_list-port1,
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 141284d..2787e1c 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1801,7 +1801,7 @@ sony_pic_read_possible_resource(struct acpi_resource 
*resource, void *context)
if (!interrupt)
return AE_ERROR;
 
-   list_add(interrupt-list, dev-interrupts);
+   list_add_tail(interrupt-list, 
dev-interrupts);
interrupt-irq.triggering = p-triggering;
interrupt-irq.polarity = p-polarity;
interrupt-irq.sharable = p-sharable;
@@ -1823,7 +1823,7 @@ sony_pic_read_possible_resource(struct acpi_resource 
*resource, void *context)
if (!ioport)
return AE_ERROR;
 
-   list_add(ioport-list, dev-ioports);
+   list_add_tail(ioport-list, dev-ioports);
memcpy(ioport-io, io, sizeof(*io));
return AE_OK;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: additional platform attributes coming from SNY6001

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=49a11deade3c1d9e2d7c88d25899b3a9174d048e
Commit: 49a11deade3c1d9e2d7c88d25899b3a9174d048e
Parent: 1549ee6fb122400c0767b5f3da2c42abbc4f750a
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 19:28:56 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:19 2007 -0400

sony-laptop: additional platform attributes coming from SNY6001

Register additional platform attributes coming from the SPIC (sonypi) 
driver.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |  205 +++-
 1 files changed, 204 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index cf8d792..3e8f3aa 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -774,7 +774,8 @@ static int sony_nc_add(struct acpi_device *device)
 
}
 
-   if (sony_pf_add())
+   result = sony_pf_add();
+   if (result)
goto outbacklight;
 
/* create sony_pf sysfs attributes related to the SNC device */
@@ -903,6 +904,8 @@ struct sony_pic_irq {
 
 struct sony_pic_dev {
int model;
+   u8  camera_power;
+   u8  bluetooth_power;
struct acpi_device  *acpi_dev;
struct sony_pic_irq *cur_irq;
struct sony_pic_ioport  *cur_ioport;
@@ -1181,6 +1184,186 @@ static u8 sony_pic_call2(u8 dev, u8 fn)
return v1;
 }
 
+static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
+{
+   u8 v1;
+
+   wait_on_command(inb_p(spic_dev.cur_ioport-io.minimum + 4)  2, 
ITERATIONS_LONG);
+   outb(dev, spic_dev.cur_ioport-io.minimum + 4);
+   wait_on_command(inb_p(spic_dev.cur_ioport-io.minimum + 4)  2, 
ITERATIONS_LONG);
+   outb(fn, spic_dev.cur_ioport-io.minimum);
+   wait_on_command(inb_p(spic_dev.cur_ioport-io.minimum + 4)  2, 
ITERATIONS_LONG);
+   outb(v, spic_dev.cur_ioport-io.minimum);
+   v1 = inb_p(spic_dev.cur_ioport-io.minimum);
+   dprintk(sony_pic_call3: 0x%.4x\n, v1);
+   return v1;
+}
+
+/* camera tests and poweron/poweroff */
+#define SONYPI_CAMERA_PICTURE  5
+#define SONYPI_CAMERA_MUTE_MASK0x40
+#define SONYPI_CAMERA_CONTROL  0x10
+#define SONYPI_CAMERA_STATUS   7
+#define SONYPI_CAMERA_STATUS_READY 0x2
+#define SONYPI_CAMERA_STATUS_POSITION  0x4
+
+static int sony_pic_camera_ready(void)
+{
+   u8 v;
+
+   v = sony_pic_call2(0x8f, SONYPI_CAMERA_STATUS);
+   return (v != 0xff  (v  SONYPI_CAMERA_STATUS_READY));
+}
+
+static void sony_pic_camera_off(void)
+{
+   wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
+   SONYPI_CAMERA_MUTE_MASK),
+   ITERATIONS_SHORT);
+
+   if (!spic_dev.camera_power)
+   return;
+
+   sony_pic_call2(0x91, 0);
+   spic_dev.camera_power = 0;
+}
+
+static void sony_pic_camera_on(void)
+{
+   int i, j;
+
+   if (spic_dev.camera_power)
+   return;
+
+   for (j = 5; j  0; j--) {
+
+   while (sony_pic_call2(0x91, 0x1))
+   msleep(10);
+   sony_pic_call1(0x93);
+
+   for (i = 400; i  0; i--) {
+   if (sony_pic_camera_ready())
+   break;
+   msleep(10);
+   }
+   if (i)
+   break;
+   }
+
+   if (j == 0) {
+   printk(KERN_WARNING sonypi: failed to power on camera\n);
+   return;
+   }
+
+   wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
+   0x5a),
+   ITERATIONS_SHORT);
+
+   spic_dev.camera_power = 1;
+}
+
+static ssize_t sony_pic_camerapower_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buffer, size_t count)
+{
+   unsigned long value;
+   if (count  31)
+   return -EINVAL;
+
+   value = simple_strtoul(buffer, NULL, 10);
+   if (value)
+   sony_pic_camera_on();
+   else
+   sony_pic_camera_off();
+
+   return count;
+}
+
+static ssize_t sony_pic_camerapower_show(struct device *dev,
+   struct device_attribute *attr, char *buffer)
+{
+   return snprintf(buffer, PAGE_SIZE, %d\n, spic_dev.camera_power);
+}
+
+/* bluetooth subsystem power state */
+static void sony_pic_set_bluetoothpower(u8 state)
+{
+   state = !!state;
+   if (spic_dev.bluetooth_power == state)
+   return;
+   sony_pic_call2(0x96, state);
+   sony_pic_call1(0x82);
+   spic_dev.bluetooth_power = state;
+}
+
+static ssize_t sony_pic_bluetoothpower_store(struct device *dev,
+ 

sony-laptop: Unify the input subsystem event forwarding

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1549ee6fb122400c0767b5f3da2c42abbc4f750a
Commit: 1549ee6fb122400c0767b5f3da2c42abbc4f750a
Parent: 33a04454527edd33d4a6332a2944d2b4f46fbb18
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 10:19:08 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:19 2007 -0400

sony-laptop: Unify the input subsystem event forwarding

SNC and SPIC events are forwarded to the same input devices
and are thus handled together.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |  541 ++--
 1 files changed, 276 insertions(+), 265 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index b797c8c..cf8d792 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -97,18 +97,266 @@ MODULE_PARM_DESC(no_spic,
 static int compat; /* = 0 */
 module_param(compat, int, 0444);
 MODULE_PARM_DESC(compat,
-set this if you want to enable backward compatibility mode);
-
-static int force_jog;  /* = 0 */
-module_param(force_jog, int, 0444);
-MODULE_PARM_DESC(force_jog,
-set this if the driver doesn't detect your jogdial);
+set this if you want to enable backward compatibility mode 
for SPIC);
 
 static unsigned long mask = 0x;
 module_param(mask, ulong, 0644);
 MODULE_PARM_DESC(mask,
 set this to the mask of event you want to enable (see doc));
 
+/*** Input Devices ***/
+
+#define SONY_LAPTOP_BUF_SIZE   128
+struct sony_laptop_input_s {
+   atomic_tusers;
+   struct input_dev*jog_dev;
+   struct input_dev*key_dev;
+   struct kfifo*fifo;
+   spinlock_t  fifo_lock;
+   struct workqueue_struct *wq;
+};
+static struct sony_laptop_input_s sony_laptop_input = {
+   .users = ATOMIC_INIT(0),
+};
+
+struct sony_laptop_keypress {
+   struct input_dev *dev;
+   int key;
+};
+
+/* Correspondance table between sonypi events and input layer events */
+static struct {
+   int sonypiev;
+   int inputev;
+} sony_laptop_inputkeys[] = {
+   { SONYPI_EVENT_CAPTURE_PRESSED, KEY_CAMERA },
+   { SONYPI_EVENT_FNKEY_ONLY,  KEY_FN },
+   { SONYPI_EVENT_FNKEY_ESC,   KEY_FN_ESC },
+   { SONYPI_EVENT_FNKEY_F1,KEY_FN_F1 },
+   { SONYPI_EVENT_FNKEY_F2,KEY_FN_F2 },
+   { SONYPI_EVENT_FNKEY_F3,KEY_FN_F3 },
+   { SONYPI_EVENT_FNKEY_F4,KEY_FN_F4 },
+   { SONYPI_EVENT_FNKEY_F5,KEY_FN_F5 },
+   { SONYPI_EVENT_FNKEY_F6,KEY_FN_F6 },
+   { SONYPI_EVENT_FNKEY_F7,KEY_FN_F7 },
+   { SONYPI_EVENT_FNKEY_F8,KEY_FN_F8 },
+   { SONYPI_EVENT_FNKEY_F9,KEY_FN_F9 },
+   { SONYPI_EVENT_FNKEY_F10,   KEY_FN_F10 },
+   { SONYPI_EVENT_FNKEY_F11,   KEY_FN_F11 },
+   { SONYPI_EVENT_FNKEY_F12,   KEY_FN_F12 },
+   { SONYPI_EVENT_FNKEY_1, KEY_FN_1 },
+   { SONYPI_EVENT_FNKEY_2, KEY_FN_2 },
+   { SONYPI_EVENT_FNKEY_D, KEY_FN_D },
+   { SONYPI_EVENT_FNKEY_E, KEY_FN_E },
+   { SONYPI_EVENT_FNKEY_F, KEY_FN_F },
+   { SONYPI_EVENT_FNKEY_S, KEY_FN_S },
+   { SONYPI_EVENT_FNKEY_B, KEY_FN_B },
+   { SONYPI_EVENT_BLUETOOTH_PRESSED,   KEY_BLUE },
+   { SONYPI_EVENT_BLUETOOTH_ON,KEY_BLUE },
+   { SONYPI_EVENT_PKEY_P1, KEY_PROG1 },
+   { SONYPI_EVENT_PKEY_P2, KEY_PROG2 },
+   { SONYPI_EVENT_PKEY_P3, KEY_PROG3 },
+   { SONYPI_EVENT_BACK_PRESSED,KEY_BACK },
+   { SONYPI_EVENT_HELP_PRESSED,KEY_HELP },
+   { SONYPI_EVENT_ZOOM_PRESSED,KEY_ZOOM },
+   { SONYPI_EVENT_THUMBPHRASE_PRESSED, BTN_THUMB },
+   { 0, 0 },
+};
+
+/* release buttons after a short delay if pressed */
+static void do_sony_laptop_release_key(struct work_struct *work)
+{
+   struct sony_laptop_keypress kp;
+
+   while (kfifo_get(sony_laptop_input.fifo, (unsigned char *)kp,
+sizeof(kp)) == sizeof(kp)) {
+   msleep(10);
+   input_report_key(kp.dev, kp.key, 0);
+   input_sync(kp.dev);
+   }
+}
+static DECLARE_WORK(sony_laptop_release_key_work,
+   do_sony_laptop_release_key);
+
+/* forward event to the input subsytem */
+static void sony_laptop_report_input_event(u8 event)
+{
+   struct input_dev *jog_dev = sony_laptop_input.jog_dev;
+   struct input_dev *key_dev = 

sony-laptop: complete the motion eye camera support in sony-laptop

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e364632e740fe9fcb401e5ece3be69e4d81c5a80
Commit: e364632e740fe9fcb401e5ece3be69e4d81c5a80
Parent: 1a3e323907dc5991cba2d715d5db3ae2eac78280
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 23:34:22 2007 +0900
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 22:06:00 2007 -0400

sony-laptop: complete the motion eye camera support in sony-laptop

Add the exported sony_pic_camera_command() function to make the MEYE
driver happy.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |  108 ---
 1 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 2787e1c..bc863f5 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1220,11 +1220,35 @@ static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
 
 /* camera tests and poweron/poweroff */
 #define SONYPI_CAMERA_PICTURE  5
-#define SONYPI_CAMERA_MUTE_MASK0x40
 #define SONYPI_CAMERA_CONTROL  0x10
-#define SONYPI_CAMERA_STATUS   7
-#define SONYPI_CAMERA_STATUS_READY 0x2
-#define SONYPI_CAMERA_STATUS_POSITION  0x4
+
+#define SONYPI_CAMERA_BRIGHTNESS   0
+#define SONYPI_CAMERA_CONTRAST 1
+#define SONYPI_CAMERA_HUE  2
+#define SONYPI_CAMERA_COLOR3
+#define SONYPI_CAMERA_SHARPNESS4
+
+#define SONYPI_CAMERA_EXPOSURE_MASK0xC
+#define SONYPI_CAMERA_WHITE_BALANCE_MASK   0x3
+#define SONYPI_CAMERA_PICTURE_MODE_MASK0x30
+#define SONYPI_CAMERA_MUTE_MASK0x40
+
+/* the rest don't need a loop until not 0xff */
+#define SONYPI_CAMERA_AGC  6
+#define SONYPI_CAMERA_AGC_MASK 0x30
+#define SONYPI_CAMERA_SHUTTER_MASK 0x7
+
+#define SONYPI_CAMERA_SHUTDOWN_REQUEST 7
+#define SONYPI_CAMERA_CONTROL  0x10
+
+#define SONYPI_CAMERA_STATUS   7
+#define SONYPI_CAMERA_STATUS_READY 0x2
+#define SONYPI_CAMERA_STATUS_POSITION  0x4
+
+#define SONYPI_DIRECTION_BACKWARDS 0x4
+
+#define SONYPI_CAMERA_REVISION 8
+#define SONYPI_CAMERA_ROMVERSION   9
 
 static int __sony_pic_camera_ready(void)
 {
@@ -1234,14 +1258,13 @@ static int __sony_pic_camera_ready(void)
return (v != 0xff  (v  SONYPI_CAMERA_STATUS_READY));
 }
 
-static int sony_pic_camera_off(void)
+static int __sony_pic_camera_off(void)
 {
if (!camera) {
printk(KERN_WARNING DRV_PFX camera control not enabled\n);
return -ENODEV;
}
 
-   mutex_lock(spic_dev.lock);
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
SONYPI_CAMERA_MUTE_MASK),
ITERATIONS_SHORT);
@@ -1250,23 +1273,20 @@ static int sony_pic_camera_off(void)
sony_pic_call2(0x91, 0);
spic_dev.camera_power = 0;
}
-   mutex_unlock(spic_dev.lock);
return 0;
 }
 
-static int sony_pic_camera_on(void)
+static int __sony_pic_camera_on(void)
 {
int i, j, x;
-   int result = 0;
 
if (!camera) {
printk(KERN_WARNING DRV_PFX camera control not enabled\n);
return -ENODEV;
}
 
-   mutex_lock(spic_dev.lock);
if (spic_dev.camera_power)
-   goto out_unlock;
+   return 0;
 
for (j = 5; j  0; j--) {
 
@@ -1285,8 +1305,7 @@ static int sony_pic_camera_on(void)
 
if (j == 0) {
printk(KERN_WARNING DRV_PFX failed to power on camera\n);
-   result = -ENODEV;
-   goto out_unlock;
+   return -ENODEV;
}
 
wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1294,9 +1313,6 @@ static int sony_pic_camera_on(void)
ITERATIONS_SHORT);
 
spic_dev.camera_power = 1;
-
-out_unlock:
-   mutex_unlock(spic_dev.lock);
return 0;
 }
 
@@ -1310,10 +1326,13 @@ static ssize_t sony_pic_camerapower_store(struct device 
*dev,
return -EINVAL;
 
value = simple_strtoul(buffer, NULL, 10);
+
+   mutex_lock(spic_dev.lock);
if (value)
-   result = sony_pic_camera_on();
+   result = __sony_pic_camera_on();
else
-   result = sony_pic_camera_off();
+   result = __sony_pic_camera_off();
+   mutex_unlock(spic_dev.lock);
 
if (result)
return result;
@@ -1331,6 +1350,59 @@ static ssize_t sony_pic_camerapower_show(struct device 
*dev,
return count;
 }
 
+/* External camera command (exported to the motion eye v4l driver) */

sony-laptop: sanitize printks

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f6119b027578c21b544a98fd67e5f0b7e4fbea7d
Commit: f6119b027578c21b544a98fd67e5f0b7e4fbea7d
Parent: 49a11deade3c1d9e2d7c88d25899b3a9174d048e
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 19:31:06 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:19 2007 -0400

sony-laptop: sanitize printks

Unify printks to resemble a unique driver.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   40 +++-
 1 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 3e8f3aa..9042184 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -64,20 +64,19 @@
 #include linux/sonypi.h
 
 #define DRV_PFXsony-laptop: 
-#define LOG_PFXKERN_WARNING DRV_PFX
 #define dprintk(msg...)do {\
-   if (debug) printk(LOG_PFX  msg);\
+   if (debug) printk(KERN_WARNING DRV_PFX  msg);   \
 } while (0)
 
 #define SONY_LAPTOP_DRIVER_VERSION 0.5
 
 #define SONY_NC_CLASS  sony-nc
 #define SONY_NC_HIDSNY5001
-#define SONY_NC_DRIVER_NAMESony Notebook Control
+#define SONY_NC_DRIVER_NAMESony Notebook Control Driver
 
 #define SONY_PIC_CLASS sony-pic
 #define SONY_PIC_HID   SNY6001
-#define SONY_PIC_DRIVER_NAME   Sony Programmable IO Control
+#define SONY_PIC_DRIVER_NAME   Sony Programmable IO Control Driver
 
 MODULE_AUTHOR(Stelian Pop, Mattia Dongili);
 MODULE_DESCRIPTION(Sony laptop extras driver (SPIC and SNC ACPI device));
@@ -518,7 +517,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, 
int *result)
return 0;
}
 
-   printk(LOG_PFX acpi_callreadfunc failed\n);
+   printk(KERN_WARNING DRV_PFX acpi_callreadfunc failed\n);
 
return -1;
 }
@@ -544,7 +543,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, 
int value,
if (status == AE_OK) {
if (result != NULL) {
if (out_obj.type != ACPI_TYPE_INTEGER) {
-   printk(LOG_PFX acpi_evaluate_object bad 
+   printk(KERN_WARNING DRV_PFX 
acpi_evaluate_object bad 
   return type\n);
return -1;
}
@@ -553,7 +552,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, 
int value,
return 0;
}
 
-   printk(LOG_PFX acpi_evaluate_object failed\n);
+   printk(KERN_WARNING DRV_PFX acpi_evaluate_object failed\n);
 
return -1;
 }
@@ -689,7 +688,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, 
u32 level,
node = (struct acpi_namespace_node *)handle;
operand = (union acpi_operand_object *)node-object;
 
-   printk(LOG_PFX method: name: %4.4s, args %X\n, node-name.ascii,
+   printk(KERN_WARNING DRV_PFX method: name: %4.4s, args %X\n, 
node-name.ascii,
   (u32) operand-method.param_count);
 
return AE_OK;
@@ -724,6 +723,9 @@ static int sony_nc_add(struct acpi_device *device)
acpi_handle handle;
struct sony_nc_value *item;
 
+   printk(KERN_INFO DRV_PFX %s v%s.\n,
+   SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
+
sony_nc_acpi_device = device;
strcpy(acpi_device_class(device), sony/hotkey);
 
@@ -733,7 +735,7 @@ static int sony_nc_add(struct acpi_device *device)
status = acpi_walk_namespace(ACPI_TYPE_METHOD, 
sony_nc_acpi_handle,
 1, sony_walk_callback, NULL, NULL);
if (ACPI_FAILURE(status)) {
-   printk(LOG_PFX unable to walk acpi resources\n);
+   printk(KERN_WARNING DRV_PFX unable to walk acpi 
resources\n);
result = -ENODEV;
goto outwalk;
}
@@ -751,7 +753,7 @@ static int sony_nc_add(struct acpi_device *device)
 ACPI_DEVICE_NOTIFY,
 sony_acpi_notify, NULL);
if (ACPI_FAILURE(status)) {
-   printk(LOG_PFX unable to install notify handler\n);
+   printk(KERN_WARNING DRV_PFX unable to install notify 
handler\n);
result = -ENODEV;
goto outinput;
}
@@ -762,7 +764,7 @@ static int sony_nc_add(struct acpi_device *device)
  
sony_backlight_ops);
 
if (IS_ERR(sony_backlight_device)) {
-   printk(LOG_PFX unable to register backlight device\n);
+ 

sony-laptop: update documentation and Kconfig help

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3d2b8a9f2c26bc0fe03b3545d07245798b1b81b9
Commit: 3d2b8a9f2c26bc0fe03b3545d07245798b1b81b9
Parent: f6119b027578c21b544a98fd67e5f0b7e4fbea7d
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 19:31:16 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:19 2007 -0400

sony-laptop: update documentation and Kconfig help

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/sony-laptop.txt |   25 ++---
 drivers/misc/Kconfig  |9 -
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/Documentation/sony-laptop.txt b/Documentation/sony-laptop.txt
index dfd26df..7a5c1a8 100644
--- a/Documentation/sony-laptop.txt
+++ b/Documentation/sony-laptop.txt
@@ -3,12 +3,18 @@ Sony Notebook Control Driver (SNC) Readme
Copyright (C) 2004- 2005 Stelian Pop [EMAIL PROTECTED]
Copyright (C) 2007 Mattia Dongili [EMAIL PROTECTED]
 
-This mini-driver drives the SNC device present in the ACPI BIOS of
-the Sony Vaio laptops.
+This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
+Sony Vaio laptops. This driver mixes both devices functions under the same
+(hopefully consistent) interface. This also means that the sonypi driver is
+obsoleted by sony-laptop now.
 
-It gives access to some extra laptop functionalities. In its current
-form, this driver let the user set or query the screen brightness
-through the backlight subsystem and remove/apply power to some devices.
+Fn keys (hotkeys):
+--
+Some models report hotkeys through the SNC or SPIC devices, such events are
+reported both through the ACPI subsystem as acpi events and through the INPUT
+subsystem. See the logs of acpid or /proc/acpi/event and
+/proc/bus/input/devices to find out what those events are and which input
+devices are created by the driver.
 
 Backlight control:
 --
@@ -39,6 +45,8 @@ The files are:
audiopower  power on/off the internal sound card
lanpowerpower on/off the internal ethernet card
(only in debug mode)
+   bluetoothpower  power on/off the internal bluetooth device
+   fanspeedget/set the fan speed
 
 Note that some files may be missing if they are not supported
 by your particular laptop model.
@@ -76,9 +84,9 @@ The sony-laptop driver creates, for some of those methods 
(the most
 current ones found on several Vaio models), an entry under
 /sys/devices/platform/sony-laptop, just like the 'cdpower' one.
 You can create other entries corresponding to your own laptop methods by
-further editing the source (see the 'sony_acpi_values' table, and add a new
+further editing the source (see the 'sony_nc_values' table, and add a new
 entry to this table with your get/set method names using the
-HANDLE_NAMES macro).
+SNC_HANDLE_NAMES macro).
 
 Your mission, should you accept it, is to try finding out what
 those entries are for, by reading/writing random values from/to those
@@ -87,6 +95,9 @@ files and find out what is the impact on your laptop.
 Should you find anything interesting, please report it back to me,
 I will not disavow all knowledge of your actions :)
 
+See also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other
+useful info.
+
 Bugs/Limitations:
 -
 
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 80b199f..4fb951b 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -112,12 +112,11 @@ config SONY_LAPTOP
depends on X86  ACPI
select BACKLIGHT_CLASS_DEVICE
  ---help---
- This mini-driver drives the SNC device present in the ACPI BIOS of
- the Sony Vaio laptops.
+ This mini-driver drives the SNC and SPIC devices present in the ACPI
+ BIOS of the Sony Vaio laptops.
 
- It gives access to some extra laptop functionalities. In its current
- form, this driver let the user set or query the screen brightness
- through the backlight subsystem and remove/apply power to some
+ It gives access to some extra laptop functionalities like Bluetooth,
+ screen brightness control, Fn keys and allows powering on/off some
  devices.
 
  Read file:Documentation/sony-laptop.txt for more information.
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: sonypi backward compatibility code

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b153f366867a3b70daeaf3c6074e4a0594057a7
Commit: 7b153f366867a3b70daeaf3c6074e4a0594057a7
Parent: 3d2b8a9f2c26bc0fe03b3545d07245798b1b81b9
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 19:31:25 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:05:22 2007 -0400

sony-laptop: sonypi backward compatibility code

Compatibility code to allow old sonypi bound userspace apps to still work.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/Kconfig   |6 +
 drivers/misc/sony-laptop.c |  332 +++-
 2 files changed, 335 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 4fb951b..75dbc58 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -121,4 +121,10 @@ config SONY_LAPTOP
 
  Read file:Documentation/sony-laptop.txt for more information.
 
+config SONY_LAPTOP_OLD
+   bool Sonypi compatibility
+   depends on SONY_LAPTOP
+ ---help---
+ Build the sonypi driver compatibility code into the sony-laptop 
driver.
+
 endmenu
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 9042184..8cc0411 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -62,6 +62,10 @@
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
 #include linux/sonypi.h
+#ifdef CONFIG_SONY_LAPTOP_OLD
+#include linux/poll.h
+#include linux/miscdevice.h
+#endif
 
 #define DRV_PFXsony-laptop: 
 #define dprintk(msg...)do {\
@@ -96,13 +100,21 @@ MODULE_PARM_DESC(no_spic,
 static int compat; /* = 0 */
 module_param(compat, int, 0444);
 MODULE_PARM_DESC(compat,
-set this if you want to enable backward compatibility mode 
for SPIC);
+set this if you want to enable backward compatibility mode);
 
 static unsigned long mask = 0x;
 module_param(mask, ulong, 0644);
 MODULE_PARM_DESC(mask,
 set this to the mask of event you want to enable (see doc));
 
+#ifdef CONFIG_SONY_LAPTOP_OLD
+static int minor = -1;
+module_param(minor, int, 0);
+MODULE_PARM_DESC(minor,
+minor number of the misc device for the SPIC compatibility 
code, 
+default is -1 (automatic));
+#endif
+
 /*** Input Devices ***/
 
 #define SONY_LAPTOP_BUF_SIZE   128
@@ -1318,6 +1330,16 @@ static ssize_t sony_pic_bluetoothpower_show(struct 
device *dev,
 /* fan speed */
 /* FAN0 information (reverse engineered from ACPI tables) */
 #define SONY_PIC_FAN0_STATUS   0x93
+static int sony_pic_set_fanspeed(unsigned long value)
+{
+   return ec_write(SONY_PIC_FAN0_STATUS, value);
+}
+
+static int sony_pic_get_fanspeed(u8 *value)
+{
+   return ec_read(SONY_PIC_FAN0_STATUS, value);
+}
+
 static ssize_t sony_pic_fanspeed_store(struct device *dev,
struct device_attribute *attr,
const char *buffer, size_t count)
@@ -1327,7 +1349,7 @@ static ssize_t sony_pic_fanspeed_store(struct device *dev,
return -EINVAL;
 
value = simple_strtoul(buffer, NULL, 10);
-   if (ec_write(SONY_PIC_FAN0_STATUS, value))
+   if (sony_pic_set_fanspeed(value))
return -EIO;
 
return count;
@@ -1337,7 +1359,7 @@ static ssize_t sony_pic_fanspeed_show(struct device *dev,
struct device_attribute *attr, char *buffer)
 {
u8 value = 0;
-   if (ec_read(SONY_PIC_FAN0_STATUS, value))
+   if (sony_pic_get_fanspeed(value))
return -EIO;
 
return snprintf(buffer, PAGE_SIZE, %d\n, value);
@@ -1363,6 +1385,304 @@ static struct attribute_group spic_attribute_group = {
.attrs = spic_attributes
 };
 
+/ SONYPI compatibility **/
+#ifdef CONFIG_SONY_LAPTOP_OLD
+
+/* battery / brightness / temperature  addresses */
+#define SONYPI_BAT_FLAGS   0x81
+#define SONYPI_LCD_LIGHT   0x96
+#define SONYPI_BAT1_PCTRM  0xa0
+#define SONYPI_BAT1_LEFT   0xa2
+#define SONYPI_BAT1_MAXRT  0xa4
+#define SONYPI_BAT2_PCTRM  0xa8
+#define SONYPI_BAT2_LEFT   0xaa
+#define SONYPI_BAT2_MAXRT  0xac
+#define SONYPI_BAT1_MAXTK  0xb0
+#define SONYPI_BAT1_FULL   0xb2
+#define SONYPI_BAT2_MAXTK  0xb8
+#define SONYPI_BAT2_FULL   0xba
+#define SONYPI_TEMP_STATUS 0xC1
+
+struct sonypi_compat_s {
+   struct fasync_struct*fifo_async;
+   struct kfifo*fifo;
+   spinlock_t  fifo_lock;
+   wait_queue_head_t   fifo_proc_list;
+   atomic_topen_count;
+};
+static struct sonypi_compat_s sonypi_compat = {
+   .open_count = ATOMIC_INIT(0),
+};
+
+static int sonypi_misc_fasync(int fd, struct file *filp, int on)
+{
+   int retval;
+
+   

ACPI: ibm-acpi: update copyright notice

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a62bc916cf48caaf9efa2fed20440fd617647c6c
Commit: a62bc916cf48caaf9efa2fed20440fd617647c6c
Parent: 56b6aeb05890f219895197f5166637b3d7a6f679
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:58 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: update copyright notice

Update copyright and license info on the source code comments.  No
functional changes.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/ibm_acpi.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 984ec81..ae03b8f 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -3,7 +3,7 @@
  *
  *
  *  Copyright (C) 2004-2005 Borislav Deianov [EMAIL PROTECTED]
- *  Copyright (C) 2006 Henrique de Moraes Holschuh [EMAIL PROTECTED]
+ *  Copyright (C) 2006-2007 Henrique de Moraes Holschuh [EMAIL PROTECTED]
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,7 +17,8 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ *  02110-1301, USA.
  */
 
 #define IBM_VERSION 0.13
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


asus-laptop: version bump

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8ec555c2c4c6c33759a1dbb13fa8f3b14fc77e10
Commit: 8ec555c2c4c6c33759a1dbb13fa8f3b14fc77e10
Parent: 185e5af98b1e09b1e0f859332243223776b2ad57
Author: Corentin Chary [EMAIL PROTECTED]
AuthorDate: Sun Mar 11 10:28:03 2007 +0100
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 11 15:45:05 2007 -0400

asus-laptop: version bump

Version and copyright bump.

Signed-off-by: Corentin Chary [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/asus-laptop.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index d75e447..65c32a9 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -3,7 +3,7 @@
  *
  *
  *  Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor
- *  Copyright (C) 2006 Corentin Chary
+ *  Copyright (C) 2006-2007 Corentin Chary
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
 
-#define ASUS_LAPTOP_VERSION 0.40
+#define ASUS_LAPTOP_VERSION 0.41
 
 #define ASUS_HOTK_NAME  Asus Laptop Support
 #define ASUS_HOTK_CLASS hotkey
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: ibm-acpi: organize code

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=56b6aeb05890f219895197f5166637b3d7a6f679
Commit: 56b6aeb05890f219895197f5166637b3d7a6f679
Parent: 1406cdd1760743106278c1f02a0f445159c8f400
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:57 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: organize code

Shuffle code around to better organize the driver code inside the
ibm-acpi.c file.

This patch adds no functional changes.  It is pure fluff that will make me
a bit more productive.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/ibm_acpi.c | 1398 +--
 1 files changed, 757 insertions(+), 641 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index e2da954..984ec81 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -87,8 +87,17 @@ MODULE_LICENSE(GPL);
 
 #define __unused __attribute__ ((unused))
 
-static int experimental;
-module_param(experimental, int, 0);
+/
+ 
+ *
+ * ACPI Helpers and device model
+ *
+ 
+ /
+
+/*
+ * ACPI basic handles
+ */
 
 static acpi_handle root_handle = NULL;
 
@@ -105,183 +114,31 @@ IBM_HANDLE(ec, root, \\_SB.PCI0.ISA.EC0,   /* 240, 
240x */
   \\_SB.PCI0.AD4S.EC0,   /* i1400, R30 */
   \\_SB.PCI0.ICH3.EC0,   /* R31 */
   \\_SB.PCI0.LPC.EC, /* all others */
-);
+  );
 
-IBM_HANDLE(vid, root, \\_SB.PCI.AGP.VGA, /* 570 */
-  \\_SB.PCI0.AGP0.VID0,  /* 600e/x, 770x */
-  \\_SB.PCI0.VID0,   /* 770e */
-  \\_SB.PCI0.VID,/* A21e, G4x, R50e, X30, X40 */
-  \\_SB.PCI0.AGP.VID,/* all others */
-); /* R30, R31 */
+IBM_HANDLE(ecrd, ec, ECRD);  /* 570 */
+IBM_HANDLE(ecwr, ec, ECWR);  /* 570 */
 
-IBM_HANDLE(vid2, root, \\_SB.PCI0.AGPB.VID); /* G41 */
+
+/*
+ * Misc ACPI handles
+ */
 
 IBM_HANDLE(cmos, root, \\UCMS,   /* R50, R50e, R50p, R51, T4x, X31, X40 
*/
   \\CMOS,/* A3x, G4x, R32, T23, T30, X22-24, X30 */
   \\CMS, /* R40, R40e */
-); /* all others */
-#ifdef CONFIG_ACPI_IBM_DOCK
-IBM_HANDLE(dock, root, \\_SB.GDCK,   /* X30, X31, X40 */
-  \\_SB.PCI0.DOCK,   /* 600e/x,770e,770x,A2xm/p,T20-22,X20-21 */
-  \\_SB.PCI0.PCI1.DOCK,  /* all others */
-  \\_SB.PCI.ISA.SLCE,/* 570 */
-); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
-#endif
-#ifdef CONFIG_ACPI_IBM_BAY
-IBM_HANDLE(bay, root, \\_SB.PCI.IDE.SECN.MAST,   /* 570 */
-  \\_SB.PCI0.IDE0.IDES.IDSM, /* 600e/x, 770e, 770x */
-  \\_SB.PCI0.SATA.SCND.MSTR, /* T60, X60, Z60 */
-  \\_SB.PCI0.IDE0.SCND.MSTR, /* all others */
-); /* A21e, R30, R31 */
-
-IBM_HANDLE(bay_ej, bay, _EJ3,/* 600e/x, A2xm/p, A3x */
-  _EJ0,  /* all others */
-); /* 570,A21e,G4x,R30,R31,R32,R40e,R50e */
-
-IBM_HANDLE(bay2, root, \\_SB.PCI0.IDE0.PRIM.SLAV,/* A3x, R32 */
-  \\_SB.PCI0.IDE0.IDEP.IDPS, /* 600e/x, 770e, 770x */
-); /* all others */
-
-IBM_HANDLE(bay2_ej, bay2, _EJ3,  /* 600e/x, 770e, A3x */
-  _EJ0,  /* 770x */
-); /* all others */
-#endif /* CONFIG_ACPI_IBM_BAY */
-
-/* don't list other alternatives as we install a notify handler on the 570 */
-IBM_HANDLE(pci, root, \\_SB.PCI);/* 570 */
+  );   /* all others */
 
 IBM_HANDLE(hkey, ec, \\_SB.HKEY, /* 600e/x, 770e, 770x */
   ^HKEY, /* R30, R31 */
   HKEY,  /* all others */
-); /* 570 */
+  );   /* 570 */
 
-IBM_HANDLE(lght, root, \\LGHT);  /* A21e, A2xm/p, T20-22, X20-21 */
-IBM_HANDLE(ledb, ec, LEDB);  /* G4x */
 
-IBM_HANDLE(led, ec, SLED,/* 570 */
-  SYSL,  /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, 
X20-21 */
-  LED,   /* all others */
-); /* R30, R31 */
-
-IBM_HANDLE(beep, ec, BEEP);  /* all except R30, R31 */
-IBM_HANDLE(ecrd, ec, ECRD);  /* 570 */
-IBM_HANDLE(ecwr, ec, ECWR);  /* 570 */
-IBM_HANDLE(fans, ec, FANS);  /* X31, X40, X41 */
-
-IBM_HANDLE(gfan, ec, 

asus-laptop: add wapf param

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=185e5af98b1e09b1e0f859332243223776b2ad57
Commit: 185e5af98b1e09b1e0f859332243223776b2ad57
Parent: fdd8d08084663242b42e27f7d71739f3f9009286
Author: Corentin Chary [EMAIL PROTECTED]
AuthorDate: Sun Mar 11 10:27:33 2007 +0100
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 11 15:44:59 2007 -0400

asus-laptop: add wapf param

Add the wapf param. This param allows to define the behavior
of  the Fn F2 key (wlan switch).

Signed-off-by: Corentin Chary [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/asus-laptop.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 475709b..d75e447 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -95,6 +95,19 @@ MODULE_AUTHOR(Julien Lerouge, Karol Kozimor, Corentin 
Chary);
 MODULE_DESCRIPTION(ASUS_HOTK_NAME);
 MODULE_LICENSE(GPL);
 
+/* WAPF defines the behavior of the Fn+Fx wlan key
+ * The significance of values is yet to be found, but
+ * most of the time:
+ * 0x0 will do nothing
+ * 0x1 will allow to control the device with Fn+Fx key.
+ * 0x4 will send an ACPI event (0x88) while pressing the Fn+Fx key
+ * 0x5 like 0x1 or 0x4
+ * So, if something doesn't work as you want, just try other values =)
+ */
+static uint wapf = 1;
+module_param(wapf, uint, 0644);
+MODULE_PARM_DESC(wapf, WAPF value);
+
 #define ASUS_HANDLE(object, paths...)  \
static acpi_handle  object##_handle = NULL; \
static char *object##_paths[] = { paths }
@@ -811,6 +824,9 @@ static int asus_hotk_get_info(void)
printk(ASUS_NOTICE BSTS called, 0x%02x returned\n,
   (uint) bsts_result);
 
+   /* This too ... */
+   write_acpi_int(hotk-handle, CWAP, wapf, NULL);
+
/*
 * Try to match the object returned by INIT to the specific model.
 * Handle every possible object (or the lack of thereof) the DSDT
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sony-laptop: Remove ACPI references from variable and function names.

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59b19106f3f20487093ea06c8220426147cf7835
Commit: 59b19106f3f20487093ea06c8220426147cf7835
Parent: 90f30eccf41302a2542f5d374af243061902bd98
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 10:19:04 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:18 2007 -0400

sony-laptop: Remove ACPI references from variable and function names.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |  186 ++--
 1 files changed, 93 insertions(+), 93 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index ac708bc..e67189a 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -35,9 +35,9 @@
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
 
-#define ACPI_SNC_CLASS sony
-#define ACPI_SNC_HID   SNY5001
-#define ACPI_SNC_DRIVER_NAME   ACPI Sony Notebook Control Driver v0.4
+#define SONY_NC_CLASS  sony
+#define SONY_NC_HIDSNY5001
+#define SONY_NC_DRIVER_NAMEACPI Sony Notebook Control Driver v0.4
 
 /* the device uses 1-based values, while the backlight subsystem uses
0-based values */
@@ -46,7 +46,7 @@
 #define LOG_PFXKERN_WARNING sony-laptop: 
 
 MODULE_AUTHOR(Stelian Pop, Mattia Dongili);
-MODULE_DESCRIPTION(ACPI_SNC_DRIVER_NAME);
+MODULE_DESCRIPTION(SONY_NC_DRIVER_NAME);
 MODULE_LICENSE(GPL);
 
 static int debug;
@@ -54,9 +54,9 @@ module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, set this to 1 (and RTFM) if you want to help 
 the development of this driver);
 
-static ssize_t sony_acpi_show(struct device *, struct device_attribute *,
+static ssize_t sony_nc_sysfs_show(struct device *, struct device_attribute *,
  char *);
-static ssize_t sony_acpi_store(struct device *, struct device_attribute *,
+static ssize_t sony_nc_sysfs_store(struct device *, struct device_attribute *,
   const char *, size_t);
 static int boolean_validate(const int, const int);
 static int brightness_default_validate(const int, const int);
@@ -64,7 +64,7 @@ static int brightness_default_validate(const int, const int);
 #define SNC_VALIDATE_IN0
 #define SNC_VALIDATE_OUT   1
 
-struct sony_acpi_value {
+struct sony_nc_value {
char *name; /* name of the entry */
char **acpiget; /* names of the ACPI get function */
char **acpiset; /* names of the ACPI set function */
@@ -75,65 +75,65 @@ struct sony_acpi_value {
struct device_attribute devattr;/* sysfs atribute */
 };
 
-#define HANDLE_NAMES(_name, _values...) \
+#define SNC_HANDLE_NAMES(_name, _values...) \
static char *snc_##_name[] = { _values, NULL }
 
-#define SONY_ACPI_VALUE(_name, _getters, _setters, _validate, _debug) \
+#define SNC_HANDLE(_name, _getters, _setters, _validate, _debug) \
{ \
.name   = __stringify(_name), \
.acpiget= _getters, \
.acpiset= _setters, \
.validate   = _validate, \
.debug  = _debug, \
-   .devattr= __ATTR(_name, 0, sony_acpi_show, 
sony_acpi_store), \
+   .devattr= __ATTR(_name, 0, sony_nc_sysfs_show, 
sony_nc_sysfs_store), \
}
 
-#define SONY_ACPI_VALUE_NULL   { .name = NULL }
+#define SNC_HANDLE_NULL{ .name = NULL }
 
-HANDLE_NAMES(fnkey_get, GHKE);
+SNC_HANDLE_NAMES(fnkey_get, GHKE);
 
-HANDLE_NAMES(brightness_def_get, GPBR);
-HANDLE_NAMES(brightness_def_set, SPBR);
+SNC_HANDLE_NAMES(brightness_def_get, GPBR);
+SNC_HANDLE_NAMES(brightness_def_set, SPBR);
 
-HANDLE_NAMES(cdpower_get, GCDP);
-HANDLE_NAMES(cdpower_set, SCDP, CDPW);
+SNC_HANDLE_NAMES(cdpower_get, GCDP);
+SNC_HANDLE_NAMES(cdpower_set, SCDP, CDPW);
 
-HANDLE_NAMES(audiopower_get, GAZP);
-HANDLE_NAMES(audiopower_set, AZPW);
+SNC_HANDLE_NAMES(audiopower_get, GAZP);
+SNC_HANDLE_NAMES(audiopower_set, AZPW);
 
-HANDLE_NAMES(lanpower_get, GLNP);
-HANDLE_NAMES(lanpower_set, LNPW);
+SNC_HANDLE_NAMES(lanpower_get, GLNP);
+SNC_HANDLE_NAMES(lanpower_set, LNPW);
 
-HANDLE_NAMES(PID_get, GPID);
+SNC_HANDLE_NAMES(PID_get, GPID);
 
-HANDLE_NAMES(CTR_get, GCTR);
-HANDLE_NAMES(CTR_set, SCTR);
+SNC_HANDLE_NAMES(CTR_get, GCTR);
+SNC_HANDLE_NAMES(CTR_set, SCTR);
 
-HANDLE_NAMES(PCR_get, GPCR);
-HANDLE_NAMES(PCR_set, SPCR);
+SNC_HANDLE_NAMES(PCR_get, GPCR);
+SNC_HANDLE_NAMES(PCR_set, SPCR);
 
-HANDLE_NAMES(CMI_get, GCMI);
-HANDLE_NAMES(CMI_set, SCMI);
+SNC_HANDLE_NAMES(CMI_get, GCMI);
+SNC_HANDLE_NAMES(CMI_set, SCMI);
 
-static struct sony_acpi_value sony_acpi_values[] = {
-   SONY_ACPI_VALUE(brightness_default, snc_brightness_def_get,
+static struct sony_nc_value sony_nc_values[] = {

sony-laptop: Add debug macros also used by the sonypi reimplementation

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b9a218b738c5c2387f666731b81a4376021d681e
Commit: b9a218b738c5c2387f666731b81a4376021d681e
Parent: 56b8756b3bc8812837a21f3e066dba1b489e071e
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 10:19:06 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:18 2007 -0400

sony-laptop: Add debug macros also used by the sonypi reimplementation

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 2d05d5b..f475537 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -35,6 +35,11 @@
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
 
+#define LOG_PFXKERN_WARNING sony-laptop: 
+#define dprintk(msg...)do {\
+   if (debug) printk(KERN_WARNING LOG_PFX  msg);   \
+} while (0)
+
 #define SONY_NC_CLASS  sony
 #define SONY_NC_HIDSNY5001
 #define SONY_NC_DRIVER_NAMEACPI Sony Notebook Control Driver v0.4
@@ -43,8 +48,6 @@
0-based values */
 #define SONY_MAX_BRIGHTNESS8
 
-#define LOG_PFXKERN_WARNING sony-laptop: 
-
 MODULE_AUTHOR(Stelian Pop, Mattia Dongili);
 MODULE_DESCRIPTION(SONY_NC_DRIVER_NAME);
 MODULE_LICENSE(GPL);
@@ -368,8 +371,7 @@ static struct backlight_ops sony_backlight_ops = {
  */
 static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-   if (debug)
-   printk(LOG_PFX sony_acpi_notify, event: %d\n, event);
+   dprintk(sony_acpi_notify, event: %d\n, event);
acpi_bus_generate_event(sony_nc_acpi_device, 1, event);
 }
 
@@ -472,9 +474,8 @@ static int sony_nc_add(struct acpi_device *device)
if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle,
 *item-acpiget,
 handle))) {
-   if (debug)
-   printk(LOG_PFX Found %s getter: %s\n,
-  item-name, *item-acpiget);
+   dprintk(Found %s getter: %s\n,
+   item-name, *item-acpiget);
item-devattr.attr.mode |= S_IRUGO;
break;
}
@@ -485,9 +486,8 @@ static int sony_nc_add(struct acpi_device *device)
if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle,
 *item-acpiset,
 handle))) {
-   if (debug)
-   printk(LOG_PFX Found %s setter: %s\n,
-  item-name, *item-acpiset);
+   dprintk(Found %s setter: %s\n,
+   item-name, *item-acpiset);
item-devattr.attr.mode |= S_IWUSR;
break;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: ibm-acpi: add header file

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1406cdd1760743106278c1f02a0f445159c8f400
Commit: 1406cdd1760743106278c1f02a0f445159c8f400
Parent: e062e0343871a41e8ec408f1c1e8ac3b0310da9d
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:56 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: add header file

Add a (private) header file for ibm-acpi, and move type definitions and
ThinkPad driver constants to the new header file.

This patch has no functional changes.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/ibm_acpi.c |  139 +---
 drivers/acpi/ibm_acpi.h |  437 +++
 2 files changed, 438 insertions(+), 138 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 41c46b0..e2da954 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -78,44 +78,13 @@
  *  2004-08-09 0.1 initial release, support for X series
  */
 
-#include linux/kernel.h
-#include linux/module.h
-#include linux/init.h
-#include linux/types.h
-#include linux/string.h
-
-#include linux/proc_fs.h
-#include linux/backlight.h
-#include linux/fb.h
-#include asm/uaccess.h
-
-#include linux/dmi.h
-#include linux/jiffies.h
-#include linux/workqueue.h
-
-#include acpi/acpi_drivers.h
-#include acpi/acnamesp.h
-
-#define IBM_NAME ibm
-#define IBM_DESC IBM ThinkPad ACPI Extras
-#define IBM_FILE ibm_acpi
-#define IBM_URL http://ibm-acpi.sf.net/;
+#include ibm_acpi.h
 
 MODULE_AUTHOR(Borislav Deianov, Henrique de Moraes Holschuh);
 MODULE_DESCRIPTION(IBM_DESC);
 MODULE_VERSION(IBM_VERSION);
 MODULE_LICENSE(GPL);
 
-#define IBM_DIR IBM_NAME
-
-#define IBM_LOG IBM_FILE : 
-#define IBM_ERR   KERN_ERRIBM_LOG
-#define IBM_NOTICE KERN_NOTICE IBM_LOG
-#define IBM_INFO   KERN_INFO   IBM_LOG
-#define IBM_DEBUG  KERN_DEBUG  IBM_LOG
-
-#define IBM_MAX_ACPI_ARGS 3
-
 #define __unused __attribute__ ((unused))
 
 static int experimental;
@@ -207,22 +176,6 @@ IBM_HANDLE(sfan, ec, SFAN,   /* 570 */
   JFNS,  /* 770x-JL */
 ); /* all others */
 
-#define IBM_HKEY_HID   IBM0068
-#define IBM_PCI_HIDPNP0A03
-
-enum thermal_access_mode {
-   IBMACPI_THERMAL_NONE = 0,   /* No thermal support */
-   IBMACPI_THERMAL_ACPI_TMP07, /* Use ACPI TMP0-7 */
-   IBMACPI_THERMAL_ACPI_UPDT,  /* Use ACPI TMP0-7 with UPDT */
-   IBMACPI_THERMAL_TPEC_8, /* Use ACPI EC regs, 8 sensors */
-   IBMACPI_THERMAL_TPEC_16,/* Use ACPI EC regs, 16 sensors */
-};
-
-#define IBMACPI_MAX_THERMAL_SENSORS 16 /* Max thermal sensors supported */
-struct ibm_thermal_sensors_struct {
-   s32 temp[IBMACPI_MAX_THERMAL_SENSORS];
-};
-
 /*
  * FAN ACCESS MODES
  *
@@ -323,72 +276,12 @@ struct ibm_thermal_sensors_struct {
  * but the ACPI tables just mention level 7.
  */
 
-enum fan_status_access_mode {
-   IBMACPI_FAN_NONE = 0,   /* No fan status or control */
-   IBMACPI_FAN_RD_ACPI_GFAN,   /* Use ACPI GFAN */
-   IBMACPI_FAN_RD_TPEC,/* Use ACPI EC regs 0x2f, 0x84-0x85 */
-};
-
-enum fan_control_access_mode {
-   IBMACPI_FAN_WR_NONE = 0,/* No fan control */
-   IBMACPI_FAN_WR_ACPI_SFAN,   /* Use ACPI SFAN */
-   IBMACPI_FAN_WR_TPEC,/* Use ACPI EC reg 0x2f */
-   IBMACPI_FAN_WR_ACPI_FANS,   /* Use ACPI FANS and EC reg 0x2f */
-};
-
-enum fan_control_commands {
-   IBMACPI_FAN_CMD_SPEED   = 0x0001,   /* speed command */
-   IBMACPI_FAN_CMD_LEVEL   = 0x0002,   /* level command  */
-   IBMACPI_FAN_CMD_ENABLE  = 0x0004,   /* enable/disable cmd,
-* and also watchdog cmd */
-};
-
-enum { /* Fan control constants */
-   fan_status_offset = 0x2f,   /* EC register 0x2f */
-   fan_rpm_offset = 0x84,  /* EC register 0x84: LSB, 0x85 MSB (RPM)
-* 0x84 must be read before 0x85 */
-
-   IBMACPI_FAN_EC_DISENGAGED   = 0x40, /* EC mode: tachometer
-* disengaged */
-   IBMACPI_FAN_EC_AUTO = 0x80, /* EC mode: auto fan
-* control */
-};
-
 static char *ibm_thinkpad_ec_found = NULL;
 
-struct ibm_struct {
-   char *name;
-   char param[32];
-
-   char *hid;
-   struct acpi_driver *driver;
-
-   int (*init) (void);
-   int (*read) (char *);
-   int (*write) (char *);
-   void (*exit) (void);
-
-   void (*notify) (struct ibm_struct *, u32);
-   acpi_handle *handle;
-   int type;
-   struct acpi_device *device;
-
-   int driver_registered;
-   

sony-laptop: Add SNY6001 device handling (sonypi reimplementation)

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=33a04454527edd33d4a6332a2944d2b4f46fbb18
Commit: 33a04454527edd33d4a6332a2944d2b4f46fbb18
Parent: b9a218b738c5c2387f666731b81a4376021d681e
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Mon Apr 9 19:26:03 2007 +0200
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Tue Apr 10 16:01:19 2007 -0400

sony-laptop: Add SNY6001 device handling (sonypi reimplementation)

Reimplement sonypi using ACPI only functions.

Signed-off-by: Mattia Dongili [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/sony-laptop.c | 1085 +++-
 1 files changed, 1072 insertions(+), 13 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index f475537..b797c8c 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1,5 +1,5 @@
 /*
- * ACPI Sony Notebook Control Driver (SNC)
+ * ACPI Sony Notebook Control Driver (SNC and SPIC)
  *
  * Copyright (C) 2004-2005 Stelian Pop [EMAIL PROTECTED]
  * Copyright (C) 2007 Mattia Dongili [EMAIL PROTECTED]
@@ -7,6 +7,25 @@
  * Parts of this driver inspired from asus_acpi.c and ibm_acpi.c
  * which are copyrighted by their respective authors.
  *
+ * The SNY6001 driver part is based on the sonypi driver which includes
+ * material from:
+ *
+ * Copyright (C) 2001-2005 Stelian Pop [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2005 Narayanan R S [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2001-2002 Alc�ve www.alcove.com
+ *
+ * Copyright (C) 2001 Michael Ashley [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2001 Junichi Morita [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2000 Takaya Kinjo [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2000 Andrew Tridgell [EMAIL PROTECTED]
+ *
+ * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -31,32 +50,65 @@
 #include linux/backlight.h
 #include linux/platform_device.h
 #include linux/err.h
+#include linux/dmi.h
+#include linux/pci.h
+#include linux/interrupt.h
+#include linux/delay.h
+#include linux/input.h
+#include linux/kfifo.h
+#include linux/workqueue.h
+#include linux/acpi.h
 #include acpi/acpi_drivers.h
 #include acpi/acpi_bus.h
 #include asm/uaccess.h
+#include linux/sonypi.h
 
-#define LOG_PFXKERN_WARNING sony-laptop: 
+#define DRV_PFXsony-laptop: 
+#define LOG_PFXKERN_WARNING DRV_PFX
 #define dprintk(msg...)do {\
-   if (debug) printk(KERN_WARNING LOG_PFX  msg);   \
+   if (debug) printk(LOG_PFX  msg);\
 } while (0)
 
-#define SONY_NC_CLASS  sony
+#define SONY_LAPTOP_DRIVER_VERSION 0.5
+
+#define SONY_NC_CLASS  sony-nc
 #define SONY_NC_HIDSNY5001
-#define SONY_NC_DRIVER_NAMEACPI Sony Notebook Control Driver v0.4
+#define SONY_NC_DRIVER_NAMESony Notebook Control
 
-/* the device uses 1-based values, while the backlight subsystem uses
-   0-based values */
-#define SONY_MAX_BRIGHTNESS8
+#define SONY_PIC_CLASS sony-pic
+#define SONY_PIC_HID   SNY6001
+#define SONY_PIC_DRIVER_NAME   Sony Programmable IO Control
 
 MODULE_AUTHOR(Stelian Pop, Mattia Dongili);
-MODULE_DESCRIPTION(SONY_NC_DRIVER_NAME);
+MODULE_DESCRIPTION(Sony laptop extras driver (SPIC and SNC ACPI device));
 MODULE_LICENSE(GPL);
+MODULE_VERSION(SONY_LAPTOP_DRIVER_VERSION);
 
 static int debug;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, set this to 1 (and RTFM) if you want to help 
 the development of this driver);
 
+static int no_spic;/* = 0 */
+module_param(no_spic, int, 0444);
+MODULE_PARM_DESC(no_spic,
+set this if you don't want to enable the SPIC device);
+
+static int compat; /* = 0 */
+module_param(compat, int, 0444);
+MODULE_PARM_DESC(compat,
+set this if you want to enable backward compatibility mode);
+
+static int force_jog;  /* = 0 */
+module_param(force_jog, int, 0444);
+MODULE_PARM_DESC(force_jog,
+set this if the driver doesn't detect your jogdial);
+
+static unsigned long mask = 0x;
+module_param(mask, ulong, 0644);
+MODULE_PARM_DESC(mask,
+set this to the mask of event you want to enable (see doc));
+
 /*** Platform Device ***/
 
 static atomic_t sony_pf_users = ATOMIC_INIT(0);
@@ -115,6 +167,13 @@ static void sony_pf_remove(void)
 
 /*** SNC (SNY5001) Device ***/
 
+/* the device uses 1-based values, while the backlight subsystem uses
+   0-based values */
+#define SONY_MAX_BRIGHTNESS8
+
+#define SNC_VALIDATE_IN0
+#define 

asus-laptop: use acpi_evaluate_integer instead of read_acpi_int

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a8168500674b1062afe438d34d0c8216d38dc31
Commit: 9a8168500674b1062afe438d34d0c8216d38dc31
Parent: be521466feb3bb1cd89de82a2b1d080e9ebd3cb6
Author: Corentin Chary [EMAIL PROTECTED]
AuthorDate: Sun Mar 11 10:25:38 2007 +0100
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 11 15:44:36 2007 -0400

asus-laptop: use acpi_evaluate_integer instead of read_acpi_int

Use acpi_evaluate_integer() instead of read_acpi_int()

Signed-off-by: Corentin Chary [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/asus-laptop.c |   68 ++--
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 4b23212..dcab778 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -245,32 +245,19 @@ static int write_acpi_int(acpi_handle handle, const char 
*method, int val,
return (status == AE_OK);
 }
 
-static int read_acpi_int(acpi_handle handle, const char *method, int *val,
-struct acpi_object_list *params)
-{
-   struct acpi_buffer output;
-   union acpi_object out_obj;
-   acpi_status status;
-
-   output.length = sizeof(out_obj);
-   output.pointer = out_obj;
-
-   status = acpi_evaluate_object(handle, (char *)method, params, output);
-   *val = out_obj.integer.value;
-   return (status == AE_OK)  (out_obj.type == ACPI_TYPE_INTEGER);
-}
-
 static int read_wireless_status(int mask)
 {
-   int status;
+   ulong status;
+   acpi_status rv = AE_OK;
 
if (!wireless_status_handle)
return (hotk-status  mask) ? 1 : 0;
 
-   if (read_acpi_int(wireless_status_handle, NULL, status, NULL)) {
-   return (status  mask) ? 1 : 0;
-   } else
+   rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, status);
+   if (ACPI_FAILURE(rv))
printk(ASUS_WARNING Error reading Wireless status\n);
+   else
+   return (status  mask) ? 1 : 0;
 
return (hotk-status  mask) ? 1 : 0;
 }
@@ -354,9 +341,11 @@ static void lcd_blank(int blank)
 
 static int read_brightness(struct backlight_device *bd)
 {
-   int value;
+   ulong value;
+   acpi_status rv = AE_OK;
 
-   if (!read_acpi_int(brightness_get_handle, NULL, value, NULL))
+   rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, value);
+   if (ACPI_FAILURE(rv))
printk(ASUS_WARNING Error reading brightness\n);
 
return value;
@@ -403,8 +392,10 @@ static ssize_t show_infos(struct device *dev,
  struct device_attribute *attr, char *page)
 {
int len = 0;
-   int temp;
+   ulong temp;
char buf[16];   //enough for all info
+   acpi_status rv = AE_OK;
+
/*
 * We use the easy way, we don't care of off and count, so we don't set 
eof
 * to 1
@@ -418,9 +409,10 @@ static ssize_t show_infos(struct device *dev,
 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
 * The significance of others is yet to be found.
 */
-   if (read_acpi_int(hotk-handle, SFUN, temp, NULL))
-   len +=
-   sprintf(page + len, SFUN value : 0x%04x\n, temp);
+   rv = acpi_evaluate_integer(hotk-handle, SFUN, NULL, temp);
+   if (!ACPI_FAILURE(rv))
+   len += sprintf(page + len, SFUN value : 0x%04x\n,
+  (uint) temp);
/*
 * Another value for userspace: the ASYM method returns 0x02 for
 * battery low and 0x04 for battery critical, its readings tend to be
@@ -428,9 +420,10 @@ static ssize_t show_infos(struct device *dev,
 * Note: since not all the laptops provide this method, errors are
 * silently ignored.
 */
-   if (read_acpi_int(hotk-handle, ASYM, temp, NULL))
-   len +=
-   sprintf(page + len, ASYM value : 0x%04x\n, temp);
+   rv = acpi_evaluate_integer(hotk-handle, ASYM, NULL, temp);
+   if (!ACPI_FAILURE(rv))
+   len += sprintf(page + len, ASYM value : 0x%04x\n,
+  (uint) temp);
if (asus_info) {
snprintf(buf, 16, %d, asus_info-length);
len += sprintf(page + len, DSDT length: %s\n, buf);
@@ -547,12 +540,15 @@ static void set_display(int value)
 
 static int read_display(void)
 {
-   int value = 0;
+   ulong value = 0;
+   acpi_status rv = AE_OK;
 
/* In most of the case, we know how to set the display, but sometime
   we can't read it */
if (display_get_handle) {
-   if (!read_acpi_int(display_get_handle, NULL, value, NULL))
+   rv = 

asus-laptop: clean write_status

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=935ffeeca84fe5d48d0cc9f35c58db42b384229f
Commit: 935ffeeca84fe5d48d0cc9f35c58db42b384229f
Parent: 9a8168500674b1062afe438d34d0c8216d38dc31
Author: Corentin Chary [EMAIL PROTECTED]
AuthorDate: Sun Mar 11 10:26:12 2007 +0100
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 11 15:44:46 2007 -0400

asus-laptop: clean write_status

Clean the write_status function, and implement special case with
a switch inside write_status. It also make sure bt and wl status
are right when booting with the hardware switch off.

Signed-off-by: Corentin Chary [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/asus-laptop.c |   48 ++-
 1 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index dcab778..3ba5798 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -272,19 +272,25 @@ static int read_status(int mask)
return (hotk-status  mask) ? 1 : 0;
 }
 
-static void write_status(acpi_handle handle, int out, int mask, int invert)
+static void write_status(acpi_handle handle, int out, int mask)
 {
hotk-status = (out) ? (hotk-status | mask) : (hotk-status  ~mask);
 
-   if (invert) /* invert target value */
+   switch (mask) {
+   case MLED_ON:
out = !out  0x1;
+   break;
+   default:
+   out = 0x1;
+   break;
+   }
 
if (handle  !write_acpi_int(handle, NULL, out, NULL))
-   printk(ASUS_WARNING  write failed\n);
+   printk(ASUS_WARNING  write failed %x\n, mask);
 }
 
 /* /sys/class/led handlers */
-#define ASUS_LED_HANDLER(object, mask, invert) \
+#define ASUS_LED_HANDLER(object, mask) \
static void object##_led_set(struct led_classdev *led_cdev, \
 enum led_brightness value) \
{   \
@@ -294,13 +300,13 @@ static void write_status(acpi_handle handle, int out, int 
mask, int invert)
static void object##_led_update(struct work_struct *ignored)\
{   \
int value = object##_led_wk;\
-   write_status(object##_set_handle, value, (mask), (invert)); \
+   write_status(object##_set_handle, value, (mask));   \
}
 
-ASUS_LED_HANDLER(mled, MLED_ON, 1);
-ASUS_LED_HANDLER(pled, PLED_ON, 0);
-ASUS_LED_HANDLER(rled, RLED_ON, 0);
-ASUS_LED_HANDLER(tled, TLED_ON, 0);
+ASUS_LED_HANDLER(mled, MLED_ON);
+ASUS_LED_HANDLER(pled, PLED_ON);
+ASUS_LED_HANDLER(rled, RLED_ON);
+ASUS_LED_HANDLER(tled, TLED_ON);
 
 static int get_lcd_state(void)
 {
@@ -325,7 +331,7 @@ static int set_lcd_state(int value)
printk(ASUS_WARNING Error switching LCD\n);
}
 
-   write_status(NULL, lcd, LCD_ON, 0);
+   write_status(NULL, lcd, LCD_ON);
return 0;
 }
 
@@ -458,7 +464,7 @@ static int parse_arg(const char *buf, unsigned long count, 
int *val)
 }
 
 static ssize_t store_status(const char *buf, size_t count,
-   acpi_handle handle, int mask, int invert)
+   acpi_handle handle, int mask)
 {
int rv, value;
int out = 0;
@@ -467,7 +473,7 @@ static ssize_t store_status(const char *buf, size_t count,
if (rv  0)
out = value ? 1 : 0;
 
-   write_status(handle, out, mask, invert);
+   write_status(handle, out, mask);
 
return rv;
 }
@@ -508,7 +514,7 @@ static ssize_t show_wlan(struct device *dev,
 static ssize_t store_wlan(struct device *dev, struct device_attribute *attr,
  const char *buf, size_t count)
 {
-   return store_status(buf, count, wl_switch_handle, WL_ON, 0);
+   return store_status(buf, count, wl_switch_handle, WL_ON);
 }
 
 /*
@@ -524,7 +530,7 @@ static ssize_t store_bluetooth(struct device *dev,
   struct device_attribute *attr, const char *buf,
   size_t count)
 {
-   return store_status(buf, count, bt_switch_handle, BT_ON, 0);
+   return store_status(buf, count, bt_switch_handle, BT_ON);
 }
 
 /*
@@ -652,10 +658,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 
event, void *data)
 * switched
 */
if (event == ATKD_LCD_ON) {
-   write_status(NULL, 1, LCD_ON, 0);
+   write_status(NULL, 1, LCD_ON);
lcd_blank(FB_BLANK_UNBLANK);
} else if (event == ATKD_LCD_OFF) {
-   write_status(NULL, 0, LCD_ON, 0);
+   write_status(NULL, 0, LCD_ON);

ACPI: thinkpad-acpi: cleanup Kconfig for thinkpad-acpi

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85998248b2e8c6ae7d3ad1fa7b059aed22205ec4
Commit: 85998248b2e8c6ae7d3ad1fa7b059aed22205ec4
Parent: f21f85de4b3b9ad4a671fb19a889c16db2ea38b2
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Thu Mar 29 01:58:41 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Fri Mar 30 15:35:42 2007 -0400

ACPI: thinkpad-acpi: cleanup Kconfig for thinkpad-acpi

Since ibm-acpi was renamed to thinkpad-acpi, rename and update its Kconfig
entries and Kconfig-related symbols accordingly.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/Kconfig |   37 -
 drivers/misc/Makefile|2 +-
 drivers/misc/thinkpad_acpi.c |   26 +-
 drivers/misc/thinkpad_acpi.h |8 
 4 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 5d2bcbf..2cd96a3 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -122,40 +122,43 @@ config SONY_LAPTOP
 
  Read file:Documentation/sony-laptop.txt for more information.
 
-config ACPI_IBM
-   tristate IBM ThinkPad Laptop Extras
+config THINKPAD_ACPI
+   tristate ThinkPad ACPI Laptop Extras
depends on X86  ACPI
select BACKLIGHT_CLASS_DEVICE
---help---
- This is a Linux ACPI driver for the IBM ThinkPad laptops. It adds
+ This is a driver for the IBM and Lenovo ThinkPad laptops. It adds
  support for Fn-Fx key combinations, Bluetooth control, video
  output switching, ThinkLight control, UltraBay eject and more.
- For more information about this driver see 
file:Documentation/ibm-acpi.txt
- and http://ibm-acpi.sf.net/ .
+ For more information about this driver see 
+ file:Documentation/thinkpad-acpi.txt and http://ibm-acpi.sf.net/ .
 
- If you have an IBM ThinkPad laptop, say Y or M here.
+ This driver was formely known as ibm-acpi.
 
-config ACPI_IBM_DOCK
+ If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
+
+config THINKPAD_ACPI_DOCK
bool Legacy Docking Station Support
-   depends on ACPI_IBM
+   depends on THINKPAD_ACPI
depends on ACPI_DOCK=n
default n
---help---
- Allows the ibm_acpi driver to handle docking station events.
- This support is obsoleted by CONFIG_HOTPLUG_PCI_ACPI.  It will
- allow locking and removing the laptop from the docking station,
- but will not properly connect PCI devices.
+ Allows the thinkpad_acpi driver to handle docking station events.
+ This support was made obsolete by the generic ACPI docking station
+ support (CONFIG_ACPI_DOCK).  It will allow locking and removing the
+ laptop from the docking station, but will not properly connect PCI
+ devices.
 
  If you are not sure, say N here.
 
-config ACPI_IBM_BAY
+config THINKPAD_ACPI_BAY
bool Legacy Removable Bay Support
-   depends on ACPI_IBM
+   depends on THINKPAD_ACPI
default y
---help---
- Allows the ibm_acpi driver to handle removable bays.  It will allow
- disabling the device in the bay, and also generate notifications when
- the bay lever is ejected or inserted.
+ Allows the thinkpad_acpi driver to handle removable bays.  It will
+ eletrically disable the device in the bay, and also generate
+ notifications when the bay lever is ejected or inserted.
 
  If you are not sure, say Y here.
 
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index ebf4ff2..e325164 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -12,4 +12,4 @@ obj-$(CONFIG_TIFM_CORE)   += tifm_core.o
 obj-$(CONFIG_TIFM_7XX1)+= tifm_7xx1.o
 obj-$(CONFIG_SGI_IOC4) += ioc4.o
 obj-$(CONFIG_SONY_LAPTOP)  += sony-laptop.o
-obj-$(CONFIG_ACPI_IBM) += thinkpad_acpi.o
+obj-$(CONFIG_THINKPAD_ACPI)+= thinkpad_acpi.o
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 2836516..bb789db 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1040,7 +1040,7 @@ static int light_write(char *buf)
 /* don't list other alternatives as we install a notify handler on the 570 */
 IBM_HANDLE(pci, root, \\_SB.PCI);/* 570 */
 
-#ifdef CONFIG_ACPI_IBM_DOCK
+#ifdef CONFIG_THINKPAD_ACPI_DOCK
 
 IBM_HANDLE(dock, root, \\_SB.GDCK,   /* X30, X31, X40 */
   \\_SB.PCI0.DOCK,   /* 600e/x,770e,770x,A2xm/p,T20-22,X20-21 */
@@ -,13 +,13 @@ static int dock_write(char *buf)
return 0;
 }
 
-#endif /* CONFIG_ACPI_IBM_DOCK */
+#endif /* CONFIG_THINKPAD_ACPI_DOCK */
 
 

ACPI: ibm-acpi: rename some identifiers

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e062e0343871a41e8ec408f1c1e8ac3b0310da9d
Commit: e062e0343871a41e8ec408f1c1e8ac3b0310da9d
Parent: 837ca6ddb440c186eaa8e01b69486581d3457f2c
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:55 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: rename some identifiers

Rename some identifiers so that they are more in tune with the rest of the
driver code, or less generic.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/ibm_acpi.c |   43 ---
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 60aaed9..41c46b0 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -506,7 +506,7 @@ static int ibm_acpi_driver_init(void)
return 0;
 }
 
-static int driver_read(char *p)
+static int ibm_acpi_driver_read(char *p)
 {
int len = 0;
 
@@ -1310,9 +1310,9 @@ static const int led_exp_hlbl[] = { 0, 0, 1 };/* led# 
* */
 static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */
 static const int led_led_arg1[] = { 0, 0x80, 0xc0 };
 
-#define EC_HLCL 0x0c
-#define EC_HLBL 0x0d
-#define EC_HLMS 0x0e
+#define IBMACPI_LED_EC_HLCL 0x0c
+#define IBMACPI_LED_EC_HLBL 0x0d
+#define IBMACPI_LED_EC_HLMS 0x0e
 
 static int led_write(char *buf)
 {
@@ -1344,13 +1344,15 @@ static int led_write(char *buf)
} else if (led_supported == IBMACPI_LED_OLD) {
/* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */
led = 1  led;
-   ret = ec_write(EC_HLMS, led);
+   ret = ec_write(IBMACPI_LED_EC_HLMS, led);
if (ret = 0)
ret =
-   ec_write(EC_HLBL, led * led_exp_hlbl[ind]);
+   ec_write(IBMACPI_LED_EC_HLBL,
+led * led_exp_hlbl[ind]);
if (ret = 0)
ret =
-   ec_write(EC_HLCL, led * led_exp_hlcl[ind]);
+   ec_write(IBMACPI_LED_EC_HLCL,
+led * led_exp_hlcl[ind]);
if (ret  0)
return ret;
} else {
@@ -1657,8 +1659,8 @@ static int brightness_read(char *p)
return len;
 }
 
-#define BRIGHTNESS_UP  4
-#define BRIGHTNESS_DOWN5
+#define TP_CMOS_BRIGHTNESS_UP  4
+#define TP_CMOS_BRIGHTNESS_DOWN5
 
 static int brightness_set(int value)
 {
@@ -1667,7 +1669,8 @@ static int brightness_set(int value)
 
value = 7;
 
-   cmos_cmd = value  current_value ? BRIGHTNESS_UP : BRIGHTNESS_DOWN;
+   cmos_cmd = value  current_value ?
+  TP_CMOS_BRIGHTNESS_UP : TP_CMOS_BRIGHTNESS_DOWN;
inc = value  current_value ? 1 : -1;
for (i = current_value; i != value; i += inc) {
if (!cmos_eval(cmos_cmd))
@@ -1769,9 +1772,9 @@ static int volume_read(char *p)
return len;
 }
 
-#define VOLUME_DOWN0
-#define VOLUME_UP  1
-#define VOLUME_MUTE2
+#define TP_CMOS_VOLUME_DOWN0
+#define TP_CMOS_VOLUME_UP  1
+#define TP_CMOS_VOLUME_MUTE2
 
 static int volume_write(char *buf)
 {
@@ -1805,7 +1808,8 @@ static int volume_write(char *buf)
return -EINVAL;
 
if (new_level != level) {   /* mute doesn't change */
-   cmos_cmd = new_level  level ? VOLUME_UP : VOLUME_DOWN;
+   cmos_cmd = new_level  level ?
+   TP_CMOS_VOLUME_UP : TP_CMOS_VOLUME_DOWN;
inc = new_level  level ? 1 : -1;
 
if (mute  (!cmos_eval(cmos_cmd) ||
@@ -1817,14 +1821,15 @@ static int volume_write(char *buf)
!acpi_ec_write(volume_offset, i + inc))
return -EIO;
 
-   if (mute  (!cmos_eval(VOLUME_MUTE) ||
+   if (mute  (!cmos_eval(TP_CMOS_VOLUME_MUTE) ||
 !acpi_ec_write(volume_offset,
new_level + mute)))
return -EIO;
}
 
if (new_mute != mute) { /* level doesn't change */
-   cmos_cmd = new_mute ? VOLUME_MUTE : VOLUME_UP;
+   cmos_cmd = new_mute ?
+  TP_CMOS_VOLUME_MUTE : TP_CMOS_VOLUME_UP;
 
if (!cmos_eval(cmos_cmd) ||
!acpi_ec_write(volume_offset, 

ACPI: ibm-acpi: kill trailing whitespace

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=837ca6ddb440c186eaa8e01b69486581d3457f2c
Commit: 837ca6ddb440c186eaa8e01b69486581d3457f2c
Parent: e0f2e3a06be513352cb4955313ed7e55909acd84
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Fri Mar 23 17:33:54 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sun Mar 25 23:37:54 2007 -0400

ACPI: ibm-acpi: kill trailing whitespace

I shall protect the ibm-acpi city against the invasion of the barbarian
blanks!  To the unforgiving jaws of sed s/[[:blank:]]\+$// they go!

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/ibm-acpi.txt |6 +++---
 drivers/acpi/ibm_acpi.c|6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/ibm-acpi.txt b/Documentation/ibm-acpi.txt
index 0132d36..cdcef01 100644
--- a/Documentation/ibm-acpi.txt
+++ b/Documentation/ibm-acpi.txt
@@ -21,7 +21,7 @@ detailed description):
 
- Fn key combinations
- Bluetooth enable and disable
-   - video output switching, expansion control 
+   - video output switching, expansion control
- ThinkLight on and off
- limited docking and undocking
- UltraBay eject
@@ -472,7 +472,7 @@ This feature dumps the values of 256 embedded controller
 registers. Values which have changed since the last time the registers
 were dumped are marked with a star:
 
[EMAIL PROTECTED] ibm-acpi]# cat /proc/acpi/ibm/ecdump 
[EMAIL PROTECTED] ibm-acpi]# cat /proc/acpi/ibm/ecdump
 EC   +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
 EC 0x00:  a7  47  87  01  fe  96  00  08  01  00  cb  00  00  00  40  00
 EC 0x10:  00  00  ff  ff  f4  3c  87  09  01  ff  42  01  ff  ff  0d  00
@@ -503,7 +503,7 @@ vary. The second ensures that the fan-related values do 
vary, since
 the fan speed fluctuates a bit. The third will (hopefully) mark the
 fan register with a star:
 
[EMAIL PROTECTED] ibm-acpi]# cat /proc/acpi/ibm/ecdump 
[EMAIL PROTECTED] ibm-acpi]# cat /proc/acpi/ibm/ecdump
 EC   +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
 EC 0x00:  a7  47  87  01  fe  96  00  08  01  00  cb  00  00  00  40  00
 EC 0x10:  00  00  ff  ff  f4  3c  87  09  01  ff  42  01  ff  ff  0d  00
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index dc10966..60aaed9 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -28,7 +28,7 @@
  *  2006-11-22 0.13new maintainer
  * changelog now lives in git commit history, and will
  * not be updated further in-file.
- *  
+ *
  *  2005-08-17  0.12   fix compilation on 2.6.13-rc kernels
  *  2005-03-17 0.11support for 600e, 770x
  * thanks to Jamie Lentin [EMAIL PROTECTED]
@@ -38,7 +38,7 @@
  * experimental brightness control
  * experimental volume control
  * experimental fan enable/disable
- *  2005-01-16 0.10fix module loading on R30, R31 
+ *  2005-01-16 0.10fix module loading on R30, R31
  *  2005-01-16 0.9 support for 570, R30, R31
  * ultrabay support on A22p, A3x
  * limit arg for cmos, led, beep, drop experimental status
@@ -161,7 +161,7 @@ IBM_HANDLE(dock, root, \\_SB.GDCK,/* X30, X31, 
X40 */
 #ifdef CONFIG_ACPI_IBM_BAY
 IBM_HANDLE(bay, root, \\_SB.PCI.IDE.SECN.MAST,   /* 570 */
   \\_SB.PCI0.IDE0.IDES.IDSM, /* 600e/x, 770e, 770x */
-  \\_SB.PCI0.SATA.SCND.MSTR, /* T60, X60, Z60 */ 
+  \\_SB.PCI0.SATA.SCND.MSTR, /* T60, X60, Z60 */
   \\_SB.PCI0.IDE0.SCND.MSTR, /* all others */
 ); /* A21e, R30, R31 */
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: add compatibility MODULE_ALIAS entry

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d903ac5455102b13d0e28d6a39f640175fb4cd4d
Commit: d903ac5455102b13d0e28d6a39f640175fb4cd4d
Parent: 85998248b2e8c6ae7d3ad1fa7b059aed22205ec4
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Thu Mar 29 01:58:42 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Fri Mar 30 15:35:42 2007 -0400

ACPI: thinkpad-acpi: add compatibility MODULE_ALIAS entry

Add a ibm_acpi module alias for userpace, so that modprobe ibm_acpi will
still load the correct driver.  This alias can be removed in the future,
probably two years from now if nothing warrants removing it sooner.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index bb789db..90ffc46 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -86,6 +86,9 @@ MODULE_DESCRIPTION(IBM_DESC);
 MODULE_VERSION(IBM_VERSION);
 MODULE_LICENSE(GPL);
 
+/* Please remove this in year 2009 */
+MODULE_ALIAS(ibm_acpi);
+
 #define __unused __attribute__ ((unused))
 
 /
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: update MAINTAINERS

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=756970ad4bb93027a60da2de9b43d094b7f387a2
Commit: 756970ad4bb93027a60da2de9b43d094b7f387a2
Parent: 643f12dbb660e139fbaea268f3e3ce4d7d594b8f
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Thu Mar 29 01:58:44 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Fri Mar 30 15:35:42 2007 -0400

ACPI: thinkpad-acpi: update MAINTAINERS

Update MAINTAINERS file for the ibm-acpi - thinkpad-acpi renaming.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 MAINTAINERS |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index dd6978b..7d42183 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1618,15 +1618,6 @@ W:   http://www.ia64-linux.org/
 T: git kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
 S: Maintained
 
-IBM ACPI EXTRAS DRIVER
-P: Henrique de Moraes Holschuh
-M: [EMAIL PROTECTED]
-L: [EMAIL PROTECTED]
-W: http://ibm-acpi.sourceforge.net
-W: http://thinkwiki.org/wiki/Ibm-acpi
-T: git repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
-S: Maintained
-
 SN-IA64 (Itanium) SUB-PLATFORM
 P: Jes Sorensen
 M: [EMAIL PROTECTED]
@@ -3118,6 +3109,15 @@ P:   Chris Zankel
 M: [EMAIL PROTECTED]
 S: Maintained
 
+THINKPAD ACPI EXTRAS DRIVER
+P: Henrique de Moraes Holschuh
+M: [EMAIL PROTECTED]
+L: [EMAIL PROTECTED]
+W: http://ibm-acpi.sourceforge.net
+W: http://thinkwiki.org/wiki/Ibm-acpi
+T: git repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
+S: Maintained
+
 UltraSPARC (sparc64):
 P: David S. Miller
 M: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: rename register_ibmacpi_subdriver

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6700121b535fa16fe1c8aaac03559b2f12909726
Commit: 6700121b535fa16fe1c8aaac03559b2f12909726
Parent: 756970ad4bb93027a60da2de9b43d094b7f387a2
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:25 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:32 2007 -0400

ACPI: thinkpad-acpi: rename register_ibmacpi_subdriver

Rename register_ibmacpi_subdriver to register_tpacpi_subdriver, as
we are not called ibmacpi anymore.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |4 ++--
 drivers/misc/thinkpad_acpi.h |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index ddaedf8..cac73e5 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -345,7 +345,7 @@ static int __init ibm_device_add(struct acpi_device *device)
return 0;
 }
 
-static int __init register_ibmacpi_subdriver(struct ibm_struct *ibm)
+static int __init register_tpacpi_subdriver(struct ibm_struct *ibm)
 {
int ret;
 
@@ -2574,7 +2574,7 @@ static int __init ibm_init(struct ibm_struct *ibm)
return 0;
 
if (ibm-hid) {
-   ret = register_ibmacpi_subdriver(ibm);
+   ret = register_tpacpi_subdriver(ibm);
if (ret  0)
return ret;
ibm-driver_registered = 1;
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 015c02b..b86e574 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -157,7 +157,7 @@ static void ibm_exit(struct ibm_struct *ibm);
 static void dispatch_notify(acpi_handle handle, u32 event, void *data);
 static int setup_notify(struct ibm_struct *ibm);
 static int ibm_device_add(struct acpi_device *device);
-static int register_ibmacpi_subdriver(struct ibm_struct *ibm);
+static int register_tpacpi_subdriver(struct ibm_struct *ibm);
 
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: rename one stray use of ibm-acpi in a comment

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=142cfc90f026b0b8fd1a14ba11ae29eb7b1b6ca1
Commit: 142cfc90f026b0b8fd1a14ba11ae29eb7b1b6ca1
Parent: 6700121b535fa16fe1c8aaac03559b2f12909726
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:26 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: rename one stray use of ibm-acpi in a comment

Rename a stray use of ibm-acpi on a comment, no functional changes.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index cac73e5..4b43486 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -459,7 +459,7 @@ static char *next_cmd(char **cmds)
  /
 
 /*
- * ibm-acpi init subdriver
+ * thinkpad-acpi init subdriver
  */
 
 static int thinkpad_acpi_driver_init(void)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: rename module glue

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1def7115f0277ce9d2a54efd0ae187aa88d5c7fa
Commit: 1def7115f0277ce9d2a54efd0ae187aa88d5c7fa
Parent: 142cfc90f026b0b8fd1a14ba11ae29eb7b1b6ca1
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:27 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: rename module glue

Rename module init and exit functions, now that we are not called ibm-acpi
anymore.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   12 ++--
 drivers/misc/thinkpad_acpi.h |4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 4b43486..80ef195 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -2707,7 +2707,7 @@ IBM_PARAM(brightness);
 IBM_PARAM(volume);
 IBM_PARAM(fan);
 
-static int __init acpi_ibm_init(void)
+static int __init thinkpad_acpi_module_init(void)
 {
int ret, i;
 
@@ -2754,7 +2754,7 @@ static int __init acpi_ibm_init(void)
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
if (!proc_dir) {
printk(IBM_ERR unable to create proc dir %s, IBM_DIR);
-   acpi_ibm_exit();
+   thinkpad_acpi_module_exit();
return -ENODEV;
}
proc_dir-owner = THIS_MODULE;
@@ -2764,7 +2764,7 @@ static int __init acpi_ibm_init(void)
if (ret = 0  *ibms[i].param)
ret = ibms[i].write(ibms[i].param);
if (ret  0) {
-   acpi_ibm_exit();
+   thinkpad_acpi_module_exit();
return ret;
}
}
@@ -2772,7 +2772,7 @@ static int __init acpi_ibm_init(void)
return 0;
 }
 
-static void acpi_ibm_exit(void)
+static void thinkpad_acpi_module_exit(void)
 {
int i;
 
@@ -2786,5 +2786,5 @@ static void acpi_ibm_exit(void)
kfree(ibm_thinkpad_ec_found);
 }
 
-module_init(acpi_ibm_init);
-module_exit(acpi_ibm_exit);
+module_init(thinkpad_acpi_module_init);
+module_exit(thinkpad_acpi_module_exit);
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index b86e574..8b2fd1a 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -115,8 +115,8 @@ static int experimental;
 static char *ibm_thinkpad_ec_found;
 
 static char* check_dmi_for_ec(void);
-static int acpi_ibm_init(void);
-static void acpi_ibm_exit(void);
+static int thinkpad_acpi_module_init(void);
+static void thinkpad_acpi_module_exit(void);
 
 
 /
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: update fan firmware documentation

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f51d1a39840ae5e8678d702ab57377c611fc3826
Commit: f51d1a39840ae5e8678d702ab57377c611fc3826
Parent: efa27145df34eacf2569bd45f68dbe3d3616
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:29 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: update fan firmware documentation

Update some stuff in the in-code text describing the ThinkPad fan
firmware.  This patch has no code changes.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   28 +---
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 1683bfe..4131a78 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1852,16 +1852,17 @@ static int volume_write(char *buf)
  * ACPI GFAN method: returns fan level
  *
  * see TPACPI_FAN_WR_ACPI_SFAN
- * EC 0x2f not available if GFAN exists
+ * EC 0x2f (HFSP) not available if GFAN exists
  *
  * TPACPI_FAN_WR_ACPI_SFAN:
  * ACPI SFAN method: sets fan level, 0 (stop) to 7 (max)
  *
- * EC 0x2f might be available *for reading*, but never for writing.
+ * EC 0x2f (HFSP) might be available *for reading*, but do not use
+ * it for writing.
  *
  * TPACPI_FAN_WR_TPEC:
- * ThinkPad EC register 0x2f (HFSP): fan control loop mode Supported
- * on almost all ThinkPads
+ * ThinkPad EC register 0x2f (HFSP): fan control loop mode
+ * Supported on almost all ThinkPads
  *
  * Fan speed changes of any sort (including those caused by the
  * disengaged mode) are usually done slowly by the firmware as the
@@ -1875,12 +1876,13 @@ static int volume_write(char *buf)
  *  7  automatic mode engaged;
  * (default operation mode of the ThinkPad)
  * fan level is ignored in this mode.
- *  6  disengage mode (takes precedence over bit 7);
+ *  6  full speed mode (takes precedence over bit 7);
  * not available on all thinkpads.  May disable
- * the tachometer, and speeds up fan to 100% duty-cycle,
- * which speeds it up far above the standard RPM
- * levels.  It is not impossible that it could cause
- * hardware damage.
+ * the tachometer while the fan controller ramps up
+ * the speed (which can take up to a few *minutes*).
+ * Speeds up fan to 100% duty-cycle, which is far above
+ * the standard RPM levels.  It is not impossible that
+ * it could cause hardware damage.
  * 5-3 unused in some models.  Extra bits for fan level
  * in others, but still useless as all values above
  * 7 map to the same speed as level 7 in these models.
@@ -1916,9 +1918,8 @@ static int volume_write(char *buf)
  * FIRMWARE BUG: always read 0x84 first, otherwise incorrect readings
  * might result.
  *
- * FIRMWARE BUG: when EC 0x2f bit 6 is set (disengaged mode), this
- * register is not invalidated in ThinkPads that disable tachometer
- * readings.  Thus, the tachometer readings go stale.
+ * FIRMWARE BUG: may go stale while the EC is switching to full speed
+ * mode.
  *
  * For firmware bugs, refer to:
  * http://thinkwiki.org/wiki/Embedded_Controller_Firmware#Firmware_Issues
@@ -2283,9 +2284,6 @@ static int fan_read(char *p)
len += sprintf(p + len, status:\t\t%s\n,
   (status != 0) ? enabled : disabled);
 
-   /* No ThinkPad boots on disengaged mode, we can safely
-* assume the tachometer is online if fan control status
-* was unknown */
if ((rc = fan_get_speed(speed))  0)
return rc;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: rename thinkpad constants

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=efa27145df34eacf2569bd45f68dbe3d3616
Commit: efa27145df34eacf2569bd45f68dbe3d3616
Parent: 1def7115f0277ce9d2a54efd0ae187aa88d5c7fa
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:28 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: rename thinkpad constants

Rename all IBMACPI_ constants, now that we are not called ibm-acpi anymore.
Driver-specific constants are now prefixed TPACPI_, ThinkPad firmware
specific ones are now prefixed TP_CMOS_, TP_ACPI_, or TP_EC_.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  188 +-
 drivers/misc/thinkpad_acpi.h |   64 +++
 2 files changed, 125 insertions(+), 127 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 80ef195..1683bfe 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -781,16 +781,16 @@ static int video_init(void)
 
if (!vid_handle)
/* video switching not supported on R30, R31 */
-   video_supported = IBMACPI_VIDEO_NONE;
+   video_supported = TPACPI_VIDEO_NONE;
else if (acpi_evalf(vid_handle, video_orig_autosw, SWIT, qd))
/* 570 */
-   video_supported = IBMACPI_VIDEO_570;
+   video_supported = TPACPI_VIDEO_570;
else if (acpi_evalf(vid_handle, video_orig_autosw, ^VADL, qd))
/* 600e/x, 770e, 770x */
-   video_supported = IBMACPI_VIDEO_770;
+   video_supported = TPACPI_VIDEO_770;
else
/* all others */
-   video_supported = IBMACPI_VIDEO_NEW;
+   video_supported = TPACPI_VIDEO_NEW;
 
return 0;
 }
@@ -805,15 +805,15 @@ static int video_status(void)
int status = 0;
int i;
 
-   if (video_supported == IBMACPI_VIDEO_570) {
+   if (video_supported == TPACPI_VIDEO_570) {
if (acpi_evalf(NULL, i, \\_SB.PHS, dd, 0x87))
status = i  3;
-   } else if (video_supported == IBMACPI_VIDEO_770) {
+   } else if (video_supported == TPACPI_VIDEO_770) {
if (acpi_evalf(NULL, i, \\VCDL, d))
status |= 0x01 * i;
if (acpi_evalf(NULL, i, \\VCDC, d))
status |= 0x02 * i;
-   } else if (video_supported == IBMACPI_VIDEO_NEW) {
+   } else if (video_supported == TPACPI_VIDEO_NEW) {
acpi_evalf(NULL, NULL, \\VUPS, vd, 1);
if (acpi_evalf(NULL, i, \\VCDC, d))
status |= 0x02 * i;
@@ -832,10 +832,10 @@ static int video_autosw(void)
 {
int autosw = 0;
 
-   if (video_supported == IBMACPI_VIDEO_570)
+   if (video_supported == TPACPI_VIDEO_570)
acpi_evalf(vid_handle, autosw, SWIT, d);
-   else if (video_supported == IBMACPI_VIDEO_770 ||
-video_supported == IBMACPI_VIDEO_NEW)
+   else if (video_supported == TPACPI_VIDEO_770 ||
+video_supported == TPACPI_VIDEO_NEW)
acpi_evalf(vid_handle, autosw, ^VDEE, d);
 
return autosw  1;
@@ -848,7 +848,7 @@ static int video_switch(void)
 
if (!acpi_evalf(vid_handle, NULL, _DOS, vd, 1))
return -EIO;
-   ret = video_supported == IBMACPI_VIDEO_570 ?
+   ret = video_supported == TPACPI_VIDEO_570 ?
acpi_evalf(ec_handle, NULL, _Q16, v) :
acpi_evalf(vid_handle, NULL, VSWT, v);
acpi_evalf(vid_handle, NULL, _DOS, vd, autosw);
@@ -858,9 +858,9 @@ static int video_switch(void)
 
 static int video_expand(void)
 {
-   if (video_supported == IBMACPI_VIDEO_570)
+   if (video_supported == TPACPI_VIDEO_570)
return acpi_evalf(ec_handle, NULL, _Q17, v);
-   else if (video_supported == IBMACPI_VIDEO_770)
+   else if (video_supported == TPACPI_VIDEO_770)
return acpi_evalf(vid_handle, NULL, VEXP, v);
else
return acpi_evalf(NULL, NULL, \\VEXP, v);
@@ -870,10 +870,10 @@ static int video_switch2(int status)
 {
int ret;
 
-   if (video_supported == IBMACPI_VIDEO_570) {
+   if (video_supported == TPACPI_VIDEO_570) {
ret = acpi_evalf(NULL, NULL,
 \\_SB.PHS2, vdd, 0x8b, status | 0x80);
-   } else if (video_supported == IBMACPI_VIDEO_770) {
+   } else if (video_supported == TPACPI_VIDEO_770) {
int autosw = video_autosw();
if (!acpi_evalf(vid_handle, NULL, _DOS, vd, 1))
return -EIO;
@@ -904,12 +904,12 @@ static int video_read(char *p)
len += sprintf(p + len, 

ACPI: thinkpad-acpi: clean up probing and move init to subdrivers

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5fba344cfdbaa79e6320da26c3db34dfb219a845
Commit: 5fba344cfdbaa79e6320da26c3db34dfb219a845
Parent: 132ce09123755ec5e3d3a8ae22f4f753c3baac97
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:31 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: clean up probing and move init to subdrivers

Move most of the probing code to its own function, and most of the
subdriver-specific init code into subdriver init functions.

This allows us to not define pci_handle unless the dock subdriver is
enabled, as well.

This patch causes a minor userland interface change: if a subdriver doesn't
detect a capability, /proc entries for it are not created anymore (as
opposed to a /proc entry that just returned unsupported).

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  231 +++---
 drivers/misc/thinkpad_acpi.h |4 +-
 2 files changed, 151 insertions(+), 84 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 7fa906f..eeab394 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -277,9 +277,9 @@ static int _sta(acpi_handle handle)
  * ACPI device model
  */
 
-static void __init ibm_handle_init(char *name,
-  acpi_handle * handle, acpi_handle parent,
-  char **paths, int num_paths, char **path)
+static void ibm_handle_init(char *name,
+  acpi_handle *handle, acpi_handle parent,
+  char **paths, int num_paths, char **path)
 {
int i;
acpi_status status;
@@ -351,8 +351,8 @@ static int __init register_tpacpi_subdriver(struct 
ibm_struct *ibm)
 
ibm-driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
if (!ibm-driver) {
-   printk(IBM_ERR kmalloc(ibm-driver) failed\n);
-   return -1;
+   printk(IBM_ERR kzalloc(ibm-driver) failed\n);
+   return -ENOMEM;
}
 
sprintf(ibm-driver-name, %s_%s, IBM_NAME, ibm-name);
@@ -364,7 +364,9 @@ static int __init register_tpacpi_subdriver(struct 
ibm_struct *ibm)
printk(IBM_ERR acpi_bus_register_driver(%s) failed: %d\n,
   ibm-hid, ret);
kfree(ibm-driver);
-   }
+   ibm-driver = NULL;
+   } else if (!ret)
+   ibm-driver_registered = 1;
 
return ret;
 }
@@ -495,6 +497,8 @@ static int hotkey_orig_mask;
 
 static int hotkey_init(void)
 {
+   IBM_HANDLE_INIT(hkey);
+
/* hotkey not supported on 570 */
hotkey_supported = hkey_handle != NULL;
 
@@ -508,13 +512,14 @@ static int hotkey_init(void)
return -ENODEV;
}
 
-   return 0;
+   return (hotkey_supported)? 0 : 1;
 }
 
 static void hotkey_exit(void)
 {
-   if (hotkey_supported)
+   if (hotkey_supported) {
hotkey_set(hotkey_orig_status, hotkey_orig_mask);
+   }
 }
 
 static void hotkey_notify(struct ibm_struct *ibm, u32 event)
@@ -628,12 +633,14 @@ static int bluetooth_supported;
 
 static int bluetooth_init(void)
 {
+   IBM_HANDLE_INIT(hkey);
+
/* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
   G4x, R30, R31, R40e, R50e, T20-22, X20-21 */
bluetooth_supported = hkey_handle 
acpi_evalf(hkey_handle, NULL, GBDC, qv);
 
-   return 0;
+   return (bluetooth_supported)? 0 : 1;
 }
 
 static int bluetooth_status(void)
@@ -697,10 +704,12 @@ static int wan_supported;
 
 static int wan_init(void)
 {
+   IBM_HANDLE_INIT(hkey);
+
wan_supported = hkey_handle 
acpi_evalf(hkey_handle, NULL, GWAN, qv);
 
-   return 0;
+   return (wan_supported)? 0 : 1;
 }
 
 static int wan_status(void)
@@ -775,6 +784,9 @@ static int video_init(void)
 {
int ivga;
 
+   IBM_HANDLE_INIT(vid);
+   IBM_HANDLE_INIT(vid2);
+
if (vid2_handle  acpi_evalf(NULL, ivga, \\IVGA, d)  ivga)
/* G41, assume IVGA doesn't change */
vid_handle = vid2_handle;
@@ -792,7 +804,7 @@ static int video_init(void)
/* all others */
video_supported = TPACPI_VIDEO_NEW;
 
-   return 0;
+   return (video_supported != TPACPI_VIDEO_NONE)? 0 : 1;
 }
 
 static void video_exit(void)
@@ -979,6 +991,10 @@ IBM_HANDLE(ledb, ec, LEDB);  /* G4x */
 
 static int light_init(void)
 {
+   IBM_HANDLE_INIT(ledb);
+   IBM_HANDLE_INIT(lght);
+   IBM_HANDLE_INIT(cmos);
+
/* light not supported on 570, 600e/x, 770e, 770x, G4x, R30, R31 */
light_supported = (cmos_handle || 

ACPI: thinkpad-acpi: improve thinkpad detection

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0dcef77c5b889338811d35e786b42046259fe433
Commit: 0dcef77c5b889338811d35e786b42046259fe433
Parent: a5763f2223ce3fdbc75923f8c948fc7b59ed2f96
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:34 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: improve thinkpad detection

Improve the detection of ThinkPads, so as to reduce the chances of false
positives.

Since this could potentially add false negatives on the very old models,
add a module parameter to force the detection of a thinkpad.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/thinkpad-acpi.txt |7 +++
 drivers/misc/thinkpad_acpi.c|   13 +
 drivers/misc/thinkpad_acpi.h|1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 20d5ec3..1a42b77 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -716,3 +716,10 @@ to enable more than one output class, just add their 
values.
 
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
+
+Force loading of module
+---
+
+If thinkpad-acpi refuses to detect your ThinkPad, you can try to specify
+the module parameter force_load=1.  Regardless of whether this works or
+not, please contact [EMAIL PROTECTED] with a report.
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 5611268..cddf81b 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -2881,6 +2881,16 @@ static int __init probe_for_thinkpad(void)
return -ENODEV;
}
 
+   /*
+* Risks a regression on very old machines, but reduces potential
+* false positives a damn great deal
+*/
+   if (!is_thinkpad)
+   is_thinkpad = dmi_name_in_vendors(IBM);
+
+   if (!is_thinkpad  !force_load)
+   return -ENODEV;
+
return 0;
 }
 
@@ -2986,6 +2996,9 @@ module_param(experimental, int, 0);
 static u32 dbg_level;
 module_param_named(debug, dbg_level, uint, 0);
 
+static int force_load;
+module_param(force_load, int, 0);
+
 #define IBM_PARAM(feature) \
module_param_call(feature, set_ibm_param, NULL, NULL, 0)
 
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 97467b7..2020398 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -128,6 +128,7 @@ static char *next_cmd(char **cmds);
 /* Module */
 static int experimental;
 static u32 dbg_level;
+static int force_load;
 static char *ibm_thinkpad_ec_found;
 
 static char* check_dmi_for_ec(void);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: use bitfields to hold subdriver flags

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=926411779287ad4f7013c9d80aa44fd131b70cd9
Commit: 926411779287ad4f7013c9d80aa44fd131b70cd9
Parent: 0dcef77c5b889338811d35e786b42046259fe433
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:35 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: use bitfields to hold subdriver flags

Save some memory by using bitfields to hold boolean flags for the
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   32 
 drivers/misc/thinkpad_acpi.h |   13 +++--
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index cddf81b..a5efd06 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -339,7 +339,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
}
return -ENODEV;
}
-   ibm-notify_installed = 1;
+   ibm-flags.notify_installed = 1;
return 0;
 }
 
@@ -372,7 +372,7 @@ static int __init register_tpacpi_subdriver(struct 
ibm_struct *ibm)
kfree(ibm-driver);
ibm-driver = NULL;
} else if (!ret)
-   ibm-driver_registered = 1;
+   ibm-flags.driver_registered = 1;
 
return ret;
 }
@@ -815,7 +815,7 @@ static struct ibm_struct wan_driver_data = {
.name = wan,
.read = wan_read,
.write = wan_write,
-   .experimental = 1,
+   .flags.experimental = 1,
 };
 
 /*
@@ -1851,7 +1851,7 @@ static struct ibm_struct ecdump_driver_data = {
.name = ecdump,
.read = ecdump_read,
.write = ecdump_write,
-   .experimental = 1,
+   .flags.experimental = 1,
 };
 
 /*
@@ -2684,7 +2684,7 @@ static struct ibm_struct fan_driver_data = {
.read = fan_read,
.write = fan_write,
.exit = fan_exit,
-   .experimental = 1,
+   .flags.experimental = 1,
 };
 
 /
@@ -2725,7 +2725,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
 
INIT_LIST_HEAD(ibm-all_drivers);
 
-   if (ibm-experimental  !experimental)
+   if (ibm-flags.experimental  !experimental)
return 0;
 
dbg_printk(TPACPI_DBG_INIT,
@@ -2738,7 +2738,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
if (ret)
return ret;
 
-   ibm-init_called = 1;
+   ibm-flags.init_called = 1;
}
 
if (ibm-hid) {
@@ -2777,7 +2777,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
entry-read_proc = dispatch_read;
if (ibm-write)
entry-write_proc = dispatch_write;
-   ibm-proc_created = 1;
+   ibm-flags.proc_created = 1;
}
 
list_add_tail(ibm-all_drivers, tpacpi_all_drivers);
@@ -2799,33 +2799,33 @@ static void ibm_exit(struct ibm_struct *ibm)
 
list_del_init(ibm-all_drivers);
 
-   if (ibm-notify_installed) {
+   if (ibm-flags.notify_installed) {
dbg_printk(TPACPI_DBG_EXIT,
%s: acpi_remove_notify_handler\n, ibm-name);
acpi_remove_notify_handler(*ibm-handle, ibm-type,
   dispatch_notify);
-   ibm-notify_installed = 0;
+   ibm-flags.notify_installed = 0;
}
 
-   if (ibm-proc_created) {
+   if (ibm-flags.proc_created) {
dbg_printk(TPACPI_DBG_EXIT,
%s: remove_proc_entry\n, ibm-name);
remove_proc_entry(ibm-name, proc_dir);
-   ibm-proc_created = 0;
+   ibm-flags.proc_created = 0;
}
 
-   if (ibm-driver_registered) {
+   if (ibm-flags.driver_registered) {
dbg_printk(TPACPI_DBG_EXIT,
%s: acpi_bus_unregister_driver\n, ibm-name);
acpi_bus_unregister_driver(ibm-driver);
kfree(ibm-driver);
ibm-driver = NULL;
-   ibm-driver_registered = 0;
+   ibm-flags.driver_registered = 0;
}
 
-   if (ibm-init_called  ibm-exit) {
+   if (ibm-flags.init_called  ibm-exit) {
ibm-exit();
-   ibm-init_called = 0;
+   ibm-flags.init_called = 0;
}
 
dbg_printk(TPACPI_DBG_INIT, finished removing %s\n, ibm-name);
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h

ACPI: thinkpad-acpi: add debug mode

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=132ce09123755ec5e3d3a8ae22f4f753c3baac97
Commit: 132ce09123755ec5e3d3a8ae22f4f753c3baac97
Parent: f51d1a39840ae5e8678d702ab57377c611fc3826
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:30 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: add debug mode

Add a debug mode parameter and verbose debug mode Kconfig option.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/thinkpad-acpi.txt |   13 +
 drivers/misc/Kconfig|   10 ++
 drivers/misc/thinkpad_acpi.c|3 +++
 drivers/misc/thinkpad_acpi.h|   13 +
 4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index af18d29..82fd822 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -699,3 +699,16 @@ for example:
 
modprobe thinkpad_acpi hotkey=enable,0x video=auto_disable
 
+Enabling debugging output
+-
+
+The module takes a debug paramater which can be used to selectively
+enable various classes of debugging output, for example:
+
+modprobe ibm_acpi debug=0x
+
+will enable all debugging output classes.  It takes a bitmask, so
+to enable more than one output class, just add their values.
+
+There is also a kernel build option to enable more debugging
+information, which may be necessary to debug driver problems.
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 2cd96a3..44e4c8f 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -137,6 +137,16 @@ config THINKPAD_ACPI
 
  If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
 
+config THINKPAD_ACPI_DEBUG
+   bool Verbose debug mode
+   depends on THINKPAD_ACPI
+   default n
+   ---help---
+ Enables extra debugging information, at the expense of a slightly
+ increase in driver size.
+
+ If you are not sure, say N here.
+
 config THINKPAD_ACPI_DOCK
bool Legacy Docking Station Support
depends on THINKPAD_ACPI
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 4131a78..7fa906f 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -2684,6 +2684,9 @@ static int __init set_ibm_param(const char *val, struct 
kernel_param *kp)
 static int experimental;
 module_param(experimental, int, 0);
 
+static u32 dbg_level;
+module_param_named(debug, dbg_level, uint, 0);
+
 #define IBM_PARAM(feature) \
module_param_call(feature, set_ibm_param, NULL, NULL, 0)
 
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 02a297e..b2348d7 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -74,6 +74,18 @@
 #define enabled(status,bit) ((status)  (1  (bit)) ? enabled : disabled)
 #define strlencmp(a,b) (strncmp((a), (b), strlen(b)))
 
+/* Debugging */
+#define TPACPI_DBG_ALL 0x
+#define dbg_printk(a_dbg_level, format, arg...) \
+   do { if (dbg_level  a_dbg_level) \
+   printk(IBM_DEBUG %s:  format, __func__ , ## arg); } while (0)
+#ifdef CONFIG_THINKPAD_ACPI_DEBUG
+#define vdbg_printk(a_dbg_level, format, arg...) \
+   dbg_printk(a_dbg_level, format, ## arg)
+#else
+#define vdbg_printk(a_dbg_level, format, arg...)
+#endif
+
 /* ACPI HIDs */
 #define IBM_HKEY_HIDIBM0068
 #define IBM_PCI_HID PNP0A03
@@ -112,6 +124,7 @@ static char *next_cmd(char **cmds);
 
 /* Module */
 static int experimental;
+static u32 dbg_level;
 static char *ibm_thinkpad_ec_found;
 
 static char* check_dmi_for_ec(void);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: uncouple subdriver init from ibms struct

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a5763f2223ce3fdbc75923f8c948fc7b59ed2f96
Commit: a5763f2223ce3fdbc75923f8c948fc7b59ed2f96
Parent: fe08bc4b4fd1371fad111675a564e4d2ebbf39ea
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:33 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: uncouple subdriver init from ibms struct

Move the .init method from ibms struct to another struct, and use a list
head to control which subdrivers have been activated.

This allows us to have the subdriver init methods marked __init, saving
quite a lot of .text size, and even a bit of .data size as some data can
now be made __initdata.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  402 ++
 drivers/misc/thinkpad_acpi.h |   51 +++---
 2 files changed, 278 insertions(+), 175 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index e8fc8da..5611268 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -470,7 +470,7 @@ static char *next_cmd(char **cmds)
  * thinkpad-acpi init subdriver
  */
 
-static int thinkpad_acpi_driver_init(void)
+static int __init thinkpad_acpi_driver_init(struct ibm_init_struct *iibm)
 {
printk(IBM_INFO %s v%s\n, IBM_DESC, IBM_VERSION);
printk(IBM_INFO %s\n, IBM_URL);
@@ -492,6 +492,11 @@ static int thinkpad_acpi_driver_read(char *p)
return len;
 }
 
+static struct ibm_struct thinkpad_acpi_driver_data = {
+   .name = driver,
+   .read = thinkpad_acpi_driver_read,
+};
+
 /*
  * Hotkey subdriver
  */
@@ -501,7 +506,7 @@ static int hotkey_mask_supported;
 static int hotkey_orig_status;
 static int hotkey_orig_mask;
 
-static int hotkey_init(void)
+static int __init hotkey_init(struct ibm_init_struct *iibm)
 {
vdbg_printk(TPACPI_DBG_INIT, initializing hotkey subdriver\n);
 
@@ -640,13 +645,24 @@ static int hotkey_write(char *buf)
return 0;
 }
 
+static struct ibm_struct hotkey_driver_data = {
+   .name = hotkey,
+   .hid = IBM_HKEY_HID,
+   .read = hotkey_read,
+   .write = hotkey_write,
+   .exit = hotkey_exit,
+   .notify = hotkey_notify,
+   .handle = hkey_handle,
+   .type = ACPI_DEVICE_NOTIFY,
+};
+
 /*
  * Bluetooth subdriver
  */
 
 static int bluetooth_supported;
 
-static int bluetooth_init(void)
+static int __init bluetooth_init(struct ibm_init_struct *iibm)
 {
vdbg_printk(TPACPI_DBG_INIT, initializing bluetooth subdriver\n);
 
@@ -716,13 +732,19 @@ static int bluetooth_write(char *buf)
return 0;
 }
 
+static struct ibm_struct bluetooth_driver_data = {
+   .name = bluetooth,
+   .read = bluetooth_read,
+   .write = bluetooth_write,
+};
+
 /*
  * Wan subdriver
  */
 
 static int wan_supported;
 
-static int wan_init(void)
+static int __init wan_init(struct ibm_init_struct *iibm)
 {
vdbg_printk(TPACPI_DBG_INIT, initializing wan subdriver\n);
 
@@ -789,6 +811,13 @@ static int wan_write(char *buf)
return 0;
 }
 
+static struct ibm_struct wan_driver_data = {
+   .name = wan,
+   .read = wan_read,
+   .write = wan_write,
+   .experimental = 1,
+};
+
 /*
  * Video subdriver
  */
@@ -805,7 +834,7 @@ IBM_HANDLE(vid, root, \\_SB.PCI.AGP.VGA,  /* 570 */
 
 IBM_HANDLE(vid2, root, \\_SB.PCI0.AGPB.VID); /* G41 */
 
-static int video_init(void)
+static int __init video_init(struct ibm_init_struct *iibm)
 {
int ivga;
 
@@ -1011,6 +1040,13 @@ static int video_write(char *buf)
return 0;
 }
 
+static struct ibm_struct video_driver_data = {
+   .name = video,
+   .read = video_read,
+   .write = video_write,
+   .exit = video_exit,
+};
+
 /*
  * Light (thinklight) subdriver
  */
@@ -1021,7 +1057,7 @@ static int light_status_supported;
 IBM_HANDLE(lght, root, \\LGHT);  /* A21e, A2xm/p, T20-22, X20-21 */
 IBM_HANDLE(ledb, ec, LEDB);  /* G4x */
 
-static int light_init(void)
+static int __init light_init(struct ibm_init_struct *iibm)
 {
vdbg_printk(TPACPI_DBG_INIT, initializing light subdriver\n);
 
@@ -1093,6 +1129,12 @@ static int light_write(char *buf)
return 0;
 }
 
+static struct ibm_struct light_driver_data = {
+   .name = light,
+   .read = light_read,
+   .write = light_write,
+};
+
 /*
  

ACPI: thinkpad-acpi: prepare for device model conversion

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8d376cd6543d57ef10799be02ba5f19aa6678032
Commit: 8d376cd6543d57ef10799be02ba5f19aa6678032
Parent: d8fd94d9f08237ffda7e44e6825b057bf20a90e3
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:37 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: prepare for device model conversion

Prepare the thinkpad-acpi driver for the conversion to the device
model, by renaming variables and doing other glue work that shall
make the later patches much cleaner.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  231 +++---
 drivers/misc/thinkpad_acpi.h |   40 +---
 2 files changed, 153 insertions(+), 118 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index e2a1b63..809ec84 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -277,7 +277,7 @@ static int _sta(acpi_handle handle)
  * ACPI device model
  */
 
-static void ibm_handle_init(char *name,
+static void drv_acpi_handle_init(char *name,
   acpi_handle *handle, acpi_handle parent,
   char **paths, int num_paths, char **path)
 {
@@ -295,40 +295,42 @@ static void ibm_handle_init(char *name,
*handle = NULL;
 }
 
-static void dispatch_notify(acpi_handle handle, u32 event, void *data)
+static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
struct ibm_struct *ibm = data;
 
-   if (!ibm || !ibm-notify)
+   if (!ibm || !ibm-acpi || !ibm-acpi-notify)
return;
 
-   ibm-notify(ibm, event);
+   ibm-acpi-notify(ibm, event);
 }
 
-static int __init setup_notify(struct ibm_struct *ibm)
+static int __init setup_acpi_notify(struct ibm_struct *ibm)
 {
acpi_status status;
int ret;
 
-   if (!*ibm-handle)
+   BUG_ON(!ibm-acpi);
+
+   if (!*ibm-acpi-handle)
return 0;
 
dbg_printk(TPACPI_DBG_INIT,
setting up ACPI notify for %s\n, ibm-name);
 
-   ret = acpi_bus_get_device(*ibm-handle, ibm-device);
+   ret = acpi_bus_get_device(*ibm-acpi-handle, ibm-acpi-device);
if (ret  0) {
printk(IBM_ERR %s device not present\n, ibm-name);
return -ENODEV;
}
 
-   acpi_driver_data(ibm-device) = ibm;
-   sprintf(acpi_device_class(ibm-device), %s/%s,
+   acpi_driver_data(ibm-acpi-device) = ibm;
+   sprintf(acpi_device_class(ibm-acpi-device), %s/%s,
IBM_ACPI_EVENT_PREFIX,
ibm-name);
 
-   status = acpi_install_notify_handler(*ibm-handle, ibm-type,
-dispatch_notify, ibm);
+   status = acpi_install_notify_handler(*ibm-acpi-handle,
+   ibm-acpi-type, dispatch_acpi_notify, ibm);
if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) {
printk(IBM_NOTICE another device driver is already 
handling %s events\n,
@@ -339,11 +341,11 @@ static int __init setup_notify(struct ibm_struct *ibm)
}
return -ENODEV;
}
-   ibm-flags.notify_installed = 1;
+   ibm-flags.acpi_notify_installed = 1;
return 0;
 }
 
-static int __init ibm_device_add(struct acpi_device *device)
+static int __init tpacpi_device_add(struct acpi_device *device)
 {
return 0;
 }
@@ -355,24 +357,26 @@ static int __init register_tpacpi_subdriver(struct 
ibm_struct *ibm)
dbg_printk(TPACPI_DBG_INIT,
registering %s as an ACPI driver\n, ibm-name);
 
-   ibm-driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
-   if (!ibm-driver) {
+   BUG_ON(!ibm-acpi);
+
+   ibm-acpi-driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
+   if (!ibm-acpi-driver) {
printk(IBM_ERR kzalloc(ibm-driver) failed\n);
return -ENOMEM;
}
 
-   sprintf(ibm-driver-name, %s_%s, IBM_NAME, ibm-name);
-   ibm-driver-ids = ibm-hid;
-   ibm-driver-ops.add = ibm_device_add;
+   sprintf(ibm-acpi-driver-name, %s_%s, IBM_NAME, ibm-name);
+   ibm-acpi-driver-ids = ibm-acpi-hid;
+   ibm-acpi-driver-ops.add = tpacpi_device_add;
 
-   ret = acpi_bus_register_driver(ibm-driver);
+   ret = acpi_bus_register_driver(ibm-acpi-driver);
if (ret  0) {
printk(IBM_ERR acpi_bus_register_driver(%s) failed: %d\n,
-  ibm-hid, ret);
-   kfree(ibm-driver);
-   ibm-driver = NULL;
+  ibm-acpi-hid, ret);
+   kfree(ibm-acpi-driver);
+   ibm-acpi-driver = NULL;
} else if (!ret)
-   

ACPI: thinkpad-acpi: mark acpi helper functions __must_check

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d01320e606d334a0cd35d781a58f9f3c254829ab
Commit: d01320e606d334a0cd35d781a58f9f3c254829ab
Parent: 8d376cd6543d57ef10799be02ba5f19aa6678032
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:38 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: mark acpi helper functions __must_check

Mark acpi_evalf and friends __must_check.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 529528c..1b4cd16 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -97,11 +97,11 @@ static const char *str_supported(int is_supported);
 #define IBM_PCI_HID PNP0A03
 
 /* ACPI helpers */
-static int acpi_evalf(acpi_handle handle,
+static int __must_check acpi_evalf(acpi_handle handle,
  void *res, char *method, char *fmt, ...);
-static int acpi_ec_read(int i, u8 * p);
-static int acpi_ec_write(int i, u8 v);
-static int _sta(acpi_handle handle);
+static int __must_check acpi_ec_read(int i, u8 * p);
+static int __must_check acpi_ec_write(int i, u8 v);
+static int __must_check _sta(acpi_handle handle);
 
 /* ACPI handles */
 static acpi_handle root_handle;/* root namespace */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: clean up hotkey subdriver

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b86c4722de62f336b82dff3c47ef59ba2a587ec1
Commit: b86c4722de62f336b82dff3c47ef59ba2a587ec1
Parent: d01320e606d334a0cd35d781a58f9f3c254829ab
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:39 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: clean up hotkey subdriver

Cleanup hotkey subdriver code.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   46 ++---
 1 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 809ec84..344eb55 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -511,6 +511,8 @@ static int hotkey_orig_mask;
 
 static int __init hotkey_init(struct ibm_init_struct *iibm)
 {
+   int res;
+
vdbg_printk(TPACPI_DBG_INIT, initializing hotkey subdriver\n);
 
IBM_ACPIHANDLE_INIT(hkey);
@@ -530,8 +532,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
vdbg_printk(TPACPI_DBG_INIT, hotkey masks are %s\n,
str_supported(tp_features.hotkey_mask));
 
-   if (!hotkey_get(hotkey_orig_status, hotkey_orig_mask))
-   return -ENODEV;
+   res = hotkey_get(hotkey_orig_status, hotkey_orig_mask);
+   if (res)
+   return res;
}
 
return (tp_features.hotkey)? 0 : 1;
@@ -539,9 +542,13 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 
 static void hotkey_exit(void)
 {
+   int res;
+
if (tp_features.hotkey) {
dbg_printk(TPACPI_DBG_EXIT, restoring original hotkey mask\n);
-   hotkey_set(hotkey_orig_status, hotkey_orig_mask);
+   res = hotkey_set(hotkey_orig_status, hotkey_orig_mask);
+   if (res)
+   printk(IBM_ERR failed to restore hotkey to BIOS 
defaults\n);
}
 }
 
@@ -560,13 +567,13 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 
event)
 static int hotkey_get(int *status, int *mask)
 {
if (!acpi_evalf(hkey_handle, status, DHKC, d))
-   return 0;
+   return -EIO;
 
if (tp_features.hotkey_mask)
if (!acpi_evalf(hkey_handle, mask, DHKN, d))
-   return 0;
+   return -EIO;
 
-   return 1;
+   return 0;
 }
 
 static int hotkey_set(int status, int mask)
@@ -574,22 +581,22 @@ static int hotkey_set(int status, int mask)
int i;
 
if (!acpi_evalf(hkey_handle, NULL, MHKC, vd, status))
-   return 0;
+   return -EIO;
 
if (tp_features.hotkey_mask)
for (i = 0; i  32; i++) {
int bit = ((1  i)  mask) != 0;
if (!acpi_evalf(hkey_handle,
NULL, MHKM, vdd, i + 1, bit))
-   return 0;
+   return -EIO;
}
 
-   return 1;
+   return 0;
 }
 
 static int hotkey_read(char *p)
 {
-   int status, mask;
+   int res, status, mask;
int len = 0;
 
if (!tp_features.hotkey) {
@@ -597,8 +604,9 @@ static int hotkey_read(char *p)
return len;
}
 
-   if (!hotkey_get(status, mask))
-   return -EIO;
+   res = hotkey_get(status, mask);
+   if (res)
+   return res;
 
len += sprintf(p + len, status:\t\t%s\n, enabled(status, 0));
if (tp_features.hotkey_mask) {
@@ -615,15 +623,16 @@ static int hotkey_read(char *p)
 
 static int hotkey_write(char *buf)
 {
-   int status, mask;
+   int res, status, mask;
char *cmd;
int do_cmd = 0;
 
if (!tp_features.hotkey)
return -ENODEV;
 
-   if (!hotkey_get(status, mask))
-   return -EIO;
+   res = hotkey_get(status, mask);
+   if (res)
+   return res;
 
while ((cmd = next_cmd(buf))) {
if (strlencmp(cmd, enable) == 0) {
@@ -642,8 +651,11 @@ static int hotkey_write(char *buf)
do_cmd = 1;
}
 
-   if (do_cmd  !hotkey_set(status, mask))
-   return -EIO;
+   if (do_cmd) {
+   res = hotkey_set(status, mask);
+   if (res)
+   return res;
+   }
 
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: thinkpad-acpi: cleanup bluetooth and wan for sysfs conversion

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6fdd1e91a8a4cd852dc1d945165e3a69ac9e257
Commit: d6fdd1e91a8a4cd852dc1d945165e3a69ac9e257
Parent: b86c4722de62f336b82dff3c47ef59ba2a587ec1
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:40 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: cleanup bluetooth and wan for sysfs conversion

Prepare bluetooth and wan driver code to be more easily hooked into sysfs
helpers, by separating the procfs logic from the device attribute handling.

These changes also remove the entries from procfs on notebooks without the
bluetooth/wan hardware installed.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  130 +-
 drivers/misc/thinkpad_acpi.h |   20 ++-
 2 files changed, 108 insertions(+), 42 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 344eb55..a77368f 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -681,6 +681,8 @@ static struct ibm_struct hotkey_driver_data = {
 
 static int __init bluetooth_init(struct ibm_init_struct *iibm)
 {
+   int status = 0;
+
vdbg_printk(TPACPI_DBG_INIT, initializing bluetooth subdriver\n);
 
IBM_ACPIHANDLE_INIT(hkey);
@@ -688,36 +690,65 @@ static int __init bluetooth_init(struct ibm_init_struct 
*iibm)
/* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
   G4x, R30, R31, R40e, R50e, T20-22, X20-21 */
tp_features.bluetooth = hkey_handle 
-   acpi_evalf(hkey_handle, NULL, GBDC, qv);
+   acpi_evalf(hkey_handle, status, GBDC, qd);
 
-   vdbg_printk(TPACPI_DBG_INIT, bluetooth is %s\n,
-   str_supported(tp_features.bluetooth));
+   vdbg_printk(TPACPI_DBG_INIT, bluetooth is %s, status 0x%02x\n,
+   str_supported(tp_features.bluetooth),
+   status);
+
+   if (tp_features.bluetooth 
+   !(status  TP_ACPI_BLUETOOTH_HWPRESENT)) {
+   /* no bluetooth hardware present in system */
+   tp_features.bluetooth = 0;
+   dbg_printk(TPACPI_DBG_INIT,
+  bluetooth hardware not installed\n);
+   }
 
return (tp_features.bluetooth)? 0 : 1;
 }
 
-static int bluetooth_status(void)
+static int bluetooth_get_radiosw(void)
 {
int status;
 
-   if (!tp_features.bluetooth ||
-   !acpi_evalf(hkey_handle, status, GBDC, d))
-   status = 0;
+   if (!tp_features.bluetooth)
+   return -ENODEV;
 
-   return status;
+   if (!acpi_evalf(hkey_handle, status, GBDC, d))
+   return -EIO;
+
+   return ((status  TP_ACPI_BLUETOOTH_RADIOSSW) != 0);
+}
+
+static int bluetooth_set_radiosw(int radio_on)
+{
+   int status;
+
+   if (!tp_features.bluetooth)
+   return -ENODEV;
+
+   if (!acpi_evalf(hkey_handle, status, GBDC, d))
+   return -EIO;
+   if (radio_on)
+   status |= TP_ACPI_BLUETOOTH_RADIOSSW;
+   else
+   status = ~TP_ACPI_BLUETOOTH_RADIOSSW;
+   if (!acpi_evalf(hkey_handle, NULL, SBDC, vd, status))
+   return -EIO;
+
+   return 0;
 }
 
 static int bluetooth_read(char *p)
 {
int len = 0;
-   int status = bluetooth_status();
+   int status = bluetooth_get_radiosw();
 
if (!tp_features.bluetooth)
len += sprintf(p + len, status:\t\tnot supported\n);
-   else if (!(status  1))
-   len += sprintf(p + len, status:\t\tnot installed\n);
else {
-   len += sprintf(p + len, status:\t\t%s\n, enabled(status, 1));
+   len += sprintf(p + len, status:\t\t%s\n,
+   (status)? enabled : disabled);
len += sprintf(p + len, commands:\tenable, disable\n);
}
 
@@ -726,26 +757,20 @@ static int bluetooth_read(char *p)
 
 static int bluetooth_write(char *buf)
 {
-   int status = bluetooth_status();
char *cmd;
-   int do_cmd = 0;
 
if (!tp_features.bluetooth)
return -ENODEV;
 
while ((cmd = next_cmd(buf))) {
if (strlencmp(cmd, enable) == 0) {
-   status |= 2;
+   bluetooth_set_radiosw(1);
} else if (strlencmp(cmd, disable) == 0) {
-   status = ~2;
+   bluetooth_set_radiosw(0);
} else
return -EINVAL;
-   do_cmd = 1;
}
 
-   if (do_cmd  !acpi_evalf(hkey_handle, NULL, SBDC, vd, status))
-   return -EIO;
-
return 0;
 }
 
@@ -761,41 +786,72 @@ static struct ibm_struct 

ACPI: thinkpad-acpi: cleanup video subdriver

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=83f34724643a3b0ec9322490b9ad9f1b60170a6c
Commit: 83f34724643a3b0ec9322490b9ad9f1b60170a6c
Parent: d6fdd1e91a8a4cd852dc1d945165e3a69ac9e257
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:41 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: cleanup video subdriver

Cleanup video subdriver for sysfs conversion, and properly check
result status of acpi_evalf.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |  262 --
 drivers/misc/thinkpad_acpi.h |   25 +++-
 2 files changed, 197 insertions(+), 90 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index a77368f..19c14bb 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -935,111 +935,194 @@ static int __init video_init(struct ibm_init_struct 
*iibm)
 
 static void video_exit(void)
 {
-   dbg_printk(TPACPI_DBG_EXIT, restoring original video autoswitch 
mode\n);
-   acpi_evalf(vid_handle, NULL, _DOS, vd, video_orig_autosw);
+   dbg_printk(TPACPI_DBG_EXIT,
+  restoring original video autoswitch mode\n);
+   if (video_autosw_set(video_orig_autosw))
+   printk(IBM_ERR error while trying to restore original 
+   video autoswitch mode\n);
 }
 
-static int video_status(void)
+static int video_outputsw_get(void)
 {
int status = 0;
int i;
 
-   if (video_supported == TPACPI_VIDEO_570) {
-   if (acpi_evalf(NULL, i, \\_SB.PHS, dd, 0x87))
-   status = i  3;
-   } else if (video_supported == TPACPI_VIDEO_770) {
-   if (acpi_evalf(NULL, i, \\VCDL, d))
-   status |= 0x01 * i;
-   if (acpi_evalf(NULL, i, \\VCDC, d))
-   status |= 0x02 * i;
-   } else if (video_supported == TPACPI_VIDEO_NEW) {
-   acpi_evalf(NULL, NULL, \\VUPS, vd, 1);
-   if (acpi_evalf(NULL, i, \\VCDC, d))
-   status |= 0x02 * i;
-
-   acpi_evalf(NULL, NULL, \\VUPS, vd, 0);
-   if (acpi_evalf(NULL, i, \\VCDL, d))
-   status |= 0x01 * i;
-   if (acpi_evalf(NULL, i, \\VCDD, d))
-   status |= 0x08 * i;
+   switch (video_supported) {
+   case TPACPI_VIDEO_570:
+   if (!acpi_evalf(NULL, i, \\_SB.PHS, dd,
+TP_ACPI_VIDEO_570_PHSCMD))
+   return -EIO;
+   status = i  TP_ACPI_VIDEO_570_PHSMASK;
+   break;
+   case TPACPI_VIDEO_770:
+   if (!acpi_evalf(NULL, i, \\VCDL, d))
+   return -EIO;
+   if (i)
+   status |= TP_ACPI_VIDEO_S_LCD;
+   if (!acpi_evalf(NULL, i, \\VCDC, d))
+   return -EIO;
+   if (i)
+   status |= TP_ACPI_VIDEO_S_CRT;
+   break;
+   case TPACPI_VIDEO_NEW:
+   if (!acpi_evalf(NULL, NULL, \\VUPS, vd, 1) ||
+   !acpi_evalf(NULL, i, \\VCDC, d))
+   return -EIO;
+   if (i)
+   status |= TP_ACPI_VIDEO_S_CRT;
+
+   if (!acpi_evalf(NULL, NULL, \\VUPS, vd, 0) ||
+   !acpi_evalf(NULL, i, \\VCDL, d))
+   return -EIO;
+   if (i)
+   status |= TP_ACPI_VIDEO_S_LCD;
+   if (!acpi_evalf(NULL, i, \\VCDD, d))
+   return -EIO;
+   if (i)
+   status |= TP_ACPI_VIDEO_S_DVI;
+   break;
+   default:
+   return -ENOSYS;
}
 
return status;
 }
 
-static int video_autosw(void)
+static int video_outputsw_set(int status)
 {
-   int autosw = 0;
+   int autosw;
+   int res = 0;
 
-   if (video_supported == TPACPI_VIDEO_570)
-   acpi_evalf(vid_handle, autosw, SWIT, d);
-   else if (video_supported == TPACPI_VIDEO_770 ||
-video_supported == TPACPI_VIDEO_NEW)
-   acpi_evalf(vid_handle, autosw, ^VDEE, d);
+   switch (video_supported) {
+   case TPACPI_VIDEO_570:
+   res = acpi_evalf(NULL, NULL,
+\\_SB.PHS2, vdd,
+TP_ACPI_VIDEO_570_PHS2CMD,
+status | TP_ACPI_VIDEO_570_PHS2SET);
+   break;
+   case TPACPI_VIDEO_770:
+   autosw = video_autosw_get();
+   if (autosw  0)
+   return autosw;
 
-   return autosw  1;
+   res = video_autosw_set(1);
+   if 

ACPI: thinkpad-acpi: clean up CMOS commands subdriver

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9bea99c1a712548db3437cbca52b0da8f30069c
Commit: c9bea99c1a712548db3437cbca52b0da8f30069c
Parent: 83f34724643a3b0ec9322490b9ad9f1b60170a6c
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:42 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: clean up CMOS commands subdriver

Some ThinkPad CMOS commands subdriver cleanups, and also rename/promote
cmos_eval to a ACPI helper function, as it is used by many other
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   39 ---
 drivers/misc/thinkpad_acpi.h |4 +++-
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 19c14bb..8829d3c 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -273,6 +273,17 @@ static int _sta(acpi_handle handle)
return status;
 }
 
+static int issue_thinkpad_cmos_command(int cmos_cmd)
+{
+   if (!cmos_handle)
+   return -ENXIO;
+
+   if (!acpi_evalf(cmos_handle, NULL, NULL, vd, cmos_cmd))
+   return -EIO;
+
+   return 0;
+}
+
 /*
  * ACPI device model
  */
@@ -1550,14 +1561,6 @@ static int __init cmos_init(struct ibm_init_struct *iibm)
return (cmos_handle)? 0 : 1;
 }
 
-static int cmos_eval(int cmos_cmd)
-{
-   if (cmos_handle)
-   return acpi_evalf(cmos_handle, NULL, NULL, vd, cmos_cmd);
-   else
-   return 1;
-}
-
 static int cmos_read(char *p)
 {
int len = 0;
@@ -1577,10 +1580,7 @@ static int cmos_read(char *p)
 static int cmos_write(char *buf)
 {
char *cmd;
-   int cmos_cmd;
-
-   if (!cmos_handle)
-   return -EINVAL;
+   int cmos_cmd, res;
 
while ((cmd = next_cmd(buf))) {
if (sscanf(cmd, %u, cmos_cmd) == 1 
@@ -1589,8 +1589,9 @@ static int cmos_write(char *buf)
} else
return -EINVAL;
 
-   if (!cmos_eval(cmos_cmd))
-   return -EIO;
+   res = issue_thinkpad_cmos_command(cmos_cmd);
+   if (res)
+   return res;
}
 
return 0;
@@ -2093,7 +2094,7 @@ static int brightness_set(int value)
cmos_cmd = value  current_value ? TP_CMOS_BRIGHTNESS_UP : 
TP_CMOS_BRIGHTNESS_DOWN;
inc = value  current_value ? 1 : -1;
for (i = current_value; i != value; i += inc) {
-   if (!cmos_eval(cmos_cmd))
+   if (issue_thinkpad_cmos_command(cmos_cmd))
return -EIO;
if (!acpi_ec_write(brightness_offset, i + inc))
return -EIO;
@@ -2210,16 +2211,16 @@ static int volume_write(char *buf)
cmos_cmd = new_level  level ? TP_CMOS_VOLUME_UP : 
TP_CMOS_VOLUME_DOWN;
inc = new_level  level ? 1 : -1;
 
-   if (mute  (!cmos_eval(cmos_cmd) ||
+   if (mute  (issue_thinkpad_cmos_command(cmos_cmd) ||
 !acpi_ec_write(volume_offset, level)))
return -EIO;
 
for (i = level; i != new_level; i += inc)
-   if (!cmos_eval(cmos_cmd) ||
+   if (issue_thinkpad_cmos_command(cmos_cmd) ||
!acpi_ec_write(volume_offset, i + inc))
return -EIO;
 
-   if (mute  (!cmos_eval(TP_CMOS_VOLUME_MUTE) ||
+   if (mute  
(issue_thinkpad_cmos_command(TP_CMOS_VOLUME_MUTE) ||
 !acpi_ec_write(volume_offset,
new_level + mute)))
return -EIO;
@@ -2228,7 +2229,7 @@ static int volume_write(char *buf)
if (new_mute != mute) { /* level doesn't change */
cmos_cmd = new_mute ? TP_CMOS_VOLUME_MUTE : 
TP_CMOS_VOLUME_UP;
 
-   if (!cmos_eval(cmos_cmd) ||
+   if (issue_thinkpad_cmos_command(cmos_cmd) ||
!acpi_ec_write(volume_offset, level + new_mute))
return -EIO;
}
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 3a8718a..fb0abb0 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -116,6 +116,9 @@ static void drv_acpi_handle_init(char *name,
drv_acpi_handle_init(#object, object##_handle, *object##_parent,   
\
 

ACPI: thinkpad-acpi: cleanup thermal subdriver for sysfs conversion

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=04cc862c1893a055ab1117fa6f3aa0886c0ba032
Commit: 04cc862c1893a055ab1117fa6f3aa0886c0ba032
Parent: c9bea99c1a712548db3437cbca52b0da8f30069c
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:43 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: cleanup thermal subdriver for sysfs conversion

Clean-up the thermal subdriver for sysfs conversion.  Make thermal_get_*
reentrancy-safe while at it, and add the missing thermal_read_mode variable
to the header file.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   79 --
 drivers/misc/thinkpad_acpi.h |8 
 2 files changed, 61 insertions(+), 26 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 8829d3c..e9aec87 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1818,13 +1818,13 @@ static int __init thermal_init(struct ibm_init_struct 
*iibm)
 
ta1 = ta2 = 0;
for (i = 0; i  8; i++) {
-   if (likely(acpi_ec_read(0x78 + i, t))) {
+   if (acpi_ec_read(TP_EC_THERMAL_TMP0 + i, t)) {
ta1 |= t;
} else {
ta1 = 0;
break;
}
-   if (likely(acpi_ec_read(0xC0 + i, t))) {
+   if (acpi_ec_read(TP_EC_THERMAL_TMP8 + i, t)) {
ta2 |= t;
} else {
ta1 = 0;
@@ -1869,57 +1869,84 @@ static int __init thermal_init(struct ibm_init_struct 
*iibm)
return (thermal_read_mode != TPACPI_THERMAL_NONE)? 0 : 1;
 }
 
-static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
+/* idx is zero-based */
+static int thermal_get_sensor(int idx, s32 *value)
 {
-   int i, t;
+   int t;
s8 tmp;
-   char tmpi[] = TMPi;
+   char tmpi[5];
 
-   if (!s)
-   return -EINVAL;
+   t = TP_EC_THERMAL_TMP0;
 
switch (thermal_read_mode) {
 #if TPACPI_MAX_THERMAL_SENSORS = 16
case TPACPI_THERMAL_TPEC_16:
-   for (i = 0; i  8; i++) {
-   if (!acpi_ec_read(0xC0 + i, tmp))
-   return -EIO;
-   s-temp[i + 8] = tmp * 1000;
+   if (idx = 8  idx = 15) {
+   t = TP_EC_THERMAL_TMP8;
+   idx -= 8;
}
/* fallthrough */
 #endif
case TPACPI_THERMAL_TPEC_8:
-   for (i = 0; i  8; i++) {
-   if (!acpi_ec_read(0x78 + i, tmp))
+   if (idx = 7) {
+   if (!acpi_ec_read(t + idx, tmp))
return -EIO;
-   s-temp[i] = tmp * 1000;
+   *value = tmp * 1000;
+   return 0;
}
-   return (thermal_read_mode == TPACPI_THERMAL_TPEC_16) ? 16 : 8;
+   break;
 
case TPACPI_THERMAL_ACPI_UPDT:
-   if (!acpi_evalf(ec_handle, NULL, UPDT, v))
-   return -EIO;
-   for (i = 0; i  8; i++) {
-   tmpi[3] = '0' + i;
+   if (idx = 7) {
+   snprintf(tmpi, sizeof(tmpi), TMP%c, '0' + idx);
+   if (!acpi_evalf(ec_handle, NULL, UPDT, v))
+   return -EIO;
if (!acpi_evalf(ec_handle, t, tmpi, d))
return -EIO;
-   s-temp[i] = (t - 2732) * 100;
+   *value = (t - 2732) * 100;
+   return 0;
}
-   return 8;
+   break;
 
case TPACPI_THERMAL_ACPI_TMP07:
-   for (i = 0; i  8; i++) {
-   tmpi[3] = '0' + i;
+   if (idx = 7) {
+   snprintf(tmpi, sizeof(tmpi), TMP%c, '0' + idx);
if (!acpi_evalf(ec_handle, t, tmpi, d))
return -EIO;
-   s-temp[i] = t * 1000;
+   *value = t * 1000;
+   return 0;
}
-   return 8;
+   break;
 
case TPACPI_THERMAL_NONE:
default:
-   return 0;
+   return -ENOSYS;
}
+
+   return -EINVAL;
+}
+
+static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
+{
+   int res, i;
+   int n;
+
+   n = 8;
+   i = 0;
+
+   if (!s)
+   return -EINVAL;
+

ACPI: thinkpad-acpi: improve fan watchdog messages

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99fba3f8177956170f3d86f83c2cf2f70747105f
Commit: 99fba3f8177956170f3d86f83c2cf2f70747105f
Parent: 04cc862c1893a055ab1117fa6f3aa0886c0ba032
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:44 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:34 2007 -0400

ACPI: thinkpad-acpi: improve fan watchdog messages

Improve some of the fan watchdog error messages to be a little more
helpful.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/misc/thinkpad_acpi.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index e9aec87..9b4eea4 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -2524,7 +2524,7 @@ static int fan_get_status(u8 *status)
 
 static void fan_exit(void)
 {
-   vdbg_printk(TPACPI_DBG_EXIT, cancelling any pending watchdogs\n);
+   vdbg_printk(TPACPI_DBG_EXIT, cancelling any pending fan watchdog 
tasks\n);
cancel_delayed_work(fan_watchdog_task);
flush_scheduled_work();
 }
@@ -2554,9 +2554,13 @@ static int fan_get_speed(unsigned int *speed)
 
 static void fan_watchdog_fire(struct work_struct *ignored)
 {
+   int rc;
+
printk(IBM_NOTICE fan watchdog: enabling fan\n);
-   if (fan_set_enable()) {
-   printk(IBM_ERR fan watchdog: error while enabling fan\n);
+   rc = fan_set_enable();
+   if (rc  0) {
+   printk(IBM_ERR fan watchdog: error %d while enabling fan, 
+   will try again later...\n, -rc);
/* reschedule for later */
fan_watchdog_reset();
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: handle ata_pci_device_do_resume() failure while resuming

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5aea408df5ae459cb29b91d45fa0f8bc1bee924e
Commit: 5aea408df5ae459cb29b91d45fa0f8bc1bee924e
Parent: 8343f88999bfcf4c4169e964c8a5c040f40c5a77
Author: Dmitriy Monakhov [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:37:54 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

libata: handle ata_pci_device_do_resume() failure while resuming

Since commit:553c4aa630af7bc885e056d0436e4eb7f238579b
ata_pci_device_do_resume() can return error code, all callers was updated
except this one.

Signed-off-by: Monakhov Dmitriy [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/sata_inic162x.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 4f5a6a1..11c3079 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -642,7 +642,9 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
void __iomem *mmio_base = host-iomap[MMIO_BAR];
int rc;
 
-   ata_pci_device_do_resume(pdev);
+   rc = ata_pci_device_do_resume(pdev);
+   if (rc)
+   return rc;
 
if (pdev-dev.power.power_state.event == PM_EVENT_SUSPEND) {
rc = init_controller(mmio_base, hpriv-cached_hctl);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: warn if speed limited due to 40-wire cable

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8343f88999bfcf4c4169e964c8a5c040f40c5a77
Commit: 8343f88999bfcf4c4169e964c8a5c040f40c5a77
Parent: f0ef88ed413232daebfe675c7b1bbf100d604d4b
Author: Robert Hancock [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:37:51 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

libata: warn if speed limited due to 40-wire cable

Warn the user if a drive's transfer rate is limited because of a 40-wire
cable detection.

Signed-off-by: Robert Hancock [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |   33 -
 1 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 99a8815..93e7b99 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3425,19 +3425,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
xfer_mask = ata_pack_xfermask(ap-pio_mask,
  ap-mwdma_mask, ap-udma_mask);
 
-   /* Apply cable rule here.  Don't apply it early because when
-* we handle hot plug the cable type can itself change.
-*/
-   if (ap-cbl == ATA_CBL_PATA40)
-   xfer_mask = ~(0xF8  ATA_SHIFT_UDMA);
-   /* Apply drive side cable rule. Unknown or 80 pin cables reported
-* host side are checked drive side as well. Cases where we know a
-* 40wire cable is used safely for 80 are not checked here.
-*/
-if (ata_drive_40wire(dev-id)  (ap-cbl == ATA_CBL_PATA_UNK || 
ap-cbl == ATA_CBL_PATA80))
-   xfer_mask = ~(0xF8  ATA_SHIFT_UDMA);
-
-
+   /* drive modes available */
xfer_mask = ata_pack_xfermask(dev-pio_mask,
   dev-mwdma_mask, dev-udma_mask);
xfer_mask = ata_id_xfermask(dev-id);
@@ -3469,6 +3457,25 @@ static void ata_dev_xfermask(struct ata_device *dev)
if (ap-ops-mode_filter)
xfer_mask = ap-ops-mode_filter(ap, dev, xfer_mask);
 
+   /* Apply cable rule here.  Don't apply it early because when
+* we handle hot plug the cable type can itself change.
+* Check this last so that we know if the transfer rate was
+* solely limited by the cable.
+* Unknown or 80 wire cables reported host side are checked
+* drive side as well. Cases where we know a 40wire cable
+* is used safely for 80 are not checked here.
+*/
+   if (xfer_mask  (0xF8  ATA_SHIFT_UDMA))
+   /* UDMA/44 or higher would be available */
+   if((ap-cbl == ATA_CBL_PATA40) ||
+   (ata_drive_40wire(dev-id) 
+(ap-cbl == ATA_CBL_PATA_UNK ||
+ ap-cbl == ATA_CBL_PATA80))) {
+   ata_dev_printk(dev, KERN_WARNING,
+limited to UDMA/33 due to 40-wire cable\n);
+   xfer_mask = ~(0xF8  ATA_SHIFT_UDMA);
+   }
+
ata_unpack_xfermask(xfer_mask, dev-pio_mask,
dev-mwdma_mask, dev-udma_mask);
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: cable detection fixes

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be0d18dff5fae83845801929f297977c10ab99ad
Commit: be0d18dff5fae83845801929f297977c10ab99ad
Parent: 5aea408df5ae459cb29b91d45fa0f8bc1bee924e
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:37:56 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

libata: cable detection fixes

2.6.21-rc has horrible problems with libata and PATA cable types (and
thus speeds). This occurs because Tejun fixed a pile of other bugs and
we now do cable detect enforcement for drive side detection properly.

Unfortunately we don't do the process around cable detection right. Tejun
identified the problem and pointed to the right Annex in the spec, this 
patch
implements the rest of the needed changes.

We add a -cable_detect() method called after the identify
sequence which allows a host to do host side detection at this point
should it wish, or to modify the results of the drive side identify.

This separate -cable_detect method also cleans up a lot of code because
many drivers have their own error_handler methods which really just set
the cable type.

If there is no -cable_detect method the cable type is left alone so a
driver setting it earlier (eg because it has the SATA flags set or
because it uses the old error_handler approach) will still do the right
thing (or at least the same thing) as before.

This patch simply adds the cable_detect method and helpers it doesn't use
them but other follow up patches will (ie Adrian please don't submit
patches to unexport them ;))

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |   59 +
 include/linux/libata.h|7 +
 2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 93e7b99..1e1140c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1791,6 +1791,56 @@ err_out_nosup:
 }
 
 /**
+ * ata_cable_40wire-   return 40pin cable type
+ * @ap: port
+ *
+ * Helper method for drivers which want to hardwire 40 pin cable
+ * detection.
+ */
+
+int ata_cable_40wire(struct ata_port *ap)
+{
+   return ATA_CBL_PATA40;
+}
+
+/**
+ * ata_cable_80wire-   return 40pin cable type
+ * @ap: port
+ *
+ * Helper method for drivers which want to hardwire 80 pin cable
+ * detection.
+ */
+
+int ata_cable_80wire(struct ata_port *ap)
+{
+   return ATA_CBL_PATA80;
+}
+
+/**
+ * ata_cable_unknown   -   return unknown PATA cable.
+ * @ap: port
+ *
+ * Helper method for drivers which have no PATA cable detection.
+ */
+
+int ata_cable_unknown(struct ata_port *ap)
+{
+   return ATA_CBL_PATA_UNK;
+}
+
+/**
+ * ata_cable_sata  -   return SATA cable type
+ * @ap: port
+ *
+ * Helper method for drivers which have SATA cables
+ */
+
+int ata_cable_sata(struct ata_port *ap)
+{
+   return ATA_CBL_SATA;
+}
+
+/**
  * ata_bus_probe - Reset and probe ATA bus
  * @ap: Bus to probe
  *
@@ -1860,6 +1910,10 @@ int ata_bus_probe(struct ata_port *ap)
goto fail;
}
 
+   /* Now ask for the cable type as PDIAG- should have been released */
+   if (ap-ops-cable_detect)
+   ap-cbl = ap-ops-cable_detect(ap);
+
/* After the identify sequence we can now set up the devices. We do
   this in the normal order so that the user doesn't get confused */
 
@@ -6453,3 +6507,8 @@ EXPORT_SYMBOL_GPL(ata_dummy_irq_on);
 EXPORT_SYMBOL_GPL(ata_irq_ack);
 EXPORT_SYMBOL_GPL(ata_dummy_irq_ack);
 EXPORT_SYMBOL_GPL(ata_dev_try_classify);
+
+EXPORT_SYMBOL_GPL(ata_cable_40wire);
+EXPORT_SYMBOL_GPL(ata_cable_80wire);
+EXPORT_SYMBOL_GPL(ata_cable_unknown);
+EXPORT_SYMBOL_GPL(ata_cable_sata);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 84787ca..3451ef9 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -616,6 +616,8 @@ struct ata_port_operations {
 
void (*post_set_mode) (struct ata_port *ap);
 
+   int (*cable_detect) (struct ata_port *ap);
+
int  (*check_atapi_dma) (struct ata_queued_cmd *qc);
 
void (*bmdma_setup) (struct ata_queued_cmd *qc);
@@ -834,6 +836,11 @@ extern u8 ata_dummy_irq_on(struct ata_port *ap);
 extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
 extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
 
+extern int ata_cable_40wire(struct ata_port *ap);
+extern int ata_cable_80wire(struct ata_port *ap);
+extern int ata_cable_sata(struct ata_port *ap);
+extern int ata_cable_unknown(struct ata_port *ap);
+
 /*
  * Timing helpers
  */
-
To 

Support for Marvell 7042 Chip

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6a3d586d8e8a50e4cfd7f8c36d82a53c5614e05b
Commit: 6a3d586d8e8a50e4cfd7f8c36d82a53c5614e05b
Parent: b2248dac07cf057e4af3ec970e7d36a09f44fac8
Author: Morrison, Tom [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:38:10 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

Support for Marvell 7042 Chip

Added Support for Marvell 7042 Chip - 7042 has same capabilities  behavior
as 6042.

Signed-off-by: Thomas A. Morrison [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/sata_mv.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 7b73c73..2580beb 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -548,6 +548,9 @@ static const struct pci_device_id mv_pci_tbl[] = {
 
{ PCI_VDEVICE(TTI, 0x2310), chip_7042 },
 
+   /* add Marvell 7042 support */
+   { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
+
{ } /* terminate list */
 };
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_cmd640: CMD640 PCI support

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b2248dac07cf057e4af3ec970e7d36a09f44fac8
Commit: b2248dac07cf057e4af3ec970e7d36a09f44fac8
Parent: be0d18dff5fae83845801929f297977c10ab99ad
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:38:11 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

pata_cmd640: CMD640 PCI support

Support for the PCI CMD640 (not VLB)

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/Kconfig   |   10 ++
 drivers/ata/Makefile  |1 +
 drivers/ata/pata_cmd640.c |  298 +
 3 files changed, 309 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 7bdbe5a..1410907 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -209,6 +209,16 @@ config PATA_ATIIXP
 
  If unsure, say N.
 
+config PATA_CMD640_PCI
+   tristate CMD640 PCI PATA support (Very Experimental)
+   depends on PCI  EXPERIMENTAL
+   help
+ This option enables support for the CMD640 PCI IDE
+ interface chip. Only the primary channel is currently
+ supported.
+
+ If unsure, say N.
+
 config PATA_CMD64X
tristate CMD64x PATA support (Very Experimental)
depends on PCI EXPERIMENTAL
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 13d7397..b7055e3 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_PATA_ALI)+= pata_ali.o
 obj-$(CONFIG_PATA_AMD) += pata_amd.o
 obj-$(CONFIG_PATA_ARTOP)   += pata_artop.o
 obj-$(CONFIG_PATA_ATIIXP)  += pata_atiixp.o
+obj-$(CONFIG_PATA_CMD640_PCI)  += pata_cmd640.o
 obj-$(CONFIG_PATA_CMD64X)  += pata_cmd64x.o
 obj-$(CONFIG_PATA_CS5520)  += pata_cs5520.o
 obj-$(CONFIG_PATA_CS5530)  += pata_cs5530.o
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
new file mode 100644
index 000..4d01d46
--- /dev/null
+++ b/drivers/ata/pata_cmd640.c
@@ -0,0 +1,298 @@
+/*
+ * pata_cmd640.c   - CMD640 PCI PATA for new ATA layer
+ *   (C) 2007 Red Hat Inc
+ *   Alan Cox [EMAIL PROTECTED]
+ *
+ * Based upon
+ *  linux/drivers/ide/pci/cmd640.c Version 1.02  Sep 01, 1996
+ *
+ *  Copyright (C) 1995-1996  Linus Torvalds  authors (see driver)
+ *
+ * This drives only the PCI version of the controller. If you have a
+ * VLB one then we have enough docs to support it but you can write
+ * your own code.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/blkdev.h
+#include linux/delay.h
+#include scsi/scsi_host.h
+#include linux/libata.h
+
+#define DRV_NAME pata_cmd640
+#define DRV_VERSION 0.0.3
+
+struct cmd640_reg {
+   int last;
+   u8 reg58[ATA_MAX_DEVICES];
+};
+
+enum {
+   CFR = 0x50,
+   CNTRL = 0x51,
+   CMDTIM = 0x52,
+   ARTIM0 = 0x53,
+   DRWTIM0 = 0x54,
+   ARTIM23 = 0x57,
+   DRWTIM23 = 0x58,
+   BRST = 0x59
+};
+
+/**
+ * cmd640_set_piomode  -   set initial PIO mode data
+ * @adev: ATA device
+ *
+ * Called to do the PIO mode setup.
+ */
+
+static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev)
+{
+   struct cmd640_reg *timing = ap-private_data;
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   struct ata_timing t;
+   const unsigned long T = 100 / 33;
+   const u8 setup_data[] = { 0x40, 0x40, 0x40, 0x80, 0x00 };
+   u8 reg;
+   int arttim = ARTIM0 + 2 * adev-devno;
+   struct ata_device *pair = ata_dev_pair(adev);
+
+   if (ata_timing_compute(adev, adev-pio_mode, t, T, 0)  0) {
+   printk(KERN_ERR DRV_NAME : mode computation failed.\n);
+   return;
+   }
+
+   /* The second channel has shared timings and the setup timing is
+  messy to switch to merge it for worst case */
+   if (ap-port_no  pair) {
+   struct ata_timing p;
+   ata_timing_compute(pair, pair-pio_mode, p, T, 1);
+   ata_timing_merge(p, t, t, ATA_TIMING_SETUP);
+   }
+
+   /* Make the timings fit */
+   if (t.recover  16) {
+   t.active += t.recover - 16;
+   t.recover = 16;
+   }
+   if (t.active  16)
+   t.active = 16;
+
+   /* Now convert the clocks into values we can actually stuff into
+  the chip */
+
+   if (t.recover  1)
+   t.recover--;/* 640B only */
+   else
+   t.recover = 15;
+
+   if (t.setup  4)
+   t.setup = 0xC0;
+   else
+   t.setup = setup_data[t.setup];
+
+   if (ap-port_no == 0) {
+   t.active = 0x0F;   /* 0 = 16 */
+
+

pata_it8213: Cable detect

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5816fbbf22470b687964462e6c1f18165b291f22
Commit: 5816fbbf22470b687964462e6c1f18165b291f22
Parent: a0fcdc0259e98d1c16d96baea9ba8a8603e41791
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Wed Mar 7 16:46:20 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

pata_it8213: Cable detect

Another not-quite PIIX, another cable type conversion

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_it8213.c |   36 +++-
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index ea73470..011306e 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -25,8 +25,8 @@
  * it8213_pre_reset-   check for 40/80 pin
  * @ap: Port
  *
- * Perform cable detection for the 8213 ATA interface. This is
- * different to the PIIX arrangement
+ * Filter out ports by the enable bits before doing the normal reset
+ * and probe.
  */
 
 static int it8213_pre_reset(struct ata_port *ap)
@@ -34,23 +34,14 @@ static int it8213_pre_reset(struct ata_port *ap)
static const struct pci_bits it8213_enable_bits[] = {
{ 0x41U, 1U, 0x80UL, 0x80UL },  /* port 0 */
};
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-   u8 tmp;
-
if (!pci_test_config_bits(pdev, it8213_enable_bits[ap-port_no]))
return -ENOENT;
-
-   pci_read_config_byte(pdev, 0x42, tmp);
-   if (tmp  2)/* The initial docs are incorrect */
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
return ata_std_prereset(ap);
 }
 
 /**
- * it8213_probe_reset - Probe specified port on PATA host controller
+ * it8213_error_handler - Probe specified port on PATA host controller
  * @ap: Port to probe
  *
  * LOCKING:
@@ -63,9 +54,27 @@ static void it8213_error_handler(struct ata_port *ap)
 }
 
 /**
+ * it8213_cable_detect -   check for 40/80 pin
+ * @ap: Port
+ *
+ * Perform cable detection for the 8213 ATA interface. This is
+ * different to the PIIX arrangement
+ */
+
+static int it8213_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 tmp;
+   pci_read_config_byte(pdev, 0x42, tmp);
+   if (tmp  2)/* The initial docs are incorrect */
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
+}
+
+/**
  * it8213_set_piomode - Initialize host controller PATA PIO timings
  * @ap: Port whose timings we are configuring
- * @adev: um
+ * @adev: Device whose timings we are configuring
  *
  * Set PIO mode for device, in host controller PCI config space.
  *
@@ -268,6 +277,7 @@ static const struct ata_port_operations it8213_ops = {
.thaw   = ata_bmdma_thaw,
.error_handler  = it8213_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = it8213_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_sis: Clean up using cable_detect methods

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2e413f510f1b77846e0e7728b991849e697d7f8b
Commit: 2e413f510f1b77846e0e7728b991849e697d7f8b
Parent: 307c6054ad67428ad4e2bd4e5faae54fc4f8bcd2
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Wed Mar 7 16:54:24 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

pata_sis: Clean up using cable_detect methods

This changeset revolves around the fact that all the SiS controllers have
the same enable bits, but differing cable detection methods. Previously
that meant each type had its own error_handler methods. Instead we can
now implement different -cable_detect methods and share a single
error_handler which does the filtering by enable bits.

In addition we had some auto const arrays that should be static const. I'm
not sure if gcc already treats them intelligently but adding the static
will make sure.

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_sis.c |  109 +---
 1 files changed, 29 insertions(+), 80 deletions(-)

diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 8dc3bc4..a3fbcee 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -35,7 +35,7 @@
 #include sis.h
 
 #define DRV_NAME   pata_sis
-#define DRV_VERSION0.5.0
+#define DRV_VERSION0.5.1
 
 struct sis_chipset {
u16 device; /* PCI host ID */
@@ -86,106 +86,55 @@ static int sis_port_base(struct ata_device *adev)
 }
 
 /**
- * sis_133_pre_reset   -   check for 40/80 pin
+ * sis_133_cable_detect-   check for 40/80 pin
  * @ap: Port
  *
  * Perform cable detection for the later UDMA133 capable
  * SiS chipset.
  */
 
-static int sis_133_pre_reset(struct ata_port *ap)
+static int sis_133_cable_detect(struct ata_port *ap)
 {
-   static const struct pci_bits sis_enable_bits[] = {
-   { 0x4aU, 1U, 0x02UL, 0x02UL },  /* port 0 */
-   { 0x4aU, 1U, 0x04UL, 0x04UL },  /* port 1 */
-   };
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u16 tmp;
 
-   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no]))
-   return -ENOENT;
-
/* The top bit of this register is the cable detect bit */
pci_read_config_word(pdev, 0x50 + 2 * ap-port_no, tmp);
if ((tmp  0x8000)  !sis_short_ata40(pdev))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-
-   return ata_std_prereset(ap);
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
 }
 
 /**
- * sis_error_handler - Probe specified port on PATA host controller
- * @ap: Port to probe
- *
- * LOCKING:
- * None (inherited from caller).
- */
-
-static void sis_133_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, sis_133_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
-
-
-/**
- * sis_66_pre_reset-   check for 40/80 pin
+ * sis_66_cable_detect -   check for 40/80 pin
  * @ap: Port
  *
  * Perform cable detection on the UDMA66, UDMA100 and early UDMA133
  * SiS IDE controllers.
  */
 
-static int sis_66_pre_reset(struct ata_port *ap)
+static int sis_66_cable_detect(struct ata_port *ap)
 {
-   static const struct pci_bits sis_enable_bits[] = {
-   { 0x4aU, 1U, 0x02UL, 0x02UL },  /* port 0 */
-   { 0x4aU, 1U, 0x04UL, 0x04UL },  /* port 1 */
-   };
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u8 tmp;
 
-   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no])) {
-   ata_port_disable(ap);
-   ata_port_printk(ap, KERN_INFO, port disabled. ignoring.\n);
-   return 0;
-   }
/* Older chips keep cable detect in bits 4/5 of reg 0x48 */
pci_read_config_byte(pdev, 0x48, tmp);
tmp = ap-port_no;
if ((tmp  0x10)  !sis_short_ata40(pdev))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-
-   return ata_std_prereset(ap);
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
 }
 
-/**
- * sis_66_error_handler - Probe specified port on PATA host controller
- * @ap: Port to probe
- * @classes:
- *
- * LOCKING:
- * None (inherited from caller).
- */
-
-static void sis_66_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, sis_66_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
 
 /**
- * sis_old_pre_reset   -   probe begin
+ * sis_pre_reset   -   probe begin
  * @ap: ATA port
  *
  * Set up cable type and use generic probe init
  */
 
-static int sis_old_pre_reset(struct ata_port *ap)
+static int 

ACPI: thinkpad-acpi: add subdriver debug statements

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fe08bc4b4fd1371fad111675a564e4d2ebbf39ea
Commit: fe08bc4b4fd1371fad111675a564e4d2ebbf39ea
Parent: 5fba344cfdbaa79e6320da26c3db34dfb219a845
Author: Henrique de Moraes Holschuh [EMAIL PROTECTED]
AuthorDate: Sat Apr 21 11:08:32 2007 -0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 21 23:30:33 2007 -0400

ACPI: thinkpad-acpi: add subdriver debug statements

Add debug messages to the subdriver initialization and exit code.

Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 Documentation/thinkpad-acpi.txt |4 ++
 drivers/misc/thinkpad_acpi.c|  111 +++
 drivers/misc/thinkpad_acpi.h|4 ++
 3 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 82fd822..20d5ec3 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -710,5 +710,9 @@ enable various classes of debugging output, for example:
 will enable all debugging output classes.  It takes a bitmask, so
 to enable more than one output class, just add their values.
 
+   Debug bitmask   Description
+   0x0001  Initialization and probing
+   0x0002  Removal
+
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index eeab394..e8fc8da 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -313,6 +313,9 @@ static int __init setup_notify(struct ibm_struct *ibm)
if (!*ibm-handle)
return 0;
 
+   dbg_printk(TPACPI_DBG_INIT,
+   setting up ACPI notify for %s\n, ibm-name);
+
ret = acpi_bus_get_device(*ibm-handle, ibm-device);
if (ret  0) {
printk(IBM_ERR %s device not present\n, ibm-name);
@@ -349,6 +352,9 @@ static int __init register_tpacpi_subdriver(struct 
ibm_struct *ibm)
 {
int ret;
 
+   dbg_printk(TPACPI_DBG_INIT,
+   registering %s as an ACPI driver\n, ibm-name);
+
ibm-driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
if (!ibm-driver) {
printk(IBM_ERR kzalloc(ibm-driver) failed\n);
@@ -497,17 +503,25 @@ static int hotkey_orig_mask;
 
 static int hotkey_init(void)
 {
+   vdbg_printk(TPACPI_DBG_INIT, initializing hotkey subdriver\n);
+
IBM_HANDLE_INIT(hkey);
 
/* hotkey not supported on 570 */
hotkey_supported = hkey_handle != NULL;
 
+   vdbg_printk(TPACPI_DBG_INIT, hotkeys are %s\n,
+   str_supported(hotkey_supported));
+
if (hotkey_supported) {
/* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
   A30, R30, R31, T20-22, X20-21, X22-24 */
hotkey_mask_supported =
acpi_evalf(hkey_handle, NULL, DHKN, qv);
 
+   vdbg_printk(TPACPI_DBG_INIT, hotkey masks are %s\n,
+   str_supported(hotkey_mask_supported));
+
if (!hotkey_get(hotkey_orig_status, hotkey_orig_mask))
return -ENODEV;
}
@@ -518,6 +532,7 @@ static int hotkey_init(void)
 static void hotkey_exit(void)
 {
if (hotkey_supported) {
+   dbg_printk(TPACPI_DBG_EXIT, restoring original hotkey mask\n);
hotkey_set(hotkey_orig_status, hotkey_orig_mask);
}
 }
@@ -633,6 +648,8 @@ static int bluetooth_supported;
 
 static int bluetooth_init(void)
 {
+   vdbg_printk(TPACPI_DBG_INIT, initializing bluetooth subdriver\n);
+
IBM_HANDLE_INIT(hkey);
 
/* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
@@ -640,6 +657,9 @@ static int bluetooth_init(void)
bluetooth_supported = hkey_handle 
acpi_evalf(hkey_handle, NULL, GBDC, qv);
 
+   vdbg_printk(TPACPI_DBG_INIT, bluetooth is %s\n,
+   str_supported(bluetooth_supported));
+
return (bluetooth_supported)? 0 : 1;
 }
 
@@ -704,11 +724,16 @@ static int wan_supported;
 
 static int wan_init(void)
 {
+   vdbg_printk(TPACPI_DBG_INIT, initializing wan subdriver\n);
+
IBM_HANDLE_INIT(hkey);
 
wan_supported = hkey_handle 
acpi_evalf(hkey_handle, NULL, GWAN, qv);
 
+   vdbg_printk(TPACPI_DBG_INIT, wan is %s\n,
+   str_supported(wan_supported));
+
return (wan_supported)? 0 : 1;
 }
 
@@ -784,6 +809,8 @@ static int video_init(void)
 {
int ivga;
 
+   vdbg_printk(TPACPI_DBG_INIT, initializing video subdriver\n);
+
IBM_HANDLE_INIT(vid);
IBM_HANDLE_INIT(vid2);
 
@@ -804,11 +831,16 @@ static int video_init(void)
/* all others */
video_supported 

sata_promise: Switch to cable method, clean up some bits as a result

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e2a9752a21df4407a2094fb3345878d18a6c6d68
Commit: e2a9752a21df4407a2094fb3345878d18a6c6d68
Parent: 2e41e8e67af4cb0917793922fc8f55d3eeb6fa43
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 23:06:47 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:57 2007 -0400

sata_promise: Switch to cable method, clean up some bits as a result

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/sata_promise.c |   30 --
 1 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 2339813..78df546 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -45,7 +45,7 @@
 #include sata_promise.h
 
 #define DRV_NAME   sata_promise
-#define DRV_VERSION2.00
+#define DRV_VERSION2.01
 
 
 enum {
@@ -131,7 +131,7 @@ static void pdc_freeze(struct ata_port *ap);
 static void pdc_thaw(struct ata_port *ap);
 static void pdc_error_handler(struct ata_port *ap);
 static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
-
+static int pdc_cable_detect(struct ata_port *ap);
 
 static struct scsi_host_template pdc_ata_sht = {
.module = THIS_MODULE,
@@ -166,6 +166,7 @@ static const struct ata_port_operations pdc_sata_ops = {
.thaw   = pdc_thaw,
.error_handler  = pdc_error_handler,
.post_internal_cmd  = pdc_post_internal_cmd,
+   .cable_detect   = pdc_cable_detect,
.data_xfer  = ata_data_xfer,
.irq_handler= pdc_interrupt,
.irq_clear  = pdc_irq_clear,
@@ -374,18 +375,18 @@ static void pdc_reset_port(struct ata_port *ap)
readl(mmio);/* flush */
 }
 
-static void pdc_pata_cbl_detect(struct ata_port *ap)
+static int pdc_cable_detect(struct ata_port *ap)
 {
u8 tmp;
void __iomem *mmio = (void __iomem *) ap-ioaddr.cmd_addr + PDC_CTLSTAT 
+ 0x03;
 
-   tmp = readb(mmio);
-
-   if (tmp  0x01) {
-   ap-cbl = ATA_CBL_PATA40;
-   ap-udma_mask = ATA_UDMA_MASK_40C;
-   } else
-   ap-cbl = ATA_CBL_PATA80;
+   if (!sata_scr_valid(ap)) {
+   tmp = readb(mmio);
+   if (tmp  0x01)
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
+   }
+   return ATA_CBL_SATA;
 }
 
 static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
@@ -555,13 +556,6 @@ static void pdc_thaw(struct ata_port *ap)
readl(mmio + PDC_CTLSTAT); /* flush */
 }
 
-static int pdc_pre_reset(struct ata_port *ap)
-{
-   if (!sata_scr_valid(ap))
-   pdc_pata_cbl_detect(ap);
-   return ata_std_prereset(ap);
-}
-
 static void pdc_error_handler(struct ata_port *ap)
 {
ata_reset_fn_t hardreset;
@@ -574,7 +568,7 @@ static void pdc_error_handler(struct ata_port *ap)
hardreset = sata_std_hardreset;
 
/* perform recovery */
-   ata_do_eh(ap, pdc_pre_reset, ata_std_softreset, hardreset,
+   ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
  ata_std_postreset);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata-core: fix comments on cable type

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2e41e8e67af4cb0917793922fc8f55d3eeb6fa43
Commit: 2e41e8e67af4cb0917793922fc8f55d3eeb6fa43
Parent: 942d09470c3fb3254905c75f0cc9cd2d0dff24dd
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 23:19:19 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

libata-core: fix comments on cable type

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 1e1140c..89a77e1 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1791,10 +1791,10 @@ err_out_nosup:
 }
 
 /**
- * ata_cable_40wire-   return 40pin cable type
+ * ata_cable_40wire-   return 40 wire cable type
  * @ap: port
  *
- * Helper method for drivers which want to hardwire 40 pin cable
+ * Helper method for drivers which want to hardwire 40 wire cable
  * detection.
  */
 
@@ -1804,10 +1804,10 @@ int ata_cable_40wire(struct ata_port *ap)
 }
 
 /**
- * ata_cable_80wire-   return 40pin cable type
+ * ata_cable_80wire-   return 80 wire cable type
  * @ap: port
  *
- * Helper method for drivers which want to hardwire 80 pin cable
+ * Helper method for drivers which want to hardwire 80 wire cable
  * detection.
  */
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: Restore Kconfig updated experimental levels and correct

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=942d09470c3fb3254905c75f0cc9cd2d0dff24dd
Commit: 942d09470c3fb3254905c75f0cc9cd2d0dff24dd
Parent: 7938a72db4d82f3caf3ae22aafa1ea18793a3149
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 23:24:49 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

libata: Restore Kconfig updated experimental levels and correct

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/Kconfig |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 1410907..c679bba 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -184,7 +184,7 @@ config PATA_ALI
  If unsure, say N.
 
 config PATA_AMD
-   tristate AMD/NVidia PATA support (Experimental)
+   tristate AMD/NVidia PATA support
depends on PCI
help
  This option enables support for the AMD and NVidia PATA
@@ -283,7 +283,7 @@ config ATA_GENERIC
  If unsure, say N.
 
 config PATA_HPT366
-   tristate HPT 366/368 PATA support (Very Experimental)
+   tristate HPT 366/368 PATA support (Experimental)
depends on PCI  EXPERIMENTAL
help
  This option enables support for the HPT 366 and 368
@@ -292,7 +292,7 @@ config PATA_HPT366
  If unsure, say N.
 
 config PATA_HPT37X
-   tristate HPT 370/370A/371/372/374/302 PATA support (Very Experimental)
+   tristate HPT 370/370A/371/372/374/302 PATA support (Experimental)
depends on PCI  EXPERIMENTAL
help
  This option enables support for the majority of the later HPT
@@ -319,7 +319,7 @@ config PATA_HPT3X3
  If unsure, say N.
 
 config PATA_ISAPNP
-   tristate ISA Plug and Play PATA support (Very Experimental)
+   tristate ISA Plug and Play PATA support (Experimental)
depends on EXPERIMENTAL  ISAPNP
help
  This option enables support for ISA plug  play ATA
@@ -328,8 +328,8 @@ config PATA_ISAPNP
  If unsure, say N.
 
 config PATA_IT821X
-   tristate IT8211/2 PATA support (Experimental)
-   depends on PCI  EXPERIMENTAL
+   tristate IT8211/2 PATA support
+   depends on PCI
help
  This option enables support for the ITE 8211 and 8212
  PATA controllers via the new ATA layer, including RAID
@@ -400,10 +400,10 @@ config PATA_MPIIX
  If unsure, say N.
 
 config PATA_OLDPIIX
-   tristate Intel PATA old PIIX support (Experimental)
-   depends on PCI  EXPERIMENTAL
+   tristate Intel PATA old PIIX support
+   depends on PCI
help
- This option enables support for old(?) PIIX PATA support.
+ This option enables support for early PIIX PATA support.
 
  If unsure, say N.
 
@@ -454,7 +454,7 @@ config PATA_PCMCIA
  If unsure, say N.
 
 config PATA_PDC_OLD
-   tristate Older Promise PATA controller support (Very Experimental)
+   tristate Older Promise PATA controller support (Experimental)
depends on PCI  EXPERIMENTAL
help
  This option enables support for the Promise 20246, 20262, 20263,
@@ -469,7 +469,7 @@ config PATA_QDI
  Support for QDI 6500 and 6580 PATA controllers on VESA local bus.
 
 config PATA_RADISYS
-   tristate RADISYS 82600 PATA support (Very experimental)
+   tristate RADISYS 82600 PATA support (Very Experimental)
depends on PCI  EXPERIMENTAL
help
  This option enables support for the RADISYS 82600
@@ -487,7 +487,7 @@ config PATA_RZ1000
  If unsure, say N.
 
 config PATA_SC1200
-   tristate SC1200 PATA support (Raving Lunatic)
+   tristate SC1200 PATA support (Very Experimental)
depends on PCI  EXPERIMENTAL
help
  This option enables support for the NatSemi/AMD SC1200 SoC
@@ -496,8 +496,8 @@ config PATA_SC1200
  If unsure, say N.
 
 config PATA_SERVERWORKS
-   tristate SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support (Experimental)
-   depends on PCI  EXPERIMENTAL
+   tristate SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support
+   depends on PCI
help
  This option enables support for the Serverworks OSB4/CSB5/CSB6 and
  HT1000 PATA controllers, via the new ATA layer.
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_cmd640: Multiple updates

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7938a72db4d82f3caf3ae22aafa1ea18793a3149
Commit: 7938a72db4d82f3caf3ae22aafa1ea18793a3149
Parent: 97cb81c335565f3ce27cd26d71480dff0211797a
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Wed Mar 7 16:43:29 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

pata_cmd640: Multiple updates

Fix suspend/resume support
Write 0x5B to 0 not 0x5C

The former is important as we must kill the FIFO on a resume

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_cmd640.c |   34 --
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 4d01d46..ab9468d 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -23,7 +23,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_cmd640
-#define DRV_VERSION 0.0.3
+#define DRV_VERSION 0.0.5
 
 struct cmd640_reg {
int last;
@@ -43,6 +43,7 @@ enum {
 
 /**
  * cmd640_set_piomode  -   set initial PIO mode data
+ * @ap: ATA port
  * @adev: ATA device
  *
  * Called to do the PIO mode setup.
@@ -106,7 +107,7 @@ static void cmd640_set_piomode(struct ata_port *ap, struct 
ata_device *adev)
pci_write_config_byte(pdev, arttim + 1, (t.active  4) | 
t.recover);
} else {
/* Save the shared timings for channel, they will be loaded
-  by qc_issue_prot. Reloading the setup time is expensive
+  by qc_issue_prot. Reloading the setup time is expensive 
   so we keep a merged one loaded */
pci_read_config_byte(pdev, ARTIM23, reg);
reg = 0x3F;
@@ -219,29 +220,20 @@ static struct ata_port_operations cmd640_port_ops = {
.port_start = cmd640_port_start,
 };
 
-static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id 
*id)
+static void cmd640_hardware_init(struct pci_dev *pdev)
 {
u8 r;
u8 ctrl;
 
-   static struct ata_port_info info = {
-   .sht = cmd640_sht,
-   .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
-   .pio_mask = 0x1f,
-   .port_ops = cmd640_port_ops
-   };
-
-   static struct ata_port_info *port_info[2] = { info, info };
-
/* CMD640 detected, commiserations */
-   pci_write_config_byte(pdev, 0x5C, 0x00);
+   pci_write_config_byte(pdev, 0x5B, 0x00);
/* Get version info */
pci_read_config_byte(pdev, CFR, r);
/* PIO0 command cycles */
pci_write_config_byte(pdev, CMDTIM, 0);
/* 512 byte bursts (sector) */
pci_write_config_byte(pdev, BRST, 0x40);
-   /*
+   /* 
 * A reporter a long time ago
 * Had problems with the data fifo
 * So don't run the risk
@@ -255,12 +247,26 @@ static int cmd640_init_one(struct pci_dev *pdev, const 
struct pci_device_id *id)
pci_read_config_byte(pdev, ARTIM23, ctrl);
ctrl |= 0x0C;
pci_write_config_byte(pdev, ARTIM23, ctrl);
+}
+
+static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id 
*id)
+{
+   static struct ata_port_info info = {
+   .sht = cmd640_sht,
+   .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+   .pio_mask = 0x1f,
+   .port_ops = cmd640_port_ops
+   };
+
+   static struct ata_port_info *port_info[2] = { info, info };
 
+   cmd640_hardware_init(pdev);
return ata_pci_init_one(pdev, port_info, 2);
 }
 
 static int cmd640_reinit_one(struct pci_dev *pdev)
 {
+   cmd640_hardware_init(pdev);
return ata_pci_device_resume(pdev);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_marvell: Cable and reset fixes

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=307c6054ad67428ad4e2bd4e5faae54fc4f8bcd2
Commit: 307c6054ad67428ad4e2bd4e5faae54fc4f8bcd2
Parent: 5816fbbf22470b687964462e6c1f18165b291f22
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Wed Mar 7 16:48:09 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:56 2007 -0400

pata_marvell: Cable and reset fixes

There are two changes here. Firstly we switch to a cable detect method,
secondly the old code forgot to call ata_std_prereset() but somehow
managed to work anyway. Fix the missing call.

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_marvell.c |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 6dd7c4e..d9b94a1 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -20,7 +20,7 @@
 #include linux/ata.h
 
 #define DRV_NAME   pata_marvell
-#define DRV_VERSION0.1.1
+#define DRV_VERSION0.1.4
 
 /**
  * marvell_pre_reset   -   check for 40/80 pin
@@ -52,22 +52,23 @@ static int marvell_pre_reset(struct ata_port *ap)
if ((pdev-device == 0x6145)  (ap-port_no == 0) 
(!(devices  0x10)))/* PATA enable ? */
return -ENOENT;
+   return ata_std_prereset(ap);
+}
 
+static int marvell_cable_detect(struct ata_port *ap)
+{
/* Cable type */
switch(ap-port_no)
{
case 0:
if (ioread8(ap-ioaddr.bmdma_addr + 1)  1)
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-   break;
-
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
case 1: /* Legacy SATA port */
-   ap-cbl = ATA_CBL_SATA;
-   break;
+   return ATA_CBL_SATA;
}
-   return ata_std_prereset(ap);
+   BUG();
+   return 0;   /* Our BUG macro needs the right markup */
 }
 
 /**
@@ -123,6 +124,7 @@ static const struct ata_port_operations marvell_ops = {
.thaw   = ata_bmdma_thaw,
.error_handler  = marvell_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = marvell_cable_detect,
 
/* BMDMA handling is PCI ATA format, use helpers */
.bmdma_setup= ata_bmdma_setup,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata: dev_config does not need ap and adev passing

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cd0d3bbcdd650651b7ccfaf55d107e3fc237d95a
Commit: cd0d3bbcdd650651b7ccfaf55d107e3fc237d95a
Parent: d88184fb2348a50f7c34f5d49a901c875b2e0114
Author: Alan [EMAIL PROTECTED]
AuthorDate: Fri Mar 2 00:56:15 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

libata: dev_config does not need ap and adev passing

It used to be impossible to get from ata_device to ata_port but that is
no longer true. Various methods have been cleaned up over time but
dev_config still takes both and most users don't need both anyway. Tidy
this one up

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c   |2 +-
 drivers/ata/pata_ali.c  |2 +-
 drivers/ata/pata_it821x.c   |3 +--
 drivers/ata/pata_pdc202xx_old.c |3 +--
 drivers/ata/sata_inic162x.c |2 +-
 drivers/ata/sata_sil.c  |6 +++---
 drivers/ata/sata_sil24.c|6 +++---
 include/linux/libata.h  |2 +-
 8 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e7ad13d..2b998b3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1792,7 +1792,7 @@ int ata_dev_configure(struct ata_device *dev)
dev-horkage |= ATA_HORKAGE_DMA_RW_ONLY;
 
if (ap-ops-dev_config)
-   ap-ops-dev_config(ap, dev);
+   ap-ops-dev_config(dev);
 
if (ata_msg_probe(ap))
ata_dev_printk(dev, KERN_DEBUG, %s: EXIT, drv_stat = 0x%x\n,
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 11ea552..7624340 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -324,7 +324,7 @@ static void ali_set_dmamode(struct ata_port *ap, struct 
ata_device *adev)
  * slower PIO methods
  */
 
-static void ali_lock_sectors(struct ata_port *ap, struct ata_device *adev)
+static void ali_lock_sectors(struct ata_device *adev)
 {
adev-max_sectors = 255;
 }
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 35ecb2b..be8c9ef 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -520,7 +520,6 @@ static int it821x_smart_set_mode(struct ata_port *ap, 
struct ata_device **unused
 
 /**
  * it821x_dev_config   -   Called each device identify
- * @ap: ATA port
  * @adev: Device that has just been identified
  *
  * Perform the initial setup needed for each device that is chip
@@ -531,7 +530,7 @@ static int it821x_smart_set_mode(struct ata_port *ap, 
struct ata_device **unused
  * basically we need to filter commands for this chip.
  */
 
-static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
+static void it821x_dev_config(struct ata_device *adev)
 {
unsigned char model_num[ATA_ID_PROD_LEN + 1];
 
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 0a14933..a764ce8 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -244,7 +244,6 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
 
 /**
  * pdc2026x_dev_config -   device setup hook
- * @ap: ATA port
  * @adev: newly found device
  *
  * Perform chip specific early setup. We need to lock the transfer
@@ -252,7 +251,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
  * barf.
  */
 
-static void pdc2026x_dev_config(struct ata_port *ap, struct ata_device *adev)
+static void pdc2026x_dev_config(struct ata_device *adev)
 {
adev-max_sectors = 256;
 }
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 1e21688..4f5a6a1 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -492,7 +492,7 @@ static void inic_post_internal_cmd(struct ata_queued_cmd 
*qc)
inic_reset_port(inic_port_base(qc-ap));
 }
 
-static void inic_dev_config(struct ata_port *ap, struct ata_device *dev)
+static void inic_dev_config(struct ata_device *dev)
 {
/* inic can only handle upto LBA28 max sectors */
if (dev-max_sectors  ATA_MAX_SECTORS)
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 917b7ea..170d36e 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -114,7 +114,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct 
pci_device_id *ent);
 #ifdef CONFIG_PM
 static int sil_pci_device_resume(struct pci_dev *pdev);
 #endif
-static void sil_dev_config(struct ata_port *ap, struct ata_device *dev);
+static void sil_dev_config(struct ata_device *dev);
 static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static void sil_post_set_mode (struct ata_port *ap);
@@ -521,7 +521,6 @@ static 

pata_sc1200: restore cable type

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=745975c052cc8e808860c8634a2efdcc2da6dd01
Commit: 745975c052cc8e808860c8634a2efdcc2da6dd01
Parent: 2a25dfe4f43b2199376424dce67ed11e3e276467
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 22:58:03 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:57 2007 -0400

pata_sc1200: restore cable type

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_sc1200.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 93b3ed0..66e8ff4 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -216,6 +216,7 @@ static struct ata_port_operations sc1200_port_ops = {
.thaw   = ata_bmdma_thaw,
.error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[libata] sata_mv: clean up DMA boundary issues, turn on 64-bit DMA

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d88184fb2348a50f7c34f5d49a901c875b2e0114
Commit: d88184fb2348a50f7c34f5d49a901c875b2e0114
Parent: 43727fbc753c63f9d2764c56467303698cc52c14
Author: Jeff Garzik [EMAIL PROTECTED]
AuthorDate: Mon Feb 26 01:26:06 2007 -0500
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:55 2007 -0400

[libata] sata_mv: clean up DMA boundary issues, turn on 64-bit DMA

The chips covered by sata_mv have a 32-bit DMA boundary they must not
cross, not a 64K boundary.  We are merely limited to a 64K maximum
segment size.  Therefore, the DMA scatter/gather table fill code can be
greatly simplified, and we need not cut in half the S/G table size as
reported to the SCSI layer.

Also, the driver forget to turn on 64-bit DMA at the PCI layer.  All
other data structures (both hardware and software) have been prepped for
64-bit PCI DMA.  It was simply never turned on.  fingers crossed let's
see if it still works...

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/sata_mv.c |   84 -
 1 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 5f3d524..7b73c73 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -253,10 +253,7 @@ enum {
 #define IS_GEN_IIE(hpriv) ((hpriv)-hp_flags  MV_HP_GEN_IIE)
 
 enum {
-   /* Our DMA boundary is determined by an ePRD being unable to handle
-* anything larger than 64KB
-*/
-   MV_DMA_BOUNDARY = 0xU,
+   MV_DMA_BOUNDARY = 0xU,
 
EDMA_REQ_Q_BASE_LO_MASK = 0xfc00U,
 
@@ -384,10 +381,10 @@ static struct scsi_host_template mv_sht = {
.queuecommand   = ata_scsi_queuecmd,
.can_queue  = MV_USE_Q_DEPTH,
.this_id= ATA_SHT_THIS_ID,
-   .sg_tablesize   = MV_MAX_SG_CT / 2,
+   .sg_tablesize   = MV_MAX_SG_CT,
.cmd_per_lun= ATA_SHT_CMD_PER_LUN,
.emulated   = ATA_SHT_EMULATED,
-   .use_clustering = ATA_SHT_USE_CLUSTERING,
+   .use_clustering = 1,
.proc_name  = DRV_NAME,
.dma_boundary   = MV_DMA_BOUNDARY,
.slave_configure= ata_scsi_slave_config,
@@ -585,6 +582,39 @@ static const struct mv_hw_ops mv6xxx_ops = {
 static int msi;  /* Use PCI msi; either zero (off, default) or 
non-zero */
 
 
+/* move to PCI layer or libata core? */
+static int pci_go_64(struct pci_dev *pdev)
+{
+   int rc;
+
+   if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
+   rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
+   if (rc) {
+   rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+   if (rc) {
+   dev_printk(KERN_ERR, pdev-dev,
+  64-bit DMA enable failed\n);
+   return rc;
+   }
+   }
+   } else {
+   rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+   if (rc) {
+   dev_printk(KERN_ERR, pdev-dev,
+  32-bit DMA enable failed\n);
+   return rc;
+   }
+   rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+   if (rc) {
+   dev_printk(KERN_ERR, pdev-dev,
+  32-bit consistent DMA enable failed\n);
+   return rc;
+   }
+   }
+
+   return rc;
+}
+
 /*
  * Functions
  */
@@ -957,38 +987,30 @@ static void mv_port_stop(struct ata_port *ap)
  *  LOCKING:
  *  Inherited from caller.
  */
-static void mv_fill_sg(struct ata_queued_cmd *qc)
+static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
 {
struct mv_port_priv *pp = qc-ap-private_data;
-   unsigned int i = 0;
+   unsigned int n_sg = 0;
struct scatterlist *sg;
+   struct mv_sg *mv_sg;
 
+   mv_sg = pp-sg_tbl;
ata_for_each_sg(sg, qc) {
-   dma_addr_t addr;
-   u32 sg_len, len, offset;
-
-   addr = sg_dma_address(sg);
-   sg_len = sg_dma_len(sg);
-
-   while (sg_len) {
-   offset = addr  MV_DMA_BOUNDARY;
-   len = sg_len;
-   if ((offset + sg_len)  0x1)
-   len = 0x1 - offset;
-
-   pp-sg_tbl[i].addr = cpu_to_le32(addr  0x);
-   pp-sg_tbl[i].addr_hi = cpu_to_le32((addr  16)  16);
-   pp-sg_tbl[i].flags_size = cpu_to_le32(len  0x);
+   dma_addr_t addr = sg_dma_address(sg);
+   u32 

pata_radisys: support cable_detect

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d36a76482c19c186aa638446def39ec643993955
Commit: d36a76482c19c186aa638446def39ec643993955
Parent: 745975c052cc8e808860c8634a2efdcc2da6dd01
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 22:56:07 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:57 2007 -0400

pata_radisys: support cable_detect

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_radisys.c |   37 +
 1 files changed, 5 insertions(+), 32 deletions(-)

diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 9a9132c..1c54673 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -24,40 +24,12 @@
 #include linux/ata.h
 
 #define DRV_NAME   pata_radisys
-#define DRV_VERSION0.4.1
-
-/**
- * radisys_probe_init  -   probe begin
- * @ap: ATA port
- *
- * Set up cable type and use generic probe init
- */
-
-static int radisys_pre_reset(struct ata_port *ap)
-{
-   ap-cbl = ATA_CBL_PATA80;
-   return ata_std_prereset(ap);
-}
-
-
-/**
- * radisys_pata_error_handler - Probe specified port on PATA host 
controller
- * @ap: Port to probe
- * @classes:
- *
- * LOCKING:
- * None (inherited from caller).
- */
-
-static void radisys_pata_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, radisys_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
+#define DRV_VERSION0.4.4
 
 /**
  * radisys_set_piomode - Initialize host controller PATA PIO timings
- * @ap: Port whose timings we are configuring
- * @adev: um
+ * @ap: ATA port
+ * @adev: Device whose timings we are configuring
  *
  * Set PIO mode for device, in host controller PCI config space.
  *
@@ -248,8 +220,9 @@ static const struct ata_port_operations radisys_pata_ops = {
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = radisys_pata_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_unknown,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[libata] export sata_print_link_status()

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=43727fbc753c63f9d2764c56467303698cc52c14
Commit: 43727fbc753c63f9d2764c56467303698cc52c14
Parent: 351772658a4d1acc0221a6e30676bb0594e74812
Author: Jeff Garzik [EMAIL PROTECTED]
AuthorDate: Sun Feb 25 16:50:52 2007 -0500
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:54 2007 -0400

[libata] export sata_print_link_status()

To be used in sata_mv's exception handling code, and overall is a
generally useful function.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |3 ++-
 include/linux/libata.h|1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0abd72d..e7ad13d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1958,7 +1958,7 @@ void ata_port_probe(struct ata_port *ap)
  * LOCKING:
  * None.
  */
-static void sata_print_link_status(struct ata_port *ap)
+void sata_print_link_status(struct ata_port *ap)
 {
u32 sstatus, scontrol, tmp;
 
@@ -6360,6 +6360,7 @@ EXPORT_SYMBOL_GPL(ata_tf_load);
 EXPORT_SYMBOL_GPL(ata_tf_read);
 EXPORT_SYMBOL_GPL(ata_noop_dev_select);
 EXPORT_SYMBOL_GPL(ata_std_dev_select);
+EXPORT_SYMBOL_GPL(sata_print_link_status);
 EXPORT_SYMBOL_GPL(ata_tf_to_fis);
 EXPORT_SYMBOL_GPL(ata_tf_from_fis);
 EXPORT_SYMBOL_GPL(ata_check_status);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0cfbcb6..a417498 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -701,6 +701,7 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
return ap-ops == ata_dummy_port_ops;
 }
 
+extern void sata_print_link_status(struct ata_port *ap);
 extern void ata_port_probe(struct ata_port *);
 extern void __sata_phy_reset(struct ata_port *ap);
 extern void sata_phy_reset(struct ata_port *ap);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[libata] sata_mv: remove extra braces

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=351772658a4d1acc0221a6e30676bb0594e74812
Commit: 351772658a4d1acc0221a6e30676bb0594e74812
Parent: b9099ff63c75216d6ca10bce5a1abcd9293c27e6
Author: Jeff Garzik [EMAIL PROTECTED]
AuthorDate: Sat Feb 24 21:26:42 2007 -0500
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:54 2007 -0400

[libata] sata_mv: remove extra braces

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/sata_mv.c |   19 +++
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index a65ba63..5f3d524 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -798,20 +798,18 @@ static u32 mv_scr_read(struct ata_port *ap, unsigned int 
sc_reg_in)
 {
unsigned int ofs = mv_scr_offset(sc_reg_in);
 
-   if (0xU != ofs) {
+   if (0xU != ofs)
return readl(mv_ap_base(ap) + ofs);
-   } else {
+   else
return (u32) ofs;
-   }
 }
 
 static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
 {
unsigned int ofs = mv_scr_offset(sc_reg_in);
 
-   if (0xU != ofs) {
+   if (0xU != ofs)
writelfl(val, mv_ap_base(ap) + ofs);
-   }
 }
 
 static void mv_edma_cfg(struct mv_host_priv *hpriv, void __iomem *port_mmio)
@@ -1320,17 +1318,15 @@ static void mv_host_intr(struct ata_host *host, u32 
relevant, unsigned int hc)
int shift, port, port0, hard_port, handled;
unsigned int err_mask;
 
-   if (hc == 0) {
+   if (hc == 0)
port0 = 0;
-   } else {
+   else
port0 = MV_PORTS_PER_HC;
-   }
 
/* we'll need the HC success int register in most cases */
hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS);
-   if (hc_irq_cause) {
+   if (hc_irq_cause)
writelfl(~hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS);
-   }
 
VPRINTK(ENTER, hc%u relevant=0x%08x HC IRQ cause=0x%08x\n,
hc,relevant,hc_irq_cause);
@@ -1425,9 +1421,8 @@ static irqreturn_t mv_interrupt(int irq, void 
*dev_instance)
/* check the cases where we either have nothing pending or have read
 * a bogus register value which can indicate HW removal or PCI fault
 */
-   if (!irq_stat || (0xU == irq_stat)) {
+   if (!irq_stat || (0xU == irq_stat))
return IRQ_NONE;
-   }
 
n_hcs = mv_get_hc_count(host-ports[0]-flags);
spin_lock(host-lock);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_atiixp: support -cable_detect

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=847086069cdb5eac14f70cd0aea8545d499c80b4
Commit: 847086069cdb5eac14f70cd0aea8545d499c80b4
Parent: d36a76482c19c186aa638446def39ec643993955
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 19:27:31 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:57 2007 -0400

pata_atiixp: support -cable_detect

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_atiixp.c |   26 --
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 51d9923..39c871a 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -22,7 +22,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_atiixp
-#define DRV_VERSION 0.4.4
+#define DRV_VERSION 0.4.5
 
 enum {
ATIIXP_IDE_PIO_TIMING   = 0x40,
@@ -35,23 +35,15 @@ enum {
 
 static int atiixp_pre_reset(struct ata_port *ap)
 {
-   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
static const struct pci_bits atiixp_enable_bits[] = {
{ 0x48, 1, 0x01, 0x00 },
{ 0x48, 1, 0x08, 0x00 }
};
-   u8 udma;
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
 
if (!pci_test_config_bits(pdev, atiixp_enable_bits[ap-port_no]))
return -ENOENT;
 
-   /* Hack from drivers/ide/pci. Really we want to know how to do the
-  raw detection not play follow the bios mode guess */
-   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap-port_no, udma);
-   if ((udma  0x07) = 0x04 || (udma  0x70) = 0x40)
-   ap-cbl = ATA_CBL_PATA80;
-   else
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -60,6 +52,19 @@ static void atiixp_error_handler(struct ata_port *ap)
ata_bmdma_drive_eh(ap, atiixp_pre_reset, ata_std_softreset, NULL,   
ata_std_postreset);
 }
 
+static int atiixp_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 udma;
+
+   /* Hack from drivers/ide/pci. Really we want to know how to do the
+  raw detection not play follow the bios mode guess */
+   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap-port_no, udma);
+   if ((udma  0x07) = 0x04 || (udma  0x70) = 0x40)
+   return  ATA_CBL_PATA80;
+   return ATA_CBL_PATA40;
+}
+
 /**
  * atiixp_set_pio_timing   -   set initial PIO mode data
  * @ap: ATA interface
@@ -245,6 +250,7 @@ static struct ata_port_operations atiixp_port_ops = {
.thaw   = ata_bmdma_thaw,
.error_handler  = atiixp_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = atiixp_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= atiixp_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_hpt366: support -cable_detect

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fecfda5d88dcc3775f72d6f3a55d11b77c67f878
Commit: fecfda5d88dcc3775f72d6f3a55d11b77c67f878
Parent: 6bfed3fb035b4eff59160c2da5e3fbb69d6b0531
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 19:34:28 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:57 2007 -0400

pata_hpt366: support -cable_detect

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_hpt366.c |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index baf35f8..e9ad4eb 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -27,7 +27,7 @@
 #include linux/libata.h
 
 #define DRV_NAME   pata_hpt366
-#define DRV_VERSION0.6.0
+#define DRV_VERSION0.6.1
 
 struct hpt_clock {
u8  xfer_speed;
@@ -210,24 +210,28 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int 
speed)
return 0xU; /* silence compiler warning */
 }
 
+static int hpt36x_cable_detect(struct ata_port *ap)
+{
+   u8 ata66;
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+
+   pci_read_config_byte(pdev, 0x5A, ata66);
+   if (ata66  (1  ap-port_no))
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
+}
+
 static int hpt36x_pre_reset(struct ata_port *ap)
 {
static const struct pci_bits hpt36x_enable_bits[] = {
{ 0x50, 1, 0x04, 0x04 },
{ 0x54, 1, 0x04, 0x04 }
};
-
-   u8 ata66;
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
 
if (!pci_test_config_bits(pdev, hpt36x_enable_bits[ap-port_no]))
return -ENOENT;
 
-   pci_read_config_byte(pdev, 0x5A, ata66);
-   if (ata66  (1  ap-port_no))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
return ata_std_prereset(ap);
 }
 
@@ -354,6 +358,7 @@ static struct ata_port_operations hpt366_port_ops = {
.thaw   = ata_bmdma_thaw,
.error_handler  = hpt36x_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = hpt36x_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPICA: clear fields reserved before FADT r3

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=79fff270026dc46634563a29b99e4034028ee919
Commit: 79fff270026dc46634563a29b99e4034028ee919
Parent: de46c33745f5e2ad594c72f2cf5f490861b16ce1
Author: Bob Moore [EMAIL PROTECTED]
AuthorDate: Sat Apr 28 20:53:50 2007 -0400
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Sat Apr 28 20:55:06 2007 -0400

ACPICA: clear fields reserved before FADT r3

Linux-2.6.21 stopped booting on a P4/HT because Linux
wrote the FADT.CST_CNT value to the SMI_CMD.
Apparently this stumbled over some SMM instability,
such as confusing SMM when invoking it from cpu1.

Linux did this because even though the r2 FADT reserves
the CST_CNT field, this BIOS set that field and Linux
used it.

Turns out that up through 2.6.20 we explicitly cleared
cst_control for r2 FADTs.  So here we go back to doing that,
plus also clear some additional fields that are reserved
until FADT r3.

http://bugzilla.kernel.org/show_bug.cgi?id=8346

Signed-off-by: Bob Moore [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/tables/tbfadt.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c
index 807c711..1db833e 100644
--- a/drivers/acpi/tables/tbfadt.c
+++ b/drivers/acpi/tables/tbfadt.c
@@ -347,6 +347,18 @@ static void acpi_tb_convert_fadt(void)
acpi_gbl_xpm1b_enable.space_id = 
acpi_gbl_FADT.xpm1a_event_block.space_id;
 
}
+
+   /*
+* For ACPI 1.0 FADTs, ensure that reserved fields (which should be 
zero)
+* are indeed zero. This will workaround BIOSs that inadvertently placed
+* values in these fields.
+*/
+   if (acpi_gbl_FADT.header.revision  3) {
+   acpi_gbl_FADT.preferred_profile = 0;
+   acpi_gbl_FADT.pstate_control = 0;
+   acpi_gbl_FADT.cst_control = 0;
+   acpi_gbl_FADT.boot_flags = 0;
+   }
 }
 
 /**
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: sbs: remove i2c_ec.[ch]

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=439a85c584f7ac8536a43be80475f9eaed71
Commit: 439a85c584f7ac8536a43be80475f9eaed71
Parent: 722062334b972c31a3b83dbf7e9b5a58bb2707dd
Author: Len Brown [EMAIL PROTECTED]
AuthorDate: Thu Mar 22 01:21:05 2007 -0400
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Thu Mar 22 01:21:05 2007 -0400

ACPI: sbs: remove i2c_ec.[ch]

Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/i2c_ec.c |  403 -
 drivers/acpi/i2c_ec.h |   23 ---
 2 files changed, 0 insertions(+), 426 deletions(-)

diff --git a/drivers/acpi/i2c_ec.c b/drivers/acpi/i2c_ec.c
deleted file mode 100644
index acab4a4..000
--- a/drivers/acpi/i2c_ec.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * SMBus driver for ACPI Embedded Controller ($Revision: 1.3 $)
- *
- * Copyright (c) 2002, 2005 Ducrot Bruno
- * Copyright (c) 2005 Rich Townsend (tiny hacks  tweaks)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2.
- */
-
-#include linux/version.h
-#include linux/module.h
-#include linux/slab.h
-#include linux/kernel.h
-#include linux/stddef.h
-#include linux/init.h
-#include linux/i2c.h
-#include linux/acpi.h
-#include linux/delay.h
-
-#include i2c_ec.h
-
-#definexudelay(t)  udelay(t)
-#definexmsleep(t)  msleep(t)
-
-#define ACPI_EC_HC_COMPONENT   0x0008
-#define ACPI_EC_HC_CLASS   ec_hc_smbus
-#define ACPI_EC_HC_HID ACPI0001
-#define ACPI_EC_HC_DEVICE_NAME EC HC smbus
-
-#define _COMPONENT ACPI_EC_HC_COMPONENT
-
-ACPI_MODULE_NAME(i2c_ec);
-
-static int acpi_ec_hc_add(struct acpi_device *device);
-static int acpi_ec_hc_remove(struct acpi_device *device, int type);
-
-static struct acpi_driver acpi_ec_hc_driver = {
-   .name = i2c_ec,
-   .class = ACPI_EC_HC_CLASS,
-   .ids = ACPI_EC_HC_HID,
-   .ops = {
-   .add = acpi_ec_hc_add,
-   .remove = acpi_ec_hc_remove,
-   },
-};
-
-/* Various bit mask for EC_SC (R) */
-#define OBF0x01
-#define IBF0x02
-#define CMD0x08
-#define BURST  0x10
-#define SCI_EVT0x20
-#define SMI_EVT0x40
-
-/* Commands for EC_SC (W) */
-#define RD_EC  0x80
-#define WR_EC  0x81
-#define BE_EC  0x82
-#define BD_EC  0x83
-#define QR_EC  0x84
-
-/*
- * ACPI 2.0 chapter 13 SMBus 2.0 EC register model
- */
-
-#define ACPI_EC_SMB_PRTCL  0x00/* protocol, PEC */
-#define ACPI_EC_SMB_STS0x01/* status */
-#define ACPI_EC_SMB_ADDR   0x02/* address */
-#define ACPI_EC_SMB_CMD0x03/* command */
-#define ACPI_EC_SMB_DATA   0x04/* 32 data registers */
-#define ACPI_EC_SMB_BCNT   0x24/* number of data bytes */
-#define ACPI_EC_SMB_ALRM_A 0x25/* alarm address */
-#define ACPI_EC_SMB_ALRM_D 0x26/* 2 bytes alarm data */
-
-#define ACPI_EC_SMB_STS_DONE   0x80
-#define ACPI_EC_SMB_STS_ALRM   0x40
-#define ACPI_EC_SMB_STS_RES0x20
-#define ACPI_EC_SMB_STS_STATUS 0x1f
-
-#define ACPI_EC_SMB_STATUS_OK  0x00
-#define ACPI_EC_SMB_STATUS_FAIL0x07
-#define ACPI_EC_SMB_STATUS_DNAK0x10
-#define ACPI_EC_SMB_STATUS_DERR0x11
-#define ACPI_EC_SMB_STATUS_CMD_DENY0x12
-#define ACPI_EC_SMB_STATUS_UNKNOWN 0x13
-#define ACPI_EC_SMB_STATUS_ACC_DENY0x17
-#define ACPI_EC_SMB_STATUS_TIMEOUT 0x18
-#define ACPI_EC_SMB_STATUS_NOTSUP  0x19
-#define ACPI_EC_SMB_STATUS_BUSY0x1A
-#define ACPI_EC_SMB_STATUS_PEC 0x1F
-
-#define ACPI_EC_SMB_PRTCL_WRITE0x00
-#define ACPI_EC_SMB_PRTCL_READ 0x01
-#define ACPI_EC_SMB_PRTCL_QUICK0x02
-#define ACPI_EC_SMB_PRTCL_BYTE 0x04
-#define ACPI_EC_SMB_PRTCL_BYTE_DATA0x06
-#define ACPI_EC_SMB_PRTCL_WORD_DATA0x08
-#define ACPI_EC_SMB_PRTCL_BLOCK_DATA   0x0a
-#define ACPI_EC_SMB_PRTCL_PROC_CALL0x0c
-#define ACPI_EC_SMB_PRTCL_BLOCK_PROC_CALL  0x0d
-#define ACPI_EC_SMB_PRTCL_I2C_BLOCK_DATA   0x4a
-#define ACPI_EC_SMB_PRTCL_PEC  0x80
-
-/* Length of pre/post transaction sleep (msec) */
-#define ACPI_EC_SMB_TRANSACTION_SLEEP  1
-#define ACPI_EC_SMB_ACCESS_SLEEP1  1
-#define ACPI_EC_SMB_ACCESS_SLEEP2  10
-
-static int acpi_ec_smb_read(struct acpi_ec_smbus *smbus, u8 address, u8 * data)
-{
-   u8 val;
-   int err;
-
-   err = ec_read(smbus-base + address, val);
-   if (!err) {
-   *data = val;
-   }
-   xmsleep(ACPI_EC_SMB_TRANSACTION_SLEEP);
-   return (err);
-}
-
-static int acpi_ec_smb_write(struct acpi_ec_smbus *smbus, u8 

iomap: implement pcim_iounmap_regions()

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ec04b075843d12b5115267415d0426b48e672136
Commit: ec04b075843d12b5115267415d0426b48e672136
Parent: a73984a0d5664fa1bfdd9f0a475b8d74af7f44a6
Author: Tejun Heo [EMAIL PROTECTED]
AuthorDate: Fri Mar 9 19:45:58 2007 +0900
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:58 2007 -0400

iomap: implement pcim_iounmap_regions()

Implement pcim_iounmap_regions() - the opposite of
pcim_iomap_regions().

Signed-off-by: Tejun heo [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 include/linux/pci.h |1 +
 lib/devres.c|   26 ++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index a3ad762..9724910 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -838,6 +838,7 @@ void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, 
unsigned long maxlen);
 void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
 void __iomem * const * pcim_iomap_table(struct pci_dev *pdev);
 int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
+void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
 
 extern int pci_pci_problems;
 #define PCIPCI_FAIL1   /* No PCI PCI DMA */
diff --git a/lib/devres.c b/lib/devres.c
index eb38849..b1d336c 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -296,5 +296,31 @@ int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, 
const char *name)
return rc;
 }
 EXPORT_SYMBOL(pcim_iomap_regions);
+
+/**
+ * pcim_iounmap_regions - Unmap and release PCI BARs
+ * @pdev: PCI device to map IO resources for
+ * @mask: Mask of BARs to unmap and release
+ *
+ * Unamp and release regions specified by @mask.
+ */
+void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask)
+{
+   void __iomem * const *iomap;
+   int i;
+
+   iomap = pcim_iomap_table(pdev);
+   if (!iomap)
+   return;
+
+   for (i = 0; i  DEVICE_COUNT_RESOURCE; i++) {
+   if (!(mask  (1  i)))
+   continue;
+
+   pcim_iounmap(pdev, iomap[i]);
+   pci_release_region(pdev, i);
+   }
+}
+EXPORT_SYMBOL(pcim_iounmap_regions);
 #endif
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: sbs: Debug messages correction/improvement

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6845118b3b7a9cc2ba14dc665370217bc3ba8057
Commit: 6845118b3b7a9cc2ba14dc665370217bc3ba8057
Parent: 84cb55987236ffea062a35fbe1441768b6bb2722
Author: Vladimir Lebedev [EMAIL PROTECTED]
AuthorDate: Mon Mar 19 17:45:50 2007 +0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Thu Mar 22 01:15:58 2007 -0400

ACPI: sbs: Debug messages correction/improvement

Debug messages correction/improvement:
Use ACPI_EXCEPTION instead of ACPI_DEBUG_PRINT.

Signed-off-by: Vladimir Lebedev [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/sbs.c |  299 ++--
 1 files changed, 149 insertions(+), 150 deletions(-)

diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index eab5c68..3956645 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -271,7 +271,7 @@ acpi_ec_sbs_access(struct acpi_sbs *sbs, u16 addr,
break;
default:
ACPI_EXCEPTION((AE_INFO, AE_ERROR,
-   unsupported transaction %d\n, size));
+   unsupported transaction %d, size));
return (-1);
}
 
@@ -291,7 +291,7 @@ acpi_ec_sbs_access(struct acpi_sbs *sbs, u16 addr,
if ((~temp[0]  ACPI_EC_SMB_STS_DONE)
|| (temp[0]  ACPI_EC_SMB_STS_STATUS)) {
ACPI_EXCEPTION((AE_INFO, AE_ERROR,
-   transaction %d error\n, size));
+   transaction %d error, size));
return (-1);
}
 
@@ -318,7 +318,7 @@ acpi_ec_sbs_access(struct acpi_sbs *sbs, u16 addr,
break;
default:
ACPI_EXCEPTION((AE_INFO, AE_ERROR,
-   unsupported transaction %d\n, size));
+   unsupported transaction %d, size));
return (-1);
}
 
@@ -335,8 +335,8 @@ acpi_sbs_read_word(struct acpi_sbs *sbs, int addr, int 
func, u16 * word)
ACPI_SBS_SMBUS_READ, func,
ACPI_SBS_WORD_DATA, data);
if (result) {
-   ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- acpi_ec_sbs_access() failed\n));
+   ACPI_EXCEPTION((AE_INFO, AE_ERROR,
+   acpi_ec_sbs_access() failed));
} else {
*word = data.word;
}
@@ -354,8 +354,8 @@ acpi_sbs_read_str(struct acpi_sbs *sbs, int addr, int func, 
char *str)
ACPI_SBS_SMBUS_READ, func,
ACPI_SBS_BLOCK_DATA, data);
if (result) {
-   ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- acpi_ec_sbs_access() failed\n));
+   ACPI_EXCEPTION((AE_INFO, AE_ERROR,
+   acpi_ec_sbs_access() failed));
} else {
strncpy(str, (const char *)data.block + 1, data.block[0]);
str[data.block[0]] = 0;
@@ -376,8 +376,8 @@ acpi_sbs_write_word(struct acpi_sbs *sbs, int addr, int 
func, int word)
ACPI_SBS_SMBUS_WRITE, func,
ACPI_SBS_WORD_DATA, data);
if (result) {
-   ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- acpi_ec_sbs_access() failed\n));
+   ACPI_EXCEPTION((AE_INFO, AE_ERROR,
+   acpi_ec_sbs_access() failed));
}
 
return result;
@@ -419,8 +419,8 @@ static int acpi_battery_get_present(struct acpi_battery 
*battery)
result = acpi_sbs_read_word(battery-sbs,
ACPI_SBSM_SMBUS_ADDR, 0x01, state);
if (result) {
-   ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- acpi_sbs_read_word() failed));
+   ACPI_EXCEPTION((AE_INFO, AE_ERROR,
+   acpi_sbs_read_word() failed));
}
if (!result) {
is_present = (state  0x000f)  (1  battery-id);
@@ -456,8 +456,8 @@ static int acpi_battery_select(struct acpi_battery *battery)
result =
acpi_sbs_read_word(sbs, ACPI_SBSM_SMBUS_ADDR, 0x01, state);
if (result) {
-   ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- acpi_sbs_read_word() failed\n));
+   ACPI_EXCEPTION((AE_INFO, AE_ERROR,
+   acpi_sbs_read_word() failed));
goto end;
}
 
@@ -465,8 +465,8 @@ static int acpi_battery_select(struct acpi_battery *battery)
result =
acpi_sbs_write_word(sbs, ACPI_SBSM_SMBUS_ADDR, 0x01, foo);
if (result) {
-   

ACPI: sbs: remove I2C Makefile hooks

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=84cb55987236ffea062a35fbe1441768b6bb2722
Commit: 84cb55987236ffea062a35fbe1441768b6bb2722
Parent: b4150fc4ae20621edf2f8e1ea5ce13eb2c803e7a
Author: Vladimir Lebedev [EMAIL PROTECTED]
AuthorDate: Mon Mar 19 17:45:50 2007 +0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Thu Mar 22 01:15:58 2007 -0400

ACPI: sbs: remove I2C Makefile hooks

SBS does not depend on I2C.
i2c_ec.h and i2c_ec.c are not needed

Signed-off-by: Vladimir Lebedev [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 5956e9f..55bbc40 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -59,4 +59,4 @@ obj-$(CONFIG_ACPI_IBM)+= ibm_acpi.o
 obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
 obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)  += acpi_memhotplug.o
 obj-y  += cm_sbs.o
-obj-$(CONFIG_ACPI_SBS) += i2c_ec.o sbs.o
+obj-$(CONFIG_ACPI_SBS) += sbs.o
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pata_hpt37x: Updates from drivers/ide work

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fcc2f69a6fad1543b466db9c35aa5a2f364eb3d4
Commit: fcc2f69a6fad1543b466db9c35aa5a2f364eb3d4
Parent: ec04b075843d12b5115267415d0426b48e672136
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 23:28:52 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:58 2007 -0400

pata_hpt37x: Updates from drivers/ide work

Drag pata_hpt37x kicking and screaming in the direction of
drivers/ide/pci/hpt366.c and all the work that Sergei has been doing
there. Plenty left to be done but this is a good snapshot for folks to
work on and to review

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/pata_hpt37x.c |  358 ++---
 1 files changed, 146 insertions(+), 212 deletions(-)

diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index f331eee..12f387f 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -8,6 +8,7 @@
  * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED]
  * Portions Copyright (C) 2001 Sun Microsystems, Inc.
  * Portions Copyright (C) 2003 Red Hat Inc
+ * Portions Copyright (C) 2005-2006MontaVista Software, Inc.
  *
  * TODO
  * PLL mode
@@ -25,7 +26,7 @@
 #include linux/libata.h
 
 #define DRV_NAME   pata_hpt37x
-#define DRV_VERSION0.6.0
+#define DRV_VERSION0.6.4
 
 struct hpt_clock {
u8  xfer_speed;
@@ -61,201 +62,75 @@ struct hpt_chip {
  * 31 FIFO enable.
  */
 
-/* from highpoint documentation. these are old values */
-static const struct hpt_clock hpt370_timings_33[] = {
-/* {   XFER_UDMA_5,0x1A85F442, 0x16454e31  }, */
-   {   XFER_UDMA_5,0x16454e31  },
-   {   XFER_UDMA_4,0x16454e31  },
-   {   XFER_UDMA_3,0x166d4e31  },
-   {   XFER_UDMA_2,0x16494e31  },
-   {   XFER_UDMA_1,0x164d4e31  },
-   {   XFER_UDMA_0,0x16514e31  },
-
-   {   XFER_MW_DMA_2,  0x26514e21  },
-   {   XFER_MW_DMA_1,  0x26514e33  },
-   {   XFER_MW_DMA_0,  0x26514e97  },
-
-   {   XFER_PIO_4, 0x06514e21  },
-   {   XFER_PIO_3, 0x06514e22  },
-   {   XFER_PIO_2, 0x06514e33  },
-   {   XFER_PIO_1, 0x06914e43  },
-   {   XFER_PIO_0, 0x06914e57  },
-   {   0,  0x06514e57  }
+static struct hpt_clock hpt37x_timings_33[] = {
+   { XFER_UDMA_6,  0x12446231 },   /* 0x12646231 ?? */
+   { XFER_UDMA_5,  0x12446231 },
+   { XFER_UDMA_4,  0x12446231 },
+   { XFER_UDMA_3,  0x126c6231 },
+   { XFER_UDMA_2,  0x12486231 },
+   { XFER_UDMA_1,  0x124c6233 },
+   { XFER_UDMA_0,  0x12506297 },
+
+   { XFER_MW_DMA_2,0x22406c31 },
+   { XFER_MW_DMA_1,0x22406c33 },
+   { XFER_MW_DMA_0,0x22406c97 },
+
+   { XFER_PIO_4,   0x06414e31 },
+   { XFER_PIO_3,   0x06414e42 },
+   { XFER_PIO_2,   0x06414e53 },
+   { XFER_PIO_1,   0x06814e93 },
+   { XFER_PIO_0,   0x06814ea7 }
 };
 
-static const struct hpt_clock hpt370_timings_66[] = {
-   {   XFER_UDMA_5,0x14846231  },
-   {   XFER_UDMA_4,0x14886231  },
-   {   XFER_UDMA_3,0x148c6231  },
-   {   XFER_UDMA_2,0x148c6231  },
-   {   XFER_UDMA_1,0x14906231  },
-   {   XFER_UDMA_0,0x14986231  },
-
-   {   XFER_MW_DMA_2,  0x26514e21  },
-   {   XFER_MW_DMA_1,  0x26514e33  },
-   {   XFER_MW_DMA_0,  0x26514e97  },
-
-   {   XFER_PIO_4, 0x06514e21  },
-   {   XFER_PIO_3, 0x06514e22  },
-   {   XFER_PIO_2, 0x06514e33  },
-   {   XFER_PIO_1, 0x06914e43  },
-   {   XFER_PIO_0, 0x06914e57  },
-   {   0,  0x06514e57  }
+static struct hpt_clock hpt37x_timings_50[] = {
+   { XFER_UDMA_6,  0x12848242 },
+   { XFER_UDMA_5,  0x12848242 },
+   { XFER_UDMA_4,  0x12ac8242 },
+   { XFER_UDMA_3,  0x128c8242 },
+   { XFER_UDMA_2,  0x120c8242 },
+   { XFER_UDMA_1,  0x12148254 },
+   { XFER_UDMA_0,  0x121882ea },
+
+   { XFER_MW_DMA_2,0x22808242 },
+   { XFER_MW_DMA_1,0x22808254 },
+   { XFER_MW_DMA_0,0x228082ea },
+
+   { XFER_PIO_4,   0x0a81f442 },
+   { XFER_PIO_3,   0x0a81f443 },
+   { XFER_PIO_2,   0x0a81f454 },
+   { XFER_PIO_1,   0x0ac1f465 },
+   { XFER_PIO_0,   0x0ac1f48a }
 };
 
-/* these are the current (4 sep 2001) timings 

pata: expose set_mode method so it can be wrapped

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=04351821b43e6c0c91ad50d7e4be54a935f749e1
Commit: 04351821b43e6c0c91ad50d7e4be54a935f749e1
Parent: fcc2f69a6fad1543b466db9c35aa5a2f364eb3d4
Author: Alan [EMAIL PROTECTED]
AuthorDate: Tue Mar 6 02:37:52 2007 -0800
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:58 2007 -0400

pata: expose set_mode method so it can be wrapped

This splits set_mode into do_set_mode and the wrapper so that a driver can
call the standard method inside its own.  This in theory also obsoletes
-post_set_mode().

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Tejun Heo [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |   37 ++---
 include/linux/libata.h|1 +
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 89a77e1..14b469f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2519,12 +2519,13 @@ static int ata_dev_set_mode(struct ata_device *dev)
 }
 
 /**
- * ata_set_mode - Program timings and issue SET FEATURES - XFER
+ * ata_do_set_mode - Program timings and issue SET FEATURES - XFER
  * @ap: port on which timings will be programmed
  * @r_failed_dev: out paramter for failed device
  *
- * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).  If
- * ata_set_mode() fails, pointer to the failing device is
+ * Standard implementation of the function used to tune and set
+ * ATA device disk transfer mode (PIO3, UDMA6, etc.).  If
+ * ata_dev_set_mode() fails, pointer to the failing device is
  * returned in @r_failed_dev.
  *
  * LOCKING:
@@ -2533,14 +2534,12 @@ static int ata_dev_set_mode(struct ata_device *dev)
  * RETURNS:
  * 0 on success, negative errno otherwise
  */
-int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
+
+int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
 {
struct ata_device *dev;
int i, rc = 0, used_dma = 0, found = 0;
 
-   /* has private set_mode? */
-   if (ap-ops-set_mode)
-   return ap-ops-set_mode(ap, r_failed_dev);
 
/* step 1: calculate xfer_mask */
for (i = 0; i  ATA_MAX_DEVICES; i++) {
@@ -2625,6 +2624,29 @@ int ata_set_mode(struct ata_port *ap, struct ata_device 
**r_failed_dev)
 }
 
 /**
+ * ata_set_mode - Program timings and issue SET FEATURES - XFER
+ * @ap: port on which timings will be programmed
+ * @r_failed_dev: out paramter for failed device
+ *
+ * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).  If
+ * ata_set_mode() fails, pointer to the failing device is
+ * returned in @r_failed_dev.
+ *
+ * LOCKING:
+ * PCI/etc. bus probe sem.
+ *
+ * RETURNS:
+ * 0 on success, negative errno otherwise
+ */
+int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
+{
+   /* has private set_mode? */
+   if (ap-ops-set_mode)
+   return ap-ops-set_mode(ap, r_failed_dev);
+   return ata_do_set_mode(ap, r_failed_dev);
+}
+
+/**
  * ata_tf_to_host - issue ATA taskfile to host controller
  * @ap: port to which command is being issued
  * @tf: ATA taskfile register set
@@ -6413,6 +6435,7 @@ EXPORT_SYMBOL_GPL(ata_altstatus);
 EXPORT_SYMBOL_GPL(ata_exec_command);
 EXPORT_SYMBOL_GPL(ata_port_start);
 EXPORT_SYMBOL_GPL(ata_interrupt);
+EXPORT_SYMBOL_GPL(ata_do_set_mode);
 EXPORT_SYMBOL_GPL(ata_data_xfer);
 EXPORT_SYMBOL_GPL(ata_data_xfer_noirq);
 EXPORT_SYMBOL_GPL(ata_qc_prep);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3451ef9..c145d9d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -831,6 +831,7 @@ extern void ata_scsi_slave_destroy(struct scsi_device 
*sdev);
 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
   int queue_depth);
 extern struct ata_device *ata_dev_pair(struct ata_device *adev);
+extern int ata_do_set_mode(struct ata_port *ap, struct ata_device 
**r_failed_dev);
 extern u8 ata_irq_on(struct ata_port *ap);
 extern u8 ata_dummy_irq_on(struct ata_port *ap);
 extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: sbs: use EC rather than I2C

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d15702cc07503b74494dc4f1ddb15f354987b14
Commit: 6d15702cc07503b74494dc4f1ddb15f354987b14
Parent: 8559840c4ca3f2fff73a882803bc8916078fac1f
Author: Vladimir Lebedev [EMAIL PROTECTED]
AuthorDate: Mon Mar 19 17:45:50 2007 +0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Thu Mar 22 01:15:57 2007 -0400

ACPI: sbs: use EC rather than I2C

SBS is based on EC function(ec_read/ec_write).
Not needed using of I2C structures/functions ... is removed.
SBS does not depend on I2C now.

Signed-off-by: Vladimir Lebedev [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/sbs.c |  565 ++--
 1 files changed, 287 insertions(+), 278 deletions(-)

diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 59640d9..eab5c68 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -30,30 +30,9 @@
 #include linux/seq_file.h
 #include asm/uaccess.h
 #include linux/acpi.h
-#include linux/i2c.h
+#include linux/timer.h
 #include linux/delay.h
 
-#include i2c_ec.h
-
-#defineDEF_CAPACITY_UNIT   3
-#defineMAH_CAPACITY_UNIT   1
-#defineMWH_CAPACITY_UNIT   2
-#defineCAPACITY_UNIT   DEF_CAPACITY_UNIT
-
-#defineREQUEST_UPDATE_MODE 1
-#defineQUEUE_UPDATE_MODE   2
-
-#defineDATA_TYPE_COMMON0
-#defineDATA_TYPE_INFO  1
-#defineDATA_TYPE_STATE 2
-#defineDATA_TYPE_ALARM 3
-#defineDATA_TYPE_AC_STATE  4
-
-extern struct proc_dir_entry *acpi_lock_ac_dir(void);
-extern struct proc_dir_entry *acpi_lock_battery_dir(void);
-extern void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
-extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
-
 #define ACPI_SBS_COMPONENT 0x0008
 #define ACPI_SBS_CLASS sbs
 #define ACPI_AC_CLASS  ac_adapter
@@ -74,15 +53,62 @@ extern void acpi_unlock_battery_dir(struct proc_dir_entry 
*acpi_battery_dir);
 
 #define _COMPONENT ACPI_SBS_COMPONENT
 
-#defineMAX_SBS_BAT 4
-#defineMAX_SMBUS_ERR   1
-
 ACPI_MODULE_NAME(sbs);
 
 MODULE_AUTHOR(Rich Townsend);
 MODULE_DESCRIPTION(Smart Battery System ACPI interface driver);
 MODULE_LICENSE(GPL);
 
+#definexmsleep(t)  msleep(t)
+
+#define ACPI_EC_SMB_PRTCL  0x00/* protocol, PEC */
+
+#define ACPI_EC_SMB_STS0x01/* status */
+#define ACPI_EC_SMB_ADDR   0x02/* address */
+#define ACPI_EC_SMB_CMD0x03/* command */
+#define ACPI_EC_SMB_DATA   0x04/* 32 data registers */
+#define ACPI_EC_SMB_BCNT   0x24/* number of data bytes */
+
+#define ACPI_EC_SMB_STS_DONE   0x80
+#define ACPI_EC_SMB_STS_STATUS 0x1f
+
+#define ACPI_EC_SMB_PRTCL_WRITE0x00
+#define ACPI_EC_SMB_PRTCL_READ 0x01
+#define ACPI_EC_SMB_PRTCL_WORD_DATA0x08
+#define ACPI_EC_SMB_PRTCL_BLOCK_DATA   0x0a
+
+#define ACPI_EC_SMB_TRANSACTION_SLEEP  1
+#define ACPI_EC_SMB_ACCESS_SLEEP1  1
+#define ACPI_EC_SMB_ACCESS_SLEEP2  10
+
+#defineDEF_CAPACITY_UNIT   3
+#defineMAH_CAPACITY_UNIT   1
+#defineMWH_CAPACITY_UNIT   2
+#defineCAPACITY_UNIT   DEF_CAPACITY_UNIT
+
+#defineREQUEST_UPDATE_MODE 1
+#defineQUEUE_UPDATE_MODE   2
+
+#defineDATA_TYPE_COMMON0
+#defineDATA_TYPE_INFO  1
+#defineDATA_TYPE_STATE 2
+#defineDATA_TYPE_ALARM 3
+#defineDATA_TYPE_AC_STATE  4
+
+extern struct proc_dir_entry *acpi_lock_ac_dir(void);
+extern struct proc_dir_entry *acpi_lock_battery_dir(void);
+extern void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
+extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
+
+#defineMAX_SBS_BAT 4
+#define ACPI_SBS_BLOCK_MAX 32
+
+#define ACPI_SBS_SMBUS_READ1
+#define ACPI_SBS_SMBUS_WRITE   2
+
+#define ACPI_SBS_WORD_DATA 1
+#define ACPI_SBS_BLOCK_DATA2
+
 static struct semaphore sbs_sem;
 
 #defineUPDATE_MODE QUEUE_UPDATE_MODE
@@ -105,7 +131,6 @@ module_param(update_time2, int, 0);
 
 static int acpi_sbs_add(struct acpi_device *device);
 static int acpi_sbs_remove(struct acpi_device *device, int type);
-static void acpi_battery_smbus_err_handler(struct acpi_ec_smbus *smbus);
 static void acpi_sbs_update_queue(void *data);
 
 static struct acpi_driver acpi_sbs_driver = {
@@ -126,9 +151,9 @@ struct acpi_battery_info {
int vscale;
int ipscale;
s16 serial_number;
-   char manufacturer_name[I2C_SMBUS_BLOCK_MAX + 3];
-   char device_name[I2C_SMBUS_BLOCK_MAX + 3];
-   char 

ACPI: sbs: remove I2C Kconfig dependency

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b4150fc4ae20621edf2f8e1ea5ce13eb2c803e7a
Commit: b4150fc4ae20621edf2f8e1ea5ce13eb2c803e7a
Parent: 6d15702cc07503b74494dc4f1ddb15f354987b14
Author: Vladimir Lebedev [EMAIL PROTECTED]
AuthorDate: Mon Mar 19 17:45:50 2007 +0300
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Thu Mar 22 01:15:57 2007 -0400

ACPI: sbs: remove I2C Kconfig dependency

SBS does not depend on I2C.

Signed-off-by: Vladimir Lebedev [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/Kconfig |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e2ce4a9..d9d9721 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -388,11 +388,10 @@ config ACPI_HOTPLUG_MEMORY
 
 config ACPI_SBS
tristate Smart Battery System (EXPERIMENTAL)
-   depends on X86  I2C
+   depends on X86
depends on EXPERIMENTAL
help
  This driver adds support for the Smart Battery System.
- Depends on I2C (Device Drivers --- I2C support)
  A Smart Battery is quite old and quite rare compared
  to today's ACPI Control Method battery.
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ACPI: dock: use NULL for pointer

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=62a6d7fd9bc1d85f9aae734c46234e88fa839db0
Commit: 62a6d7fd9bc1d85f9aae734c46234e88fa839db0
Parent: ac122bb64b0d51f0512185d3522a75f3f3a80bc9
Author: Randy Dunlap [EMAIL PROTECTED]
AuthorDate: Mon Mar 26 21:38:49 2007 -0800
Committer:  Len Brown [EMAIL PROTECTED]
CommitDate: Wed Mar 28 23:31:43 2007 -0400

ACPI: dock: use NULL for pointer

Use NULL instead of 0 for pointers:
drivers/acpi/dock.c:677:75: warning: Using plain integer as NULL pointer

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Len Brown [EMAIL PROTECTED]
---
 drivers/acpi/dock.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 811b1aa..4546bf8 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -29,6 +29,7 @@
 #include linux/notifier.h
 #include linux/platform_device.h
 #include linux/jiffies.h
+#include linux/stddef.h
 #include acpi/acpi_bus.h
 #include acpi/acpi_drivers.h
 
@@ -674,7 +675,7 @@ static ssize_t show_dock_uid(struct device *dev,
 struct device_attribute *attr, char *buf)
 {
unsigned long lbuf;
-   acpi_status status = acpi_evaluate_integer(dock_station-handle, 
_UID, 0, lbuf);
+   acpi_status status = acpi_evaluate_integer(dock_station-handle, 
_UID, NULL, lbuf);
if(ACPI_FAILURE(status)) {
return 0;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


libata-core: Fix the iordy methods

2007-04-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=432729f0b0c299ae9731aaa31beaa0dd3a9751eb
Commit: 432729f0b0c299ae9731aaa31beaa0dd3a9751eb
Parent: 04351821b43e6c0c91ad50d7e4be54a935f749e1
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Thu Mar 8 23:22:59 2007 +
Committer:  Jeff Garzik [EMAIL PROTECTED]
CommitDate: Sat Apr 28 14:15:58 2007 -0400

libata-core: Fix the iordy methods

This alone isn't sufficient to save the universe from prehistoric disks
and controllers but it is a first important step. Split off a separate
function to provide a mode filter when controller iordy is not available.

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/ata/libata-core.c |   36 +---
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 14b469f..d01bb5d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1379,30 +1379,44 @@ unsigned int ata_do_simple_cmd(struct ata_device *dev, 
u8 cmd)
  * Check if the current speed of the device requires IORDY. Used
  * by various controllers for chip configuration.
  */
-
+ 
 unsigned int ata_pio_need_iordy(const struct ata_device *adev)
 {
-   int pio;
-   int speed = adev-pio_mode - XFER_PIO_0;
-
-   if (speed  2)
+   /* Controller doesn't support  IORDY. Probably a pointless check
+  as the caller should know this */
+   if (adev-ap-flags  ATA_FLAG_NO_IORDY)
return 0;
-   if (speed  2)
+   /* PIO3 and higher it is mandatory */
+   if (adev-pio_mode  XFER_PIO_2)
return 1;
+   /* We turn it on when possible */
+   if (ata_id_has_iordy(adev-id))
+   return 1;
+   return 0;
+}
 
+/**
+ * ata_pio_mask_no_iordy   -   Return the non IORDY mask
+ * @adev: ATA device
+ *
+ * Compute the highest mode possible if we are not using iordy. Return
+ * -1 if no iordy mode is available.
+ */
+ 
+static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
+{
/* If we have no drive specific rule, then PIO 2 is non IORDY */
-
if (adev-id[ATA_ID_FIELD_VALID]  2) { /* EIDE */
-   pio = adev-id[ATA_ID_EIDE_PIO];
+   u16 pio = adev-id[ATA_ID_EIDE_PIO];
/* Is the speed faster than the drive allows non IORDY ? */
if (pio) {
/* This is cycle times not frequency - watch the logic! 
*/
if (pio  240)  /* PIO2 is 240nS per cycle */
-   return 1;
-   return 0;
+   return 3  ATA_SHIFT_PIO;
+   return 7  ATA_SHIFT_PIO;
}
}
-   return 0;
+   return 3  ATA_SHIFT_PIO;
 }
 
 /**
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


<    1   2   3   4   5   6   7   >