Module Name:    src
Committed By:   jmcneill
Date:           Thu Jul 14 23:47:46 UTC 2011

Modified Files:
        src/sys/dev/pci: cxdtv.c cxdtv_boards.c files.pci

Log Message:
hook in lg3303 demod support and modularize


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/cxdtv.c \
    src/sys/dev/pci/cxdtv_boards.c
cvs rdiff -u -r1.341 -r1.342 src/sys/dev/pci/files.pci

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/cxdtv.c
diff -u src/sys/dev/pci/cxdtv.c:1.1 src/sys/dev/pci/cxdtv.c:1.2
--- src/sys/dev/pci/cxdtv.c:1.1	Mon Jul 11 00:46:03 2011
+++ src/sys/dev/pci/cxdtv.c	Thu Jul 14 23:47:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cxdtv.c,v 1.1 2011/07/11 00:46:03 jakllsch Exp $ */
+/* $NetBSD: cxdtv.c,v 1.2 2011/07/14 23:47:45 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxdtv.c,v 1.1 2011/07/11 00:46:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxdtv.c,v 1.2 2011/07/14 23:47:45 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -35,7 +35,7 @@
 #include <sys/kmem.h>
 #include <sys/mutex.h>
 #include <sys/condvar.h>
-
+#include <sys/module.h>
 #include <sys/bus.h>
 
 #include <dev/pci/pcivar.h>
@@ -48,6 +48,7 @@
 #include <dev/i2c/tvpll_tuners.h>
 
 #include <dev/i2c/nxt2kvar.h>
+#include <dev/i2c/lg3303var.h>
 
 #include <dev/pci/cxdtvreg.h>
 #include <dev/pci/cxdtvvar.h>
@@ -63,6 +64,7 @@
 
 static int cxdtv_match(struct device *, struct cfdata *, void *);
 static void cxdtv_attach(struct device *, struct device *, void *);
+static int cxdtv_detach(struct device *, int);
 static int cxdtv_intr(void *);
 
 static bool cxdtv_resume(device_t, const pmf_qual_t *);
@@ -126,7 +128,7 @@
 };
 
 CFATTACH_DECL_NEW(cxdtv, sizeof(struct cxdtv_softc),
-    cxdtv_match, cxdtv_attach, NULL, NULL);
+    cxdtv_match, cxdtv_attach, cxdtv_detach, NULL);
 
 static int
 cxdtv_match(device_t parent, cfdata_t match, void *aux)
@@ -244,6 +246,12 @@
 	return;
 }
 
+static int
+cxdtv_detach(device_t self, int flags)
+{
+	return EBUSY;
+}
+
 static bool
 cxdtv_resume(device_t dv, const pmf_qual_t *qual)
 {
@@ -425,6 +433,10 @@
 	case CXDTV_DEMOD_NXT2004:
 		sc->sc_demod = nxt2k_open(sc->sc_dev, &sc->sc_i2c, 0x0a, 0);
 		break;
+	case CXDTV_DEMOD_LG3303:
+		sc->sc_demod = lg3303_open(sc->sc_dev, &sc->sc_i2c, 0x59,
+		    LG3303_CFG_SERIAL_INPUT);
+		break;
 	default:
 		break;
 	}
@@ -515,6 +527,9 @@
 	case CXDTV_DEMOD_NXT2004:
 		error = nxt2k_set_modulation(sc->sc_demod, params->u.vsb.modulation);
 		break;
+	case CXDTV_DEMOD_LG3303:
+		error = lg3303_set_modulation(sc->sc_demod, params->u.vsb.modulation);
+		break;
 	default:
 		break;
 	}
@@ -531,6 +546,8 @@
 	switch(sc->sc_board->cb_demod) {
 	case CXDTV_DEMOD_NXT2004:
 		return nxt2k_get_dtv_status(sc->sc_demod);
+	case CXDTV_DEMOD_LG3303:
+		return lg3303_get_dtv_status(sc->sc_demod);
 	default:
 		return 0;
 	}
@@ -1069,3 +1086,32 @@
 	cv_timedwait(&sc->sc_delaycv, &sc->sc_delaylock, mstohz(15));
 	mutex_exit(&sc->sc_delaylock);
 }
+
+MODULE(MODULE_CLASS_DRIVER, cxdtv, "dtv,tvpll,nxt2k,lg3303");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+cxdtv_modcmd(modcmd_t cmd, void *opaque)
+{
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		return config_init_component(cfdriver_ioconf_cxdtv,
+		    cfattach_ioconf_cxdtv, cfdata_ioconf_cxdtv);
+#else
+		return 0;
+#endif
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		return config_fini_component(cfdriver_ioconf_cxdtv,
+		    cfattach_ioconf_cxdtv, cfdata_ioconf_cxdtv);
+#else
+		return 0;
+#endif
+	default:
+		return ENOTTY;
+	}
+}
Index: src/sys/dev/pci/cxdtv_boards.c
diff -u src/sys/dev/pci/cxdtv_boards.c:1.1 src/sys/dev/pci/cxdtv_boards.c:1.2
--- src/sys/dev/pci/cxdtv_boards.c:1.1	Mon Jul 11 00:46:04 2011
+++ src/sys/dev/pci/cxdtv_boards.c	Thu Jul 14 23:47:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cxdtv_boards.c,v 1.1 2011/07/11 00:46:04 jakllsch Exp $ */
+/* $NetBSD: cxdtv_boards.c,v 1.2 2011/07/14 23:47:45 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxdtv_boards.c,v 1.1 2011/07/11 00:46:04 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxdtv_boards.c,v 1.2 2011/07/14 23:47:45 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/device.h>
@@ -60,7 +60,7 @@
 cxdtv_board_lookup(pci_vendor_id_t vendor, pci_product_id_t product)
 {
 	const struct cxdtv_board *cb;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < __arraycount(cxdtv_boards); i++) {
 		cb = &cxdtv_boards[i];

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.341 src/sys/dev/pci/files.pci:1.342
--- src/sys/dev/pci/files.pci:1.341	Mon Jul 11 00:46:04 2011
+++ src/sys/dev/pci/files.pci	Thu Jul 14 23:47:45 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.341 2011/07/11 00:46:04 jakllsch Exp $
+#	$NetBSD: files.pci,v 1.342 2011/07/14 23:47:45 jmcneill Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1049,7 +1049,7 @@
 file	dev/pci/if_vte.c		vte
 
 # Conexant CX23880-series DTV interface
-device	cxdtv: dtvbus, firmload, i2c_bitbang, i2cbus, i2cexec, tvpll, nxt2k
+device	cxdtv: dtvbus, i2c_bitbang, i2cbus, i2cexec, tvpll, nxt2k, lg3303
 attach	cxdtv at pci
 file	dev/pci/cxdtv.c		cxdtv
 file	dev/pci/cxdtv_boards.c	cxdtv

Reply via email to