All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fdt: add new fdt_fixup_display function to configure display
@ 2015-04-06 14:07 Tim Harvey
  2015-04-08  1:50 ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2015-04-06 14:07 UTC (permalink / raw)
  To: u-boot

Add 'fdt_fixup_display' function to fixup device-tree for a specific
display. This is useful if a device-tree has configurations for multiple
display timings for undetectable displays.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 common/fdt_support.c  | 31 +++++++++++++++++++++++++++++++
 include/fdt_support.h |  1 +
 2 files changed, 32 insertions(+)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8266bca..60609e5 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1560,3 +1560,34 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
 
 	return 0;
 }
+
+/*
+ * Update native-mode in display-timings from display environment variable.
+ * The node to update are specified by path.
+ */
+int fdt_fixup_display(void *blob, const char *path, const char *display)
+{
+	int off, toff;
+
+	if (!display || !path)
+		return -1;
+
+	toff = fdt_path_offset(blob, path);
+	if (toff >= 0)
+		toff = fdt_subnode_offset(blob, toff, "display-timings");
+	if (toff < 0)
+		return toff;
+
+	for (off = fdt_first_subnode(blob, toff);
+	     off >= 0;
+	     off = fdt_next_subnode(blob, off)) {
+		uint32_t handle = fdt_get_phandle(blob, off);
+		debug("%s:0x%x\n", fdt_get_name(blob, off, NULL),
+		      fdt32_to_cpu(handle));
+		if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0) {
+			fdt_setprop_u32(blob, toff, "native-mode", handle);
+			break;
+		}
+	}
+	return toff;
+}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index ae5e8a3..98379d3 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -46,6 +46,7 @@ void fdt_fixup_ethernet(void *fdt);
 int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 			 const void *val, int len, int create);
 void fdt_fixup_qe_firmware(void *fdt);
+int fdt_fixup_display(void *blob, const char *path, const char *display);
 
 #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
 void fdt_fixup_dr_usb(void *blob, bd_t *bd);
-- 
1.9.1

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

* [U-Boot] [PATCH] fdt: add new fdt_fixup_display function to configure display
  2015-04-06 14:07 [U-Boot] [PATCH] fdt: add new fdt_fixup_display function to configure display Tim Harvey
@ 2015-04-08  1:50 ` Simon Glass
  2015-04-08 18:45   ` [U-Boot] [PATCH v2] " Tim Harvey
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2015-04-08  1:50 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On 6 April 2015 at 08:07, Tim Harvey <tharvey@gateworks.com> wrote:
>
> Add 'fdt_fixup_display' function to fixup device-tree for a specific
> display. This is useful if a device-tree has configurations for multiple
> display timings for undetectable displays.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  common/fdt_support.c  | 31 +++++++++++++++++++++++++++++++
>  include/fdt_support.h |  1 +
>  2 files changed, 32 insertions(+)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 8266bca..60609e5 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -1560,3 +1560,34 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
>
>         return 0;
>  }
> +
> +/*
> + * Update native-mode in display-timings from display environment variable.
> + * The node to update are specified by path.
> + */
> +int fdt_fixup_display(void *blob, const char *path, const char *display)
> +{
> +       int off, toff;
> +
> +       if (!display || !path)
> +               return -1;

This is -FDT_ERR_NOTFOUND. Better to be explicit.

> +
> +       toff = fdt_path_offset(blob, path);
> +       if (toff >= 0)
> +               toff = fdt_subnode_offset(blob, toff, "display-timings");
> +       if (toff < 0)
> +               return toff;
> +
> +       for (off = fdt_first_subnode(blob, toff);
> +            off >= 0;
> +            off = fdt_next_subnode(blob, off)) {
> +               uint32_t handle = fdt_get_phandle(blob, off);
> +               debug("%s:0x%x\n", fdt_get_name(blob, off, NULL),
> +                     fdt32_to_cpu(handle));
> +               if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0) {
> +                       fdt_setprop_u32(blob, toff, "native-mode", handle);

Error checking.

> +                       break;
> +               }
> +       }
> +       return toff;
> +}
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index ae5e8a3..98379d3 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -46,6 +46,7 @@ void fdt_fixup_ethernet(void *fdt);
>  int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
>                          const void *val, int len, int create);
>  void fdt_fixup_qe_firmware(void *fdt);
> +int fdt_fixup_display(void *blob, const char *path, const char *display);

Function comment for this please - see ft_board_setup() as an example.
Remember to document the return value.

>
>  #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
>  void fdt_fixup_dr_usb(void *blob, bd_t *bd);
> --
> 1.9.1
>

Regards,
Simon

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-08  1:50 ` Simon Glass
@ 2015-04-08 18:45   ` Tim Harvey
  2015-04-09 17:56     ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2015-04-08 18:45 UTC (permalink / raw)
  To: u-boot

Add 'fdt_fixup_display' function to fixup device-tree native-mode property
of display-timings node to select timings for a specific display.
This is useful if a device-tree has configurations for multiple
display timings for undetectable displays.

see kernel Documentation/devicetree/bindings/video/display-timing.txt

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v2:
 - use explicit error code
 - return fdt_setprop_u32 to all error checking by caller
 - add comments to function prototype
 - added more verbosity to commit log
---
 common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
 include/fdt_support.h | 13 +++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8266bca..c5ed5ad 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1560,3 +1560,32 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
 
 	return 0;
 }
+
+/*
+ * Update native-mode in display-timings from display environment variable.
+ * The node to update are specified by path.
+ */
+int fdt_fixup_display(void *blob, const char *path, const char *display)
+{
+	int off, toff;
+
+	if (!display || !path)
+		return -FDT_ERR_NOTFOUND;
+
+	toff = fdt_path_offset(blob, path);
+	if (toff >= 0)
+		toff = fdt_subnode_offset(blob, toff, "display-timings");
+	if (toff < 0)
+		return toff;
+
+	for (off = fdt_first_subnode(blob, toff);
+	     off >= 0;
+	     off = fdt_next_subnode(blob, off)) {
+		uint32_t h = fdt_get_phandle(blob, off);
+		debug("%s:0x%x\n", fdt_get_name(blob, off, NULL),
+		      fdt32_to_cpu(h));
+		if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0)
+			return fdt_setprop_u32(blob, toff, "native-mode", h);
+	}
+	return toff;
+}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index ae5e8a3..5d4f28d 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -47,6 +47,19 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 			 const void *val, int len, int create);
 void fdt_fixup_qe_firmware(void *fdt);
 
+/**
+ * Update native-mode property of display-timings node to the phandle
+ * of the timings matching a display by name (case insensitive).
+ *
+ * see kernel Documentation/devicetree/bindings/video/display-timing.txt
+ *
+ * @param blob		FDT blob to update
+ * @param path		path within dt
+ * @param display	name of display timing to match
+ * @return 0 if ok, or -FDT_ERR_... on error
+ */
+int fdt_fixup_display(void *blob, const char *path, const char *display);
+
 #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
 void fdt_fixup_dr_usb(void *blob, bd_t *bd);
 #else
-- 
1.9.1

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-08 18:45   ` [U-Boot] [PATCH v2] " Tim Harvey
@ 2015-04-09 17:56     ` Simon Glass
  2015-04-09 18:05       ` Tim Harvey
  2015-04-21  4:13       ` Tim Harvey
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Glass @ 2015-04-09 17:56 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On 8 April 2015 at 12:45, Tim Harvey <tharvey@gateworks.com> wrote:
>
> Add 'fdt_fixup_display' function to fixup device-tree native-mode property
> of display-timings node to select timings for a specific display.
> This is useful if a device-tree has configurations for multiple
> display timings for undetectable displays.
>
> see kernel Documentation/devicetree/bindings/video/display-timing.txt
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> v2:
>  - use explicit error code
>  - return fdt_setprop_u32 to all error checking by caller
>  - add comments to function prototype
>  - added more verbosity to commit log
> ---
>  common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
>  include/fdt_support.h | 13 +++++++++++++
>  2 files changed, 42 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>

Is that binding file already in U-Boot?

Regards,
Simon

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-09 17:56     ` Simon Glass
@ 2015-04-09 18:05       ` Tim Harvey
  2015-04-09 18:18         ` Simon Glass
  2015-04-21  4:13       ` Tim Harvey
  1 sibling, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2015-04-09 18:05 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
> Is that binding file already in U-Boot?
>

Simon,

No - I don't think it is. I see now that there is a
doc/device-tree-bindings/ dir in U-Boot. Is this for bindings that
U-Boot itself 'uses' as far as using a device-tree U-Boot or just that
U-Boot supports for fixups when booting Linux in ways like I'm doing
with this patch?

Tim

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-09 18:05       ` Tim Harvey
@ 2015-04-09 18:18         ` Simon Glass
  0 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2015-04-09 18:18 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On 9 April 2015 at 12:05, Tim Harvey <tharvey@gateworks.com> wrote:
> On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
>>
>> Is that binding file already in U-Boot?
>>
>
> Simon,
>
> No - I don't think it is. I see now that there is a
> doc/device-tree-bindings/ dir in U-Boot. Is this for bindings that
> U-Boot itself 'uses' as far as using a device-tree U-Boot or just that
> U-Boot supports for fixups when booting Linux in ways like I'm doing
> with this patch?

The former, so actually I don't think we need to add it.

Regards,
Simon

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-09 17:56     ` Simon Glass
  2015-04-09 18:05       ` Tim Harvey
@ 2015-04-21  4:13       ` Tim Harvey
  2015-04-22 12:38         ` Stefano Babic
  1 sibling, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2015-04-21  4:13 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Tim,
>
> On 8 April 2015 at 12:45, Tim Harvey <tharvey@gateworks.com> wrote:
>>
>> Add 'fdt_fixup_display' function to fixup device-tree native-mode property
>> of display-timings node to select timings for a specific display.
>> This is useful if a device-tree has configurations for multiple
>> display timings for undetectable displays.
>>
>> see kernel Documentation/devicetree/bindings/video/display-timing.txt
>>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>> v2:
>>  - use explicit error code
>>  - return fdt_setprop_u32 to all error checking by caller
>>  - add comments to function prototype
>>  - added more verbosity to commit log
>> ---
>>  common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
>>  include/fdt_support.h | 13 +++++++++++++
>>  2 files changed, 42 insertions(+)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Simon,

I thought you were the maintainer for common/fdt_support.c. Can you
commit this or do I need anyone else's ack?

It's a dependency of a set of IMX patches that Stefano is waiting on.

Regards,

Tim

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-21  4:13       ` Tim Harvey
@ 2015-04-22 12:38         ` Stefano Babic
  2015-04-22 16:26           ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Stefano Babic @ 2015-04-22 12:38 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On 21/04/2015 06:13, Tim Harvey wrote:
> On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
>> Hi Tim,
>>
>> On 8 April 2015 at 12:45, Tim Harvey <tharvey@gateworks.com> wrote:
>>>
>>> Add 'fdt_fixup_display' function to fixup device-tree native-mode property
>>> of display-timings node to select timings for a specific display.
>>> This is useful if a device-tree has configurations for multiple
>>> display timings for undetectable displays.
>>>
>>> see kernel Documentation/devicetree/bindings/video/display-timing.txt
>>>
>>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>>> ---
>>> v2:
>>>  - use explicit error code
>>>  - return fdt_setprop_u32 to all error checking by caller
>>>  - add comments to function prototype
>>>  - added more verbosity to commit log
>>> ---
>>>  common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
>>>  include/fdt_support.h | 13 +++++++++++++
>>>  2 files changed, 42 insertions(+)
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
> 
> Simon,
> 
> I thought you were the maintainer for common/fdt_support.c. Can you
> commit this or do I need anyone else's ack?
> 
> It's a dependency of a set of IMX patches that Stefano is waiting on.
> 

