All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Stephen Boyd <swboyd@chromium.org>,
	benjamin.tissoires@redhat.com, Jiri Kosina <jikos@kernel.org>,
	Sean O'Brien <seobrien@chromium.org>,
	"Douglas Anderson linux-kernel @ vger . kernel . org" 
	<dianders@chromium.org>
Subject: [PATCH v5 4/5] HID: google: Add support for vivaldi to hid-hammer
Date: Sun, 27 Feb 2022 23:54:45 -0800	[thread overview]
Message-ID: <20220228075446.466016-5-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20220228075446.466016-1-dmitry.torokhov@gmail.com>

From: Stephen Boyd <swboyd@chromium.org>

Add support to the hammer driver to parse vivaldi keyboard layouts and
expose them to userspace. This allows hammer devices to use vivaldi
function row keys while also supporting the other features this driver
supports, like the CBAS (chrome base attached switch) and a keyboard
backlight.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220216195901.1326924-4-swboyd@chromium.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/hid/Kconfig             |  2 ++
 drivers/hid/hid-google-hammer.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f5245c5fe1af..4bea966e617b 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -412,6 +412,8 @@ config HID_VIVALDI_COMMON
 
 config HID_GOOGLE_HAMMER
 	tristate "Google Hammer Keyboard"
+	select HID_VIVALDI_COMMON
+	select INPUT_VIVALDIFMAP
 	depends on USB_HID && LEDS_CLASS && CROS_EC
 	help
 	Say Y here if you have a Google Hammer device.
diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index e7da4e74b4bf..5d774c9c596c 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -15,6 +15,7 @@
 
 #include <linux/acpi.h>
 #include <linux/hid.h>
+#include <linux/input/vivaldi-fmap.h>
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -25,6 +26,7 @@
 #include <asm/unaligned.h>
 
 #include "hid-ids.h"
+#include "hid-vivaldi-common.h"
 
 /*
  * C(hrome)B(ase)A(ttached)S(witch) - switch exported by Chrome EC and reporting
@@ -501,8 +503,15 @@ static void hammer_stop(void *hdev)
 static int hammer_probe(struct hid_device *hdev,
 			const struct hid_device_id *id)
 {
+	struct vivaldi_data *vdata;
 	int error;
 
+	vdata = devm_kzalloc(&hdev->dev, sizeof(*vdata), GFP_KERNEL);
+	if (!vdata)
+		return -ENOMEM;
+
+	hid_set_drvdata(hdev, vdata);
+
 	error = hid_parse(hdev);
 	if (error)
 		return error;
@@ -598,6 +607,8 @@ static struct hid_driver hammer_driver = {
 	.id_table = hammer_devices,
 	.probe = hammer_probe,
 	.remove = hammer_remove,
+	.feature_mapping = vivaldi_feature_mapping,
+	.input_configured = vivaldi_input_configured,
 	.input_mapping = hammer_input_mapping,
 	.event = hammer_event,
 };
-- 
2.35.1.574.g5d30c73bfb-goog


  parent reply	other threads:[~2022-02-28  7:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28  7:54 [PATCH v5 0/5] Input/HID: Consolidate ChromeOS Vivaldi keyboard logic Dmitry Torokhov
2022-02-28  7:54 ` [PATCH v5 1/5] HID: google: switch to devm when registering keyboard backlight LED Dmitry Torokhov
2022-02-28  7:54 ` [PATCH v5 2/5] Input: extract ChromeOS vivaldi physmap show function Dmitry Torokhov
2022-02-28  7:54 ` [PATCH v5 3/5] HID: google: extract Vivaldi hid feature mapping for use in hid-hammer Dmitry Torokhov
2022-02-28 20:56   ` Stephen Boyd
2022-02-28  7:54 ` Dmitry Torokhov [this message]
2022-02-28  7:54 ` [PATCH v5 5/5] HID: google: modify HID device groups of eel Dmitry Torokhov
2022-02-28 20:57   ` Stephen Boyd
2022-03-01  6:55     ` Dmitry Torokhov
2022-03-02  1:52 ` [PATCH v5 0/5] Input/HID: Consolidate ChromeOS Vivaldi keyboard logic Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220228075446.466016-5-dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dianders@chromium.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=seobrien@chromium.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.