linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
@ 2022-10-21 20:07 Douglas Anderson
  2022-10-21 21:18 ` Abhinav Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Douglas Anderson @ 2022-10-21 20:07 UTC (permalink / raw)
  To: dri-devel
  Cc: Kuogee Hsieh, Abhinav Kumar, Stephen Boyd, Douglas Anderson,
	Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, linux-kernel

If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
like to see the EDID that was read so we have a chance of
understanding what's wrong. There's already a function for that, so
let's call it in the error case.

NOTE: edid_block_read() has a retry loop in it, so actually we'll only
print the block read back from the final attempt. This still seems
better than nothing.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/drm_edid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 47465b9765f1..d63e26ec88b1 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2721,6 +2721,8 @@ u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)
 
 	if (edid_block_status_valid(status, edid_block_tag(base_block)))
 		panel_id = edid_extract_panel_id(base_block);
+	else
+		edid_block_dump(KERN_NOTICE, base_block, 0);
 
 	kfree(base_block);
 
-- 
2.38.0.135.g90850a2211-goog


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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-10-21 20:07 [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error Douglas Anderson
@ 2022-10-21 21:18 ` Abhinav Kumar
  2022-10-24 20:28   ` Doug Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Abhinav Kumar @ 2022-10-21 21:18 UTC (permalink / raw)
  To: Douglas Anderson, dri-devel
  Cc: Kuogee Hsieh, Stephen Boyd, Daniel Vetter, David Airlie,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	linux-kernel

Hi Doug

On 10/21/2022 1:07 PM, Douglas Anderson wrote:
> If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
> like to see the EDID that was read so we have a chance of
> understanding what's wrong. There's already a function for that, so
> let's call it in the error case.
> 
> NOTE: edid_block_read() has a retry loop in it, so actually we'll only
> print the block read back from the final attempt. This still seems
> better than nothing.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Instead of checkinf for edid_block_status_valid() on the base_block, do 
you want to use drm_edid_block_valid() instead?

That way you get the edid_block_dump() for free if it was invalid.

> ---
> 
>   drivers/gpu/drm/drm_edid.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 47465b9765f1..d63e26ec88b1 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2721,6 +2721,8 @@ u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)
>   
>   	if (edid_block_status_valid(status, edid_block_tag(base_block)))
>   		panel_id = edid_extract_panel_id(base_block);
> +	else
> +		edid_block_dump(KERN_NOTICE, base_block, 0);
>   
>   	kfree(base_block);
>   

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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-10-21 21:18 ` Abhinav Kumar
@ 2022-10-24 20:28   ` Doug Anderson
  2022-10-25 20:39     ` Abhinav Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Anderson @ 2022-10-24 20:28 UTC (permalink / raw)
  To: Abhinav Kumar
  Cc: dri-devel, Kuogee Hsieh, Stephen Boyd, Daniel Vetter,
	David Airlie, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, linux-kernel

Hi,

On Fri, Oct 21, 2022 at 2:18 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
> Hi Doug
>
> On 10/21/2022 1:07 PM, Douglas Anderson wrote:
> > If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
> > like to see the EDID that was read so we have a chance of
> > understanding what's wrong. There's already a function for that, so
> > let's call it in the error case.
> >
> > NOTE: edid_block_read() has a retry loop in it, so actually we'll only
> > print the block read back from the final attempt. This still seems
> > better than nothing.
> >
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
>
> Instead of checkinf for edid_block_status_valid() on the base_block, do
> you want to use drm_edid_block_valid() instead?
>
> That way you get the edid_block_dump() for free if it was invalid.

I can... ...but it feels a bit awkward and maybe not quite how the
functions were intended to work together?

One thing I notice is that if I call drm_edid_block_valid() I'm doing
a bunch of duplicate work that already happened in edid_block_read(),
which already calls edid_block_check() and handles fixing headers. I
guess also if I call drm_edid_block_valid() then I should ignore the
"status" return value of edid_block_read() because we don't need to
pass it anywhere (because the work is re-done in
drm_edid_block_valid()).

