Thread (24 messages) 24 messages, 6 authors, 2025-06-07

Re: [PATCH v20 5/9] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver

From: Maxime Ripard <mripard@kernel.org>
Date: 2024-12-17 08:06:40
Also in: dri-devel, linux-devicetree, linux-phy, lkml

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help