mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Jander <david@protonic.nl>
To: Robin van der Gracht <robin@protonic.nl>,
	Miguel Ojeda <ojeda@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	David Jander <david@protonic.nl>
Subject: [PATCH 1/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb
Date: Wed, 30 Mar 2022 09:34:39 +0200	[thread overview]
Message-ID: <20220330073440.3986724-2-david@protonic.nl> (raw)
In-Reply-To: <20220330073440.3986724-1-david@protonic.nl>

In the case there is also a display with a frame-buffer device, the probe
order of the auxdisplay fb and the main fb is not predictable, possibly
leading to the situation where the holtek auxdisplay becomes /dev/fb0.
This is problematic because there is currently no way to automatically
rename these devices, and too much user-space software that assumes fb0
to be the main display.
In such a situation, adding "holtek,refuse-primary-fb" to the DT, the
auxdisplay driver returns -EPROBE_DEFER to wait for the primary fb device
to get probed first.

Signed-off-by: David Jander <david@protonic.nl>
---
 drivers/auxdisplay/ht16k33.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 4fab3b2c7023..e8e0c644f2e4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -581,12 +581,20 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
 	return input_register_device(keypad->dev);
 }
 
+extern int num_registered_fb;
+
 static int ht16k33_fbdev_probe(struct device *dev, struct ht16k33_priv *priv,
 			       uint32_t brightness)
 {
 	struct ht16k33_fbdev *fbdev = &priv->fbdev;
 	struct backlight_device *bl = NULL;
 	int err;
+	bool not_primary;
+
+	not_primary = device_property_read_bool(dev, "holtek,refuse-primary-fb");
+
+	if (!num_registered_fb && not_primary)
+		return -EPROBE_DEFER;
 
 	if (priv->led.dev) {
 		err = ht16k33_brightness_set(priv, brightness);
-- 
2.32.0


  reply	other threads:[~2022-03-30  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30  7:34 [PATCH 0/2] " David Jander
2022-03-30  7:34 ` David Jander [this message]
2022-03-30  7:34 ` [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb David Jander
2022-03-30 13:50   ` Rob Herring
2022-03-30 18:19   ` Rob Herring

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=20220330073440.3986724-2-david@protonic.nl \
    --to=david@protonic.nl \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=robin@protonic.nl \
    /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

all inboxes | Powered by JetHome®