1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * isst_tpmi.c: SST TPMI interface
4  *
5  * Copyright (c) 2023, Intel Corporation.
6  * All Rights Reserved.
7  *
8  */
9 
10 #include <linux/auxiliary_bus.h>
11 #include <linux/module.h>
12 #include <linux/intel_tpmi.h>
13 
14 #include "isst_tpmi_core.h"
15 
16 static int intel_sst_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id)
17 {
18 	int ret;
19 
20 	ret = tpmi_sst_init();
21 	if (ret)
22 		return ret;
23 
24 	ret = tpmi_sst_dev_add(auxdev);
25 	if (ret)
26 		tpmi_sst_exit();
27 
28 	return ret;
29 }
30 
31 static void intel_sst_remove(struct auxiliary_device *auxdev)
32 {
33 	tpmi_sst_dev_remove(auxdev);
34 	tpmi_sst_exit();
35 }
36 
37 static const struct auxiliary_device_id intel_sst_id_table[] = {
38 	{ .name = "intel_vsec.tpmi-sst" },
39 	{}
40 };
41 MODULE_DEVICE_TABLE(auxiliary, intel_sst_id_table);
42 
43 static struct auxiliary_driver intel_sst_aux_driver = {
44 	.id_table       = intel_sst_id_table,
45 	.remove         = intel_sst_remove,
46 	.probe          = intel_sst_probe,
47 };
48 
49 module_auxiliary_driver(intel_sst_aux_driver);
50 
51 MODULE_IMPORT_NS(INTEL_TPMI_SST);
52 MODULE_DESCRIPTION("Intel TPMI SST Driver");
53 MODULE_LICENSE("GPL");
54