Picon
Favicon

[PATCH 6/7] ACPI: thinkpad-acpi: bump up version to 0.21

rfkill support deserves a new version checkpoint...

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 Documentation/laptops/thinkpad-acpi.txt |    4 ++--
 drivers/misc/thinkpad_acpi.c            |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 1c1c021..02dc748 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
 <at>  <at>  -1,7 +1,7  <at>  <at> 
 		     ThinkPad ACPI Extras Driver

-                            Version 0.20
-                          April 09th, 2008
+                            Version 0.21
+                           May 29th, 2008

                Borislav Deianov <borislav@...>
              Henrique de Moraes Holschuh <hmh@...>
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index dc8d00a..3eb01af 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -21,7 +21,7  <at>  <at> 
  *  02110-1301, USA.
  */

(Continue reading)

Picon
Favicon

[PATCH 5/7] ACPI: thinkpad-acpi: add bluetooth and WWAN rfkill support

Add a read/write rfkill interface to the bluetooth radio switch on the
bluetooth submodule, and one for the wireless wan radio switch to the wan
submodule.

Since rfkill does care for when a switch changes state, use WLSW
notifications to also check if the WWAN or Bluetooth switches did not
change state (due to them being slaves of WLSW in firmware/hardware, but
that reality not being always properly exported by the thinkpad firmware).

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
Cc: Ivo van Doorn <IvDoorn@...>
Cc: John W. Linville <linville@...>
---
 Documentation/laptops/thinkpad-acpi.txt |   22 +++-
 drivers/misc/Kconfig                    |    2 +
 drivers/misc/thinkpad_acpi.c            |  208 +++++++++++++++++++++++++++----
 3 files changed, 200 insertions(+), 32 deletions(-)

diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 64b3f14..1c1c021 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
 <at>  <at>  -621,7 +621,8  <at>  <at>  Bluetooth
 ---------

 procfs: /proc/acpi/ibm/bluetooth
-sysfs device attribute: bluetooth_enable
+sysfs device attribute: bluetooth_enable (deprecated)
+sysfs rfkill class: switch "tpacpi_bluetooth_sw"

(Continue reading)

Picon
Favicon

[GIT PATCH] thinkpad-acpi changes for 2.6.27 merge window


Andi,

Here a patchset with the thinkpad-acpi changes scheduled for 2.6.27.

It depends on the rfkill changes in net-next-2.6 (already in
linux-next).  Usually, I provide a git tree for pulling and also send
the patches.  Due to the linux-next dependency, this one is going out
just as patches.

Please stage these patches for merging during the 2.6.27 merge window or
on early -rc1, AFTER the rfkill changes land in mainline.

Shortlog:

Henrique de Moraes Holschuh (7):
      ACPI: thinkpad-acpi: minor refactor on radio switch init
      ACPI: thinkpad-acpi: consolidate wlsw notification function
      ACPI: thinkpad-acpi: prepare for bluetooth and wwan rfkill support
      ACPI: thinkpad-acpi: WLSW overrides other rfkill switches
      ACPI: thinkpad-acpi: add bluetooth and WWAN rfkill support
      ACPI: thinkpad-acpi: bump up version to 0.21
      ACPI: thinkpad-acpi: don't misdetect in get_thinkpad_model_data() on -ENOMEM

Thank you.

--

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
(Continue reading)

Picon
Favicon

[PATCH 4/7] ACPI: thinkpad-acpi: WLSW overrides other rfkill switches

On ThinkPads where the WLSW switch exists, the firmware or the hardware
ANDs the WLSW state with the device-specific switches (WWAN, Bluetooth).
It is downright impossible to enable WWAN or Bluetooth when WLSW is
blocking the radios.

This reality does not necessarily carry over to the WWAN and Bluetooth
firmware interfaces, though... so the state thinkpad-acpi was reporting
could be incorrect.

Tie the three switches in the driver so that we keep their state sane.
When WLSL is off, force the other switches to off as well.

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 drivers/misc/thinkpad_acpi.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 743a4d6..202d63e 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -2588,6 +2588,10  <at>  <at>  static int bluetooth_get_radiosw(void)
 	if (!tp_features.bluetooth)
 		return -ENODEV;

+	/* WLSW overrides bluetooth in firmware/hardware, reflect that */
+	if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
+		return 0;
+
 	if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
(Continue reading)

Picon
Favicon

[PATCH 1/7] ACPI: thinkpad-acpi: minor refactor on radio switch init

Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it
much easier to add some Kconfig-selected debugging code later.

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 drivers/misc/thinkpad_acpi.c |   49 ++++++++++++++++++++++-------------------
 1 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index b596929..c800855 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -2167,9 +2167,10  <at>  <at>  static int __init hotkey_init(struct ibm_init_struct *iibm)
 		printk(TPACPI_INFO
 			"radio switch found; radios are %s\n",
 			enabled(status, 0));
+	}
+	if (tp_features.hotkey_wlsw)
 		res = add_to_attr_set(hotkey_dev_attributes,
 				&dev_attr_hotkey_radio_sw.attr);
