linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	GTA04 owners <gta04-owner@goldelico.com>,
	"Dr. H. Nikolaus Schaller" <hns@goldelico.com>
Subject: [PATCH] OMAPDSS: restore "name" sysfs entry.
Date: Tue, 24 Feb 2015 09:37:06 +0000	[thread overview]
Message-ID: <20150224203706.1eafa129@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 2553 bytes --]



commit 303e4697e762dc92a40405f4e4b8aac02cd0d70b
    OMAPDSS: rename display-sysfs 'name' entry

broke the xorg X server on my device as it couldn't find the display
any more.  It needs the 'name' file and now there isn't one.

That commit claims that 'name' is not compatible with i2c or spi.
i2c does register it own 'name' file, but spi does not, hence my
problem - I have an spi display.

So create a special case for i2c: add the name attribute for non-i2c
devices.

Fixes: 303e4697e762dc92a40405f4e4b8aac02cd0d70b
Signed-off-by: NeilBrown <neilb@suse.de>

--

Hi Tomi,
 I wonder if you would consider this for the next merge window (or maybe even sooner as a bug-fix).
I haven't tested it with an i2c display, but it certainly allows xorg to work
on my spi-attached display.

Thanks,
NeilBrown


diff --git a/drivers/video/fbdev/omap2/dss/display-sysfs.c b/drivers/video/fbdev/omap2/dss/display-sysfs.c
index 5a2095a98ed8..53897b743130 100644
--- a/drivers/video/fbdev/omap2/dss/display-sysfs.c
+++ b/drivers/video/fbdev/omap2/dss/display-sysfs.c
@@ -25,6 +25,15 @@
 #include <linux/platform_device.h>
 #include <linux/sysfs.h>
 
+#if IS_ENABLED(CONFIG_I2C)
+#include <linux/i2c.h>
+#else
+static inline int i2c_verify_client(struct device *dev)
+{
+	return NULL;
+}
+#endif
+
 #include <video/omapdss.h>
 #include "dss.h"
 
@@ -278,6 +287,7 @@ static ssize_t display_wss_store(struct device *dev,
 }
 
 static DEVICE_ATTR(display_name, S_IRUGO, display_name_show, NULL);
+static DEVICE_ATTR(name, S_IRUGO, display_name_show, NULL);
 static DEVICE_ATTR(enabled, S_IRUGO|S_IWUSR,
 		display_enabled_show, display_enabled_store);
 static DEVICE_ATTR(tear_elim, S_IRUGO|S_IWUSR,
@@ -315,6 +325,17 @@ int display_init_sysfs(struct platform_device *pdev)
 			DSSERR("failed to create sysfs files\n");
 			goto err;
 		}
+		if (!i2c_verify_client(dssdev->dev)) {
+			/*
+			 * Add 'name' file - not compatible with i2c, but
+			 * need by Xorg for other devices.
+			 */
+			r = sysfs_create_file(kobj, &dev_attr_name.attr);
+			if (r) {
+				DSSERR("fail to create 'name' sysfs file\n");
+				goto err;
+			}
+		}
 
 		r = sysfs_create_link(&pdev->dev.kobj, kobj, dssdev->alias);
 		if (r) {
@@ -341,5 +362,7 @@ void display_uninit_sysfs(struct platform_device *pdev)
 		sysfs_remove_link(&pdev->dev.kobj, dssdev->alias);
 		sysfs_remove_files(&dssdev->dev->kobj,
 				display_sysfs_attrs);
+		sysfs_remove_file(&dssdev->dev->kobj,
+				  &dev_attr_name.attr);
 	}
 }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

             reply	other threads:[~2015-02-24  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  9:37 NeilBrown [this message]
2015-02-24 10:40 ` [PATCH] OMAPDSS: restore "name" sysfs entry Tomi Valkeinen
2015-02-24 20:31   ` NeilBrown
2015-02-24 20:48     ` Tony Lindgren
2015-02-25  7:04     ` Tomi Valkeinen
2015-02-25  8:49     ` Tomi Valkeinen
2015-02-25  9:20       ` NeilBrown
2015-02-25  9:32         ` Tomi Valkeinen
2015-02-25 22:33           ` NeilBrown
2015-02-24 17:08 ` Dr. H. Nikolaus Schaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150224203706.1eafa129@notabene.brown \
    --to=neilb@suse.de \
    --cc=gta04-owner@goldelico.com \
    --cc=hns@goldelico.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).