diff options
author | Chen-Yu Tsai <wens@csie.org> | 2017-10-09 23:20:06 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-10-11 03:53:49 -0400 |
commit | da184deeb8aeac6cadf45f01ce9bc4197940a059 (patch) | |
tree | 99289bd002ec78525261e2ff90c7d6a80ec7f5ef | |
parent | c4a9aec3dfe5203363c6c2f9fc62353f4898225e (diff) |
drm/sun4i: hdmi: Add support for A31's HDMI controller
The HDMI controller found in the A31 SoCs is slightly different
from the one already supported, which is found in the A10s:
- Need different initial values for the PLL related registers
- Different behavior of the DDC and TMDS clocks
- Different register layout for the DDC portion
- Separate DDC parent clock
This patch adds support for it.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-10-wens@csie.org
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_hdmi.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 58 |
2 files changed, 61 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index ee42ae7e5a21..9b97da39927e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h | |||
@@ -59,10 +59,13 @@ | |||
59 | #define SUN4I_HDMI_PAD_CTRL0_TXEN BIT(23) | 59 | #define SUN4I_HDMI_PAD_CTRL0_TXEN BIT(23) |
60 | 60 | ||
61 | #define SUN4I_HDMI_PAD_CTRL1_REG 0x204 | 61 | #define SUN4I_HDMI_PAD_CTRL1_REG 0x204 |
62 | #define SUN4I_HDMI_PAD_CTRL1_UNKNOWN BIT(24) /* set on A31 */ | ||
62 | #define SUN4I_HDMI_PAD_CTRL1_AMP_OPT BIT(23) | 63 | #define SUN4I_HDMI_PAD_CTRL1_AMP_OPT BIT(23) |
63 | #define SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT BIT(22) | 64 | #define SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT BIT(22) |
64 | #define SUN4I_HDMI_PAD_CTRL1_EMP_OPT BIT(20) | 65 | #define SUN4I_HDMI_PAD_CTRL1_EMP_OPT BIT(20) |
65 | #define SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT BIT(19) | 66 | #define SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT BIT(19) |
67 | #define SUN4I_HDMI_PAD_CTRL1_PWSCK BIT(18) | ||
68 | #define SUN4I_HDMI_PAD_CTRL1_PWSDT BIT(17) | ||
66 | #define SUN4I_HDMI_PAD_CTRL1_REG_DEN BIT(15) | 69 | #define SUN4I_HDMI_PAD_CTRL1_REG_DEN BIT(15) |
67 | #define SUN4I_HDMI_PAD_CTRL1_REG_DENCK BIT(14) | 70 | #define SUN4I_HDMI_PAD_CTRL1_REG_DENCK BIT(14) |
68 | #define SUN4I_HDMI_PAD_CTRL1_REG_EMP(n) (((n) & 7) << 10) | 71 | #define SUN4I_HDMI_PAD_CTRL1_REG_EMP(n) (((n) & 7) << 10) |
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 114cbe60b3e6..027b5608dbe6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | |||
@@ -324,6 +324,63 @@ static const struct sun4i_hdmi_variant sun5i_variant = { | |||
324 | .ddc_fifo_has_dir = true, | 324 | .ddc_fifo_has_dir = true, |
325 | }; | 325 | }; |
326 | 326 | ||
327 | static const struct sun4i_hdmi_variant sun6i_variant = { | ||
328 | .has_ddc_parent_clk = true, | ||
329 | .has_reset_control = true, | ||
330 | .pad_ctrl0_init_val = 0xff | | ||
331 | SUN4I_HDMI_PAD_CTRL0_TXEN | | ||
332 | SUN4I_HDMI_PAD_CTRL0_CKEN | | ||
333 | SUN4I_HDMI_PAD_CTRL0_PWENG | | ||
334 | SUN4I_HDMI_PAD_CTRL0_PWEND | | ||
335 | SUN4I_HDMI_PAD_CTRL0_PWENC | | ||
336 | SUN4I_HDMI_PAD_CTRL0_LDODEN | | ||
337 | SUN4I_HDMI_PAD_CTRL0_LDOCEN, | ||
338 | .pad_ctrl1_init_val = SUN4I_HDMI_PAD_CTRL1_REG_AMP(6) | | ||
339 | SUN4I_HDMI_PAD_CTRL1_REG_EMP(4) | | ||
340 | SUN4I_HDMI_PAD_CTRL1_REG_DENCK | | ||
341 | SUN4I_HDMI_PAD_CTRL1_REG_DEN | | ||
342 | SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT | | ||
343 | SUN4I_HDMI_PAD_CTRL1_EMP_OPT | | ||
344 | SUN4I_HDMI_PAD_CTRL1_PWSDT | | ||
345 | SUN4I_HDMI_PAD_CTRL1_PWSCK | | ||
346 | SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT | | ||
347 | SUN4I_HDMI_PAD_CTRL1_AMP_OPT | | ||
348 | SUN4I_HDMI_PAD_CTRL1_UNKNOWN, | ||
349 | .pll_ctrl_init_val = SUN4I_HDMI_PLL_CTRL_VCO_S(8) | | ||
350 | SUN4I_HDMI_PLL_CTRL_CS(3) | | ||
351 | SUN4I_HDMI_PLL_CTRL_CP_S(10) | | ||
352 | SUN4I_HDMI_PLL_CTRL_S(4) | | ||
353 | SUN4I_HDMI_PLL_CTRL_VCO_GAIN(4) | | ||
354 | SUN4I_HDMI_PLL_CTRL_SDIV2 | | ||
355 | SUN4I_HDMI_PLL_CTRL_LDO2_EN | | ||
356 | SUN4I_HDMI_PLL_CTRL_LDO1_EN | | ||
357 | SUN4I_HDMI_PLL_CTRL_HV_IS_33 | | ||
358 | SUN4I_HDMI_PLL_CTRL_PLL_EN, | ||
359 | |||
360 | .ddc_clk_reg = REG_FIELD(SUN6I_HDMI_DDC_CLK_REG, 0, 6), | ||
361 | .ddc_clk_pre_divider = 1, | ||
362 | .ddc_clk_m_offset = 2, | ||
363 | |||
364 | .tmds_clk_div_offset = 1, | ||
365 | |||
366 | .field_ddc_en = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 0, 0), | ||
367 | .field_ddc_start = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 27, 27), | ||
368 | .field_ddc_reset = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 31, 31), | ||
369 | .field_ddc_addr_reg = REG_FIELD(SUN6I_HDMI_DDC_ADDR_REG, 1, 31), | ||
370 | .field_ddc_slave_addr = REG_FIELD(SUN6I_HDMI_DDC_ADDR_REG, 1, 7), | ||
371 | .field_ddc_int_status = REG_FIELD(SUN6I_HDMI_DDC_INT_STATUS_REG, 0, 8), | ||
372 | .field_ddc_fifo_clear = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 18, 18), | ||
373 | .field_ddc_fifo_rx_thres = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 4, 7), | ||
374 | .field_ddc_fifo_tx_thres = REG_FIELD(SUN6I_HDMI_DDC_FIFO_CTRL_REG, 0, 3), | ||
375 | .field_ddc_byte_count = REG_FIELD(SUN6I_HDMI_DDC_CMD_REG, 16, 25), | ||
376 | .field_ddc_cmd = REG_FIELD(SUN6I_HDMI_DDC_CMD_REG, 0, 2), | ||
377 | .field_ddc_sda_en = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 6, 6), | ||
378 | .field_ddc_sck_en = REG_FIELD(SUN6I_HDMI_DDC_CTRL_REG, 4, 4), | ||
379 | |||
380 | .ddc_fifo_reg = SUN6I_HDMI_DDC_FIFO_DATA_REG, | ||
381 | .ddc_fifo_thres_incl = true, | ||
382 | }; | ||
383 | |||
327 | static const struct regmap_config sun4i_hdmi_regmap_config = { | 384 | static const struct regmap_config sun4i_hdmi_regmap_config = { |
328 | .reg_bits = 32, | 385 | .reg_bits = 32, |
329 | .val_bits = 32, | 386 | .val_bits = 32, |
@@ -551,6 +608,7 @@ static int sun4i_hdmi_remove(struct platform_device *pdev) | |||
551 | 608 | ||
552 | static const struct of_device_id sun4i_hdmi_of_table[] = { | 609 | static const struct of_device_id sun4i_hdmi_of_table[] = { |
553 | { .compatible = "allwinner,sun5i-a10s-hdmi", .data = &sun5i_variant, }, | 610 | { .compatible = "allwinner,sun5i-a10s-hdmi", .data = &sun5i_variant, }, |
611 | { .compatible = "allwinner,sun6i-a31-hdmi", .data = &sun6i_variant, }, | ||
554 | { } | 612 | { } |
555 | }; | 613 | }; |
556 | MODULE_DEVICE_TABLE(of, sun4i_hdmi_of_table); | 614 | MODULE_DEVICE_TABLE(of, sun4i_hdmi_of_table); |