Re: [PATCH 1/7] drm: atmel-hlcdc: add config option for clock selection

From: Claudiu.Beznea
Date: Fri Mar 01 2019 - 05:07:10 EST




On 28.02.2019 23:25, Sam Ravnborg wrote:
> Hi Claudiu
>
> On Wed, Feb 27, 2019 at 04:24:16PM +0000, Claudiu.Beznea@xxxxxxxxxxxxx wrote:
>> From: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
>>
>> SAM9x60 LCD Controller has no option to select clock source as previous
>> controllers have. To be able to use the same driver even for this LCD
>> controller add a config option to know if controller supports this.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
>> ---
>> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 12 +++++++-----
>> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 2 ++
>> 2 files changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> index 8070a558d7b1..17a7a18f6a07 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> @@ -78,7 +78,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
>> unsigned long mode_rate;
>> struct videomode vm;
>> unsigned long prate;
>> - unsigned int cfg;
>> + unsigned int mask = ATMEL_HLCDC_CLKDIV_MASK | ATMEL_HLCDC_CLKPOL;
>> + unsigned int cfg = 0;
>> int div;
> Here cfg and mask has initial values.
>
>>
>> vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay;
>> @@ -101,7 +102,10 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
>> (adj->crtc_hdisplay - 1) |
>> ((adj->crtc_vdisplay - 1) << 16));
>>
>> - cfg = ATMEL_HLCDC_CLKSEL;
>> + if (!crtc->dc->desc->fixed_clksrc) {
>> + cfg = ATMEL_HLCDC_CLKSEL;
>> + mask |= ATMEL_HLCDC_CLKSEL;
>> + }
> And here mask is bitwise or with ATMEL_HLCDC_CLKSEL - fine.
> But cfg is directly assigned.

I directly assigned it here because it was the first time it was used.
I will use a "|" operation as you suggest in next version.

> If cfg was bitwise or the ATMEL_HLCDC_CLKSEL value then the code was prepared
> to have extra flags added above these lines.
>
> Only a small change and no functional difference.
>
> With or without this change:
> Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
>
>