Simon has already acked this patch. I can pick it up before the ventana
series.

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-22 12:38         ` Stefano Babic
@ 2015-04-22 16:26           ` Simon Glass
  2015-04-22 17:55             ` Tom Rini
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2015-04-22 16:26 UTC (permalink / raw)
  To: u-boot

Hi,

On 22 April 2015 at 06:38, Stefano Babic <sbabic@denx.de> wrote:
>
> Hi Tim,
>
> On 21/04/2015 06:13, Tim Harvey wrote:
> > On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
> >> Hi Tim,
> >>
> >> On 8 April 2015 at 12:45, Tim Harvey <tharvey@gateworks.com> wrote:
> >>>
> >>> Add 'fdt_fixup_display' function to fixup device-tree native-mode property
> >>> of display-timings node to select timings for a specific display.
> >>> This is useful if a device-tree has configurations for multiple
> >>> display timings for undetectable displays.
> >>>
> >>> see kernel Documentation/devicetree/bindings/video/display-timing.txt
> >>>
> >>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> >>> ---
> >>> v2:
> >>>  - use explicit error code
> >>>  - return fdt_setprop_u32 to all error checking by caller
> >>>  - add comments to function prototype
> >>>  - added more verbosity to commit log
> >>> ---
> >>>  common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
> >>>  include/fdt_support.h | 13 +++++++++++++
> >>>  2 files changed, 42 insertions(+)
> >>
> >> Acked-by: Simon Glass <sjg@chromium.org>
> >
> > Simon,
> >
> > I thought you were the maintainer for common/fdt_support.c. Can you
> > commit this or do I need anyone else's ack?
> >
> > It's a dependency of a set of IMX patches that Stefano is waiting on.
> >
>
> Simon has already acked this patch. I can pick it up before the ventana
> series.

Sounds good. I acked it but it is not in my patchwork TODO list so I
did not apply it.

Regards,
Simon

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

* [U-Boot] [PATCH v2] fdt: add new fdt_fixup_display function to configure display
  2015-04-22 16:26           ` Simon Glass
@ 2015-04-22 17:55             ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2015-04-22 17:55 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 22, 2015 at 10:26:30AM -0600, Simon Glass wrote:
> Hi,
> 
> On 22 April 2015 at 06:38, Stefano Babic <sbabic@denx.de> wrote:
> >
> > Hi Tim,
> >
> > On 21/04/2015 06:13, Tim Harvey wrote:
> > > On Thu, Apr 9, 2015 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
> > >> Hi Tim,
> > >>
> > >> On 8 April 2015 at 12:45, Tim Harvey <tharvey@gateworks.com> wrote:
> > >>>
> > >>> Add 'fdt_fixup_display' function to fixup device-tree native-mode property
> > >>> of display-timings node to select timings for a specific display.
> > >>> This is useful if a device-tree has configurations for multiple
> > >>> display timings for undetectable displays.
> > >>>
> > >>> see kernel Documentation/devicetree/bindings/video/display-timing.txt
> > >>>
> > >>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > >>> ---
> > >>> v2:
> > >>>  - use explicit error code
> > >>>  - return fdt_setprop_u32 to all error checking by caller
> > >>>  - add comments to function prototype
> > >>>  - added more verbosity to commit log
> > >>> ---
> > >>>  common/fdt_support.c  | 29 +++++++++++++++++++++++++++++
> > >>>  include/fdt_support.h | 13 +++++++++++++
> > >>>  2 files changed, 42 insertions(+)
> > >>
> > >> Acked-by: Simon Glass <sjg@chromium.org>
> > >
> > > Simon,
> > >
> > > I thought you were the maintainer for common/fdt_support.c. Can you
> > > commit this or do I need anyone else's ack?
> > >
> > > It's a dependency of a set of IMX patches that Stefano is waiting on.
> > >
> >
> > Simon has already acked this patch. I can pick it up before the ventana
> > series.
> 
> Sounds good. I acked it but it is not in my patchwork TODO list so I
> did not apply it.

For the record, everyone, pleae consider patchwork assignments a "rough
sort" of some kind.  If a patch is assigned to one person but another
custodian feels it might be better in their tree, or that it's assigned
to them but should be someone elses, please take or reassign.  I'm
generally just trying to keep the unassigned patches list empty.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150422/ca2d112d/attachment.sig>

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

end of thread, other threads:[~2015-04-22 17:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-06 14:07 [U-Boot] [PATCH] fdt: add new fdt_fixup_display function to configure display Tim Harvey
2015-04-08  1:50 ` Simon Glass
2015-04-08 18:45   ` [U-Boot] [PATCH v2] " Tim Harvey
2015-04-09 17:56     ` Simon Glass
2015-04-09 18:05       ` Tim Harvey
2015-04-09 18:18         ` Simon Glass
2015-04-21  4:13       ` Tim Harvey
2015-04-22 12:38         ` Stefano Babic
2015-04-22 16:26           ` Simon Glass
2015-04-22 17:55             ` Tom Rini

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.