LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
@ 2015-02-20 14:44 Bastien Nocera
  2015-02-26  6:18 ` Darren Hart
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien Nocera @ 2015-02-20 14:44 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh, Darren Hart, ibm-acpi-devel,
	platform-driver-x86, linux-kernel, linux-input, Jiri Kosina

Rather than checking on each suspend and resume whether the laptop
has an adaptive keyboard, check when the driver is initialised.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 drivers/platform/x86/thinkpad_acpi.c | 37 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index c3d11fa..c1f4daf 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -318,6 +318,7 @@ static struct {
 	u32 sensors_pdrv_attrs_registered:1;
 	u32 sensors_pdev_attrs_registered:1;
 	u32 hotkey_poll_active:1;
+	u32 has_adaptive_kbd:1;
 } tp_features;
 
 static struct {
@@ -3226,6 +3227,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 	if (!tp_features.hotkey)
 		return 1;
 
+	/*
+	 * Check if we have an adaptive keyboard, like on the
+	 * Lenovo Carbon X1 2014 (2nd Gen).
+	 */
+	if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
+		if ((hkeyv >> 8) == 2)
+			tp_features.has_adaptive_kbd = true;
+	}
+
 	quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable,
 				     ARRAY_SIZE(tpacpi_hotkey_qtable));
 
@@ -3834,28 +3844,21 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
 
 static void hotkey_suspend(void)
 {
-	int hkeyv;
-
 	/* Do these on suspend, we get the events on early resume! */
 	hotkey_wakeup_reason = TP_ACPI_WAKEUP_NONE;
 	hotkey_autosleep_ack = 0;
 
 	/* save previous mode of adaptive keyboard of X1 Carbon */
-	if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
-		if ((hkeyv >> 8) == 2) {
-			if (!acpi_evalf(hkey_handle,
-						&adaptive_keyboard_prev_mode,
-						"GTRW", "dd", 0)) {
-				pr_err("Cannot read adaptive keyboard mode.\n");
-			}
+	if (tp_features.has_adaptive_kbd) {
+		if (!acpi_evalf(hkey_handle, &adaptive_keyboard_prev_mode,
+					"GTRW", "dd", 0)) {
+			pr_err("Cannot read adaptive keyboard mode.\n");
 		}
 	}
 }
 
 static void hotkey_resume(void)
 {
-	int hkeyv;
-
 	tpacpi_disable_brightness_delay();
 
 	if (hotkey_status_set(true) < 0 ||
@@ -3870,14 +3873,10 @@ static void hotkey_resume(void)
 	hotkey_poll_setup_safe(false);
 
 	/* restore previous mode of adapive keyboard of X1 Carbon */
-	if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
-		if ((hkeyv >> 8) == 2) {
-			if (!acpi_evalf(hkey_handle,
-						NULL,
-						"STRW", "vd",
-						adaptive_keyboard_prev_mode)) {
-				pr_err("Cannot set adaptive keyboard mode.\n");
-			}
+	if (tp_features.has_adaptive_kbd) {
+		if (!acpi_evalf(hkey_handle, NULL, "STRW", "vd",
+					adaptive_keyboard_prev_mode)) {
+			pr_err("Cannot set adaptive keyboard mode.\n");
 		}
 	}
 }
-- 
2.1.0



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

* Re: [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-20 14:44 [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence Bastien Nocera
@ 2015-02-26  6:18 ` Darren Hart
  2015-02-26 11:22   ` Bastien Nocera
  2015-02-27 11:05   ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
  0 siblings, 2 replies; 9+ messages in thread
From: Darren Hart @ 2015-02-26  6:18 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Henrique de Moraes Holschuh, ibm-acpi-devel, platform-driver-x86,
	linux-kernel, linux-input, Jiri Kosina

On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> Rather than checking on each suspend and resume whether the laptop
> has an adaptive keyboard, check when the driver is initialised.

Bastien, am I awaiting another version of this from you to address comments from
Henrique?

Henrique, when you're satisfied, please provide a Reviewed-by for the series.

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center

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

* Re: [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-26  6:18 ` Darren Hart
@ 2015-02-26 11:22   ` Bastien Nocera
  2015-02-27 11:15     ` Henrique de Moraes Holschuh
  2015-02-27 11:05   ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien Nocera @ 2015-02-26 11:22 UTC (permalink / raw)
  To: Darren Hart
  Cc: Henrique de Moraes Holschuh, ibm-acpi-devel, platform-driver-x86,
	linux-kernel, linux-input, Jiri Kosina

