diff mbox

[v1,1/1] surface pro 3: add a warning when switching to tablet mode

Message ID 1462880995-66192-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Andy Shevchenko May 10, 2016, 11:49 a.m. UTC
Microsoft Surface Book has a tablet mode button. Print another message once on
this even instead of a bit annoying repetition of "Unknown event...".

Unfortunately we can't right now to implement the proper support of this since
_DSM method is very likely owned by Microsoft and it's not too easy to just run
it. Thus print a warning for now.

One may consider to evaluate GGIV method which seems responsible to return
current mode in use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/surfacepro3_button.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Darren Hart May 11, 2016, 7:56 p.m. UTC | #1
On Tue, May 10, 2016 at 02:49:55PM +0300, Andy Shevchenko wrote:
> Microsoft Surface Book has a tablet mode button. Print another message once on
> this even instead of a bit annoying repetition of "Unknown event...".
> 
> Unfortunately we can't right now to implement the proper support of this since
> _DSM method is very likely owned by Microsoft and it's not too easy to just run
> it. Thus print a warning for now.
> 
> One may consider to evaluate GGIV method which seems responsible to return
> current mode in use.
> 

I cleaned up the language of this commit a bit to make it flow a bit better.
Please do keep the line length under 75 (checkpatch will complain) as this
avoids truncation with "git log".

I dropped the last bit about GGIV entirely as I try to leave speculative stuff
out of the commit logs where possible.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I've pushed this to for-next, thanks Andy. Please have a look and let me know if
you disagree with any of the commit message changes, the code changes I left
intact.
Andy Shevchenko May 12, 2016, 11:11 a.m. UTC | #2
Mailing list missed by some reason, return it back.

On Thu, 2016-05-12 at 01:02 +0000, Chen, Yu C wrote:
> Hi Andy,

> > On Tue, May 10, 2016 at 02:49:55PM +0300, Andy Shevchenko wrote:
> > > 
> > > Microsoft Surface Book has a tablet mode button. Print another
> > > message

> I can not find this button on Surface Pro 3, is this Surface Book
> specific?

I suppose so.
Andy Shevchenko May 12, 2016, 12:32 p.m. UTC | #3
On Wed, 2016-05-11 at 12:56 -0700, Darren Hart wrote:
> On Tue, May 10, 2016 at 02:49:55PM +0300, Andy Shevchenko wrote:
> > 
> > Microsoft Surface Book has a tablet mode button. Print another
> > message once on
> > this even instead of a bit annoying repetition of "Unknown
> > event...".
> > 
> > Unfortunately we can't right now to implement the proper support of
> > this since
> > _DSM method is very likely owned by Microsoft and it's not too easy
> > to just run
> > it. Thus print a warning for now.
> > 
> > One may consider to evaluate GGIV method which seems responsible to
> > return
> > current mode in use.
> > 
> I cleaned up the language of this commit a bit to make it flow a bit
> better.
> Please do keep the line length under 75 (checkpatch will complain) as
> this
> avoids truncation with "git log".

Noted.

> 
> I dropped the last bit about GGIV entirely as I try to leave
> speculative stuff
> out of the commit logs where possible.
> 
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> I've pushed this to for-next, thanks Andy. Please have a look and let
> me know if
> you disagree with any of the commit message changes, the code changes
> I left
> intact.

I checked and found it nice and clean. Thanks, Darren!
diff mbox

Patch

diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
index 700e0fa..6505c97 100644
--- a/drivers/platform/x86/surfacepro3_button.c
+++ b/drivers/platform/x86/surfacepro3_button.c
@@ -24,6 +24,8 @@ 
 #define SURFACE_BUTTON_OBJ_NAME		"VGBI"
 #define SURFACE_BUTTON_DEVICE_NAME	"Surface Pro 3/4 Buttons"
 
+#define SURFACE_BUTTON_NOTIFY_TABLET_MODE	0xc8
+
 #define SURFACE_BUTTON_NOTIFY_PRESS_POWER	0xc6
 #define SURFACE_BUTTON_NOTIFY_RELEASE_POWER	0xc7
 
@@ -33,7 +35,7 @@ 
 #define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP	0xc0
 #define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP	0xc1
 
-#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN	0xc2
+#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN		0xc2
 #define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN	0xc3
 
 ACPI_MODULE_NAME("surface pro 3 button");
@@ -105,9 +107,12 @@  static void surface_button_notify(struct acpi_device *device, u32 event)
 	case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
 		key_code = KEY_VOLUMEDOWN;
 		break;
+	case SURFACE_BUTTON_NOTIFY_TABLET_MODE:
+		dev_warn_once(&device->dev, "Tablet mode is not supported\n");
+		break;
 	default:
 		dev_info_ratelimited(&device->dev,
-				  "Unsupported event [0x%x]\n", event);
+				     "Unsupported event [0x%x]\n", event);
 		break;
 	}
 	input = button->input;