2022-03-31 03:46:36

by David Jander

[permalink] [raw]
Subject: [PATCH 0/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.

David Jander (2):
drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary
fb
dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add
holtek,refuse-primary-fb

.../devicetree/bindings/auxdisplay/holtek,ht16k33.yaml | 3 +++
drivers/auxdisplay/ht16k33.c | 8 ++++++++
2 files changed, 11 insertions(+)

--
2.32.0


2022-03-31 03:55:21

by David Jander

[permalink] [raw]
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 <[email protected]>
---
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