All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
	robh+dt@kernel.org, kernel@collabora.com,
	devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org, jason@lakedaemon.net
Subject: Re: [RFC PATCH] dt-bindings: display: ti,tfp410.txt: convert to yaml
Date: Wed, 6 May 2020 18:53:20 +0300	[thread overview]
Message-ID: <20200506155320.GC15206@pendragon.ideasonboard.com> (raw)
In-Reply-To: <3e377c73-25a3-a7b3-0604-41c54d70039e@ti.com>

Hi Tomi,

On Tue, Apr 28, 2020 at 12:49:28PM +0300, Tomi Valkeinen wrote:
> On 28/04/2020 12:20, Ricardo Cañuelo wrote:
> 
> > 2) The definition of ti,deskew in the original binding seems to be
> > tailored to the current driver and the way it's defined may not be very
> > DT-friendly.
> > 
> >    This parameter maps to a 3-bit field in a hardware register that takes
> >    a value from 0 to 7, so the [-4, 3] range described for this would map
> >    to [000, 111]: -4 -> 000, -3 -> 001, -2 -> 010, ... 3 -> 111.
> > 
> >    Then, the driver parses the parameter (unsigned) and casts it to a
> >    signed integer to get a number in the [-4, 3] range.
> 
> Interestingly the current example has ti,deskew = <4>...
> 
> >    A vendor-specific property must have a type definition in json-schema,
> >    so if I translate the original bindings semantics directly, I should
> >    define ti,deskew as an int32, but this makes dt_binding_check fail if
> >    the property has a negative value in the example because of the
> >    internal representation of cells as unsigned integers:
> > 
> >       ti,deskew:0:0: 4294967293 is greater than the maximum of 2147483647
> 
> I don't quite understand this. We cannot have negative numbers in dts files? Or we can, but 
> dt_binding_check doesn't handle them correctly? Or that int32 is not supported in yaml bindings?
> 
> >    So I can think of two solutions to this:
> > 
> >    a) Keep the ti,deskew property as an uint32 and document the valid
> >    range ([-4, 3]) in the property description (this is what this patch
> >    does currently).
> > 
> >    b) Redefine this property to be closer to the datasheet description
> >    (ie. unsigned integers from 0 to 7) and adapt the driver accordingly.
> >    This would also let us define its range properly using minimum and
> >    maximum properties for it.
> > 
> >    I think (b) is the right thing to do but I want to know your
> >    opinion. Besides, I don't have this hardware at hand and if I updated
> >    the driver I wouldn't be able to test it.
> 
> I don't think anyone has used deskew property, so I guess changing it is not out of the question.
> 
> Laurent, did you have a board that needs deskew when you added it to tfp410?

I didn't if I remember correctly, I just mapped it to the hardware
features. The hardware register indeed takes a value between 0 and 7,
and that is mapped to [-4,3] x t(STEP). I don't mind either option.

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: devicetree@vger.kernel.org, jason@lakedaemon.net,
	dri-devel@lists.freedesktop.org, robh+dt@kernel.org,
	kernel@collabora.com,
	"Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH] dt-bindings: display: ti,tfp410.txt: convert to yaml
Date: Wed, 6 May 2020 18:53:20 +0300	[thread overview]
Message-ID: <20200506155320.GC15206@pendragon.ideasonboard.com> (raw)
In-Reply-To: <3e377c73-25a3-a7b3-0604-41c54d70039e@ti.com>

Hi Tomi,

