[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241217-judicious-stereotyped-centipede-5ddb27@houat>
Date: Tue, 17 Dec 2024 09:06:37 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Sandor Yu <Sandor.yu@....com>
Cc: dmitry.baryshkov@...aro.org, andrzej.hajda@...el.com,
neil.armstrong@...aro.org, Laurent.pinchart@...asonboard.com, jonas@...boo.se,
jernej.skrabec@...il.com, airlied@...il.com, daniel@...ll.ch, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, shawnguo@...nel.org, s.hauer@...gutronix.de, festevam@...il.com,
vkoul@...nel.org, dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, linux-phy@...ts.infradead.org,
kernel@...gutronix.de, linux-imx@....com, oliver.brown@....com,
alexander.stein@...tq-group.com, sam@...nborg.org
Subject: Re: [PATCH v20 5/9] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver
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
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists