mbox series

[00/16] drm/exynos: Convert driver to drm bridge

Message ID 20200903165717.1272492-1-m.tretter@pengutronix.de (mailing list archive)
Headers show
Series drm/exynos: Convert driver to drm bridge | expand

Message

Michael Tretter Sept. 3, 2020, 4:57 p.m. UTC
Hello,

the Exynos MIPI DSI Phy is also found on the i.MX8M Mini. However, on the
i.MX8M Mini, the bridge is driven by an LCDIF display controller instead of
the Exynos Decon. The driver for the LCDIF does not use the component
framework, but uses drm bridges.

This series converts the Exynos MIPI DSI into a drm bridge and makes it usable
with such drivers. Although the driver is converted, it still supports the
component framework API to stay compliant with the Exynos DRM driver.

Unfortunately, I don't have any Exynos SoC to actually test the series.  I
tested the driver with a few additional unfinished patches on the i.MX8M Mini
EVK, but somebody should definitely verify that the driver is still working on
Exynos hardware.

Patch 1 is a quick documentation fix.

Patches 2 to 6 implement the drm bridge interface.

Patches 7 to 12 rework the driver to make it easier to split platform specific
from common code.

Patches 13 and 14 add callbacks to handle the tearing effect interrupt and to
tell the Exynos DRM driver, if the MIPI DSI bridge is using command or video
mode. I am not too happy with these callbacks and any suggestion for a better
solution is very welcome.

Patches 15 and 16 finally split and move the drm bridge driver out of the
Exynos DRM driver.

Michael


Michael Tretter (16):
  drm/encoder: remove obsolete documentation of bridge
  drm/exynos: extract helper functions for probe
  drm/exynos: remove in_bridge_node from exynos_dsi
  drm/exynos: implement a drm bridge
  drm/exynos: convert encoder functions to bridge function
  drm/exynos: configure mode on drm bridge
  drm/exynos: get encoder from bridge whenever possible
  drm/exynos: use exynos_dsi as drvdata
  drm/exynos: call probe helper from bind
  drm/exynos: move dsi host registration to probe helper
  drm/exynos: shift register values to fields on write
  drm/exynos: use identifier instead of register offsets
  drm/exynos: add callback for tearing effect handler
  drm/exynos: add callback for enabling i80 mode
  drm/exynos: split out platform specific code
  drm/exynos: move bridge driver to bridges

 drivers/gpu/drm/bridge/Kconfig          |    7 +
 drivers/gpu/drm/bridge/Makefile         |    1 +
 drivers/gpu/drm/bridge/samsung-dsim.c   | 1797 ++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 1843 ++---------------------
 include/drm/bridge/samsung-dsim.h       |   57 +
 include/drm/drm_encoder.h               |    1 -
 6 files changed, 1967 insertions(+), 1739 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/samsung-dsim.c
 create mode 100644 include/drm/bridge/samsung-dsim.h

Comments

Krzysztof Kozlowski Sept. 3, 2020, 8:08 p.m. UTC | #1
On Thu, 3 Sep 2020 at 18:57, Michael Tretter <m.tretter@pengutronix.de> wrote:
>
> Hello,
>
> the Exynos MIPI DSI Phy is also found on the i.MX8M Mini. However, on the
> i.MX8M Mini, the bridge is driven by an LCDIF display controller instead of
> the Exynos Decon. The driver for the LCDIF does not use the component
> framework, but uses drm bridges.
>
> This series converts the Exynos MIPI DSI into a drm bridge and makes it usable
> with such drivers. Although the driver is converted, it still supports the
> component framework API to stay compliant with the Exynos DRM driver.
>
> Unfortunately, I don't have any Exynos SoC to actually test the series.  I
> tested the driver with a few additional unfinished patches on the i.MX8M Mini
> EVK, but somebody should definitely verify that the driver is still working on
> Exynos hardware.

Hi Michael,

+Cc maintainers and folks in Samsung.

Please follow the script/get_maintainers.pl to get the list of
maintainers of the Exynos DRM drivers. First they could provide you
with testing, second they might be the people merging the driver.

Unfortunately I cannot provide proper testing as none of my boards
have a display attached. :)

Best regards,
Krzysztof
Marek Szyprowski Sept. 4, 2020, 8:31 a.m. UTC | #2
Hi Krzysztof,

On 03.09.2020 22:08, Krzysztof Kozlowski wrote:
> On Thu, 3 Sep 2020 at 18:57, Michael Tretter <m.tretter@pengutronix.de> wrote:
>> the Exynos MIPI DSI Phy is also found on the i.MX8M Mini. However, on the
>> i.MX8M Mini, the bridge is driven by an LCDIF display controller instead of
>> the Exynos Decon. The driver for the LCDIF does not use the component
>> framework, but uses drm bridges.
>>
>> This series converts the Exynos MIPI DSI into a drm bridge and makes it usable
>> with such drivers. Although the driver is converted, it still supports the
>> component framework API to stay compliant with the Exynos DRM driver.
>>
>> Unfortunately, I don't have any Exynos SoC to actually test the series.  I
>> tested the driver with a few additional unfinished patches on the i.MX8M Mini
>> EVK, but somebody should definitely verify that the driver is still working on
>> Exynos hardware.
> Hi Michael,
>
> +Cc maintainers and folks in Samsung.
>
> Please follow the script/get_maintainers.pl to get the list of
> maintainers of the Exynos DRM drivers. First they could provide you
> with testing, second they might be the people merging the driver.
>
> Unfortunately I cannot provide proper testing as none of my boards
> have a display attached. :)

Thanks for adding cc to me. Sadly this patchset crashed badly on Samsung 
Exnyos based boards. Here is the log from Exynos3250-based Rinato:

exynos4-fb 11c00000.fimd: Adding to iommu group 0
OF: graph: no port node found in /soc/fimd@11c00000
[drm] Exynos DRM: using 11c00000.fimd device for DMA mapping operations
exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
OF: graph: no port node found in /soc/dsi@11c80000
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000650
pgd = (ptrval)
[00000650] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 
5.9.0-rc2-next-20200824-00017-g3e9b20f7eb0d #1576
Hardware name: Samsung Exynos (Flattened Device Tree)
PC is at samsung_dsim_resume+0x18/0x120
LR is at genpd_runtime_resume+0x160/0x278
...
[<c064f590>] (samsung_dsim_resume) from [<c0685020>] 
(genpd_runtime_resume+0x160/0x278)
[<c0685020>] (genpd_runtime_resume) from [<c0677e84>] 
(__rpm_callback+0xbc/0x124)
[<c0677e84>] (__rpm_callback) from [<c0677f0c>] (rpm_callback+0x20/0x80)
[<c0677f0c>] (rpm_callback) from [<c0676aec>] (rpm_resume+0x388/0x714)
[<c0676aec>] (rpm_resume) from [<c0676edc>] (__pm_runtime_resume+0x64/0x9c)
[<c0676edc>] (__pm_runtime_resume) from [<c0669e10>] 
(__device_attach+0xcc/0x17c)
[<c0669e10>] (__device_attach) from [<c0668ee8>] 
(bus_probe_device+0x88/0x90)
[<c0668ee8>] (bus_probe_device) from [<c06660a0>] (device_add+0x4e8/0x79c)
[<c06660a0>] (device_add) from [<c063dc1c>] 
(mipi_dsi_device_register_full+0xc8/0x148)
[<c063dc1c>] (mipi_dsi_device_register_full) from [<c063dcec>] 
(mipi_dsi_host_register+0x50/0x168)
[<c063dcec>] (mipi_dsi_host_register) from [<c064d90c>] 
(samsung_dsim_bind+0x368/0x40c)
[<c064d90c>] (samsung_dsim_bind) from [<c06449f8>] 
(exynos_dsi_bind+0x78/0x88)
[<c06449f8>] (exynos_dsi_bind) from [<c0661ef0>] 
(component_bind_all+0xfc/0x290)
[<c0661ef0>] (component_bind_all) from [<c06413d0>] 
(exynos_drm_bind+0xe4/0x19c)
[<c06413d0>] (exynos_drm_bind) from [<c0662464>] 
(try_to_bring_up_master+0x1e4/0x2c4)
[<c0662464>] (try_to_bring_up_master) from [<c06629a4>] 
(component_master_add_with_match+0xd4/0x108)
[<c06629a4>] (component_master_add_with_match) from [<c06410f8>] 
(exynos_drm_platform_probe+0xe4/0x110)
[<c06410f8>] (exynos_drm_platform_probe) from [<c066cb8c>] 
(platform_drv_probe+0x6c/0xa4)
[<c066cb8c>] (platform_drv_probe) from [<c066a0c8>] 
(really_probe+0x200/0x4fc)
[<c066a0c8>] (really_probe) from [<c066a58c>] 
(driver_probe_device+0x78/0x1fc)
[<c066a58c>] (driver_probe_device) from [<c066a974>] 
(device_driver_attach+0x58/0x60)
[<c066a974>] (device_driver_attach) from [<c066aa58>] 
(__driver_attach+0xdc/0x174)
[<c066aa58>] (__driver_attach) from [<c0667e50>] 
(bus_for_each_dev+0x68/0xb4)
[<c0667e50>] (bus_for_each_dev) from [<c0669184>] 
(bus_add_driver+0x158/0x214)
[<c0669184>] (bus_add_driver) from [<c066b93c>] (driver_register+0x78/0x110)
[<c066b93c>] (driver_register) from [<c06412b8>] 
(exynos_drm_init+0xe4/0x118)
[<c06412b8>] (exynos_drm_init) from [<c01023f4>] 
(do_one_initcall+0x8c/0x424)
[<c01023f4>] (do_one_initcall) from [<c10011a8>] 
(kernel_init_freeable+0x190/0x1dc)
[<c10011a8>] (kernel_init_freeable) from [<c0ae8e5c>] 
(kernel_init+0x8/0x118)
[<c0ae8e5c>] (kernel_init) from [<c0100114>] (ret_from_fork+0x14/0x20)
Exception stack(0xd94a5fb0 to 0xd94a5ff8)
...
---[ end trace 1a053145d15f23dc ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
CPU0: stopping
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D 
5.9.0-rc2-next-20200824-00017-g3e9b20f7eb0d #1576
Hardware name: Samsung Exynos (Flattened Device Tree)
[<c011160c>] (unwind_backtrace) from [<c010cfc0>] (show_stack+0x10/0x14)
[<c010cfc0>] (show_stack) from [<c0533c3c>] (dump_stack+0xbc/0xe8)
[<c0533c3c>] (dump_stack) from [<c01104e0>] (handle_IPI+0x3e0/0x428)
[<c01104e0>] (handle_IPI) from [<c05511dc>] (gic_handle_irq+0x98/0x9c)
[<c05511dc>] (gic_handle_irq) from [<c0100af0>] (__irq_svc+0x70/0xb0)
Exception stack(0xc1101f08 to 0xc1101f50)
...
[<c0100af0>] (__irq_svc) from [<c01095dc>] (arch_cpu_idle+0x24/0x44)
[<c01095dc>] (arch_cpu_idle) from [<c01635dc>] (do_idle+0x1bc/0x2bc)
[<c01635dc>] (do_idle) from [<c0163a90>] (cpu_startup_entry+0x18/0x1c)
[<c0163a90>] (cpu_startup_entry) from [<c1000f88>] 
(start_kernel+0x628/0x664)
[<c1000f88>] (start_kernel) from [<00000000>] (0x0)
---[ end Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0000000b ]---

I've didn't check the code yet, but the conversion also lacks "select 
DRM_SAMSUNG_DSIM" in the Exynos DSI driver's Kconfig, as I wasn't even 
able to compile it with the current exynos_defconfig.

I've tested it on top of next-20200824, because it doesn't apply 
on current linux-next.

Best regards
Michael Tretter Sept. 4, 2020, 12:20 p.m. UTC | #3
Hi Marek,

On Fri, 04 Sep 2020 10:31:12 +0200, Marek Szyprowski wrote:
> Hi Krzysztof,
> 
> On 03.09.2020 22:08, Krzysztof Kozlowski wrote:
> > On Thu, 3 Sep 2020 at 18:57, Michael Tretter <m.tretter@pengutronix.de> wrote:
> >> the Exynos MIPI DSI Phy is also found on the i.MX8M Mini. However, on the
> >> i.MX8M Mini, the bridge is driven by an LCDIF display controller instead of
> >> the Exynos Decon. The driver for the LCDIF does not use the component
> >> framework, but uses drm bridges.
> >>
> >> This series converts the Exynos MIPI DSI into a drm bridge and makes it usable
> >> with such drivers. Although the driver is converted, it still supports the
> >> component framework API to stay compliant with the Exynos DRM driver.
> >>
> >> Unfortunately, I don't have any Exynos SoC to actually test the series.  I
> >> tested the driver with a few additional unfinished patches on the i.MX8M Mini
> >> EVK, but somebody should definitely verify that the driver is still working on
> >> Exynos hardware.
> > Hi Michael,
> >
> > +Cc maintainers and folks in Samsung.
> >
> > Please follow the script/get_maintainers.pl to get the list of
> > maintainers of the Exynos DRM drivers. First they could provide you
> > with testing, second they might be the people merging the driver.
> >
> > Unfortunately I cannot provide proper testing as none of my boards
> > have a display attached. :)
> 
> Thanks for adding cc to me. Sadly this patchset crashed badly on Samsung 
> Exnyos based boards. Here is the log from Exynos3250-based Rinato:

Thanks for testing.

> 
> exynos4-fb 11c00000.fimd: Adding to iommu group 0
> OF: graph: no port node found in /soc/fimd@11c00000
> [drm] Exynos DRM: using 11c00000.fimd device for DMA mapping operations
> exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
> OF: graph: no port node found in /soc/dsi@11c80000
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000650
> pgd = (ptrval)
> [00000650] *pgd=00000000
> Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> Modules linked in:
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc2-next-20200824-00017-g3e9b20f7eb0d #1576
> Hardware name: Samsung Exynos (Flattened Device Tree)
> PC is at samsung_dsim_resume+0x18/0x120
> LR is at genpd_runtime_resume+0x160/0x278
> ...
> [<c064f590>] (samsung_dsim_resume) from [<c0685020>] 
> (genpd_runtime_resume+0x160/0x278)
> [<c0685020>] (genpd_runtime_resume) from [<c0677e84>] 
> (__rpm_callback+0xbc/0x124)
> [<c0677e84>] (__rpm_callback) from [<c0677f0c>] (rpm_callback+0x20/0x80)
> [<c0677f0c>] (rpm_callback) from [<c0676aec>] (rpm_resume+0x388/0x714)
> [<c0676aec>] (rpm_resume) from [<c0676edc>] (__pm_runtime_resume+0x64/0x9c)
> [<c0676edc>] (__pm_runtime_resume) from [<c0669e10>] 
> (__device_attach+0xcc/0x17c)
> [<c0669e10>] (__device_attach) from [<c0668ee8>] 
> (bus_probe_device+0x88/0x90)
> [<c0668ee8>] (bus_probe_device) from [<c06660a0>] (device_add+0x4e8/0x79c)
> [<c06660a0>] (device_add) from [<c063dc1c>] 
> (mipi_dsi_device_register_full+0xc8/0x148)
> [<c063dc1c>] (mipi_dsi_device_register_full) from [<c063dcec>] 
> (mipi_dsi_host_register+0x50/0x168)
> [<c063dcec>] (mipi_dsi_host_register) from [<c064d90c>] 
> (samsung_dsim_bind+0x368/0x40c)
> [<c064d90c>] (samsung_dsim_bind) from [<c06449f8>] 
> (exynos_dsi_bind+0x78/0x88)
> [<c06449f8>] (exynos_dsi_bind) from [<c0661ef0>] 
> (component_bind_all+0xfc/0x290)
> [<c0661ef0>] (component_bind_all) from [<c06413d0>] 
> (exynos_drm_bind+0xe4/0x19c)
> [<c06413d0>] (exynos_drm_bind) from [<c0662464>] 
> (try_to_bring_up_master+0x1e4/0x2c4)
> [<c0662464>] (try_to_bring_up_master) from [<c06629a4>] 
> (component_master_add_with_match+0xd4/0x108)
> [<c06629a4>] (component_master_add_with_match) from [<c06410f8>] 
> (exynos_drm_platform_probe+0xe4/0x110)
> [<c06410f8>] (exynos_drm_platform_probe) from [<c066cb8c>] 
> (platform_drv_probe+0x6c/0xa4)
> [<c066cb8c>] (platform_drv_probe) from [<c066a0c8>] 
> (really_probe+0x200/0x4fc)
> [<c066a0c8>] (really_probe) from [<c066a58c>] 
> (driver_probe_device+0x78/0x1fc)
> [<c066a58c>] (driver_probe_device) from [<c066a974>] 
> (device_driver_attach+0x58/0x60)
> [<c066a974>] (device_driver_attach) from [<c066aa58>] 
> (__driver_attach+0xdc/0x174)
> [<c066aa58>] (__driver_attach) from [<c0667e50>] 
> (bus_for_each_dev+0x68/0xb4)
> [<c0667e50>] (bus_for_each_dev) from [<c0669184>] 
> (bus_add_driver+0x158/0x214)
> [<c0669184>] (bus_add_driver) from [<c066b93c>] (driver_register+0x78/0x110)
> [<c066b93c>] (driver_register) from [<c06412b8>] 
> (exynos_drm_init+0xe4/0x118)
> [<c06412b8>] (exynos_drm_init) from [<c01023f4>] 
> (do_one_initcall+0x8c/0x424)
> [<c01023f4>] (do_one_initcall) from [<c10011a8>] 
> (kernel_init_freeable+0x190/0x1dc)
> [<c10011a8>] (kernel_init_freeable) from [<c0ae8e5c>] 
> (kernel_init+0x8/0x118)
> [<c0ae8e5c>] (kernel_init) from [<c0100114>] (ret_from_fork+0x14/0x20)
> Exception stack(0xd94a5fb0 to 0xd94a5ff8)
> ...
> ---[ end trace 1a053145d15f23dc ]---
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> CPU0: stopping
> CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D 
> 5.9.0-rc2-next-20200824-00017-g3e9b20f7eb0d #1576
> Hardware name: Samsung Exynos (Flattened Device Tree)
> [<c011160c>] (unwind_backtrace) from [<c010cfc0>] (show_stack+0x10/0x14)
> [<c010cfc0>] (show_stack) from [<c0533c3c>] (dump_stack+0xbc/0xe8)
> [<c0533c3c>] (dump_stack) from [<c01104e0>] (handle_IPI+0x3e0/0x428)
> [<c01104e0>] (handle_IPI) from [<c05511dc>] (gic_handle_irq+0x98/0x9c)
> [<c05511dc>] (gic_handle_irq) from [<c0100af0>] (__irq_svc+0x70/0xb0)
> Exception stack(0xc1101f08 to 0xc1101f50)
> ...
> [<c0100af0>] (__irq_svc) from [<c01095dc>] (arch_cpu_idle+0x24/0x44)
> [<c01095dc>] (arch_cpu_idle) from [<c01635dc>] (do_idle+0x1bc/0x2bc)
> [<c01635dc>] (do_idle) from [<c0163a90>] (cpu_startup_entry+0x18/0x1c)
> [<c0163a90>] (cpu_startup_entry) from [<c1000f88>] 
> (start_kernel+0x628/0x664)
> [<c1000f88>] (start_kernel) from [<00000000>] (0x0)
> ---[ end Kernel panic - not syncing: Attempted to kill init! 
> exitcode=0x0000000b ]---

This and the other null pointer dereference look like two different problems.
I will look into both of them and send an update.

I will also try to come up with something to at least test the bind/unbind
interface and reduce the code that I cannot test.

> 
> I've didn't check the code yet, but the conversion also lacks "select 
> DRM_SAMSUNG_DSIM" in the Exynos DSI driver's Kconfig, as I wasn't even 
> able to compile it with the current exynos_defconfig.

Dang, of course. I will fix it.

Michael