Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys modify the dtv device api so hardware drivers can be loa...
details: https://anonhg.NetBSD.org/src/rev/75b2e8d9a9b4
branches: trunk
changeset: 768108:75b2e8d9a9b4
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Aug 09 01:42:24 2011 +0000
description:
modify the dtv device api so hardware drivers can be loaded independently
of the dtv module
diffstat:
sys/conf/files | 11 ++--
sys/dev/dtv/dtv_buffer.c | 8 +-
sys/dev/dtv/dtv_device.c | 13 +----
sys/dev/dtv/dtv_math.c | 19 ++++++-
sys/dev/dtv/dtvif.h | 21 +++++---
sys/dev/dtv/dtvvar.h | 7 +-
sys/dev/dtv/files.dtv | 6 +-
sys/dev/i2c/files.i2c | 4 +-
sys/dev/i2c/xc3028.c | 6 +-
sys/dev/pci/coram.c | 51 +++++++++++++++-----
sys/dev/pci/coramvar.h | 6 ++-
sys/dev/pci/cxdtv.c | 101 ++++++++++++++++++++++++++---------------
sys/dev/pci/cxdtvvar.h | 6 ++-
sys/dev/usb/auvitek.c | 20 ++++++-
sys/dev/usb/auvitek_dtv.c | 40 ++++++++++++----
sys/dev/usb/auvitek_video.c | 16 +++++-
sys/dev/usb/auvitekvar.h | 7 ++-
sys/dev/usb/emdtv.c | 19 ++++++-
sys/dev/usb/emdtv_dtv.c | 38 +++++++++++----
sys/dev/usb/emdtvvar.h | 6 ++-
sys/modules/Makefile | 3 +-
sys/modules/dtv/Makefile | 3 +-
sys/modules/dtv_math/Makefile | 12 ++++
23 files changed, 292 insertions(+), 131 deletions(-)
diffs (truncated from 1189 to 300 lines):
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/conf/files
--- a/sys/conf/files Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/conf/files Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1023 2011/08/07 13:33:01 rmind Exp $
+# $NetBSD: files,v 1.1024 2011/08/09 01:42:24 jmcneill Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@@ -327,6 +327,10 @@
device video
attach video at videobus
+# DTV subsystem
+#
+include "dev/dtv/files.dtv"
+
# National Semiconductor LM7[89]
#
# (included here so files.i2c can define an attachment)
@@ -1729,8 +1733,3 @@
# NOR subsytem
#
include "dev/nor/files.nor"
-
-#
-# DTV subsystem
-#
-include "dev/dtv/files.dtv"
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/dtv_buffer.c
--- a/sys/dev/dtv/dtv_buffer.c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/dtv_buffer.c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_buffer.c,v 1.6 2011/07/16 12:20:01 jmcneill Exp $ */
+/* $NetBSD: dtv_buffer.c,v 1.7 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_buffer.c,v 1.6 2011/07/16 12:20:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_buffer.c,v 1.7 2011/08/09 01:42:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -96,9 +96,9 @@
}
void
-dtv_submit_payload(device_t self, const struct dtv_payload *payload)
+dtv_buffer_submit(void *priv, const struct dtv_payload *payload)
{
- struct dtv_softc *sc = device_private(self);
+ struct dtv_softc *sc = priv;
struct dtv_ts *ts = &sc->sc_ts;
const uint8_t *tspkt;
unsigned int npkts, i;
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/dtv_device.c
--- a/sys/dev/dtv/dtv_device.c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/dtv_device.c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_device.c,v 1.7 2011/07/16 12:20:01 jmcneill Exp $ */
+/* $NetBSD: dtv_device.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_device.c,v 1.7 2011/07/16 12:20:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_device.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $");
#include <sys/types.h>
#include <sys/conf.h>
@@ -301,12 +301,3 @@
}
mutex_exit(&sc->sc_lock);
}
-
-int
-dtv_print(void *arg, const char *pnp)
-{
- if (pnp)
- aprint_normal("dtv at %s", pnp);
-
- return UNCONF;
-}
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/dtv_math.c
--- a/sys/dev/dtv/dtv_math.c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/dtv_math.c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_math.c,v 1.4 2011/07/16 22:41:59 apb Exp $ */
+/* $NetBSD: dtv_math.c,v 1.5 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Alan Barrett <apb%NetBSD.org@localhost>
@@ -27,12 +27,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_math.c,v 1.4 2011/07/16 22:41:59 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_math.c,v 1.5 2011/08/09 01:42:24 jmcneill Exp $");
#include <sys/types.h>
#include <sys/bitops.h>
+#include <sys/module.h>
-#include <dev/dtv/dtvif.h>
+#include <dev/dtv/dtv_math.h>
/*
* dtv_intlog10 -- return an approximation to log10(x) * 1<<24,
@@ -148,6 +149,18 @@
return t / 2136 * 643;
}
+#ifdef _KERNEL
+MODULE(MODULE_CLASS_MISC, dtv_math, NULL);
+
+static int
+dtv_math_modcmd(modcmd_t cmd, void *opaque)
+{
+ if (cmd == MODULE_CMD_INIT || cmd == MODULE_CMD_FINI)
+ return 0;
+ return ENOTTY;
+}
+#endif
+
#ifdef TEST_DTV_MATH
/*
* To test:
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/dtvif.h
--- a/sys/dev/dtv/dtvif.h Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/dtvif.h Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtvif.h,v 1.2 2011/07/15 20:27:42 jmcneill Exp $ */
+/* $NetBSD: dtvif.h,v 1.3 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -52,6 +52,8 @@
#define ISDTVDEMUX(x) (DTVDEV((x)) == DTV_DEVICE_DEMUX)
#define ISDTVDVR(x) (DTVDEV((x)) == DTV_DEVICE_DVR)
+struct dtv_payload;
+
struct dtv_hw_if {
void (*get_devinfo)(void *, struct dvb_frontend_info *);
@@ -61,7 +63,9 @@
fe_status_t (*get_status)(void *);
uint16_t (*get_signal_strength)(void *);
uint16_t (*get_snr)(void *);
- int (*start_transfer)(void *);
+ int (*start_transfer)(void *,
+ void (*)(void *, const struct dtv_payload *),
+ void *);
int (*stop_transfer)(void *);
};
@@ -75,11 +79,12 @@
size_t size;
};
-int dtv_print(void *, const char *);
-
-void dtv_submit_payload(device_t, const struct dtv_payload *);
-
-/* dtv_math.c */
-uint32_t dtv_intlog10(uint32_t);
+static inline int
+dtv_print(void *priv, const char *pnp)
+{
+ if (pnp)
+ aprint_normal("dtv at %s", pnp);
+ return UNCONF;
+}
#endif /* !_DEV_DTV_DTVIF_H */
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/dtvvar.h
--- a/sys/dev/dtv/dtvvar.h Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/dtvvar.h Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtvvar.h,v 1.5 2011/07/16 12:20:01 jmcneill Exp $ */
+/* $NetBSD: dtvvar.h,v 1.6 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -141,8 +141,8 @@
((sc)->sc_hw->get_signal_strength((sc)->sc_priv))
#define dtv_device_get_snr(sc) \
((sc)->sc_hw->get_snr((sc)->sc_priv))
-#define dtv_device_start_transfer(sc) \
- ((sc)->sc_hw->start_transfer((sc)->sc_priv))
+#define dtv_device_start_transfer(sc) \
+ ((sc)->sc_hw->start_transfer((sc)->sc_priv, dtv_buffer_submit, (sc)))
#define dtv_device_stop_transfer(sc) \
((sc)->sc_hw->stop_transfer((sc)->sc_priv))
@@ -156,6 +156,7 @@
int dtv_buffer_destroy(struct dtv_softc *);
int dtv_buffer_read(struct dtv_softc *, struct uio *, int);
int dtv_buffer_poll(struct dtv_softc *, int, lwp_t *);
+void dtv_buffer_submit(void *, const struct dtv_payload *);
void dtv_common_close(struct dtv_softc *);
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/dtv/files.dtv
--- a/sys/dev/dtv/files.dtv Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/dtv/files.dtv Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.dtv,v 1.3 2011/07/15 20:27:42 jmcneill Exp $
+# $NetBSD: files.dtv,v 1.4 2011/08/09 01:42:24 jmcneill Exp $
define dtvbus { }
@@ -8,5 +8,7 @@
file dev/dtv/dtv_demux.c dtv
file dev/dtv/dtv_device.c dtv
file dev/dtv/dtv_ioctl.c dtv
-file dev/dtv/dtv_math.c dtv
file dev/dtv/dtv_scatter.c dtv
+
+define dtv_math
+file dev/dtv/dtv_math.c dtv_math
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/i2c/files.i2c
--- a/sys/dev/i2c/files.i2c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/i2c/files.i2c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.i2c,v 1.40 2011/08/04 01:48:34 jakllsch Exp $
+# $NetBSD: files.i2c,v 1.41 2011/08/09 01:42:24 jmcneill Exp $
defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
@@ -22,7 +22,7 @@
file dev/i2c/lg3303.c lg3303
# Xceive XC3028 tuner
-define xc3028: i2cexec, firmload
+define xc3028: i2cexec, firmload, dtv_math
file dev/i2c/xc3028.c xc3028
# Xceive XC5000 tuner
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/i2c/xc3028.c
--- a/sys/dev/i2c/xc3028.c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/i2c/xc3028.c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xc3028.c,v 1.2 2011/07/22 18:21:10 njoly Exp $ */
+/* $NetBSD: xc3028.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.2 2011/07/22 18:21:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -564,7 +564,7 @@
return 0;
}
-MODULE(MODULE_CLASS_DRIVER, xc3028, NULL);
+MODULE(MODULE_CLASS_DRIVER, xc3028, "dtv_math");
static int
xc3028_modcmd(modcmd_t cmd, void *opaque)
diff -r 2ae15af5c824 -r 75b2e8d9a9b4 sys/dev/pci/coram.c
--- a/sys/dev/pci/coram.c Tue Aug 09 00:39:35 2011 +0000
+++ b/sys/dev/pci/coram.c Tue Aug 09 01:42:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.7 2011/08/06 19:21:27 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coram.c,v 1.7 2011/08/06 19:21:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coram.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +61,7 @@
static int coram_match(device_t, cfdata_t, void *);
static void coram_attach(device_t, device_t, void *);
static int coram_detach(device_t, int);
+static int coram_rescan(device_t, const char *, const int *);
static void coram_childdet(device_t, device_t);
static bool coram_resume(device_t, const pmf_qual_t *);
static int coram_intr(void *);
@@ -82,7 +83,7 @@
Home |
Main Index |
Thread Index |
Old Index