Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci hook in lg3303 demod support and modularize
details: https://anonhg.NetBSD.org/src/rev/2e5e2ebd3ada
branches: trunk
changeset: 767302:2e5e2ebd3ada
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Jul 14 23:47:45 2011 +0000
description:
hook in lg3303 demod support and modularize
diffstat:
sys/dev/pci/cxdtv.c | 54 ++++++++++++++++++++++++++++++++++++++++++---
sys/dev/pci/cxdtv_boards.c | 6 ++--
sys/dev/pci/files.pci | 4 +-
3 files changed, 55 insertions(+), 9 deletions(-)
diffs (173 lines):
diff -r 58e37ce0db8a -r 2e5e2ebd3ada sys/dev/pci/cxdtv.c
--- a/sys/dev/pci/cxdtv.c Thu Jul 14 23:46:52 2011 +0000
+++ b/sys/dev/pci/cxdtv.c Thu Jul 14 23:47:45 2011 +0000
@@ -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;
+ }
+}
diff -r 58e37ce0db8a -r 2e5e2ebd3ada sys/dev/pci/cxdtv_boards.c
--- a/sys/dev/pci/cxdtv_boards.c Thu Jul 14 23:46:52 2011 +0000
+++ b/sys/dev/pci/cxdtv_boards.c Thu Jul 14 23:47:45 2011 +0000
@@ -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];
diff -r 58e37ce0db8a -r 2e5e2ebd3ada sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Thu Jul 14 23:46:52 2011 +0000
+++ b/sys/dev/pci/files.pci Thu Jul 14 23:47:45 2011 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index