On Wed, 2015-02-25 at 22:18 -0800, Darren Hart wrote:
> On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> > Rather than checking on each suspend and resume whether the laptop
> > has an adaptive keyboard, check when the driver is initialised.
> 
> Bastien, am I awaiting another version of this from you to address comments from
> Henrique?

I was waiting for more comments on the additional keycodes from Dmitry
and Jiri.

> Henrique, when you're satisfied, please provide a Reviewed-by for the series.

I can send the first 5 patches of that series if you want to land it
soon.


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

* Re: [ibm-acpi-devel] [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-26  6:18 ` Darren Hart
  2015-02-26 11:22   ` Bastien Nocera
@ 2015-02-27 11:05   ` Henrique de Moraes Holschuh
  2015-02-27 11:16     ` Henrique de Moraes Holschuh
  1 sibling, 1 reply; 9+ messages in thread
From: Henrique de Moraes Holschuh @ 2015-02-27 11:05 UTC (permalink / raw)
  To: Darren Hart, Bastien Nocera
  Cc: Jiri Kosina, linux-kernel, platform-driver-x86, ibm-acpi-devel,
	linux-input

On Thu, Feb 26, 2015, at 03:18, Darren Hart wrote:
> On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> > Rather than checking on each suspend and resume whether the laptop
> > has an adaptive keyboard, check when the driver is initialised.
> 
> Bastien, am I awaiting another version of this from you to address
> comments from
> Henrique?
> 
> Henrique, when you're satisfied, please provide a Reviewed-by for the
> series.

I usually provide a signed-off-by, as I am the thinkpad-acpi driver
maintainer... reviewed-by is implied in that case.

Let's wait a little bit to see if we get a reply on the keycodes.  That
said, Bastien, feel free to send the next version at any time. I won't
object to the initial keymap being full of KEY_RESERVED/KEY_UNKNOWN and
receiving incremental patches later.  It might even help merging, as you
could merge the new keycodes in a smaller patchset through the input
tree, later.

But I really want to see a patch added to the series that updates the
driver documentation before the series gets merged.  It should document
any new sysfs entries, and also the relevant HKEY events related to the
adaptative keyboard, as well as the new keymap.

-- 
  "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
  Henrique Holschuh

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

* Re: [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-26 11:22   ` Bastien Nocera
@ 2015-02-27 11:15     ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 9+ messages in thread
From: Henrique de Moraes Holschuh @ 2015-02-27 11:15 UTC (permalink / raw)
  To: Bastien Nocera, Darren Hart
  Cc: ibm-acpi-devel, platform-driver-x86, linux-kernel, linux-input,
	Jiri Kosina

On Thu, Feb 26, 2015, at 08:22, Bastien Nocera wrote:
> On Wed, 2015-02-25 at 22:18 -0800, Darren Hart wrote:
> > On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> > > Rather than checking on each suspend and resume whether the laptop
> > > has an adaptive keyboard, check when the driver is initialised.
> > 
> > Bastien, am I awaiting another version of this from you to address comments from
> > Henrique?
> 
> I was waiting for more comments on the additional keycodes from Dmitry
> and Jiri.
> 
> > Henrique, when you're satisfied, please provide a Reviewed-by for the series.
> 
> I can send the first 5 patches of that series if you want to land it
> soon.

Please write the missing patch with the documentation update, and add it
to the next version of the series...

We could then merge this series without any new keycodes ASAP through
the platform-x86 tree, and add new keycodes later through either the
input tree or the platform-x86 tree, whichever Dmitry and Darren feel
best.

-- 
  "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
  Henrique Holschuh

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

* Re: [ibm-acpi-devel] [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-27 11:05   ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
@ 2015-02-27 11:16     ` Henrique de Moraes Holschuh
  2015-03-03 16:52       ` Darren Hart
  0 siblings, 1 reply; 9+ messages in thread
From: Henrique de Moraes Holschuh @ 2015-02-27 11:16 UTC (permalink / raw)
  To: Darren Hart, Bastien Nocera
  Cc: Jiri Kosina, linux-kernel, platform-driver-x86, ibm-acpi-devel,
	linux-input

On Fri, Feb 27, 2015, at 08:05, Henrique de Moraes Holschuh wrote:
> On Thu, Feb 26, 2015, at 03:18, Darren Hart wrote:
> > On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> > > Rather than checking on each suspend and resume whether the laptop
> > > has an adaptive keyboard, check when the driver is initialised.
> > 
> > Bastien, am I awaiting another version of this from you to address
> > comments from
> > Henrique?
> > 
> > Henrique, when you're satisfied, please provide a Reviewed-by for the
> > series.
> 
> I usually provide a signed-off-by, as I am the thinkpad-acpi driver
> maintainer... reviewed-by is implied in that case.

Or an Acked-by, for that matter.  Which is what I'd use for this series,
since there is no reason to gatekeep it and it is being sent to you
directly.

-- 
  "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
  Henrique Holschuh

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

* Re: [ibm-acpi-devel] [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-02-27 11:16     ` Henrique de Moraes Holschuh
@ 2015-03-03 16:52       ` Darren Hart
  2015-03-03 18:39         ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 9+ messages in thread
From: Darren Hart @ 2015-03-03 16:52 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Bastien Nocera, Jiri Kosina, linux-kernel, platform-driver-x86,
	ibm-acpi-devel, linux-input

On Fri, Feb 27, 2015 at 08:16:19AM -0300, Henrique de Moraes Holschuh wrote:
> On Fri, Feb 27, 2015, at 08:05, Henrique de Moraes Holschuh wrote:
> > On Thu, Feb 26, 2015, at 03:18, Darren Hart wrote:
> > > On Fri, Feb 20, 2015 at 03:44:10PM +0100, Bastien Nocera wrote:
> > > > Rather than checking on each suspend and resume whether the laptop
> > > > has an adaptive keyboard, check when the driver is initialised.
> > > 
> > > Bastien, am I awaiting another version of this from you to address
> > > comments from
> > > Henrique?
> > > 
> > > Henrique, when you're satisfied, please provide a Reviewed-by for the
> > > series.
> > 
> > I usually provide a signed-off-by, as I am the thinkpad-acpi driver
> > maintainer... reviewed-by is implied in that case.
> 
> Or an Acked-by, for that matter.  Which is what I'd use for this series,
> since there is no reason to gatekeep it and it is being sent to you
> directly.
> 

Henrique, I believe I may have overstepped with thinkpad-acpi and dealt with it
like the other drivers in platform/drivers/x86, when instead I should have been
leaving it to you. My apologies, it was not intentional.

Do you typically send pull-requests for the thinkpad-acpi driver
directly to Linus? Geeze, I see that the tree listed in MAINTAINERS is not even
mine. Ugh, my sincere apologies.

I would be more than happy to basically ignore anything to thinkpad-acpi until
after you have provided a review. I can also roll up pull requests from you if
you prefer to integrate into the platform-drivers-x86 tree as the path to Linus.

How do you want to handle your driver?

-- 
Darren Hart
Intel Open Source Technology Center

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

* Re: [ibm-acpi-devel] [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-03-03 16:52       ` Darren Hart
@ 2015-03-03 18:39         ` Henrique de Moraes Holschuh
  2015-03-06 18:09           ` Darren Hart
  0 siblings, 1 reply; 9+ messages in thread
From: Henrique de Moraes Holschuh @ 2015-03-03 18:39 UTC (permalink / raw)
  To: Darren Hart
  Cc: Bastien Nocera, Jiri Kosina, linux-kernel, platform-driver-x86,
	ibm-acpi-devel, linux-input

On Tue, Mar 3, 2015, at 13:52, Darren Hart wrote:
> Henrique, I believe I may have overstepped with thinkpad-acpi and dealt
> with it like the other drivers in platform/drivers/x86, when instead I should
> have been leaving it to you. My apologies, it was not intentional.

No harm done!  And I did appreciate the extra help :-)

> Do you typically send pull-requests for the thinkpad-acpi driver directly to Linus?

thinkpad-acpi is part of the platform-x86 subsystem, so IMHO it should
continue to be merged through your tree if you are okay with that.

I'd really appreciate if the typical patch approval flux would go
through me first.  However, I certainly don't mind if you merge patches
directly should I be unresponsible for some reason, or when they are
part of the usual tree-wide spot fixes for some pattern/anti-pattern,
etc.

> I would be more than happy to basically ignore anything to thinkpad-acpi until
> after you have provided a review. I can also roll up pull requests from
> you if you prefer to integrate into the platform-drivers-x86 tree as the path to
> Linus.

Well, if it is fine with you, I'd suggest we continue with the process
used in this patchset, where I will reply to patches in this ML with a
reviewed-by or acked-by before you merge them.

If you want to change that at some point, just drop me a note and I will
start pushing patches to you either through this ML or through signed
pull requests, whichever you prefer.

-- 
  "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
  Henrique Holschuh

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

* Re: [ibm-acpi-devel] [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence
  2015-03-03 18:39         ` Henrique de Moraes Holschuh
@ 2015-03-06 18:09           ` Darren Hart
  0 siblings, 0 replies; 9+ messages in thread
From: Darren Hart @ 2015-03-06 18:09 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Bastien Nocera, Jiri Kosina, linux-kernel, platform-driver-x86,
	ibm-acpi-devel, linux-input

On Tue, Mar 03, 2015 at 03:39:54PM -0300, Henrique de Moraes Holschuh wrote:
> On Tue, Mar 3, 2015, at 13:52, Darren Hart wrote:
> > Henrique, I believe I may have overstepped with thinkpad-acpi and dealt
> > with it like the other drivers in platform/drivers/x86, when instead I should
> > have been leaving it to you. My apologies, it was not intentional.
> 
> No harm done!  And I did appreciate the extra help :-)
> 
> > Do you typically send pull-requests for the thinkpad-acpi driver directly to Linus?
> 
> thinkpad-acpi is part of the platform-x86 subsystem, so IMHO it should
> continue to be merged through your tree if you are okay with that.
> 
> I'd really appreciate if the typical patch approval flux would go
> through me first.  However, I certainly don't mind if you merge patches
> directly should I be unresponsible for some reason, or when they are
> part of the usual tree-wide spot fixes for some pattern/anti-pattern,
> etc.
> 
> > I would be more than happy to basically ignore anything to thinkpad-acpi until
> > after you have provided a review. I can also roll up pull requests from
> > you if you prefer to integrate into the platform-drivers-x86 tree as the path to
> > Linus.
> 
> Well, if it is fine with you, I'd suggest we continue with the process
> used in this patchset, where I will reply to patches in this ML with a
> reviewed-by or acked-by before you merge them.
> 
> If you want to change that at some point, just drop me a note and I will
> start pushing patches to you either through this ML or through signed
> pull requests, whichever you prefer.

Great. Things are documented correctly in MAINTAINERS then and we can continue
as before, only I will be more diligent making sure you are Cc'd and have
responded to any thinkpad-acpi.c changes. I assume two weeks is sufficient, but
may nag you after a week.

Thanks!

-- 
Darren Hart
Intel Open Source Technology Center

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

end of thread, other threads:[~2015-03-06 18:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 14:44 [PATCH 1/7] thinkpad_acpi: Remember adaptive kbd presence Bastien Nocera
2015-02-26  6:18 ` Darren Hart
2015-02-26 11:22   ` Bastien Nocera
2015-02-27 11:15     ` Henrique de Moraes Holschuh
2015-02-27 11:05   ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
2015-02-27 11:16     ` Henrique de Moraes Holschuh
2015-03-03 16:52       ` Darren Hart
2015-03-03 18:39         ` Henrique de Moraes Holschuh
2015-03-06 18:09           ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).