-	}

 	/* For X41t, X60t, X61t Tablets... */
 	if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
 <at>  <at>  -2646,18 +2647,19  <at>  <at>  static int __init bluetooth_init(struct ibm_init_struct *iibm)
 		str_supported(tp_features.bluetooth),
 		status);

+	if (tp_features.bluetooth &&
+	    !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) {
(Continue reading)

Picon
Favicon

[PATCH 2/7] ACPI: thinkpad-acpi: consolidate wlsw notification function

Rename tpacpi_input_send_radiosw() to tpacpi_send_radiosw_update(), and
make it a central point to issue "radio switch changed state" notifications
by consolidating also the poll() notification in the same function.

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 drivers/misc/thinkpad_acpi.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index c800855..9179f23 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -1285,21 +1285,6  <at>  <at>  static int hotkey_status_set(int status)
 	return 0;
 }

-static void tpacpi_input_send_radiosw(void)
-{
-	int wlsw;
-
-	if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
-		mutex_lock(&tpacpi_inputdev_send_mutex);
-
-		input_report_switch(tpacpi_inputdev,
-				    SW_RFKILL_ALL, !!wlsw);
-		input_sync(tpacpi_inputdev);
-
-		mutex_unlock(&tpacpi_inputdev_send_mutex);
-	}
(Continue reading)

Picon
Favicon

[PATCH 7/7] ACPI: thinkpad-acpi: don't misdetect in get_thinkpad_model_data() on -ENOMEM

Explicitly check for memory allocation failures, and return status to
indicate that we could not collect data due to errors.

This lets the driver have a far more predictable failure mode on ENOMEM in
that codepath: it will refuse to load.  This is far better than trying to
proceed with missing data which is used to detect quirks, etc.

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 drivers/misc/thinkpad_acpi.c |   47 +++++++++++++++++++++++++++++------------
 1 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 3eb01af..d3eb790 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -6340,13 +6340,18  <at>  <at>  err_out:

 /* Probing */

-static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp)
+/* returns 0 - probe ok, or < 0 - probe error.
+ * Probe ok doesn't mean thinkpad found.
+ * On error, kfree() cleanup on tp->* is not performed, caller must do it */
+static int __must_check __init get_thinkpad_model_data(
+						struct thinkpad_id_data *tp)
 {
 	const struct dmi_device *dev = NULL;
 	char ec_fw_string[18];
+	char const *s;
(Continue reading)

Picon
Favicon

[PATCH 3/7] ACPI: thinkpad-acpi: prepare for bluetooth and wwan rfkill support

Get rid of some forward definitions by moving code around, this will make
the rfkill conversion of wwan and bluetooth a bit cleaner.

Signed-off-by: Henrique de Moraes Holschuh <hmh@...>
---
 drivers/misc/thinkpad_acpi.c |  154 ++++++++++++++++++++----------------------
 1 files changed, 74 insertions(+), 80 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 9179f23..743a4d6 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
 <at>  <at>  -2581,8 +2581,37  <at>  <at>  enum {
 	TP_ACPI_BLUETOOTH_UNK		= 0x04,	/* unknown function */
 };

-static int bluetooth_get_radiosw(void);
-static int bluetooth_set_radiosw(int radio_on);
+static int bluetooth_get_radiosw(void)
+{
+	int status;
+
+	if (!tp_features.bluetooth)
+		return -ENODEV;
+
+	if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
+		return -EIO;
+
+	return (status & TP_ACPI_BLUETOOTH_RADIOSSW) != 0;
+}
(Continue reading)

Andi Kleen | 1 Jul 2008 20:44

Re: [PATCH 1/7] ACPI: thinkpad-acpi: minor refactor on radio switch init

Henrique de Moraes Holschuh wrote:
> Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it
> much easier to add some Kconfig-selected debugging code later.

The later seems to be wrong, the debugging code is already included?

Description seems to be incomplete.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Picon
Favicon

Re: [PATCH 1/7] ACPI: thinkpad-acpi: minor refactor on radio switch init

On Tue, 01 Jul 2008, Andi Kleen wrote:
> Henrique de Moraes Holschuh wrote:
> > Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it
> > much easier to add some Kconfig-selected debugging code later.
> 
> The later seems to be wrong, the debugging code is already included?

No, that patch just moves some code around and changes the way some
conditionals were written so it would be easier to add the debugging
code later.  It is supposed to change nothing as far as functionality
goes.

I do have that debugging code, but I didn't see a reason to submit it
for mainline yet.  But it helps me a whole deal if it is easy to just
patch it in when I needed it, so patch 1/7 is something I'd like merged.

The debugging code itself is a harness to simulate the thinkpad rfkill
firmware, as my T43 doesn't have bluetooth, WWAN or the WLSW rfkill
switch and I needed a way to test those codepaths.  As I said, it is a
separate patch I didn't submit yet (and might decide not to submit at
all, unless someone asks for it or I find out it would be helpful to
track some sort of bug).

I.e. the patch does exactly what the description says :-)

But I have nothing against changing that description, I just don't know
what to put in there that would be better...

--

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
(Continue reading)


Gmane