Re: [PATCH 1/4] drm: Add I2C connector type

From: Noralf Trønnes
Date: Tue Feb 01 2022 - 07:58:26 EST




Den 31.01.2022 21.52, skrev Sam Ravnborg:
> On Mon, Jan 31, 2022 at 09:12:21PM +0100, Javier Martinez Canillas wrote:
>> There isn't a connector type for display controllers accesed through I2C,
>> most drivers use DRM_MODE_CONNECTOR_Unknown or DRM_MODE_CONNECTOR_VIRTUAL.
>>
>> Add an I2C connector type to match the actual connector.
>>
>> As Noralf Trønnes mentions in commit fc06bf1d76d6 ("drm: Add SPI connector
>> type"), user-space should be able to cope with a connector type that does
>> not yet understand.
>>

It turned out that I wasn't entirely correct here, mpv didn't cope with
unknown types. In the PR to add support Emil Velikov wondered if libdrm
should handle these connector names:
https://github.com/mpv-player/mpv/pull/8989#issuecomment-879187711

>> Tested with `modetest -M ssd1307 -c` and shows the connector as unknown-1.
> I had expected unknown-21??
>
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
> Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>

Sam, didn't you and Laurent discuss adding DRM_MODE_CONNECTOR_PANEL for
such a use case?

If someone adds parallel bus support to the MIPI DBI helper, there will
be one more connector type (I wonder what that one will be called).

Noralf.

>> ---
>>
>> drivers/gpu/drm/drm_connector.c | 1 +
>> include/uapi/drm/drm_mode.h | 1 +
>> 2 files changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>> index a50c82bc2b2f..975a7525a508 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -105,6 +105,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
>> { DRM_MODE_CONNECTOR_WRITEBACK, "Writeback" },
>> { DRM_MODE_CONNECTOR_SPI, "SPI" },
>> { DRM_MODE_CONNECTOR_USB, "USB" },
>> + { DRM_MODE_CONNECTOR_I2C, "I2C" },
>> };
>>
>> void drm_connector_ida_init(void)
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index e1e351682872..d6d6288242db 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -421,6 +421,7 @@ enum drm_mode_subconnector {
>> #define DRM_MODE_CONNECTOR_WRITEBACK 18
>> #define DRM_MODE_CONNECTOR_SPI 19
>> #define DRM_MODE_CONNECTOR_USB 20
>> +#define DRM_MODE_CONNECTOR_I2C 21
>>
>> /**
>> * struct drm_mode_get_connector - Get connector metadata.
>> --
>> 2.34.1