So I guess I'm happy to do a v2 like that if everyone likes it better,
but to me it feels a little weird.

-Doug

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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-10-24 20:28   ` Doug Anderson
@ 2022-10-25 20:39     ` Abhinav Kumar
  2022-11-11 20:45       ` Doug Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Abhinav Kumar @ 2022-10-25 20:39 UTC (permalink / raw)
  To: Doug Anderson
  Cc: dri-devel, Kuogee Hsieh, Stephen Boyd, Daniel Vetter,
	David Airlie, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, linux-kernel

Hi Doug

On 10/24/2022 1:28 PM, Doug Anderson wrote:
> Hi,
> 
> On Fri, Oct 21, 2022 at 2:18 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>>
>> Hi Doug
>>
>> On 10/21/2022 1:07 PM, Douglas Anderson wrote:
>>> If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
>>> like to see the EDID that was read so we have a chance of
>>> understanding what's wrong. There's already a function for that, so
>>> let's call it in the error case.
>>>
>>> NOTE: edid_block_read() has a retry loop in it, so actually we'll only
>>> print the block read back from the final attempt. This still seems
>>> better than nothing.
>>>
>>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>>
>> Instead of checkinf for edid_block_status_valid() on the base_block, do
>> you want to use drm_edid_block_valid() instead?
>>
>> That way you get the edid_block_dump() for free if it was invalid.
> 
> I can... ...but it feels a bit awkward and maybe not quite how the
> functions were intended to work together?
> 
> One thing I notice is that if I call drm_edid_block_valid() I'm doing
> a bunch of duplicate work that already happened in edid_block_read(),
> which already calls edid_block_check() and handles fixing headers. I
> guess also if I call drm_edid_block_valid() then I should ignore the
> "status" return value of edid_block_read() because we don't need to
> pass it anywhere (because the work is re-done in
> drm_edid_block_valid()).
> 
> So I guess I'm happy to do a v2 like that if everyone likes it better,
> but to me it feels a little weird.
> 
> -Doug

Alright, agreed. There is some duplication of code happening if we use 
drm_edid_block_valid(). I had suggested that because it has inherent 
support for dumping the bad EDID.

In that case, this change LGTM, because in principle you are doing the 
same thing as _drm_do_get_edid() (with the only difference being here we 
read only the base block as opposed to the full EDID there).

Hence,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>


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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-10-25 20:39     ` Abhinav Kumar
@ 2022-11-11 20:45       ` Doug Anderson
  2022-11-14 10:02         ` Jani Nikula
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Anderson @ 2022-11-11 20:45 UTC (permalink / raw)
  To: Abhinav Kumar
  Cc: dri-devel, Kuogee Hsieh, Stephen Boyd, Daniel Vetter,
	David Airlie, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, linux-kernel

Hi,

On Tue, Oct 25, 2022 at 1:39 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
> Hi Doug
>
> On 10/24/2022 1:28 PM, Doug Anderson wrote:
> > Hi,
> >
> > On Fri, Oct 21, 2022 at 2:18 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> >>
> >> Hi Doug
> >>
> >> On 10/21/2022 1:07 PM, Douglas Anderson wrote:
> >>> If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
> >>> like to see the EDID that was read so we have a chance of
> >>> understanding what's wrong. There's already a function for that, so
> >>> let's call it in the error case.
> >>>
> >>> NOTE: edid_block_read() has a retry loop in it, so actually we'll only
> >>> print the block read back from the final attempt. This still seems
> >>> better than nothing.
> >>>
> >>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> >>
> >> Instead of checkinf for edid_block_status_valid() on the base_block, do
> >> you want to use drm_edid_block_valid() instead?
> >>
> >> That way you get the edid_block_dump() for free if it was invalid.
> >
> > I can... ...but it feels a bit awkward and maybe not quite how the
> > functions were intended to work together?
> >
> > One thing I notice is that if I call drm_edid_block_valid() I'm doing
> > a bunch of duplicate work that already happened in edid_block_read(),
> > which already calls edid_block_check() and handles fixing headers. I
> > guess also if I call drm_edid_block_valid() then I should ignore the
> > "status" return value of edid_block_read() because we don't need to
> > pass it anywhere (because the work is re-done in
> > drm_edid_block_valid()).
> >
> > So I guess I'm happy to do a v2 like that if everyone likes it better,
> > but to me it feels a little weird.
> >
> > -Doug
>
> Alright, agreed. There is some duplication of code happening if we use
> drm_edid_block_valid(). I had suggested that because it has inherent
> support for dumping the bad EDID.
>
> In that case, this change LGTM, because in principle you are doing the
> same thing as _drm_do_get_edid() (with the only difference being here we
> read only the base block as opposed to the full EDID there).
>
> Hence,
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

