Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/allwinner If we can't determine the preferred d...
details: https://anonhg.NetBSD.org/src/rev/661b532a53d2
branches: trunk
changeset: 333571:661b532a53d2
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 09 14:30:55 2014 +0000
description:
If we can't determine the preferred display mode for some reason, fallback
to 640x480.
diffstat:
sys/arch/arm/allwinner/awin_debe.c | 14 +++++++-------
sys/arch/arm/allwinner/awin_fb.c | 6 +++---
sys/arch/arm/allwinner/awin_hdmi.c | 27 ++++++++++++++++-----------
sys/arch/arm/allwinner/awin_tcon.c | 11 ++++++-----
sys/arch/arm/allwinner/awin_var.h | 8 ++++----
sys/arch/arm/allwinner/files.awin | 4 ++--
6 files changed, 38 insertions(+), 32 deletions(-)
diffs (245 lines):
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/awin_debe.c
--- a/sys/arch/arm/allwinner/awin_debe.c Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_debe.c Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $ */
+/* $NetBSD: awin_debe.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#include "genfb.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -74,7 +74,7 @@
static int awin_debe_alloc_videomem(struct awin_debe_softc *);
static void awin_debe_setup_fbdev(struct awin_debe_softc *,
- struct videomode *);
+ const struct videomode *);
CFATTACH_DECL_NEW(awin_debe, sizeof(struct awin_debe_softc),
awin_debe_match, awin_debe_attach, NULL, NULL);
@@ -202,9 +202,9 @@
}
static void
-awin_debe_setup_fbdev(struct awin_debe_softc *sc, struct videomode *mode)
+awin_debe_setup_fbdev(struct awin_debe_softc *sc, const struct videomode *mode)
{
- if (sc->sc_fbdev == NULL) {
+ if (mode && sc->sc_fbdev == NULL) {
struct awinfb_attach_args afb = {
.afb_fb = sc->sc_dmap,
.afb_width = mode->hdisplay,
@@ -218,14 +218,14 @@
&afb, NULL);
}
#if NGENFB > 0
- else {
+ else if (sc->sc_fbdev != NULL) {
awin_fb_set_videomode(sc->sc_fbdev, mode);
}
#endif
}
void
-awin_debe_set_videomode(struct videomode *mode)
+awin_debe_set_videomode(const struct videomode *mode)
{
struct awin_debe_softc *sc;
device_t dev;
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/awin_fb.c
--- a/sys/arch/arm/allwinner/awin_fb.c Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_fb.c Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_fb.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $ */
+/* $NetBSD: awin_fb.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -180,7 +180,7 @@
}
void
-awin_fb_set_videomode(device_t dev, struct videomode *mode)
+awin_fb_set_videomode(device_t dev, const struct videomode *mode)
{
struct awin_fb_softc *sc = device_private(dev);
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/awin_hdmi.c
--- a/sys/arch/arm/allwinner/awin_hdmi.c Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_hdmi.c Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_hdmi.c,v 1.3 2014/11/09 14:10:54 jmcneill Exp $ */
+/* $NetBSD: awin_hdmi.c,v 1.4 2014/11/09 14:30:55 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#define AWIN_HDMI_PLL 3 /* PLL7 or PLL3 */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.3 2014/11/09 14:10:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.4 2014/11/09 14:30:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -93,9 +93,9 @@
static void awin_hdmi_enable(struct awin_hdmi_softc *);
static void awin_hdmi_read_edid(struct awin_hdmi_softc *);
static void awin_hdmi_set_videomode(struct awin_hdmi_softc *,
- struct videomode *);
+ const struct videomode *);
static void awin_hdmi_set_audiomode(struct awin_hdmi_softc *,
- struct videomode *);
+ const struct videomode *);
static void awin_hdmi_hpd(struct awin_hdmi_softc *);
static void awin_hdmi_thread(void *);
#if 0
@@ -459,6 +459,7 @@
static void
awin_hdmi_read_edid(struct awin_hdmi_softc *sc)
{
+ const struct videomode *mode;
char edid[128];
struct edid_info ei;
int retry = 4;
@@ -477,18 +478,22 @@
edid_print(&ei);
#endif
- awin_debe_set_videomode(ei.edid_preferred_mode);
- awin_tcon_set_videomode(ei.edid_preferred_mode);
+ mode = ei.edid_preferred_mode;
+ if (mode == NULL)
+ mode = pick_mode_by_ref(640, 480, 60);
- if (ei.edid_preferred_mode != NULL) {
+ awin_debe_set_videomode(mode);
+ awin_tcon_set_videomode(mode);
+
+ if (mode != NULL) {
delay(10000);
- awin_hdmi_set_videomode(sc, ei.edid_preferred_mode);
- awin_hdmi_set_audiomode(sc, ei.edid_preferred_mode);
+ awin_hdmi_set_videomode(sc, mode);
+ awin_hdmi_set_audiomode(sc, mode);
}
}
static void
-awin_hdmi_set_videomode(struct awin_hdmi_softc *sc, struct videomode *mode)
+awin_hdmi_set_videomode(struct awin_hdmi_softc *sc, const struct videomode *mode)
{
uint32_t val;
const u_int dblscan_p = !!(mode->flags & VID_DBLSCAN);
@@ -617,7 +622,7 @@
}
static void
-awin_hdmi_set_audiomode(struct awin_hdmi_softc *sc, struct videomode *mode)
+awin_hdmi_set_audiomode(struct awin_hdmi_softc *sc, const struct videomode *mode)
{
/* TODO */
HDMI_WRITE(sc, AWIN_HDMI_AUD_CTRL_REG, 0);
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/awin_tcon.c
--- a/sys/arch/arm/allwinner/awin_tcon.c Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_tcon.c Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_tcon.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $ */
+/* $NetBSD: awin_tcon.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_tcon.c,v 1.1 2014/11/09 14:10:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_tcon.c,v 1.2 2014/11/09 14:30:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -60,7 +60,8 @@
static int awin_tcon_match(device_t, cfdata_t, void *);
static void awin_tcon_attach(device_t, device_t, void *);
-static void awin_tcon_set_pll(struct awin_tcon_softc *, struct videomode *);
+static void awin_tcon_set_pll(struct awin_tcon_softc *,
+ const struct videomode *);
CFATTACH_DECL_NEW(awin_tcon, sizeof(struct awin_tcon_softc),
awin_tcon_match, awin_tcon_attach, NULL, NULL);
@@ -133,7 +134,7 @@
}
static void
-awin_tcon_set_pll(struct awin_tcon_softc *sc, struct videomode *mode)
+awin_tcon_set_pll(struct awin_tcon_softc *sc, const struct videomode *mode)
{
unsigned int n, m, freq;
unsigned int m1 = ~0, n1 = ~0;
@@ -168,7 +169,7 @@
}
void
-awin_tcon_set_videomode(struct videomode *mode)
+awin_tcon_set_videomode(const struct videomode *mode)
{
struct awin_tcon_softc *sc;
device_t dev;
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/awin_var.h
--- a/sys/arch/arm/allwinner/awin_var.h Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_var.h Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.20 2014/11/09 14:10:54 jmcneill Exp $ */
+/* $NetBSD: awin_var.h,v 1.21 2014/11/09 14:30:55 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -125,9 +125,9 @@
struct videomode;
unsigned int awin_tcon_get_clk_div(void);
-void awin_tcon_set_videomode(struct videomode *);
-void awin_debe_set_videomode(struct videomode *);
-void awin_fb_set_videomode(device_t, struct videomode *);
+void awin_tcon_set_videomode(const struct videomode *);
+void awin_debe_set_videomode(const struct videomode *);
+void awin_fb_set_videomode(device_t, const struct videomode *);
void awin_fb_ddb_trap_callback(int);
void awin_wdog_reset(void);
diff -r 0f5bff9e99bf -r 661b532a53d2 sys/arch/arm/allwinner/files.awin
--- a/sys/arch/arm/allwinner/files.awin Sun Nov 09 14:29:13 2014 +0000
+++ b/sys/arch/arm/allwinner/files.awin Sun Nov 09 14:30:55 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.awin,v 1.22 2014/11/09 14:10:54 jmcneill Exp $
+# $NetBSD: files.awin,v 1.23 2014/11/09 14:30:55 jmcneill Exp $
#
# Configuration info for Allwinner ARM Peripherals
#
@@ -135,7 +135,7 @@
file arch/arm/allwinner/awin_ac.c awin_ac
# A10/A20/A31 HDMI
-device awinhdmi: edid, ddc_read_edid
+device awinhdmi: edid, ddc_read_edid, videomode
attach awinhdmi at awinio with awin_hdmi
file arch/arm/allwinner/awin_hdmi.c awin_hdmi
Home |
Main Index |
Thread Index |
Old Index