Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657108 > unrolled thread
| Started by | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| First post | 2017-06-04 18:10 +0200 |
| Last post | 2017-06-07 02:30 +0200 |
| Articles | 20 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/11] Support for H3 Composite Output support Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:10 +0200
[PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:10 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Jernej Škrabec <jernej.skrabec@siol.net> - 2017-06-04 21:00 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 21:10 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-06-07 11:50 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng <icenowy@aosc.io> - 2017-06-07 13:20 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng <icenowy@aosc.io> - 2017-06-07 14:20 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng <icenowy@aosc.io> - 2017-06-07 16:30 +0200
Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-06-07 16:50 +0200
[PATCH v2 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:10 +0200
[PATCH v2 05/11] drm: sun4i: add compatible for H3 display engine Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:20 +0200
[PATCH v2 06/11] drm: sun4i: add color space correction support for DE2 mixer Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:20 +0200
[PATCH v2 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3 Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:20 +0200
[PATCH v2 07/11] drm: sun4i: add support for the TV encoder in H3 SoC Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:20 +0200
Re: [PATCH v2 07/11] drm: sun4i: add support for the TV encoder in H3 SoC Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-06-07 11:40 +0200
[PATCH v2 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3 Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:20 +0200
[PATCH v2 02/11] drm: sun4i: add support for H3 mixers Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:30 +0200
[PATCH v2 10/11] ARM: sun8i: h3: add display engine pipeline for TVE Icenowy Zheng <icenowy@aosc.io> - 2017-06-04 18:30 +0200
Re: [PATCH v2 10/11] ARM: sun8i: h3: add display engine pipeline for TVE Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-06-07 11:50 +0200
Re: [PATCH v2 00/11] Support for H3 Composite Output support icenowy@aosc.io - 2017-06-07 02:30 +0200
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:10 +0200 |
| Subject | [PATCH v2 00/11] Support for H3 Composite Output support |
| Message-ID | <tOGgh-7tg-5@gated-at.bofh.it> |
Allwinner H3 SoC features a TV Encoder like the one in Allwinner A13, which can only output TV Composite signal. The display pipeline of H3 is also special -- it has two mixers and two TCONs, of which the connection can be swapped. The TCONs do not have channel 0 (as they are all connected to internal bridges, TVE and HDMI TX). Add support for the display pipeline and the TVE in H3, in order to make it possible to display something with mainline kernel with H3. The image quality of TVE is bad, so HDMI is a better output -- this patchset also prepared the mixers and TCONs for HDMI output, and the HDMI controller driver is already done by Jernej Skrabec. So if possible, please apply PATCH 1~5 and 8,9 as soon as possible, so that Jernej can submit his HDMI patches. Currently the jack detection feature of the TVE is still not so clear -- so it's not implemented in this version. Thus the TV output shouldn't be defaultly enabled now. Icenowy Zheng (11): dt-bindings: update the binding for Allwinner H3 TVE support drm: sun4i: add support for H3 mixers drm: sun4i: ignore swapped mixer<->tcon connection for DE2 drm: sun4i: add support for H3's TCON0/1 drm: sun4i: add compatible for H3 display engine drm: sun4i: add color space correction support for DE2 mixer drm: sun4i: add support for the TV encoder in H3 SoC clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3 clk: sunxi-ng: export CLK_PLL_DE for H3 ARM: sun8i: h3: add display engine pipeline for TVE [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC .../bindings/display/sunxi/sun4i-drm.txt | 37 +++- arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++ arch/arm/boot/dts/sun8i-h3.dtsi | 186 +++++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-h3.h | 3 +- drivers/gpu/drm/sun4i/sun4i_drv.c | 46 +++++ drivers/gpu/drm/sun4i/sun4i_tcon.c | 113 ++++++++++--- drivers/gpu/drm/sun4i/sun4i_tcon.h | 3 + drivers/gpu/drm/sun4i/sun4i_tv.c | 35 +++- drivers/gpu/drm/sun4i/sun8i_mixer.c | 53 ++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 6 +- include/dt-bindings/clock/sun8i-h3-ccu.h | 2 + 12 files changed, 463 insertions(+), 35 deletions(-) -- 2.12.2
[toc] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:10 +0200 |
| Subject | [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tOGgh-7tg-15@gated-at.bofh.it> |
| In reply to | #1657108 |
From: Icenowy Zheng <icenowy@aosc.xyz>
Allwinner H3 has two special TCONs, both come without channel0. And the
TCON1 of H3 has no special clocks even for the channel1.
Add support for these kinds of TCON.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Merged TCON0 and TCON1 quirks and compatibles.
drivers/gpu/drm/sun4i/sun4i_tcon.c | 52 +++++++++++++++++++++++++-------------
drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
2 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 568cea0e5f8f..62ba4fc19f18 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -59,6 +59,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
/* Disable the TCON's channel */
if (channel == 0) {
+ WARN_ON(!tcon->quirks->has_channel_0);
regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
SUN4I_TCON0_CTL_TCON_ENABLE, 0);
clk_disable_unprepare(tcon->dclk);
@@ -78,6 +79,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
/* Enable the TCON's channel */
if (channel == 0) {
+ WARN_ON(!tcon->quirks->has_channel_0);
regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
SUN4I_TCON0_CTL_TCON_ENABLE,
SUN4I_TCON0_CTL_TCON_ENABLE);
@@ -159,6 +161,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
/* Configure the dot clock */
clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+ WARN_ON(!tcon->quirks->has_channel_0);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -366,10 +369,12 @@ static int sun4i_tcon_init_clocks(struct device *dev,
}
clk_prepare_enable(tcon->clk);
- tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
- if (IS_ERR(tcon->sclk0)) {
- dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
- return PTR_ERR(tcon->sclk0);
+ if (tcon->quirks->has_channel_0) {
+ tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
+ if (IS_ERR(tcon->sclk0)) {
+ dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
+ return PTR_ERR(tcon->sclk0);
+ }
}
if (tcon->quirks->has_channel_1) {
@@ -594,10 +599,12 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
goto err_free_clocks;
}
- ret = sun4i_dclk_create(dev, tcon);
- if (ret) {
- dev_err(dev, "Couldn't create our TCON dot clock\n");
- goto err_free_clocks;
+ if (tcon->quirks->has_channel_0) {
+ ret = sun4i_dclk_create(dev, tcon);
+ if (ret) {
+ dev_err(dev, "Couldn't create our TCON dot clock\n");
+ goto err_free_clocks;
+ }
}
ret = sun4i_tcon_init_irq(dev, tcon);
@@ -622,7 +629,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
return 0;
err_free_dotclock:
- sun4i_dclk_free(tcon);
+ if (tcon->quirks->has_channel_0)
+ sun4i_dclk_free(tcon);
err_free_clocks:
sun4i_tcon_free_clocks(tcon);
err_assert_reset:
@@ -636,7 +644,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
struct sun4i_tcon *tcon = dev_get_drvdata(dev);
list_del(&tcon->list);
- sun4i_dclk_free(tcon);
+
+ if (tcon->quirks->has_channel_0)
+ sun4i_dclk_free(tcon);
sun4i_tcon_free_clocks(tcon);
}
@@ -667,24 +677,32 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
}
static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
- .has_unknown_mux = true,
- .has_channel_1 = true,
+ .has_unknown_mux = true,
+ .has_channel_0 = true,
+ .has_channel_1 = true,
};
static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
- .has_channel_1 = true,
+ .has_channel_0 = true,
+ .has_channel_1 = true,
};
static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
- .has_channel_1 = true,
+ .has_channel_0 = true,
+ .has_channel_1 = true,
};
static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
- /* nothing is supported */
+ .has_channel_0 = true,
};
static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
- /* nothing is supported */
+ .has_channel_0 = true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_quirks = {
+ .has_channel_1 = true,
+ .swappable_input = true,
};
static const struct of_device_id sun4i_tcon_of_table[] = {
@@ -693,7 +711,7 @@ static const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
- { }
+ { .compatible = "allwinner,sun8i-h3-tcon", .data = &sun8i_h3_quirks },
};
MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index c3e01c06e9a0..9c706a0bd478 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -145,6 +145,7 @@
struct sun4i_tcon_quirks {
bool has_unknown_mux; /* sun5i has undocumented mux */
+ bool has_channel_0; /* some A83T+ TCONs don't have channel 0*/
bool has_channel_1; /* a33 does not have channel 1 */
/* Some DE2 can swap the mixer<->TCON connection */
bool swappable_input;
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Jernej Škrabec <jernej.skrabec@siol.net> |
|---|---|
| Date | 2017-06-04 21:00 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tOIUO-yB-7@gated-at.bofh.it> |
| In reply to | #1657109 |
Hi,
Dne nedelja, 04. junij 2017 ob 18:01:42 CEST je Icenowy Zheng napisal(a):
> From: Icenowy Zheng <icenowy@aosc.xyz>
>
> Allwinner H3 has two special TCONs, both come without channel0. And the
> TCON1 of H3 has no special clocks even for the channel1.
>
> Add support for these kinds of TCON.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Merged TCON0 and TCON1 quirks and compatibles.
>
> drivers/gpu/drm/sun4i/sun4i_tcon.c | 52
> +++++++++++++++++++++++++------------- drivers/gpu/drm/sun4i/sun4i_tcon.h |
> 1 +
> 2 files changed, 36 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 568cea0e5f8f..62ba4fc19f18
> 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -59,6 +59,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon,
> int channel)
>
> /* Disable the TCON's channel */
> if (channel == 0) {
> + WARN_ON(!tcon->quirks->has_channel_0);
> regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
> SUN4I_TCON0_CTL_TCON_ENABLE, 0);
> clk_disable_unprepare(tcon->dclk);
> @@ -78,6 +79,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon,
> int channel)
>
> /* Enable the TCON's channel */
> if (channel == 0) {
> + WARN_ON(!tcon->quirks->has_channel_0);
> regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
> SUN4I_TCON0_CTL_TCON_ENABLE,
> SUN4I_TCON0_CTL_TCON_ENABLE);
> @@ -159,6 +161,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
>
> /* Configure the dot clock */
> clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
> + WARN_ON(!tcon->quirks->has_channel_0);
>
> /* Adjust clock delay */
> clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
> @@ -366,10 +369,12 @@ static int sun4i_tcon_init_clocks(struct device *dev,
> }
> clk_prepare_enable(tcon->clk);
>
> - tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
> - if (IS_ERR(tcon->sclk0)) {
> - dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
> - return PTR_ERR(tcon->sclk0);
> + if (tcon->quirks->has_channel_0) {
> + tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
> + if (IS_ERR(tcon->sclk0)) {
> + dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
> + return PTR_ERR(tcon->sclk0);
> + }
> }
>
> if (tcon->quirks->has_channel_1) {
> @@ -594,10 +599,12 @@ static int sun4i_tcon_bind(struct device *dev, struct
> device *master, goto err_free_clocks;
> }
>
> - ret = sun4i_dclk_create(dev, tcon);
> - if (ret) {
> - dev_err(dev, "Couldn't create our TCON dot clock\n");
> - goto err_free_clocks;
> + if (tcon->quirks->has_channel_0) {
> + ret = sun4i_dclk_create(dev, tcon);
> + if (ret) {
> + dev_err(dev, "Couldn't create our TCON dot clock\n");
> + goto err_free_clocks;
> + }
> }
>
> ret = sun4i_tcon_init_irq(dev, tcon);
> @@ -622,7 +629,8 @@ static int sun4i_tcon_bind(struct device *dev, struct
> device *master, return 0;
>
> err_free_dotclock:
> - sun4i_dclk_free(tcon);
> + if (tcon->quirks->has_channel_0)
> + sun4i_dclk_free(tcon);
> err_free_clocks:
> sun4i_tcon_free_clocks(tcon);
> err_assert_reset:
> @@ -636,7 +644,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct
> device *master, struct sun4i_tcon *tcon = dev_get_drvdata(dev);
>
> list_del(&tcon->list);
> - sun4i_dclk_free(tcon);
> +
> + if (tcon->quirks->has_channel_0)
> + sun4i_dclk_free(tcon);
> sun4i_tcon_free_clocks(tcon);
> }
>
> @@ -667,24 +677,32 @@ static int sun4i_tcon_remove(struct platform_device
> *pdev) }
>
> static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
> - .has_unknown_mux = true,
> - .has_channel_1 = true,
> + .has_unknown_mux = true,
> + .has_channel_0 = true,
> + .has_channel_1 = true,
> };
>
> static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
> - .has_channel_1 = true,
> + .has_channel_0 = true,
> + .has_channel_1 = true,
> };
>
> static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
> - .has_channel_1 = true,
> + .has_channel_0 = true,
> + .has_channel_1 = true,
> };
>
> static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
> - /* nothing is supported */
> + .has_channel_0 = true,
> };
>
> static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
> - /* nothing is supported */
> + .has_channel_0 = true,
> +};
> +
> +static const struct sun4i_tcon_quirks sun8i_h3_quirks = {
> + .has_channel_1 = true,
> + .swappable_input = true,
> };
>
> static const struct of_device_id sun4i_tcon_of_table[] = {
> @@ -693,7 +711,7 @@ static const struct of_device_id sun4i_tcon_of_table[] =
> { { .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks
> }, { .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
> { .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
> - { }
> + { .compatible = "allwinner,sun8i-h3-tcon", .data = &sun8i_h3_quirks },
I think you need to leave empty entry as a sentinel.
> };
> MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h
> b/drivers/gpu/drm/sun4i/sun4i_tcon.h index c3e01c06e9a0..9c706a0bd478
> 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
> @@ -145,6 +145,7 @@
>
> struct sun4i_tcon_quirks {
> bool has_unknown_mux; /* sun5i has undocumented mux */
> + bool has_channel_0; /* some A83T+ TCONs don't have channel 0*/
> bool has_channel_1; /* a33 does not have channel 1 */
> /* Some DE2 can swap the mixer<->TCON connection */
> bool swappable_input;
> --
> 2.12.2
You missed sun4i_rgb_init() function which should also be guarded with "if
(tcon->quirks->has_channel_0)".
You should also expand function sun4i_drv_node_is_tcon() at sun4i_drv.c with
new entries, but I'm not sure if this fits in this patch.
Best regards,
Jernej
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 21:10 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tOJ4t-RW-1@gated-at.bofh.it> |
| In reply to | #1657136 |
于 2017年6月5日 GMT+08:00 上午2:46:24, "Jernej Škrabec" <jernej.skrabec@siol.net> 写到:
>Hi,
>
>Dne nedelja, 04. junij 2017 ob 18:01:42 CEST je Icenowy Zheng
>napisal(a):
>> From: Icenowy Zheng <icenowy@aosc.xyz>
>>
>> Allwinner H3 has two special TCONs, both come without channel0. And
>the
>> TCON1 of H3 has no special clocks even for the channel1.
>>
>> Add support for these kinds of TCON.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>> Changes in v2:
>> - Merged TCON0 and TCON1 quirks and compatibles.
>>
>> drivers/gpu/drm/sun4i/sun4i_tcon.c | 52
>> +++++++++++++++++++++++++-------------
>drivers/gpu/drm/sun4i/sun4i_tcon.h |
>> 1 +
>> 2 files changed, 36 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 568cea0e5f8f..62ba4fc19f18
>> 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> @@ -59,6 +59,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon
>*tcon,
>> int channel)
>>
>> /* Disable the TCON's channel */
>> if (channel == 0) {
>> + WARN_ON(!tcon->quirks->has_channel_0);
>> regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
>> SUN4I_TCON0_CTL_TCON_ENABLE, 0);
>> clk_disable_unprepare(tcon->dclk);
>> @@ -78,6 +79,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon
>*tcon,
>> int channel)
>>
>> /* Enable the TCON's channel */
>> if (channel == 0) {
>> + WARN_ON(!tcon->quirks->has_channel_0);
>> regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
>> SUN4I_TCON0_CTL_TCON_ENABLE,
>> SUN4I_TCON0_CTL_TCON_ENABLE);
>> @@ -159,6 +161,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon
>*tcon,
>>
>> /* Configure the dot clock */
>> clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
>> + WARN_ON(!tcon->quirks->has_channel_0);
>>
>> /* Adjust clock delay */
>> clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
>> @@ -366,10 +369,12 @@ static int sun4i_tcon_init_clocks(struct device
>*dev,
>> }
>> clk_prepare_enable(tcon->clk);
>>
>> - tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
>> - if (IS_ERR(tcon->sclk0)) {
>> - dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
>> - return PTR_ERR(tcon->sclk0);
>> + if (tcon->quirks->has_channel_0) {
>> + tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
>> + if (IS_ERR(tcon->sclk0)) {
>> + dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
>> + return PTR_ERR(tcon->sclk0);
>> + }
>> }
>>
>> if (tcon->quirks->has_channel_1) {
>> @@ -594,10 +599,12 @@ static int sun4i_tcon_bind(struct device *dev,
>struct
>> device *master, goto err_free_clocks;
>> }
>>
>> - ret = sun4i_dclk_create(dev, tcon);
>> - if (ret) {
>> - dev_err(dev, "Couldn't create our TCON dot clock\n");
>> - goto err_free_clocks;
>> + if (tcon->quirks->has_channel_0) {
>> + ret = sun4i_dclk_create(dev, tcon);
>> + if (ret) {
>> + dev_err(dev, "Couldn't create our TCON dot clock\n");
>> + goto err_free_clocks;
>> + }
>> }
>>
>> ret = sun4i_tcon_init_irq(dev, tcon);
>> @@ -622,7 +629,8 @@ static int sun4i_tcon_bind(struct device *dev,
>struct
>> device *master, return 0;
>>
>> err_free_dotclock:
>> - sun4i_dclk_free(tcon);
>> + if (tcon->quirks->has_channel_0)
>> + sun4i_dclk_free(tcon);
>> err_free_clocks:
>> sun4i_tcon_free_clocks(tcon);
>> err_assert_reset:
>> @@ -636,7 +644,9 @@ static void sun4i_tcon_unbind(struct device *dev,
>struct
>> device *master, struct sun4i_tcon *tcon = dev_get_drvdata(dev);
>>
>> list_del(&tcon->list);
>> - sun4i_dclk_free(tcon);
>> +
>> + if (tcon->quirks->has_channel_0)
>> + sun4i_dclk_free(tcon);
>> sun4i_tcon_free_clocks(tcon);
>> }
>>
>> @@ -667,24 +677,32 @@ static int sun4i_tcon_remove(struct
>platform_device
>> *pdev) }
>>
>> static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
>> - .has_unknown_mux = true,
>> - .has_channel_1 = true,
>> + .has_unknown_mux = true,
>> + .has_channel_0 = true,
>> + .has_channel_1 = true,
>> };
>>
>> static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
>> - .has_channel_1 = true,
>> + .has_channel_0 = true,
>> + .has_channel_1 = true,
>> };
>>
>> static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
>> - .has_channel_1 = true,
>> + .has_channel_0 = true,
>> + .has_channel_1 = true,
>> };
>>
>> static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
>> - /* nothing is supported */
>> + .has_channel_0 = true,
>> };
>>
>> static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
>> - /* nothing is supported */
>> + .has_channel_0 = true,
>> +};
>> +
>> +static const struct sun4i_tcon_quirks sun8i_h3_quirks = {
>> + .has_channel_1 = true,
>> + .swappable_input = true,
>> };
>>
>> static const struct of_device_id sun4i_tcon_of_table[] = {
>> @@ -693,7 +711,7 @@ static const struct of_device_id
>sun4i_tcon_of_table[] =
>> { { .compatible = "allwinner,sun6i-a31s-tcon", .data =
>&sun6i_a31s_quirks
>> }, { .compatible = "allwinner,sun8i-a33-tcon", .data =
>&sun8i_a33_quirks },
>> { .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks
>},
>> - { }
>> + { .compatible = "allwinner,sun8i-h3-tcon", .data = &sun8i_h3_quirks
>},
>
>I think you need to leave empty entry as a sentinel.
Sorry.
>
>> };
>> MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
>>
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h
>> b/drivers/gpu/drm/sun4i/sun4i_tcon.h index c3e01c06e9a0..9c706a0bd478
>> 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
>> @@ -145,6 +145,7 @@
>>
>> struct sun4i_tcon_quirks {
>> bool has_unknown_mux; /* sun5i has undocumented mux */
>> + bool has_channel_0; /* some A83T+ TCONs don't have channel 0*/
>> bool has_channel_1; /* a33 does not have channel 1 */
>> /* Some DE2 can swap the mixer<->TCON connection */
>> bool swappable_input;
>> --
>> 2.12.2
>
>You missed sun4i_rgb_init() function which should also be guarded with
>"if
>(tcon->quirks->has_channel_0)".
>
Yes...
>You should also expand function sun4i_drv_node_is_tcon() at sun4i_drv.c
>with
>new entries, but I'm not sure if this fits in this patch.
Instead I think it should be renamed to something like
"sun4i_drv_node_is_tcon_with_ch0".
>
>Best regards,
>Jernej
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-06-07 11:50 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tPFLb-4SX-19@gated-at.bofh.it> |
| In reply to | #1657138 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jun 05, 2017 at 03:03:47AM +0800, Icenowy Zheng wrote: > >You should also expand function sun4i_drv_node_is_tcon() at sun4i_drv.c > >with > >new entries, but I'm not sure if this fits in this patch. > > Instead I think it should be renamed to something like > "sun4i_drv_node_is_tcon_with_ch0". I'm not sure, or at least, it shouldn't make any difference, since TCON without a channel 0 will not have an endpoint 0, so this will be dealt with already. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-07 13:20 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tPHah-5UP-9@gated-at.bofh.it> |
| In reply to | #1659614 |
于 2017年6月7日 GMT+08:00 下午5:43:43, Maxime Ripard <maxime.ripard@free-electrons.com> 写到: >On Mon, Jun 05, 2017 at 03:03:47AM +0800, Icenowy Zheng wrote: >> >You should also expand function sun4i_drv_node_is_tcon() at >sun4i_drv.c >> >with >> >new entries, but I'm not sure if this fits in this patch. >> >> Instead I think it should be renamed to something like >> "sun4i_drv_node_is_tcon_with_ch0". > >I'm not sure, or at least, it shouldn't make any difference, since >TCON without a channel 0 will not have an endpoint 0, so this will be >dealt with already. But that will prevent new coders from add CH1-less TCON compatibles to this function. > >Maxime
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-07 14:20 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tPI6m-6wb-17@gated-at.bofh.it> |
| In reply to | #1659614 |
于 2017年6月7日 GMT+08:00 下午5:43:43, Maxime Ripard <maxime.ripard@free-electrons.com> 写到: >On Mon, Jun 05, 2017 at 03:03:47AM +0800, Icenowy Zheng wrote: >> >You should also expand function sun4i_drv_node_is_tcon() at >sun4i_drv.c >> >with >> >new entries, but I'm not sure if this fits in this patch. >> >> Instead I think it should be renamed to something like >> "sun4i_drv_node_is_tcon_with_ch0". > >I'm not sure, or at least, it shouldn't make any difference, since >TCON without a channel 0 will not have an endpoint 0, so this will be >dealt with already. But that will prevent new coders from add CH1-less TCON compatibles to this function. > >Maxime
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-07 16:30 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tPK89-7Mn-5@gated-at.bofh.it> |
| In reply to | #1659739 |
于 2017年6月7日 GMT+08:00 下午10:19:57, Maxime Ripard <maxime.ripard@free-electrons.com> 写到: >On Wed, Jun 07, 2017 at 05:44:56PM +0800, Icenowy Zheng wrote: >> 于 2017年6月7日 GMT+08:00 下午5:43:43, Maxime Ripard ><maxime.ripard@free-electrons.com> 写到: >> >On Mon, Jun 05, 2017 at 03:03:47AM +0800, Icenowy Zheng wrote: >> >> >You should also expand function sun4i_drv_node_is_tcon() at >> >sun4i_drv.c >> >> >with >> >> >new entries, but I'm not sure if this fits in this patch. >> >> >> >> Instead I think it should be renamed to something like >> >> "sun4i_drv_node_is_tcon_with_ch0". >> > >> >I'm not sure, or at least, it shouldn't make any difference, since >> >TCON without a channel 0 will not have an endpoint 0, so this will >be >> >dealt with already. >> >> But that will prevent new coders from add CH1-less TCON >> compatibles to this function. > >Why? We already have such TCONs (like the A33's, or V3S') in that >function. Sorry, CH0-less. > >Maxime
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-06-07 16:50 +0200 |
| Subject | Re: [PATCH v2 04/11] drm: sun4i: add support for H3's TCON0/1 |
| Message-ID | <tPK89-7Mn-7@gated-at.bofh.it> |
| In reply to | #1659739 |
[Multipart message — attachments visible in raw view] — view raw
On Wed, Jun 07, 2017 at 05:44:56PM +0800, Icenowy Zheng wrote: > 于 2017年6月7日 GMT+08:00 下午5:43:43, Maxime Ripard <maxime.ripard@free-electrons.com> 写到: > >On Mon, Jun 05, 2017 at 03:03:47AM +0800, Icenowy Zheng wrote: > >> >You should also expand function sun4i_drv_node_is_tcon() at > >sun4i_drv.c > >> >with > >> >new entries, but I'm not sure if this fits in this patch. > >> > >> Instead I think it should be renamed to something like > >> "sun4i_drv_node_is_tcon_with_ch0". > > > >I'm not sure, or at least, it shouldn't make any difference, since > >TCON without a channel 0 will not have an endpoint 0, so this will be > >dealt with already. > > But that will prevent new coders from add CH1-less TCON > compatibles to this function. Why? We already have such TCONs (like the A33's, or V3S') in that function. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:10 +0200 |
| Subject | [PATCH v2 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC |
| Message-ID | <tOGgi-7tg-25@gated-at.bofh.it> |
| In reply to | #1657108 |
Orange Pi PC features a 3.5mm jack with TV output in it.
Enable the TV output.
As it currently do not have jack detection feature, do not merge this
patch.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
index 998b60f8d295..a81d25e722e9 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
@@ -98,6 +98,10 @@
status = "okay";
};
+&de {
+ status = "okay";
+};
+
&ehci0 {
status = "okay";
};
@@ -177,6 +181,14 @@
status = "okay";
};
+&tcon1 {
+ status = "okay";
+};
+
+&tve0 {
+ status = "okay";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins_a>;
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:20 +0200 |
| Subject | [PATCH v2 05/11] drm: sun4i: add compatible for H3 display engine |
| Message-ID | <tOGpX-7x8-1@gated-at.bofh.it> |
| In reply to | #1657108 |
Add a compatible string for H3 display engine in sun4i_drv code.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 775eee82d8a9..2003507b41a6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -355,6 +355,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
{ .compatible = "allwinner,sun6i-a31-display-engine" },
{ .compatible = "allwinner,sun6i-a31s-display-engine" },
{ .compatible = "allwinner,sun8i-a33-display-engine" },
+ { .compatible = "allwinner,sun8i-h3-display-engine" },
{ .compatible = "allwinner,sun8i-v3s-display-engine" },
{ }
};
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:20 +0200 |
| Subject | [PATCH v2 06/11] drm: sun4i: add color space correction support for DE2 mixer |
| Message-ID | <tOGpX-7x8-5@gated-at.bofh.it> |
| In reply to | #1657108 |
The DE2 mixer can do color space correction needed by TV Encoder with
its DCSC sub-engine.
Add support for it.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
drivers/gpu/drm/sun4i/sun8i_mixer.c | 35 +++++++++++++++++++++++++++++++++++
drivers/gpu/drm/sun4i/sun8i_mixer.h | 6 +++++-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index d658a3a8159a..65f86641eca3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -29,6 +29,14 @@
#include "sun8i_layer.h"
#include "sunxi_engine.h"
+static const u32 sun8i_rgb2yuv_coef[12] = {
+ 0x00000107, 0x00000204, 0x00000064, 0x00004200,
+ 0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
+ 0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
+};
+
+static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
+
static void sun8i_mixer_commit(struct sunxi_engine *engine)
{
DRM_DEBUG_DRIVER("Committing changes\n");
@@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine)
SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
}
+static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
+{
+ int i;
+
+ DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
+
+ /* Set color correction */
+ regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
+
+ for (i = 0; i < 12; i++)
+ regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
+ sun8i_rgb2yuv_coef[i]);
+
+ regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
+ sun8i_rgb2yuv_dcsc_alpha);
+}
+
+static void sun8i_mixer_disable_color_correction(struct sunxi_engine *engine)
+{
+ DRM_DEBUG_DRIVER("Disabling color correction\n");
+
+ /* Disable color correction */
+ regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
+}
+
void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
int layer, bool enable)
{
@@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer,
static const struct sunxi_engine_ops sun8i_engine_ops = {
.commit = sun8i_mixer_commit,
.layers_init = sun8i_layers_init,
+ .apply_color_correction = sun8i_mixer_apply_color_correction,
+ .disable_color_correction = sun8i_mixer_disable_color_correction,
};
static struct regmap_config sun8i_mixer_regmap_config = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 4785ac090b8c..d7f7513898b6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -88,6 +88,11 @@
#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888 (8 << 8)
#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF (0xff << 24)
+/* The DCSC sub-engine is used to do color space conversation */
+#define SUN8I_MIXER_DCSC_EN 0xb0000
+#define SUN8I_MIXER_DCSC_COEF_REG(x) (0xb0010 + 0x4 * x)
+#define SUN8I_MIXER_DCSC_COEF_ALPHA 0xb0040
+
/*
* These sub-engines are still unknown now, the EN registers are here only to
* be used to disable these sub-engines.
@@ -102,7 +107,6 @@
#define SUN8I_MIXER_PEAK_EN 0xa6000
#define SUN8I_MIXER_ASE_EN 0xa8000
#define SUN8I_MIXER_FCC_EN 0xaa000
-#define SUN8I_MIXER_DCSC_EN 0xb0000
struct sun8i_mixer_cfg {
int vi_num;
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:20 +0200 |
| Subject | [PATCH v2 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3 |
| Message-ID | <tOGpX-7x8-3@gated-at.bofh.it> |
| In reply to | #1657108 |
Allwinner H3 features a PLL named CLK_PLL_DE, and a mod clock for the
"Display Engine 2.0" named CLK_DE. As the name indicated, the CLK_PLL_DE
is a PLL for CLK_DE.
Only CLK_DE and CLK_TVE have a parent of CLK_PLL_DE, and CLK_TVE is also
one part of the display clocks.
So allow CLK_DE to set CLK_PLL_DE (add CLK_SET_RATE_PARENT to it).
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 62e4f0d2b2fc..b6a1636c2f6b 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -439,7 +439,7 @@ static SUNXI_CCU_GATE(dram_ts_clk, "dram-ts", "dram",
static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
- 0x104, 0, 4, 24, 3, BIT(31), 0);
+ 0x104, 0, 4, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
static const char * const tcon_parents[] = { "pll-video" };
static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:20 +0200 |
| Subject | [PATCH v2 07/11] drm: sun4i: add support for the TV encoder in H3 SoC |
| Message-ID | <tOGpX-7x8-7@gated-at.bofh.it> |
| In reply to | #1657108 |
Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
but has a internal fixed clock divider that divides the TCON1 clock
(called TVE clock in datasheet) by 11.
Add support for it.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Quirk part rewritten.
drivers/gpu/drm/sun4i/sun4i_tv.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 338b9e5bb2a3..b9ff6d5ea67a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -13,6 +13,7 @@
#include <linux/clk.h>
#include <linux/component.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>
@@ -169,14 +170,21 @@ struct tv_mode {
const struct resync_parameters *resync_params;
};
+struct sun4i_tv_quirks {
+ int fixed_divider;
+};
+
struct sun4i_tv {
struct drm_connector connector;
struct drm_encoder encoder;
struct clk *clk;
+ struct clk *mod_clk;
struct regmap *regs;
struct reset_control *reset;
+ const struct sun4i_tv_quirks *quirks;
+
struct sun4i_drv *drv;
};
@@ -391,6 +399,12 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
struct sun4i_tcon *tcon = crtc->tcon;
const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode);
+ if (tv->quirks->fixed_divider) {
+ DRM_DEBUG_DRIVER("Applying fixed divider %d on TVE clock\n",
+ tv->quirks->fixed_divider);
+ mode->crtc_clock *= tv->quirks->fixed_divider;
+ }
+
sun4i_tcon1_mode_set(tcon, mode);
sun4i_tcon_set_mux(tcon, 1, encoder);
@@ -579,6 +593,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
tv->drv = drv;
dev_set_drvdata(dev, tv);
+ tv->quirks = of_device_get_match_data(dev);
+ if (!tv->quirks)
+ return -EINVAL;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) {
@@ -684,8 +702,23 @@ static int sun4i_tv_remove(struct platform_device *pdev)
return 0;
}
+static const struct sun4i_tv_quirks sun4i_a10_tv_quirks = {
+ /* Nothing special */
+};
+
+static const struct sun4i_tv_quirks sun8i_h3_tv_quirks = {
+ .fixed_divider = 16,
+};
+
static const struct of_device_id sun4i_tv_of_table[] = {
- { .compatible = "allwinner,sun4i-a10-tv-encoder" },
+ {
+ .compatible = "allwinner,sun4i-a10-tv-encoder",
+ .data = &sun4i_a10_tv_quirks,
+ },
+ {
+ .compatible = "allwinner,sun8i-h3-tv-encoder",
+ .data = &sun8i_h3_tv_quirks,
+ },
{ }
};
MODULE_DEVICE_TABLE(of, sun4i_tv_of_table);
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-06-07 11:40 +0200 |
| Subject | Re: [PATCH v2 07/11] drm: sun4i: add support for the TV encoder in H3 SoC |
| Message-ID | <tPFBw-4Pg-25@gated-at.bofh.it> |
| In reply to | #1657114 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jun 05, 2017 at 12:01:45AM +0800, Icenowy Zheng wrote:
> Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
> but has a internal fixed clock divider that divides the TCON1 clock
> (called TVE clock in datasheet) by 11.
>
> Add support for it.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Quirk part rewritten.
>
> drivers/gpu/drm/sun4i/sun4i_tv.c | 35 ++++++++++++++++++++++++++++++++++-
> 1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
> index 338b9e5bb2a3..b9ff6d5ea67a 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
> @@ -13,6 +13,7 @@
> #include <linux/clk.h>
> #include <linux/component.h>
> #include <linux/of_address.h>
> +#include <linux/of_device.h>
> #include <linux/regmap.h>
> #include <linux/reset.h>
>
> @@ -169,14 +170,21 @@ struct tv_mode {
> const struct resync_parameters *resync_params;
> };
>
> +struct sun4i_tv_quirks {
> + int fixed_divider;
> +};
> +
> struct sun4i_tv {
> struct drm_connector connector;
> struct drm_encoder encoder;
>
> struct clk *clk;
> + struct clk *mod_clk;
> struct regmap *regs;
> struct reset_control *reset;
>
> + const struct sun4i_tv_quirks *quirks;
> +
> struct sun4i_drv *drv;
> };
>
> @@ -391,6 +399,12 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
> struct sun4i_tcon *tcon = crtc->tcon;
> const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode);
>
> + if (tv->quirks->fixed_divider) {
> + DRM_DEBUG_DRIVER("Applying fixed divider %d on TVE clock\n",
> + tv->quirks->fixed_divider);
> + mode->crtc_clock *= tv->quirks->fixed_divider;
> + }
> +
You're not allowed to change the mode in mode_set, and you shouldn't
even change it. The output pixel clock is still 27MHz.
You should implement that using the states, as we discussed already.
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:20 +0200 |
| Subject | [PATCH v2 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3 |
| Message-ID | <tOGpX-7x8-11@gated-at.bofh.it> |
| In reply to | #1657108 |
The CLK_PLL_DE is needed to be referenced in device tree for H3, for both forcing the parent of PLL_DE. So export it to the device tree binding header. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> --- drivers/clk/sunxi-ng/ccu-sun8i-h3.h | 3 +-- include/dt-bindings/clock/sun8i-h3-ccu.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h index 1b4baea37d81..add3a7c18212 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h @@ -35,9 +35,8 @@ #define CLK_PLL_PERIPH0_2X 10 #define CLK_PLL_GPU 11 #define CLK_PLL_PERIPH1 12 -#define CLK_PLL_DE 13 -/* The CPUX clock is exported */ +/* The PLL_DE and CPUX clocks is exported */ #define CLK_AXI 15 #define CLK_AHB1 16 diff --git a/include/dt-bindings/clock/sun8i-h3-ccu.h b/include/dt-bindings/clock/sun8i-h3-ccu.h index e139fe5c62ec..5345957a8c2e 100644 --- a/include/dt-bindings/clock/sun8i-h3-ccu.h +++ b/include/dt-bindings/clock/sun8i-h3-ccu.h @@ -45,6 +45,8 @@ #define CLK_PLL_PERIPH0 9 +#define CLK_PLL_DE 13 + #define CLK_CPUX 14 #define CLK_BUS_CE 20 -- 2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:30 +0200 |
| Subject | [PATCH v2 02/11] drm: sun4i: add support for H3 mixers |
| Message-ID | <tOGzD-7B8-1@gated-at.bofh.it> |
| In reply to | #1657108 |
From: Icenowy Zheng <icenowy@aosc.xyz>
Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
and the other has 1 VI and 1 UI.
Add support for these two variants.
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index cb193c5f1686..d658a3a8159a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
.ui_num = 1,
};
+static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
+ .vi_num = 1,
+ .ui_num = 3,
+};
+
+static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
+ .vi_num = 1,
+ .ui_num = 1,
+};
+
static const struct of_device_id sun8i_mixer_of_table[] = {
{
.compatible = "allwinner,sun8i-v3s-de2-mixer",
.data = &sun8i_v3s_mixer_cfg,
},
+ {
+ .compatible = "allwinner,sun8i-h3-de2-mixer0",
+ .data = &sun8i_h3_mixer0_cfg
+ },
+ {
+ .compatible = "allwinner,sun8i-h3-de2-mixer1",
+ .data = &sun8i_h3_mixer1_cfg
+ },
{ }
};
MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-06-04 18:30 +0200 |
| Subject | [PATCH v2 10/11] ARM: sun8i: h3: add display engine pipeline for TVE |
| Message-ID | <tOGzD-7B8-9@gated-at.bofh.it> |
| In reply to | #1657108 |
As we have already the support for the TV encoder on Allwinner H3, add
the display engine pipeline device tree nodes to its DTSI file.
The H5 pipeline has some differences and will be enabled later.
The currently-unused mixer0 and tcon0 are also needed, for the
completement of the pipeline.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Changes according to new dt bindings.
arch/arm/boot/dts/sun8i-h3.dtsi | 186 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 186 insertions(+)
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..d5f2f43c3fb4 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -41,6 +41,8 @@
*/
#include "sunxi-h3-h5.dtsi"
+#include <dt-bindings/clock/sun8i-de2.h>
+#include <dt-bindings/reset/sun8i-de2.h>
/ {
cpus {
@@ -72,6 +74,190 @@
};
};
+ de: display-engine {
+ compatible = "allwinner,sun8i-h3-display-engine";
+ allwinner,pipelines = <&mixer0>,
+ <&mixer1>;
+ status = "disabled";
+ };
+
+ soc {
+ display_clocks: clock@1000000 {
+ compatible = "allwinner,sun8i-a83t-de2-clk";
+ reg = <0x01000000 0x100000>;
+ clocks = <&ccu CLK_BUS_DE>,
+ <&ccu CLK_DE>;
+ clock-names = "bus",
+ "mod";
+ resets = <&ccu RST_BUS_DE>;
+ #clock-cells = <1>;
+ #reset-cells = <1>;
+ assigned-clocks = <&ccu CLK_DE>;
+ assigned-clock-parents = <&ccu CLK_PLL_DE>;
+ assigned-clock-rates = <432000000>;
+ };
+
+ mixer0: mixer@1100000 {
+ compatible = "allwinner,sun8i-h3-de2-mixer0";
+ reg = <0x01100000 0x100000>;
+ clocks = <&display_clocks CLK_BUS_MIXER0>,
+ <&display_clocks CLK_MIXER0>;
+ clock-names = "bus",
+ "mod";
+ resets = <&display_clocks RST_MIXER0>;
+ status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mixer0_out: port@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ mixer0_out_tcon0: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&tcon0_in_mixer0>;
+ };
+
+ mixer0_out_tcon1: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&tcon1_in_mixer0>;
+ };
+ };
+ };
+ };
+
+ mixer1: mixer@1200000 {
+ compatible = "allwinner,sun8i-h3-de2-mixer1";
+ reg = <0x01200000 0x100000>;
+ clocks = <&display_clocks CLK_BUS_MIXER1>,
+ <&display_clocks CLK_MIXER1>;
+ clock-names = "bus",
+ "mod";
+ resets = <&display_clocks RST_WB>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mixer1_out: port@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ mixer1_out_tcon0: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&tcon0_in_mixer1>;
+ };
+
+ mixer1_out_tcon1: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&tcon1_in_mixer1>;
+ };
+ };
+ };
+ };
+
+ tcon0: lcd-controller@1c0c000 {
+ compatible = "allwinner,sun8i-h3-tcon";
+ reg = <0x01c0c000 0x1000>;
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_TCON0>,
+ <&ccu CLK_TCON0>;
+ clock-names = "ahb",
+ "tcon-ch1";
+ resets = <&ccu RST_BUS_TCON0>;
+ reset-names = "lcd";
+ status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tcon0_in: port@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ tcon0_in_mixer0: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&mixer0_out_tcon0>;
+ };
+
+ tcon0_in_mixer1: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&mixer1_out_tcon0>;
+ };
+ };
+ };
+ };
+
+ tcon1: lcd-controller@1c0d000 {
+ compatible = "allwinner,sun8i-h3-tcon";
+ reg = <0x01c0d000 0x1000>;
+ interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_TCON1>,
+ <&ccu CLK_TVE>;
+ clock-names = "ahb",
+ "tcon-ch1";
+ resets = <&ccu RST_BUS_TCON1>;
+ reset-names = "lcd";
+ status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tcon1_in: port@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ tcon1_in_mixer0: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&mixer0_out_tcon1>;
+ };
+
+ tcon1_in_mixer1: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&mixer1_out_tcon1>;
+ };
+ };
+
+ tcon1_out: port@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ tcon1_out_tve0: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&tve0_in_tcon1>;
+ };
+ };
+ };
+ };
+
+ tve0: tv-encoder@1e00000 {
+ compatible = "allwinner,sun8i-h3-tv-encoder";
+ reg = <0x01e00000 0x1000>;
+ clocks = <&ccu CLK_BUS_TVE>;
+ resets = <&ccu RST_BUS_TVE>;
+ status = "disabled";
+
+ port {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tve0_in_tcon1: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&tcon1_out_tve0>;
+ };
+ };
+ };
+ };
+
timer {
compatible = "arm,armv7-timer";
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-06-07 11:50 +0200 |
| Subject | Re: [PATCH v2 10/11] ARM: sun8i: h3: add display engine pipeline for TVE |
| Message-ID | <tPFLb-4SX-11@gated-at.bofh.it> |
| In reply to | #1657119 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jun 05, 2017 at 12:01:48AM +0800, Icenowy Zheng wrote:
> + soc {
> + display_clocks: clock@1000000 {
> + compatible = "allwinner,sun8i-a83t-de2-clk";
> + reg = <0x01000000 0x100000>;
> + clocks = <&ccu CLK_BUS_DE>,
> + <&ccu CLK_DE>;
> + clock-names = "bus",
> + "mod";
> + resets = <&ccu RST_BUS_DE>;
> + #clock-cells = <1>;
> + #reset-cells = <1>;
> + assigned-clocks = <&ccu CLK_DE>;
> + assigned-clock-parents = <&ccu CLK_PLL_DE>;
> + assigned-clock-rates = <432000000>;
> + };
We discussed that already a few times, but there's no reason to do
so. If you need a downstream clock at a particular rate, call
clk_set_rate on it, period.
Whether its parent will be coming from PLL_DE or some other more
appriopriate clock is not relevant and doesn't make any difference.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | icenowy@aosc.io |
|---|---|
| Date | 2017-06-07 02:30 +0200 |
| Message-ID | <tPx1f-7Cp-15@gated-at.bofh.it> |
| In reply to | #1657108 |
在 2017-06-05 00:01,Icenowy Zheng 写道: > Allwinner H3 SoC features a TV Encoder like the one in Allwinner A13, > which can only output TV Composite signal. > > The display pipeline of H3 is also special -- it has two mixers and > two TCONs, of which the connection can be swapped. The TCONs do not > have channel 0 (as they are all connected to internal bridges, TVE > and HDMI TX). > > Add support for the display pipeline and the TVE in H3, in order to > make it possible to display something with mainline kernel with H3. > > The image quality of TVE is bad, so HDMI is a better output -- this > patchset also prepared the mixers and TCONs for HDMI output, and > the HDMI controller driver is already done by Jernej Skrabec. > > So if possible, please apply PATCH 1~5 and 8,9 as soon as possible, > so that Jernej can submit his HDMI patches. > > Currently the jack detection feature of the TVE is still not so > clear -- so it's not implemented in this version. Thus the TV > output shouldn't be defaultly enabled now. > > Icenowy Zheng (11): > dt-bindings: update the binding for Allwinner H3 TVE support > drm: sun4i: add support for H3 mixers > drm: sun4i: ignore swapped mixer<->tcon connection for DE2 > drm: sun4i: add support for H3's TCON0/1 > drm: sun4i: add compatible for H3 display engine > drm: sun4i: add color space correction support for DE2 mixer > drm: sun4i: add support for the TV encoder in H3 SoC > clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3 > clk: sunxi-ng: export CLK_PLL_DE for H3 > ARM: sun8i: h3: add display engine pipeline for TVE > [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC Maxime, could you pick some patches that you think appliable in this series? (especially PATCH 1, the binding patch) I think they can be useful. Thanks! > > .../bindings/display/sunxi/sun4i-drm.txt | 37 +++- > arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++ > arch/arm/boot/dts/sun8i-h3.dtsi | 186 > +++++++++++++++++++++ > drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +- > drivers/clk/sunxi-ng/ccu-sun8i-h3.h | 3 +- > drivers/gpu/drm/sun4i/sun4i_drv.c | 46 +++++ > drivers/gpu/drm/sun4i/sun4i_tcon.c | 113 ++++++++++--- > drivers/gpu/drm/sun4i/sun4i_tcon.h | 3 + > drivers/gpu/drm/sun4i/sun4i_tv.c | 35 +++- > drivers/gpu/drm/sun4i/sun8i_mixer.c | 53 ++++++ > drivers/gpu/drm/sun4i/sun8i_mixer.h | 6 +- > include/dt-bindings/clock/sun8i-h3-ccu.h | 2 + > 12 files changed, 463 insertions(+), 35 deletions(-)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web