I've given this patch a bunch of time because it wasn't urgent, but
seems like it could be about time to land. I'll plan to land it next
Monday or Tuesday unless anyone has any other comments.

Thanks!

-Doug

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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-11-11 20:45       ` Doug Anderson
@ 2022-11-14 10:02         ` Jani Nikula
  2022-11-14 22:08           ` Doug Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2022-11-14 10:02 UTC (permalink / raw)
  To: Doug Anderson, Abhinav Kumar
  Cc: Thomas Zimmermann, linux-kernel, dri-devel, Stephen Boyd, Kuogee Hsieh

On Fri, 11 Nov 2022, Doug Anderson <dianders@chromium.org> wrote:
> Hi,
>
> On Tue, Oct 25, 2022 at 1:39 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>>
>> Hi Doug
>>
>> On 10/24/2022 1:28 PM, Doug Anderson wrote:
>> > Hi,
>> >
>> > On Fri, Oct 21, 2022 at 2:18 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>> >>
>> >> Hi Doug
>> >>
>> >> On 10/21/2022 1:07 PM, Douglas Anderson wrote:
>> >>> If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
>> >>> like to see the EDID that was read so we have a chance of
>> >>> understanding what's wrong. There's already a function for that, so
>> >>> let's call it in the error case.
>> >>>
>> >>> NOTE: edid_block_read() has a retry loop in it, so actually we'll only
>> >>> print the block read back from the final attempt. This still seems
>> >>> better than nothing.
>> >>>
>> >>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>> >>
>> >> Instead of checkinf for edid_block_status_valid() on the base_block, do
>> >> you want to use drm_edid_block_valid() instead?
>> >>
>> >> That way you get the edid_block_dump() for free if it was invalid.
>> >
>> > I can... ...but it feels a bit awkward and maybe not quite how the
>> > functions were intended to work together?
>> >
>> > One thing I notice is that if I call drm_edid_block_valid() I'm doing
>> > a bunch of duplicate work that already happened in edid_block_read(),
>> > which already calls edid_block_check() and handles fixing headers. I
>> > guess also if I call drm_edid_block_valid() then I should ignore the
>> > "status" return value of edid_block_read() because we don't need to
>> > pass it anywhere (because the work is re-done in
>> > drm_edid_block_valid()).
>> >
>> > So I guess I'm happy to do a v2 like that if everyone likes it better,
>> > but to me it feels a little weird.
>> >
>> > -Doug
>>
>> Alright, agreed. There is some duplication of code happening if we use
>> drm_edid_block_valid(). I had suggested that because it has inherent
>> support for dumping the bad EDID.
>>
>> In that case, this change LGTM, because in principle you are doing the
>> same thing as _drm_do_get_edid() (with the only difference being here we
>> read only the base block as opposed to the full EDID there).
>>
>> Hence,
>>
>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>
> I've given this patch a bunch of time because it wasn't urgent, but
> seems like it could be about time to land. I'll plan to land it next
> Monday or Tuesday unless anyone has any other comments.

Ack, it's benign enough.

BR,
Jani.

>
> Thanks!
>
> -Doug

-- 
Jani Nikula, Intel Open Source Graphics Center

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

* Re: [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error
  2022-11-14 10:02         ` Jani Nikula
@ 2022-11-14 22:08           ` Doug Anderson
  0 siblings, 0 replies; 7+ messages in thread
From: Doug Anderson @ 2022-11-14 22:08 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Abhinav Kumar, Thomas Zimmermann, linux-kernel, dri-devel,
	Stephen Boyd, Kuogee Hsieh

Hi,

On Mon, Nov 14, 2022 at 2:02 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Fri, 11 Nov 2022, Doug Anderson <dianders@chromium.org> wrote:
> > Hi,
> >
> > On Tue, Oct 25, 2022 at 1:39 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> >>
> >> Hi Doug
> >>
> >> On 10/24/2022 1:28 PM, Doug Anderson wrote:
> >> > Hi,
> >> >
> >> > On Fri, Oct 21, 2022 at 2:18 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> >> >>
> >> >> Hi Doug
> >> >>
> >> >> On 10/21/2022 1:07 PM, Douglas Anderson wrote:
> >> >>> If we fail to get a valid panel ID in drm_edid_get_panel_id() we'd
> >> >>> like to see the EDID that was read so we have a chance of
> >> >>> understanding what's wrong. There's already a function for that, so
> >> >>> let's call it in the error case.
> >> >>>
> >> >>> NOTE: edid_block_read() has a retry loop in it, so actually we'll only
> >> >>> print the block read back from the final attempt. This still seems
> >> >>> better than nothing.
> >> >>>
> >> >>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> >> >>
> >> >> Instead of checkinf for edid_block_status_valid() on the base_block, do
> >> >> you want to use drm_edid_block_valid() instead?
> >> >>
> >> >> That way you get the edid_block_dump() for free if it was invalid.
> >> >
> >> > I can... ...but it feels a bit awkward and maybe not quite how the
> >> > functions were intended to work together?
> >> >
> >> > One thing I notice is that if I call drm_edid_block_valid() I'm doing
> >> > a bunch of duplicate work that already happened in edid_block_read(),
> >> > which already calls edid_block_check() and handles fixing headers. I
> >> > guess also if I call drm_edid_block_valid() then I should ignore the
> >> > "status" return value of edid_block_read() because we don't need to
> >> > pass it anywhere (because the work is re-done in
> >> > drm_edid_block_valid()).
> >> >
> >> > So I guess I'm happy to do a v2 like that if everyone likes it better,
> >> > but to me it feels a little weird.
> >> >
> >> > -Doug
> >>
> >> Alright, agreed. There is some duplication of code happening if we use
> >> drm_edid_block_valid(). I had suggested that because it has inherent
> >> support for dumping the bad EDID.
> >>
> >> In that case, this change LGTM, because in principle you are doing the
> >> same thing as _drm_do_get_edid() (with the only difference being here we
> >> read only the base block as opposed to the full EDID there).
> >>
> >> Hence,
> >>
> >> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> >
> > I've given this patch a bunch of time because it wasn't urgent, but
> > seems like it could be about time to land. I'll plan to land it next
> > Monday or Tuesday unless anyone has any other comments.
>
> Ack, it's benign enough.

Thanks! Since you didn't write the above as an Acked-by tag I didn't
add it to the commit, but I went ahead and landed with Abhinav's tag.

69c7717c20cc drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error

-Doug

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

end of thread, other threads:[~2022-11-14 22:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 20:07 [PATCH] drm/edid: Dump the EDID when drm_edid_get_panel_id() has an error Douglas Anderson
2022-10-21 21:18 ` Abhinav Kumar
2022-10-24 20:28   ` Doug Anderson
2022-10-25 20:39     ` Abhinav Kumar
2022-11-11 20:45       ` Doug Anderson
2022-11-14 10:02         ` Jani Nikula
2022-11-14 22:08           ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).