drm/sun4i: support TCONs without channel 1
Some Allwinner SoCs, such as the A33, have a variation of the TCON that doesn't have a second channel (or it is not wired to anything). Make sure we can handle that case. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
This commit is contained in:
parent
b5644a5e72
commit
8e92404725
@ -59,12 +59,14 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
|
|||||||
regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
|
regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
|
||||||
SUN4I_TCON0_CTL_TCON_ENABLE, 0);
|
SUN4I_TCON0_CTL_TCON_ENABLE, 0);
|
||||||
clk_disable_unprepare(tcon->dclk);
|
clk_disable_unprepare(tcon->dclk);
|
||||||
} else if (channel == 1) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN_ON(!tcon->has_channel_1);
|
||||||
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
||||||
SUN4I_TCON1_CTL_TCON_ENABLE, 0);
|
SUN4I_TCON1_CTL_TCON_ENABLE, 0);
|
||||||
clk_disable_unprepare(tcon->sclk1);
|
clk_disable_unprepare(tcon->sclk1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(sun4i_tcon_channel_disable);
|
EXPORT_SYMBOL(sun4i_tcon_channel_disable);
|
||||||
|
|
||||||
void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
|
void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
|
||||||
@ -75,13 +77,15 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
|
|||||||
SUN4I_TCON0_CTL_TCON_ENABLE,
|
SUN4I_TCON0_CTL_TCON_ENABLE,
|
||||||
SUN4I_TCON0_CTL_TCON_ENABLE);
|
SUN4I_TCON0_CTL_TCON_ENABLE);
|
||||||
clk_prepare_enable(tcon->dclk);
|
clk_prepare_enable(tcon->dclk);
|
||||||
} else if (channel == 1) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN_ON(!tcon->has_channel_1);
|
||||||
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
||||||
SUN4I_TCON1_CTL_TCON_ENABLE,
|
SUN4I_TCON1_CTL_TCON_ENABLE,
|
||||||
SUN4I_TCON1_CTL_TCON_ENABLE);
|
SUN4I_TCON1_CTL_TCON_ENABLE);
|
||||||
clk_prepare_enable(tcon->sclk1);
|
clk_prepare_enable(tcon->sclk1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(sun4i_tcon_channel_enable);
|
EXPORT_SYMBOL(sun4i_tcon_channel_enable);
|
||||||
|
|
||||||
void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable)
|
void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable)
|
||||||
@ -198,6 +202,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
|
|||||||
u8 clk_delay;
|
u8 clk_delay;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
WARN_ON(!tcon->has_channel_1);
|
||||||
|
|
||||||
/* Adjust clock delay */
|
/* Adjust clock delay */
|
||||||
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
|
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
|
||||||
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
|
||||||
@ -321,11 +327,13 @@ static int sun4i_tcon_init_clocks(struct device *dev,
|
|||||||
return PTR_ERR(tcon->sclk0);
|
return PTR_ERR(tcon->sclk0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tcon->has_channel_1) {
|
||||||
tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
|
tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
|
||||||
if (IS_ERR(tcon->sclk1)) {
|
if (IS_ERR(tcon->sclk1)) {
|
||||||
dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
|
dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
|
||||||
return PTR_ERR(tcon->sclk1);
|
return PTR_ERR(tcon->sclk1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sun4i_dclk_create(dev, tcon);
|
return sun4i_dclk_create(dev, tcon);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,8 @@ struct sun4i_tcon {
|
|||||||
bool has_mux;
|
bool has_mux;
|
||||||
|
|
||||||
struct drm_panel *panel;
|
struct drm_panel *panel;
|
||||||
|
|
||||||
|
bool has_channel_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
|
struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user