1 // SPDX-License-Identifier: GPL-2.0-only
3 // Copyright(c) 2020 Intel Corporation. All rights reserved.
5 // Author: Cezary Rojewski <cezary.rojewski@intel.com>
8 #include <linux/pm_runtime.h>
11 static ssize_t
fw_version_show(struct device
*dev
,
12 struct device_attribute
*attr
, char *buf
)
14 struct catpt_dev
*cdev
= dev_get_drvdata(dev
);
15 struct catpt_fw_version version
;
18 pm_runtime_get_sync(cdev
->dev
);
20 ret
= catpt_ipc_get_fw_version(cdev
, &version
);
22 pm_runtime_mark_last_busy(cdev
->dev
);
23 pm_runtime_put_autosuspend(cdev
->dev
);
26 return CATPT_IPC_ERROR(ret
);
28 return sprintf(buf
, "%d.%d.%d.%d\n", version
.type
, version
.major
,
29 version
.minor
, version
.build
);
31 static DEVICE_ATTR_RO(fw_version
);
33 static ssize_t
fw_info_show(struct device
*dev
,
34 struct device_attribute
*attr
, char *buf
)
36 struct catpt_dev
*cdev
= dev_get_drvdata(dev
);
38 return sprintf(buf
, "%s\n", cdev
->ipc
.config
.fw_info
);
40 static DEVICE_ATTR_RO(fw_info
);
42 static struct attribute
*catpt_attrs
[] = {
43 &dev_attr_fw_version
.attr
,
44 &dev_attr_fw_info
.attr
,
48 static const struct attribute_group catpt_attr_group
= {
52 const struct attribute_group
*catpt_attr_groups
[] = {