All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: Marek Vasut <marex@denx.de>, dri-devel@lists.freedesktop.org
Cc: Loic Poulain <loic.poulain@linaro.org>,
	ch@denx.de, Douglas Anderson <dianders@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Philippe Schenker <philippe.schenker@toradex.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Valentin Raevsky <valentin@compulab.co.il>,
	Sam Ravnborg <sam@ravnborg.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [V3, 2/2] drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver
Date: Tue, 25 May 2021 17:16:40 +0200	[thread overview]
Message-ID: <1916a049-e090-2044-4f74-ba26885ade4c@topic.nl> (raw)
In-Reply-To: <d86d0fea-83d1-69ee-9772-2605bbe19db8@denx.de>


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: mike.looijmans@topicproducts.com
W: www.topic.nl

Please consider the environment before printing this e-mail
On 25-05-2021 16:42, Marek Vasut wrote:
> On 5/25/21 4:23 PM, Mike Looijmans wrote:
>
> [...]
>
>>>> Alternatively, one can modify the RPi DSI code to start sending 
>>>> data after the enable calls. That also works on my setup, with 
>>>> everything in enable.
>>>>
>>>> The major point here is that you should pick one and only one 
>>>> callback: pre-enable or enable. The GPIO reset code as well as 
>>>> writing the registers should be done in that one method.
>>>
>>> Why , please elaborate ? It seems to be if there was no need for 
>>> those two callbacks, there would be no two callbacks in the API in 
>>> the first place. There is a chance you will get disable()->enable() 
>>> sequence without going through post_disable()->pre_enable() as far 
>>> as I can tell.
>>
>> The datasheet states that "the DSI CLK lanes MUST be in HS state and 
>> the DSI data lanes MUST be driven to LP11 state" when the reset 
>> de-asserts (goes high) and when the CSR registers are being written.
>>
>> Your driver now de-asserts the reset in the pre_enable and writes the 
>> CSR registers in enable. This is the "least likely to work" option.
>
> Understood. However, it seems to work on iMX8MM and MN just fine.
>
> Is there a problem on the RPi, that the driver does not work on it ?

On the RPi, without any changes, the board won't output anything. Only 
the test pattern works (using i2cset to enable it). There are two ways 
to make it work:
- Use the current RPi DSI driver as is, and move all initialization code 
in the sn65dsi83 driver to the "pre_enable" callback.

- Change the RPi DSI driver to not send any video data until after 
"enable" and move all initialization code in the sn65dsi83 driver to the 
"enable" callback.


There's also a bug in the RPi DSI driver that it does not call the 
mode_set and mode_valid methods, so it needed workarounds for that too. 
But that should be fixed in the RPi DSI driver and not in your code.

It's a surprise to me then that it works on the iMX. On the RPi it 
absolutely won't work if the DSI is sending video data when the CSR 
registers are being written. It does not seem to matter whether the data 
lanes are in LP00 or LP11 state though, either mode appears to work.

Maybe the iMX is still in a command mode and doesn't actually start 
sending video until after the "enable" callback?


Given that the test-pattern mode does work regardless of the data lane 
state, it appears that the DSI input of the sn65dsi83 chip goes berserk 
when the video data arrives before the CSR registers were written. It 
won't recover from that without a full reset.


>
>> Both the reset and the CSR writing are to be done in the same 
>> context. So either everything in "pre_enable", or everything in 
>> "enable". Which one is correct is up to the maintainers, I also don't 
>> know which is best. The other callback can just remain unused.
>>
>> If the choice is to do the chip initialization in "pre_enable" then 
>> do all the de-initialization in "post_disable". If the choice is to 
>> do the chip initialization in "enable" then do all the 
>> de-initialization in "disable".
>>
>> If for some platform the choice happens to be wrong, it's a very 
>> simple patch (just change the "ops" pointers) to change it and make 
>> it work for that platform.
>>
>> Alternatively, it's possible to make it a runtime choice through 
>> devicetree or so as to whether the CSR initializes at "enable" or 
>> "pre-enable".
>
> That would mean you encode policy in DT, so not an option.
>
> I would suggest we stop this discussion until there is input from the 
> maintainers. It could even be there is an API missing for configuring 
> the clock/data/LP/HS modes which needs to be added.

Agree...

There's no easy way out here. Adding a "post_pre_enable" or 
"pre_enable_clock_up_data_down" callback is not going to make it I guess...

> [...]


-- 
Mike Looijmans


  reply	other threads:[~2021-05-25 15:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 10:02 [PATCH V3 1/2] dt-bindings: drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 bindings Marek Vasut
2021-05-05 10:02 ` Marek Vasut
2021-05-05 10:02 ` [PATCH V3 2/2] drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver Marek Vasut
2021-05-05 12:42   ` Linus Walleij
2021-05-06  9:45   ` Dave Stevenson
2021-05-06 12:48     ` Marek Vasut
2021-05-06 13:03       ` Laurent Pinchart
2021-05-06 14:57         ` Marek Vasut
2021-05-06 17:03       ` Dave Stevenson
2021-05-06 20:49         ` Marek Vasut
2021-05-07  8:55           ` Dave Stevenson
2021-05-06 15:38   ` Frieder Schrempf
2021-05-06 15:46     ` Marek Vasut
2021-05-06 16:03       ` Frieder Schrempf
2021-05-06 20:51         ` Marek Vasut
2021-05-07  9:17           ` Dave Stevenson
2021-05-08 20:10             ` Marek Vasut
2021-05-07 12:48   ` Dave Stevenson
2021-05-08 20:16     ` Marek Vasut
2021-05-10  9:58       ` Dave Stevenson
2021-05-10 11:16         ` Marek Vasut
2021-05-10 18:04           ` Dave Stevenson
2021-05-10 19:29             ` Marek Vasut
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.d251689f-a6ba-486d-bfa1-070ac0c167d5@emailsignatures365.codetwo.com>
     [not found]     ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.0d2bd5fa-15cc-4b27-b94e-83614f9e5b38.81349e00-3f39-4654-ab28-8c85568d0c51@emailsignatures365.codetwo.com>
2021-05-17 13:23       ` [V3, " Mike Looijmans
2021-05-25 10:53         ` Marek Vasut
2021-05-25 12:08           ` Mike Looijmans
2021-05-25 13:00             ` Marek Vasut
2021-05-25 14:23               ` Mike Looijmans
2021-05-25 14:42                 ` Marek Vasut
2021-05-25 15:16                   ` Mike Looijmans [this message]
2021-05-05 12:38 ` [PATCH V3 1/2] dt-bindings: drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 bindings Linus Walleij
2021-05-05 12:38   ` Linus Walleij
2021-05-07  1:00 ` Rob Herring
2021-05-07  1:00   ` Rob Herring

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=1916a049-e090-2044-4f74-ba26885ade4c@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=ch@denx.de \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=loic.poulain@linaro.org \
    --cc=marex@denx.de \
    --cc=philippe.schenker@toradex.com \
    --cc=sam@ravnborg.org \
    --cc=swboyd@chromium.org \
    --cc=valentin@compulab.co.il \
    /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.