Sun Oct 16 17:11:05 2022 UTC ()
Propagate videomode back to tcon


(bouyer)
diff -r1.14.16.2 -r1.14.16.3 src/sys/arch/arm/sunxi/sunxi_hdmi.c

cvs diff -r1.14.16.2 -r1.14.16.3 src/sys/arch/arm/sunxi/sunxi_hdmi.c (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_hdmi.c 2022/10/16 14:56:04 1.14.16.2
+++ src/sys/arch/arm/sunxi/sunxi_hdmi.c 2022/10/16 17:11:05 1.14.16.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunxi_hdmi.c,v 1.14.16.2 2022/10/16 14:56:04 bouyer Exp $ */ 1/* $NetBSD: sunxi_hdmi.c,v 1.14.16.3 2022/10/16 17:11:05 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2014 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2014 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_ddb.h" 29#include "opt_ddb.h"
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.14.16.2 2022/10/16 14:56:04 bouyer Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.14.16.3 2022/10/16 17:11:05 bouyer Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/bus.h> 35#include <sys/bus.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/intr.h> 37#include <sys/intr.h>
38#include <sys/kmem.h> 38#include <sys/kmem.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/mutex.h> 42#include <sys/mutex.h>
43#include <sys/kthread.h> 43#include <sys/kthread.h>
44 44
45#include <dev/fdt/fdtvar.h> 45#include <dev/fdt/fdtvar.h>
@@ -1079,26 +1079,27 @@ sunxi_hdmi_mode_set(struct drm_encoder * @@ -1079,26 +1079,27 @@ sunxi_hdmi_mode_set(struct drm_encoder *
1079 const u_int vbp = mode->vtotal - mode->vsync_start; 1079 const u_int vbp = mode->vtotal - mode->vsync_start;
1080 int div, dbl, diff; 1080 int div, dbl, diff;
1081 int target_rate = mode->crtc_clock * 1000; 1081 int target_rate = mode->crtc_clock * 1000;
1082 1082
1083#ifdef SUNXI_HDMI_DEBUG 1083#ifdef SUNXI_HDMI_DEBUG
1084 device_printf(sc->sc_dev, 1084 device_printf(sc->sc_dev,
1085 "dblscan %d, interlace %d, phsync %d, pvsync %d\n", 1085 "dblscan %d, interlace %d, phsync %d, pvsync %d\n",
1086 dblscan_p, interlace_p, phsync_p, pvsync_p); 1086 dblscan_p, interlace_p, phsync_p, pvsync_p);
1087 device_printf(sc->sc_dev, "h: %u %u %u %u\n", 1087 device_printf(sc->sc_dev, "h: %u %u %u %u\n",
1088 mode->hdisplay, hbp, hfp, hspw); 1088 mode->hdisplay, hbp, hfp, hspw);
1089 device_printf(sc->sc_dev, "v: %u %u %u %u\n", 1089 device_printf(sc->sc_dev, "v: %u %u %u %u\n",
1090 mode->vdisplay, vbp, vfp, vspw); 1090 mode->vdisplay, vbp, vfp, vspw);
1091#endif 1091#endif
 1092 sunxi_tcon1_set_videomode(fdt_endpoint_device(sc->sc_in_rep), mode);
1092 1093
1093 HDMI_WRITE(sc, SUNXI_HDMI_INT_STATUS_REG, 0xffffffff); 1094 HDMI_WRITE(sc, SUNXI_HDMI_INT_STATUS_REG, 0xffffffff);
1094 1095
1095 diff = hdmi_clk_find(target_rate, &div, &dbl); 1096 diff = hdmi_clk_find(target_rate, &div, &dbl);
1096 1097
1097 if (div == 0) { 1098 if (div == 0) {
1098 device_printf(sc->sc_dev, "ERROR: TCON clk not configured\n"); 1099 device_printf(sc->sc_dev, "ERROR: TCON clk not configured\n");
1099 return; 1100 return;
1100 } 1101 }
1101 1102
1102 uint32_t pll_ctrl, pad_ctrl0, pad_ctrl1; 1103 uint32_t pll_ctrl, pad_ctrl0, pad_ctrl1;
1103 if (HDMI_1_4_P(sc)) { 1104 if (HDMI_1_4_P(sc)) {
1104 pad_ctrl0 = 0x7e8000ff; 1105 pad_ctrl0 = 0x7e8000ff;