On Tue, Apr 28, 2020 at 12:49:28PM +0300, Tomi Valkeinen wrote:
> On 28/04/2020 12:20, Ricardo Cañuelo wrote:
> 
> > 2) The definition of ti,deskew in the original binding seems to be
> > tailored to the current driver and the way it's defined may not be very
> > DT-friendly.
> > 
> >    This parameter maps to a 3-bit field in a hardware register that takes
> >    a value from 0 to 7, so the [-4, 3] range described for this would map
> >    to [000, 111]: -4 -> 000, -3 -> 001, -2 -> 010, ... 3 -> 111.
> > 
> >    Then, the driver parses the parameter (unsigned) and casts it to a
> >    signed integer to get a number in the [-4, 3] range.
> 
> Interestingly the current example has ti,deskew = <4>...
> 
> >    A vendor-specific property must have a type definition in json-schema,
> >    so if I translate the original bindings semantics directly, I should
> >    define ti,deskew as an int32, but this makes dt_binding_check fail if
> >    the property has a negative value in the example because of the
> >    internal representation of cells as unsigned integers:
> > 
> >       ti,deskew:0:0: 4294967293 is greater than the maximum of 2147483647
> 
> I don't quite understand this. We cannot have negative numbers in dts files? Or we can, but 
> dt_binding_check doesn't handle them correctly? Or that int32 is not supported in yaml bindings?
> 
> >    So I can think of two solutions to this:
> > 
> >    a) Keep the ti,deskew property as an uint32 and document the valid
> >    range ([-4, 3]) in the property description (this is what this patch
> >    does currently).
> > 
> >    b) Redefine this property to be closer to the datasheet description
> >    (ie. unsigned integers from 0 to 7) and adapt the driver accordingly.
> >    This would also let us define its range properly using minimum and
> >    maximum properties for it.
> > 
> >    I think (b) is the right thing to do but I want to know your
> >    opinion. Besides, I don't have this hardware at hand and if I updated
> >    the driver I wouldn't be able to test it.
> 
> I don't think anyone has used deskew property, so I guess changing it is not out of the question.
> 
> Laurent, did you have a board that needs deskew when you added it to tfp410?

I didn't if I remember correctly, I just mapped it to the hardware
features. The hardware register indeed takes a value between 0 and 7,
and that is mapped to [-4,3] x t(STEP). I don't mind either option.

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: devicetree@vger.kernel.org, jason@lakedaemon.net,
	dri-devel@lists.freedesktop.org, robh+dt@kernel.org,
	kernel@collabora.com,
	"Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH] dt-bindings: display: ti,tfp410.txt: convert to yaml
Date: Wed, 6 May 2020 18:53:20 +0300	[thread overview]
Message-ID: <20200506155320.GC15206@pendragon.ideasonboard.com> (raw)
In-Reply-To: <3e377c73-25a3-a7b3-0604-41c54d70039e@ti.com>

Hi Tomi,

On Tue, Apr 28, 2020 at 12:49:28PM +0300, Tomi Valkeinen wrote:
> On 28/04/2020 12:20, Ricardo Cañuelo wrote:
> 
> > 2) The definition of ti,deskew in the original binding seems to be
> > tailored to the current driver and the way it's defined may not be very
> > DT-friendly.
> > 
> >    This parameter maps to a 3-bit field in a hardware register that takes
> >    a value from 0 to 7, so the [-4, 3] range described for this would map
> >    to [000, 111]: -4 -> 000, -3 -> 001, -2 -> 010, ... 3 -> 111.
> > 
> >    Then, the driver parses the parameter (unsigned) and casts it to a
> >    signed integer to get a number in the [-4, 3] range.
> 
> Interestingly the current example has ti,deskew = <4>...
> 
> >    A vendor-specific property must have a type definition in json-schema,
> >    so if I translate the original bindings semantics directly, I should
> >    define ti,deskew as an int32, but this makes dt_binding_check fail if
> >    the property has a negative value in the example because of the
> >    internal representation of cells as unsigned integers:
> > 
> >       ti,deskew:0:0: 4294967293 is greater than the maximum of 2147483647
> 
> I don't quite understand this. We cannot have negative numbers in dts files? Or we can, but 
> dt_binding_check doesn't handle them correctly? Or that int32 is not supported in yaml bindings?
> 
> >    So I can think of two solutions to this:
> > 
> >    a) Keep the ti,deskew property as an uint32 and document the valid
> >    range ([-4, 3]) in the property description (this is what this patch
> >    does currently).
> > 
> >    b) Redefine this property to be closer to the datasheet description
> >    (ie. unsigned integers from 0 to 7) and adapt the driver accordingly.
> >    This would also let us define its range properly using minimum and
> >    maximum properties for it.
> > 
> >    I think (b) is the right thing to do but I want to know your
> >    opinion. Besides, I don't have this hardware at hand and if I updated
> >    the driver I wouldn't be able to test it.
> 
> I don't think anyone has used deskew property, so I guess changing it is not out of the question.
> 
> Laurent, did you have a board that needs deskew when you added it to tfp410?

