[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220330073440.3986724-2-david@protonic.nl>
Date: Wed, 30 Mar 2022 09:34:39 +0200
From: David Jander <david@...tonic.nl>
To: Robin van der Gracht <robin@...tonic.nl>,
Miguel Ojeda <ojeda@...nel.org>
Cc: Rob Herring <robh+dt@...nel.org>, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, David Jander <david@...tonic.nl>
Subject: [PATCH 1/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb
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@...tonic.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
Powered by blists - more mailing lists