[PATCH 1/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux