Re: [PATCH v4 02/10] drm/ingenic: Add support for JZ4780 and HDMI output

From: H. Nikolaus Schaller
Date: Tue Sep 28 2021 - 08:06:24 EST


Hi Paul,

> Am 28.09.2021 um 12:21 schrieb H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>:
>
>>> @@ -1492,10 +1555,16 @@ static int ingenic_drm_init(void)
>>> {
>>> int err;
>>> + if (IS_ENABLED(CONFIG_DRM_INGENIC_DW_HDMI)) {
>>> + err = platform_driver_register(ingenic_dw_hdmi_driver_ptr);
>>> + if (err)
>>> + return err;
>>> + }
>>
>> I don't see why you need to register the ingenic-dw-hdmi driver here. Just register it in the ingenic-dw-hdmi driver.
>
> Ok, I never though about this (as the code was not from me). We apparently just followed the IPU code pattern (learning by example).
>
> It indeed looks not necessary and would also avoid the ingenic_dw_hdmi_driver_ptr dependency.
>
> But: what is ingenic_ipu_driver_ptr then good for?
>
> If we can get rid of this as well, we can drop patch 1/10 ("drm/ingenic: Fix drm_init error path if IPU was registered") completely.

A quick test shows that it *is* required. At least if I configure everything as modules.
But like you I can't explain why.

Well, just a very rough idea (may be wrong): the bridge chain is not like an i2c bus and
clients are not automatically loaded/probed if linked in the device tree. Therefore the
consumer (ingenic_drm_drv) must register the "clients" like IPU and HDMI.

BR,
Nikolaus