2020-09-09 22:03:04 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* HID support for Vivaldi Keyboard
|
|
|
|
*
|
|
|
|
* Copyright 2020 Google LLC.
|
|
|
|
* Author: Sean O'Brien <seobrien@chromium.org>
|
|
|
|
*/
|
|
|
|
|
2022-01-07 23:23:05 +00:00
|
|
|
#include <linux/device.h>
|
2020-09-09 22:03:04 +00:00
|
|
|
#include <linux/hid.h>
|
2022-03-15 02:45:37 +00:00
|
|
|
#include <linux/input/vivaldi-fmap.h>
|
2022-01-07 23:23:05 +00:00
|
|
|
#include <linux/kernel.h>
|
2020-09-09 22:03:04 +00:00
|
|
|
#include <linux/module.h>
|
|
|
|
|
2022-03-15 04:04:39 +00:00
|
|
|
#include "hid-vivaldi-common.h"
|
2020-09-09 22:03:04 +00:00
|
|
|
|
|
|
|
static int vivaldi_probe(struct hid_device *hdev,
|
|
|
|
const struct hid_device_id *id)
|
|
|
|
{
|
|
|
|
struct vivaldi_data *drvdata;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
|
2021-12-15 08:36:05 +00:00
|
|
|
if (!drvdata)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2020-09-09 22:03:04 +00:00
|
|
|
hid_set_drvdata(hdev, drvdata);
|
|
|
|
|
|
|
|
ret = hid_parse(hdev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct hid_device_id vivaldi_table[] = {
|
2022-03-15 04:04:39 +00:00
|
|
|
{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_VIVALDI, HID_ANY_ID, HID_ANY_ID) },
|
2020-09-09 22:03:04 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(hid, vivaldi_table);
|
|
|
|
|
|
|
|
static struct hid_driver hid_vivaldi = {
|
|
|
|
.name = "hid-vivaldi",
|
|
|
|
.id_table = vivaldi_table,
|
|
|
|
.probe = vivaldi_probe,
|
|
|
|
.feature_mapping = vivaldi_feature_mapping,
|
2022-08-04 11:31:16 +00:00
|
|
|
.driver = {
|
|
|
|
.dev_groups = vivaldi_attribute_groups,
|
|
|
|
},
|
2020-09-09 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module_hid_driver(hid_vivaldi);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Sean O'Brien");
|
|
|
|
MODULE_DESCRIPTION("HID vivaldi driver");
|
|
|
|
MODULE_LICENSE("GPL");
|