Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Attempt to load the xc5k firmware at attach time...



details:   https://anonhg.NetBSD.org/src/rev/8f61792eacd4
branches:  trunk
changeset: 770072:8f61792eacd4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 02 19:15:39 2011 +0000

description:
Attempt to load the xc5k firmware at attach time using config_mountroot. If
it is unavailable the driver will try again on the next open of either the
video or dtv device.

diffstat:

 sys/dev/usb/auvitek.c       |  21 +++++++++++++++++++--
 sys/dev/usb/auvitek_dtv.c   |  14 +++-----------
 sys/dev/usb/auvitek_video.c |  13 +++----------
 sys/dev/usb/auvitekvar.h    |   3 ++-
 4 files changed, 27 insertions(+), 24 deletions(-)

diffs (133 lines):

diff -r cce7bc12e2f6 -r 8f61792eacd4 sys/dev/usb/auvitek.c
--- a/sys/dev/usb/auvitek.c     Sun Oct 02 19:03:56 2011 +0000
+++ b/sys/dev/usb/auvitek.c     Sun Oct 02 19:15:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek.c,v 1.6 2011/10/02 16:30:58 jmcneill Exp $ */
+/* $NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvitek.c,v 1.6 2011/10/02 16:30:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -254,11 +254,28 @@
                return;
        }
 
+       config_mountroot(self, auvitek_attach_tuner);
+
        auvitek_video_attach(sc);
        auvitek_audio_attach(sc);
        auvitek_dtv_attach(sc);
 }
 
+void
+auvitek_attach_tuner(device_t self)
+{
+       struct auvitek_softc *sc = device_private(self);
+
+       mutex_enter(&sc->sc_subdev_lock);
+       if (sc->sc_xc5k == NULL) {
+               sc->sc_xc5k = xc5k_open(sc->sc_dev, &sc->sc_i2c, 0xc2 >> 1,
+                   auvitek_board_tuner_reset, sc,
+                   auvitek_board_get_if_frequency(sc),
+                   FE_ATSC);
+       }
+       mutex_exit(&sc->sc_subdev_lock);
+}
+
 static int
 auvitek_detach(device_t self, int flags)
 {
diff -r cce7bc12e2f6 -r 8f61792eacd4 sys/dev/usb/auvitek_dtv.c
--- a/sys/dev/usb/auvitek_dtv.c Sun Oct 02 19:03:56 2011 +0000
+++ b/sys/dev/usb/auvitek_dtv.c Sun Oct 02 19:15:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_dtv.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $ */
+/* $NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvitek_dtv.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -149,15 +149,7 @@
        if (sc->sc_dying)
                return EIO;
 
-       mutex_enter(&sc->sc_subdev_lock);
-       if (sc->sc_xc5k == NULL) {
-               sc->sc_xc5k = xc5k_open(sc->sc_dev, &sc->sc_i2c, 0xc2 >> 1, 
-                   auvitek_board_tuner_reset, sc,
-                   auvitek_board_get_if_frequency(sc),
-                   FE_ATSC);
-       }
-       mutex_exit(&sc->sc_subdev_lock);
-
+       auvitek_attach_tuner(sc->sc_dev);
        if (sc->sc_xc5k == NULL)
                return ENXIO;
 
diff -r cce7bc12e2f6 -r 8f61792eacd4 sys/dev/usb/auvitek_video.c
--- a/sys/dev/usb/auvitek_video.c       Sun Oct 02 19:03:56 2011 +0000
+++ b/sys/dev/usb/auvitek_video.c       Sun Oct 02 19:15:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_video.c,v 1.5 2011/08/09 01:42:24 jmcneill Exp $ */
+/* $NetBSD: auvitek_video.c,v 1.6 2011/10/02 19:15:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.5 2011/08/09 01:42:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.6 2011/10/02 19:15:40 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -173,14 +173,7 @@
        if (sc->sc_dying)
                return EIO;
 
-       mutex_enter(&sc->sc_subdev_lock);
-       if (sc->sc_xc5k == NULL) {
-               sc->sc_xc5k = xc5k_open(sc->sc_dev, &sc->sc_i2c, 0xc2 >> 1, 
-                   auvitek_board_tuner_reset, sc,
-                   auvitek_board_get_if_frequency(sc),
-                   FE_ATSC);
-       }
-       mutex_exit(&sc->sc_subdev_lock);
+       auvitek_attach_tuner(sc->sc_dev);
 
        if (sc->sc_xc5k == NULL)
                return ENXIO;
diff -r cce7bc12e2f6 -r 8f61792eacd4 sys/dev/usb/auvitekvar.h
--- a/sys/dev/usb/auvitekvar.h  Sun Oct 02 19:03:56 2011 +0000
+++ b/sys/dev/usb/auvitekvar.h  Sun Oct 02 19:15:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitekvar.h,v 1.6 2011/10/02 16:30:58 jmcneill Exp $ */
+/* $NetBSD: auvitekvar.h,v 1.7 2011/10/02 19:15:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -136,6 +136,7 @@
 /* auvitek.c */
 uint8_t        auvitek_read_1(struct auvitek_softc *, uint16_t);
 void   auvitek_write_1(struct auvitek_softc *, uint16_t, uint8_t);
+void   auvitek_attach_tuner(device_t);
 
 /* auvitek_audio.c */
 int    auvitek_audio_attach(struct auvitek_softc *);



Home | Main Index | Thread Index | Old Index