I didn't if I remember correctly, I just mapped it to the hardware
features. The hardware register indeed takes a value between 0 and 7,
and that is mapped to [-4,3] x t(STEP). I don't mind either option.

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-05-06 15:53 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  9:20 [RFC PATCH] dt-bindings: display: ti,tfp410.txt: convert to yaml Ricardo Cañuelo
2020-04-28  9:20 ` Ricardo Cañuelo
2020-04-28  9:20 ` Ricardo Cañuelo
2020-04-28  9:49 ` Tomi Valkeinen
2020-04-28  9:49   ` Tomi Valkeinen
2020-04-28  9:49   ` Tomi Valkeinen
2020-05-06  7:21   ` Ricardo Cañuelo
2020-05-06  7:21     ` Ricardo Cañuelo
2020-05-06  7:21     ` Ricardo Cañuelo
2020-05-06  8:01     ` Tomi Valkeinen
2020-05-06  8:01       ` Tomi Valkeinen
2020-05-06  8:01       ` Tomi Valkeinen
2020-05-06  8:28       ` Ricardo Cañuelo
2020-05-06  8:28         ` Ricardo Cañuelo
2020-05-06  8:28         ` Ricardo Cañuelo
2020-05-06  8:33         ` Tomi Valkeinen
2020-05-06  8:33           ` Tomi Valkeinen
2020-05-06  8:33           ` Tomi Valkeinen
2020-05-06 15:53   ` Laurent Pinchart [this message]
2020-05-06 15:53     ` Laurent Pinchart
2020-05-06 15:53     ` Laurent Pinchart
2020-05-11 14:59     ` Ricardo Cañuelo
2020-05-11 14:59       ` Ricardo Cañuelo
2020-05-11 14:59       ` Ricardo Cañuelo
2020-05-11 16:26       ` Sam Ravnborg
2020-05-11 16:26         ` Sam Ravnborg
2020-05-11 16:26         ` Sam Ravnborg
2020-05-12  2:09       ` Rob Herring
2020-05-12  2:09         ` Rob Herring
2020-05-12  2:09         ` Rob Herring
2020-05-13 11:09     ` Ricardo Cañuelo
2020-05-13 11:09       ` Ricardo Cañuelo
2020-05-13 11:09       ` Ricardo Cañuelo
2020-05-13 14:08       ` Laurent Pinchart
2020-05-13 14:08         ` Laurent Pinchart
2020-05-13 14:08         ` Laurent Pinchart
2020-05-13 14:20         ` Ricardo Cañuelo
2020-05-13 14:20           ` Ricardo Cañuelo
2020-05-13 14:20           ` Ricardo Cañuelo
2020-04-28 19:21 ` Sam Ravnborg
2020-04-28 19:21   ` Sam Ravnborg
2020-04-28 19:21   ` Sam Ravnborg
2020-04-29  8:54   ` Ricardo Cañuelo
2020-04-29  8:54     ` Ricardo Cañuelo
2020-04-29  8:54     ` Ricardo Cañuelo

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=20200506155320.GC15206@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason@lakedaemon.net \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=ricardo.canuelo@collabora.com \
    --cc=robh+dt@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /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 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.