[PATCH v20 5/9] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver
Maxime Ripard
mripard at kernel.org
Tue Dec 17 00:06:37 PST 2024
Hi,
On Tue, Dec 17, 2024 at 02:51:47PM +0800, Sandor Yu wrote:
> +static ssize_t firmware_version_show(struct device *dev,
> + struct device_attribute *attr, char *buf);
> +static struct device_attribute firmware_version = __ATTR_RO(firmware_version);
> +
> +ssize_t firmware_version_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct cdns_mhdp8501_device *mhdp = dev_get_drvdata(dev);
> +
> + u32 version = readl(mhdp->base.regs + VER_L) | readl(mhdp->base.regs + VER_H) << 8;
> + u32 lib_version = readl(mhdp->base.regs + VER_LIB_L_ADDR) |
> + readl(mhdp->base.regs + VER_LIB_H_ADDR) << 8;
> +
> + return sprintf(buf, "FW version %d, Lib version %d\n", version, lib_version);
> +}
> +
> +static void cdns_mhdp8501_create_device_files(struct cdns_mhdp8501_device *mhdp)
> +{
> + if (device_create_file(mhdp->dev, &firmware_version)) {
> + DRM_ERROR("Unable to create firmware_version sysfs\n");
> + device_remove_file(mhdp->dev, &firmware_version);
> + }
> +}
sysfs files are part of the uABI, and need to be stable and documented.
For these kind of things, you should use debugfs.
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20241217/f4b34e42/attachment.sig>
More information about the linux-arm-kernel
mailing list