From patchwork Tue Apr 4 12:22:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 9661575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 871A160352 for ; Tue, 4 Apr 2017 12:23:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FE2527D0E for ; Tue, 4 Apr 2017 12:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7471C284D6; Tue, 4 Apr 2017 12:23:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D1AB27D0E for ; Tue, 4 Apr 2017 12:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753683AbdDDMXJ (ORCPT ); Tue, 4 Apr 2017 08:23:09 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:34584 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752909AbdDDMXE (ORCPT ); Tue, 4 Apr 2017 08:23:04 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 08FC7A05FA; Tue, 4 Apr 2017 12:23:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osg.samsung.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (s-opensource.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1tvV0RfqVmXZ; Tue, 4 Apr 2017 12:23:27 +0000 (UTC) Received: from smtp.s-opensource.com (177.133.87.34.dynamic.adsl.gvt.net.br [177.133.87.34]) by osg.samsung.com (Postfix) with ESMTPSA id 4A374A0603; Tue, 4 Apr 2017 12:23:19 +0000 (UTC) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.87) (envelope-from ) id 1cvNTs-0004br-5J; Tue, 04 Apr 2017 09:22:40 -0300 From: Mauro Carvalho Chehab To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: Mauro Carvalho Chehab , Linux Doc Mailing List , Jonathan Corbet , Peter Hutterer , Stuart Yoder , "David S. Miller" , Ingo Tuchscherer , Martin Schwidefsky , Florian Fainelli , Hans Verkuil , Ping Cheng , Douglas Anderson , Kamil Debski Subject: [PATCH v2 35/37] input: add a EV_SW event for ratchet switch Date: Tue, 4 Apr 2017 09:22:35 -0300 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: <67ed7b07043e6fac94528044ebaf541d5deb7c82.1491308444.git.mchehab@s-opensource.com> <8e64d13bfc6952bc9370593ddc556a539f589654.1491308444.git.mchehab@s-opensource.com> <781a89b410f25a2fb39d081d1ebd696317b6d2c2.1491308444.git.mchehab@s-opensource.com> <6800b2c4e8f67b699c22533f7574d380b37cb6d6.1491308444.git.mchehab@s-opensource.com> <9f6ae6ca543f4aa294afd000b7c8a8f49b2e8382.1491308444.git.mchehab@s-opensource.com> <00ec4ed3ae000ee03c3fd725a5fadf33c1353d16.1491308444.git.mchehab@s-opensource.com> <9794ec8a2147f66e9e183f612fa7e834c9245dd9.1491308444.git.mchehab@s-opensource.com> <3bb792c867ec11d1e5b998b2d44e99fbd654ff95.1491308444.git.mchehab@s-opensource.com> <95dd0d035385dac833029e1db56846f02b3ae69c.1491308444.git.mchehab@s-opensource.com> <3efc02b3379dc908bfc0ade34185469295fee2bc.1491308444.git.mchehab@s-opensource.com> <9b1b818d7cde485713aced6b077f0e276a24bddd.1491308444.git.mchehab@s-opensource.com> <8e0ef882aa235e4e6e758662dc434567266fb541.1491308444.git.mchehab@s-opensource.com> <23b1473a9202301d9fdb8f07564467e3091e9810.1491308444.git.mchehab@s-opensource.com> <8606760958a9fbf4cd032f66003d6074e0463584.1491308444.git.mchehab@s-opensource.com> <4b1b04eebf96c72c4e8adee8232077ba89edca6c.1491308444.git.mchehab@s-opensource.com> <3552e3986d3848001b89449926d04f44930c681e.1491308444.git.mchehab@s-opensource.com> <226042dcaf8bc66f46abe97d235904dce8962bd1.1491308444.git.mchehab@s-opensource.com> <679c283194489e852074900b0133b5b6acd9395f.1491308444.git.mchehab@s-opensource.com> <64a9b32549546f6a5b1a5d95fcae550f98ace1d7.1491308444.git.mchehab@s-opensource.com> <55d263f13237495276213de295ae1c6d67f0588b.1491308444.git.mchehab@s-opensource.com> <026c16b07bc58fc2b4b8f2ed6ba1eb4d9f8f37b1.1491308444.git.mchehab@s-opensource.com> <178fde32a3be0f5b05dc60787f6a96c704960bbb.1491308444.git.mchehab@s-opensource.com> In-Reply-To: <67ed7b07043e6fac94528044ebaf541d5deb7c82.1491308444.git.mchehab@s-opensource.com> References: <67ed7b07043e6fac94528044ebaf541d5deb7c82.1491308444.git.mchehab@s-opensource.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some mouses have a switch on their wheel, allowing to switch between ratchet or free wheel mode. Add support for it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/input/event-codes.rst | 16 ++++++++++++++++ include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst index 0c8591d39bc6..93f14f0ddb3d 100644 --- a/Documentation/input/event-codes.rst +++ b/Documentation/input/event-codes.rst @@ -239,6 +239,22 @@ Upon resume, if the switch state is the same as before suspend, then the input subsystem will filter out the duplicate switch state reports. The driver does not need to keep the state of the switch at any time. +A few EV_SW codes have special meanings: + +* SW_RATCHET: + + - Some mouses have a special switch at their wheel that allows to change + from free wheel mode to ratchet mode. + + When such switch is ratchet mode (ON state), the wheel will offer some + resistance for movements movement. It will also provide a tactile + feedback when scrolled. + + When pressed while in ratchet mode, the wheel will switch to free wheel + mode (OFF state). In this mode, it will offer no resistance to wheel + movements nor any tactile feedback. Pressing again returns to ratchet + mode. + EV_MSC ------ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 8850fcaf50db..038cddf1436a 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -292,7 +292,7 @@ struct pcmcia_device_id { #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x1f #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 23b2d377af59..a3eafd0527f1 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -782,7 +782,9 @@ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ -#define SW_MAX 0x0f +#define SW_RATCHET 0x10 /* set = ratchet mode, + unset: free wheel */ +#define SW_MAX 0x1f #define SW_CNT (SW_MAX+1) /*