Re: [PATCH] drm/ssd130x: Replace simple display helpers with the atomic helpers

From: Javier Martinez Canillas
Date: Mon Sep 05 2022 - 07:55:12 EST


On 9/5/22 13:34, Thomas Zimmermann wrote:

[...]

>>>
>>
>> Yes, I was abusing the concept of encoder here just to have a place where
>> I could hook the enable / disable logic, since I was looking at the other
>> DRM objects helper operations structures and found that these were only
>> defined for the encoder.
>
> I liked the idea of handling backlighting here. Power on/off also seems
> sensible.
>

Ok. I'll keep that then.

>>
>> But there is technically no encoder on this device. As you can see, I was
>> using DRM_MODE_ENCODER_NONE when the encoder is initialized.
>>
>> But I notice now that the struct drm_crtc_helper_funcs also have .enable
>> and .disable callbacks, it seems I was just blind and didn't see before.
>
> You certainly want to use atomic_enable/atomic_disable. They are
> mutually exclusive with the other enable/disable functions.
>

Ah, then I wasn't blind after all. It was because the encoder was the
only DRM object that had .atomic_{en,dis}able. The CRTC only had some
.{en,disable} helper callbacks.

>>
>> Would having the init and poweroff logic in the CRTC helpers be correct
>> to you or was do you have in mind ?
>
> There's quite a bit happening in the init function. Does it have to be
> re-initialized on each enable operation? If it survives the power-off
> call, the initial init can be done in the CRTC reset function. It's
> purpose is to set hardware and software to a clean state.
>

I need to check if it survives a disable/enable cycle. Specially since
on disable the VCC regulator is disabled, which might lead to the chip
state to get lost.

> Best regards
> Thomas
>
>>
>>> Best regards
>>> Thomas
>

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat