Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1474496
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/7] drm/sun4i: support TCONs without channel 1 |
| Date | 2016-09-01 17:40 +0200 |
| Message-ID | <scCfT-3EJ-23@gated-at.bofh.it> (permalink) |
| References | <scCfT-3EJ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 34 +++++++++++++++++++++-------------
drivers/gpu/drm/sun4i/sun4i_tcon.h | 2 ++
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 9180e7e7b551..fde6af1230d2 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -59,11 +59,13 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
SUN4I_TCON0_CTL_TCON_ENABLE, 0);
clk_disable_unprepare(tcon->dclk);
- } else if (channel == 1) {
- regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
- SUN4I_TCON1_CTL_TCON_ENABLE, 0);
- clk_disable_unprepare(tcon->sclk1);
+ return;
}
+
+ WARN_ON(!tcon->has_channel_1);
+ regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
+ SUN4I_TCON1_CTL_TCON_ENABLE, 0);
+ clk_disable_unprepare(tcon->sclk1);
}
EXPORT_SYMBOL(sun4i_tcon_channel_disable);
@@ -75,12 +77,14 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
SUN4I_TCON0_CTL_TCON_ENABLE,
SUN4I_TCON0_CTL_TCON_ENABLE);
clk_prepare_enable(tcon->dclk);
- } else if (channel == 1) {
- regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
- SUN4I_TCON1_CTL_TCON_ENABLE,
- SUN4I_TCON1_CTL_TCON_ENABLE);
- clk_prepare_enable(tcon->sclk1);
+ return;
}
+
+ WARN_ON(!tcon->has_channel_1);
+ regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
+ SUN4I_TCON1_CTL_TCON_ENABLE,
+ SUN4I_TCON1_CTL_TCON_ENABLE);
+ clk_prepare_enable(tcon->sclk1);
}
EXPORT_SYMBOL(sun4i_tcon_channel_enable);
@@ -198,6 +202,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
u8 clk_delay;
u32 val;
+ WARN_ON(!tcon->has_channel_1);
+
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
@@ -321,10 +327,12 @@ static int sun4i_tcon_init_clocks(struct device *dev,
return PTR_ERR(tcon->sclk0);
}
- tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
- if (IS_ERR(tcon->sclk1)) {
- dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
- return PTR_ERR(tcon->sclk1);
+ if (tcon->has_channel_1) {
+ tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
+ if (IS_ERR(tcon->sclk1)) {
+ dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
+ return PTR_ERR(tcon->sclk1);
+ }
}
return sun4i_dclk_create(dev, tcon);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 100bfa093277..12bd48925f4d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -164,6 +164,8 @@ struct sun4i_tcon {
bool has_mux;
struct drm_panel *panel;
+
+ bool has_channel_1;
};
struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
--
2.9.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
[PATCH 2/7] drm/sun4i: support A33 tcon Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [PATCH 2/7] drm/sun4i: support A33 tcon Chen-Yu Tsai <wens@csie.org> - 2016-09-02 08:10 +0200
Re: [PATCH 2/7] drm/sun4i: support A33 tcon Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-05 22:30 +0200
[PATCH 5/7] ARM: sun8i: a33: Add display pipeline Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [PATCH 5/7] ARM: sun8i: a33: Add display pipeline Chen-Yu Tsai <wens@csie.org> - 2016-09-02 08:30 +0200
Re: [PATCH 5/7] ARM: sun8i: a33: Add display pipeline Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-05 22:30 +0200
Re: [PATCH 5/7] ARM: sun8i: a33: Add display pipeline Chen-Yu Tsai <wens@csie.org> - 2016-09-06 05:00 +0200
[PATCH 1/7] drm/sun4i: support TCONs without channel 1 Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [PATCH 1/7] drm/sun4i: support TCONs without channel 1 Chen-Yu Tsai <wens@csie.org> - 2016-09-02 03:50 +0200
[PATCH 6/7] ARM: sun8i: a33: Add RGB666 pins Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [linux-sunxi] [PATCH 6/7] ARM: sun8i: a33: Add RGB666 pins Chen-Yu Tsai <wens@csie.org> - 2016-09-02 03:50 +0200
[PATCH 3/7] drm/sun4i: Add SAT and DRC drivers Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [PATCH 3/7] drm/sun4i: Add SAT and DRC drivers Chen-Yu Tsai <wens@csie.org> - 2016-09-02 08:50 +0200
Re: [PATCH 3/7] drm/sun4i: Add SAT and DRC drivers Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-05 22:30 +0200
Re: [linux-sunxi] [PATCH 3/7] drm/sun4i: Add SAT and DRC drivers Peter Korsgaard <peter@korsgaard.com> - 2016-09-04 22:10 +0200
Re: [linux-sunxi] [PATCH 3/7] drm/sun4i: Add SAT and DRC drivers Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:00 +0200
[PATCH 7/7] ARM: sun8i: sina33: Enable display Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-01 17:40 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-02 21:10 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Chen-Yu Tsai <wens@csie.org> - 2016-09-03 03:50 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-05 22:50 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Chen-Yu Tsai <wens@csie.org> - 2016-09-06 05:00 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 21:00 +0200
Re: [PATCH 0/7] drm/sun4i: Introduce A33 display driver Chen-Yu Tsai <wens@csie.org> - 2016-09-07 07:00 +0200
csiph-web