Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / nfc / microread / mei.c
blobe2a77a5fc8871093768cfb61cb7d7fb464d99b51
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
5 * HCI based Driver for Inside Secure microread NFC Chip
6 */
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10 #include <linux/module.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/nfc.h>
13 #include <net/nfc/llc.h>
15 #include "../mei_phy.h"
16 #include "microread.h"
18 #define MICROREAD_DRIVER_NAME "microread"
20 static int microread_mei_probe(struct mei_cl_device *cldev,
21 const struct mei_cl_device_id *id)
23 struct nfc_mei_phy *phy;
24 int r;
26 phy = nfc_mei_phy_alloc(cldev);
27 if (!phy)
28 return -ENOMEM;
30 r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
31 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
32 &phy->hdev);
33 if (r < 0) {
34 nfc_mei_phy_free(phy);
36 return r;
39 return 0;
42 static void microread_mei_remove(struct mei_cl_device *cldev)
44 struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev);
46 microread_remove(phy->hdev);
48 nfc_mei_phy_free(phy);
51 static struct mei_cl_device_id microread_mei_tbl[] = {
52 { MICROREAD_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY},
54 /* required last entry */
55 { }
57 MODULE_DEVICE_TABLE(mei, microread_mei_tbl);
59 static struct mei_cl_driver microread_driver = {
60 .id_table = microread_mei_tbl,
61 .name = MICROREAD_DRIVER_NAME,
63 .probe = microread_mei_probe,
64 .remove = microread_mei_remove,
67 module_mei_cl_driver(microread_driver);
69 MODULE_LICENSE("GPL");
70 MODULE_DESCRIPTION(DRIVER_DESC);