All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb
@ 2022-03-30  7:34 David Jander
  2022-03-30  7:34 ` [PATCH 1/2] " David Jander
  2022-03-30  7:34 ` [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb David Jander
  0 siblings, 2 replies; 5+ messages in thread
From: David Jander @ 2022-03-30  7:34 UTC (permalink / raw)
  To: Robin van der Gracht, Miguel Ojeda
  Cc: Rob Herring, linux-kernel, devicetree, David Jander

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb
  2022-03-30  7:34 [PATCH 0/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb David Jander
@ 2022-03-30  7:34 ` David Jander
  2022-03-30  7:34 ` [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb David Jander
  1 sibling, 0 replies; 5+ messages in thread
From: David Jander @ 2022-03-30  7:34 UTC (permalink / raw)
  To: Robin van der Gracht, Miguel Ojeda
  Cc: Rob Herring, linux-kernel, devicetree, David Jander

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb
  2022-03-30  7:34 [PATCH 0/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb David Jander
  2022-03-30  7:34 ` [PATCH 1/2] " David Jander
@ 2022-03-30  7:34 ` David Jander
  2022-03-30 13:50   ` Rob Herring
  2022-03-30 18:19   ` Rob Herring
  1 sibling, 2 replies; 5+ messages in thread
From: David Jander @ 2022-03-30  7:34 UTC (permalink / raw)
  To: Robin van der Gracht, Miguel Ojeda
  Cc: Rob Herring, linux-kernel, devicetree, David Jander

Document the DT property that will cause the holtek auxdisplay driver to
back off if it detects that it is the first driver to probe a framebuffer
device.

Signed-off-by: David Jander <david@protonic.nl>
---
 .../devicetree/bindings/auxdisplay/holtek,ht16k33.yaml         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml b/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
index fc4873deb76f..4de32c3e26ce 100644
--- a/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
+++ b/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
@@ -53,6 +53,9 @@ properties:
     $ref: /schemas/leds/common.yaml#
     unevaluatedProperties: false
 
+  holtek,refuse-primary-fb:
+    description: Refuse to claim the first framebuffer device
+
 required:
   - compatible
   - reg
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-03-30 13:50 UTC (permalink / raw)
  To: David Jander
  Cc: devicetree, Miguel Ojeda, linux-kernel, Rob Herring,
	Robin van der Gracht

On Wed, 30 Mar 2022 09:34:40 +0200, David Jander wrote:
> Document the DT property that will cause the holtek auxdisplay driver to
> back off if it detects that it is the first driver to probe a framebuffer
> device.
> 
> Signed-off-by: David Jander <david@protonic.nl>
> ---
>  .../devicetree/bindings/auxdisplay/holtek,ht16k33.yaml         | 3 +++
>  1 file changed, 3 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml: properties:holtek,refuse-primary-fb: 'oneOf' conditional failed, one must be fixed:
	'type' is a required property
		hint: A vendor boolean property can use "type: boolean"
	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml: properties:holtek,refuse-primary-fb: 'oneOf' conditional failed, one must be fixed:
		'enum' is a required property
		'const' is a required property
		hint: A vendor string property with exact values has an implicit type
		from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml: properties:holtek,refuse-primary-fb: 'oneOf' conditional failed, one must be fixed:
		'$ref' is a required property
		'allOf' is a required property
		hint: A vendor property needs a $ref to types.yaml
		from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml: ignoring, error in schema: properties: holtek,refuse-primary-fb
Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.example.dt.yaml:0:0: /example-0/i2c1/ht16k33@70: failed to match any schema with compatible: ['holtek,ht16k33']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1610969

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] dt-bindings: auxdisplay: holtek,ht16k33.yaml: Add holtek,refuse-primary-fb
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-03-30 18:19 UTC (permalink / raw)
  To: David Jander; +Cc: Robin van der Gracht, Miguel Ojeda, linux-kernel, devicetree

On Wed, Mar 30, 2022 at 09:34:40AM +0200, David Jander wrote:
> Document the DT property that will cause the holtek auxdisplay driver to
> back off if it detects that it is the first driver to probe a framebuffer
> device.
> 
> Signed-off-by: David Jander <david@protonic.nl>
> ---
>  .../devicetree/bindings/auxdisplay/holtek,ht16k33.yaml         | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml b/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
> index fc4873deb76f..4de32c3e26ce 100644
> --- a/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
> +++ b/Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml
> @@ -53,6 +53,9 @@ properties:
>      $ref: /schemas/leds/common.yaml#
>      unevaluatedProperties: false
>  
> +  holtek,refuse-primary-fb:
> +    description: Refuse to claim the first framebuffer device

How is this specific to this device?

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-30 18:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  7:34 [PATCH 0/2] drivers: auxdisplay: ht16k33.c: Add option to refuse claiming primary fb David Jander
2022-03-30  7:34 ` [PATCH 1/2] " David Jander
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.