diff mbox series

[3/4] video: mxsfb: add clk_enable()

Message ID 20200426234301.111433-4-giulio.benetti@benettiengineering.com
State New
Headers show
Series Various i.MXRT bug/typo fixes | expand

Commit Message

Giulio Benetti April 26, 2020, 11:43 p.m. UTC
BROM doesn't enable lcdif by default so add clk_enable() before
clk_set_rate().

Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
---
 drivers/video/mxsfb.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Fabio Estevam April 26, 2020, 11:48 p.m. UTC | #1
Hi Giulio,

On Sun, Apr 26, 2020 at 8:43 PM Giulio Benetti
<giulio.benetti at benettiengineering.com> wrote:

> +       ret = clk_enable(&per_clk);
> +       if (ret < 0) {
> +               dev_err(dev, "Failed to enable mxs clk: %d\n", ret);
> +               return;
> +       }
> +
>         ret = clk_set_rate(&per_clk, timings->pixelclock.typ);
>         if (ret < 0) {
>                 dev_err(dev, "Failed to set mxs clk: %d\n", ret);

Usually it is safer to configure the clock rate first and then enable
the clock to avoid glitches.

Could you try to call clk_enable() after clk_set_rate() here?
Giulio Benetti April 27, 2020, 3:04 p.m. UTC | #2
Hi Fabio,

On 4/27/20 1:48 AM, Fabio Estevam wrote:
> Hi Giulio,
> 
> On Sun, Apr 26, 2020 at 8:43 PM Giulio Benetti
> <giulio.benetti at benettiengineering.com> wrote:
> 
>> +       ret = clk_enable(&per_clk);
>> +       if (ret < 0) {
>> +               dev_err(dev, "Failed to enable mxs clk: %d\n", ret);
>> +               return;
>> +       }
>> +
>>          ret = clk_set_rate(&per_clk, timings->pixelclock.typ);
>>          if (ret < 0) {
>>                  dev_err(dev, "Failed to set mxs clk: %d\n", ret);
> 
> Usually it is safer to configure the clock rate first and then enable
> the clock to avoid glitches.
> 
> Could you try to call clk_enable() after clk_set_rate() here?

Sure, I'm going to send it for V2.

Thanks for reviewing
diff mbox series

Patch

diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 8a5a61c9fb..7eab8835b0 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -72,6 +72,12 @@  static void mxs_lcd_init(struct udevice *dev, u32 fb_addr,
 		return;
 	}
 
+	ret = clk_enable(&per_clk);
+	if (ret < 0) {
+		dev_err(dev, "Failed to enable mxs clk: %d\n", ret);
+		return;
+	}
+
 	ret = clk_set_rate(&per_clk, timings->pixelclock.typ);
 	if (ret < 0) {
 		dev_err(dev, "Failed to set mxs clk: %d\n", ret);