FILE
sysfs.c
File preview with syntax highlighting.
linux-6.19.14/sound/soc/intel/catpt/sysfs.c
1// SPDX-License-Identifier: GPL-2.0-only 2// 3// Copyright(c) 2020 Intel Corporation 4// 5// Author: Cezary Rojewski <cezary.rojewski@intel.com> 6// 7 8#include <linux/pm_runtime.h> 9#include "core.h" 10 11static ssize_t fw_version_show(struct device *dev, 12 struct device_attribute *attr, char *buf) 13{ 14 struct catpt_dev *cdev = dev_get_drvdata(dev); 15 struct catpt_fw_version version; 16 int ret; 17 18 ret = pm_runtime_resume_and_get(cdev->dev); 19 if (ret) 20 return ret; 21 22 ret = catpt_ipc_get_fw_version(cdev, &version); 23 24 pm_runtime_put_autosuspend(cdev->dev); 25 26 if (ret) 27 return CATPT_IPC_ERROR(ret); 28 29 return sysfs_emit(buf, "%d.%d.%d.%d\n", version.type, version.major, 30 version.minor, version.build); 31} 32static DEVICE_ATTR_RO(fw_version); 33 34static ssize_t fw_info_show(struct device *dev, 35 struct device_attribute *attr, char *buf) 36{ 37 struct catpt_dev *cdev = dev_get_drvdata(dev); 38 39 return sysfs_emit(buf, "%s\n", cdev->ipc.config.fw_info); 40} 41static DEVICE_ATTR_RO(fw_info); 42 43static struct attribute *catpt_attrs[] = { 44 &dev_attr_fw_version.attr, 45 &dev_attr_fw_info.attr, 46 NULL 47}; 48 49static const struct attribute_group catpt_attr_group = { 50 .attrs = catpt_attrs, 51}; 52 53const struct attribute_group *catpt_attr_groups[] = { 54 &catpt_attr_group, 55 NULL 56};
~/
Read-only file preview.