summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/Makefile6
-rw-r--r--share/man/man4/gtp.4 (renamed from share/man/man4/mr.4)42
-rw-r--r--share/man/man4/pci.46
-rw-r--r--share/man/man4/radio.44
-rw-r--r--sys/arch/i386/conf/GENERIC6
-rw-r--r--sys/dev/pci/files.pci10
-rw-r--r--sys/dev/pci/gtp.c272
-rw-r--r--sys/dev/pci/maxiradio.c284
-rw-r--r--sys/dev/pci/pcidevs6
9 files changed, 312 insertions, 324 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 24a1132963c..f4aef7fe374 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.209 2002/06/03 02:58:42 jason Exp $
+# $OpenBSD: Makefile,v 1.210 2002/06/03 16:13:21 mickey Exp $
MAN= aac.4 ac97.4 addcom.4 adv.4 aha.4 ahb.4 ahc.4 aic.4 ami.4 amphy.4 \
an.4 aria.4 ast.4 atalk.4 atapiscsi.4 \
@@ -9,13 +9,13 @@ MAN= aac.4 ac97.4 addcom.4 adv.4 aha.4 ahb.4 ahc.4 aic.4 ami.4 amphy.4 \
cue.4 cy.4 cz.4 dc.4 ddb.4 de.4 dpt.4 drum.4 eap.4 ec.4 \
eephy.4 ef.4 eg.4 eisa.4 el.4 emu.4 enc.4 ep.4 esa.4 esis.4 \
eso.4 ess.4 exphy.4 fd.4 fdc.4 fpa.4 \
- fms.4 fxp.4 gdt.4 gre.4 gx.4 hifn.4 hsq.4 icmp.4 icsphy.4 \
+ fms.4 fxp.4 gdt.4 gre.4 gtp.4 gx.4 hifn.4 hsq.4 icmp.4 icsphy.4 \
idp.4 iha.4 ifmedia.4 \
inet.4 inphy.4 iop.4 iopsp.4 ioprbs.4 iophy.4 ip.4 ipcomp.4 ipsec.4 \
isa.4 isapnp.4 ises.4 iso.4 isp.4 \
ksyms.4 kue.4 \
lc.4 lge.4 lkm.4 lmc.4 lo.4 lofn.4 lpt.4 lxtphy.4 \
- maestro.4 midi.4 mii.4 mtdphy.4 mr.4 mtio.4 \
+ maestro.4 midi.4 mii.4 mtdphy.4 mtio.4 \
ncr.4 ne.4 neo.4 netintro.4 nge.4 noct.4 nofn.4 ns.4 nsip.4 nsgphy.4 \
nsphy.4 nsphyter.4 null.4 \
ohci.4 opl.4 options.4 pcdisplay.4 pchb.4 pckbc.4 pckbd.4 \
diff --git a/share/man/man4/mr.4 b/share/man/man4/gtp.4
index 56a9ffa612d..67eee879ee3 100644
--- a/share/man/man4/mr.4
+++ b/share/man/man4/gtp.4
@@ -1,7 +1,6 @@
-.\" $OpenBSD: mr.4,v 1.4 2002/01/07 18:37:45 mickey Exp $
-.\" $RuOBSD: mr.4,v 1.3 2001/10/26 05:38:43 form Exp $
+.\" $OpenBSD: gtp.4,v 1.1 2002/06/03 16:13:21 mickey Exp $
.\"
-.\" Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
+.\" Copyright (c) 2002 Vladimir Popov <jumbo@narod.ru>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,31 +23,36 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 8, 2001
-.Dt MR 4
+.Dd June 2, 2002
+.Dt GTP 4
.Os
.Sh NAME
-.Nm mr
-.Nd Guillemot Maxi Radio FM 2000 FM radio device driver
+.Nm gtp
+.Nd Gemtek PCI FM radio device driver
.Sh SYNOPSIS
-.Cd "mr* at pci? flags 0x00"
-.Cd "radio* at mr?"
+.Cd "gtp* at pci? flags 0x00"
+.Cd "radio* at gtp?"
.Sh DESCRIPTION
The
.Nm
-driver provides support for the Maxi Radio FM radio tuners.
+driver provides support for the Gemtek PCI and Guillemot MaxiRadio FM2000
+FM radio tuners.
.Pp
-The Maxi Radio cards are stereo FM tuners that allow to tune in the range
-87.5 - 108.0 MHz, report signal status on the current frequency, force
-audio output to mono, perform hardware signal search, and have an internal
-AFC.
+The Gemtek PCI cards are stereo FM tuners that allow to tune in the range
+87.5 - 108.0 MHz, report signal status and stereo/mono on the current
+frequency, force audio output to mono, perform hardware signal search,
+and have an internal AFC.
.Pp
The card is based on the TEA5757 chip, see
.Xr radio 4
for details.
.Pp
The flags control the driver behavior. For example, with flags 0x01 the driver
-will assume that there is a TEA5759 chip is used.
+will assume that a TEA5759 chip is used.
+.Sh BUGS
+It is impossible to determine which frequency the card is tuned to.
+Thus, the driver will report an internally stored value even if it is not
+correct (changed by some program that uses direct port access).
.Sh SEE ALSO
.Xr pci 4 ,
.Xr radio 4 ,
@@ -56,14 +60,10 @@ will assume that there is a TEA5759 chip is used.
.Sh AUTHORS
The
.Nm
-driver was written by
-.An Vladimir Popov Aq jumbo@narod.ru
-and
-.An Maxim Tsyplakov Aq tm@oganer.net .
-The man page was written by
+driver and the man page was written by
.An Vladimir Popov Aq jumbo@narod.ru .
.Sh HISTORY
The
.Nm
device driver appeared in
-.Ox 3.0 .
+.Ox 3.2 .
diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4
index a5c0c8a6c3d..f37d3561127 100644
--- a/share/man/man4/pci.4
+++ b/share/man/man4/pci.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pci.4,v 1.65 2002/05/31 20:19:39 mickey Exp $
+.\" $OpenBSD: pci.4,v 1.66 2002/06/03 16:13:21 mickey Exp $
.\" $NetBSD: pci.4,v 1.29 2000/04/01 00:32:23 tsarna Exp $
.\"
.\" Copyright (c) 2000 Theo de Raadt. All rights reserved.
@@ -298,8 +298,8 @@ Yamaha DS-XG sound devices.
.El
.Ss Radio receiver devices
.Bl -tag -width 10n -offset ind
-.It Xr mr 4
-Guillemot Maxi Radio FM 2000 FM radio device driver.
+.It Xr gtp 4
+Gemtek PCI FM radio device driver.
.It Xr fms 4
SoundForte RadioLink SF64-PCR a and SF256-PCP-R FM radio devices driver.
.El
diff --git a/share/man/man4/radio.4 b/share/man/man4/radio.4
index 0010ef2b963..d122f45a68c 100644
--- a/share/man/man4/radio.4
+++ b/share/man/man4/radio.4
@@ -1,5 +1,5 @@
.\" $RuOBSD: radio.4,v 1.4 2001/10/26 05:38:43 form Exp $
-.\" $OpenBSD: radio.4,v 1.8 2002/05/30 18:42:33 mickey Exp $
+.\" $OpenBSD: radio.4,v 1.9 2002/06/03 16:13:21 mickey Exp $
.\"
.\" Copyright (c) 2001 Vladimir Popov
.\" All rights reserved.
@@ -203,7 +203,7 @@ cards.
.Xr az 4 ,
.Xr bktr 4 ,
.Xr fms 4 ,
-.Xr mr 4 ,
+.Xr gtp 4 ,
.Xr rt 4 ,
.Xr rtii 4 ,
.Xr sfr 4 ,
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index c047b19f54f..bb206dee270 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.300 2002/05/30 18:42:33 mickey Exp $
+# $OpenBSD: GENERIC,v 1.301 2002/06/03 16:13:16 mickey Exp $
# $NetBSD: GENERIC,v 1.48 1996/05/20 18:17:23 mrg Exp $
#
# GENERIC -- everything that's currently supported
@@ -452,7 +452,7 @@ audio* at emu?
bktr0 at pci? dev ? function ?
# FM-Radio devices
-#mr* at pci? dev ? function ? # Guillemot Maxi Radio FM2000 PCI Radio Card
+#gtp* at pci? dev ? function ? # Gemtek/Guillemot Radio PCI Radio Card
#sfr0 at isa? port 0x384 # SoundForte RadioLink SF16-FMR FM Radio Card
#sf2r0 at isa? port 0x384 # SoundForte RadioLink SF16-FMR2 FM Radio Card
#az0 at isa? port 0x350 # Aztech/PackardBell FM Radio Card
@@ -460,9 +460,9 @@ bktr0 at pci? dev ? function ?
#rtii0 at isa? port 0x30c # AIMS Lab Radiotrack II FM Radio Card
# FM-Radio support
-#radio* at mr?
#radio* at bktr?
#radio* at fms?
+#radio* at gtp?
#radio* at sfr0
#radio* at sf2r0
#radio* at az0
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index 308fe5b8494..e0e00ec18ca 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.135 2002/06/02 18:15:03 jason Exp $
+# $OpenBSD: files.pci,v 1.136 2002/06/03 16:13:21 mickey Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config file and device description for machine-independent PCI code.
@@ -407,10 +407,10 @@ device pcscp: scsi, ncr53c9x
attach pcscp at pci
file dev/pci/pcscp.c pcscp
-# Guillemot Maxi Radio FM 2000 Radio Card
-device mr: radiobus
-attach mr at pci
-file dev/pci/maxiradio.c mr
+# Gemtek/Guillemot PCI Radio Card
+device gtp: tea5757, radiobus
+attach gtp at pci
+file dev/pci/gtp.c gtp
# National Semiconductor DP83820/DP83821 based GigE
device nge: ether, ifnet, mii, ifmedia, mii_phy
diff --git a/sys/dev/pci/gtp.c b/sys/dev/pci/gtp.c
new file mode 100644
index 00000000000..c572e1a6e1e
--- /dev/null
+++ b/sys/dev/pci/gtp.c
@@ -0,0 +1,272 @@
+/* $OpenBSD: gtp.c,v 1.1 2002/06/03 16:13:21 mickey Exp $ */
+
+/*
+ * Copyright (c) 2002 Vladimir Popov <jumbo@narod.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Gemtek PCI Radio Card Device Driver */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/radioio.h>
+
+#include <machine/bus.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <dev/ic/tea5757.h>
+#include <dev/radio_if.h>
+
+int gtp_match(struct device *, void *, void *);
+void gtp_attach(struct device *, struct device *, void *);
+
+int gtp_get_info(void *, struct radio_info *);
+int gtp_set_info(void *, struct radio_info *);
+int gtp_search(void *, int);
+
+#define GEMTEK_PCI_CAPS RADIO_CAPS_DETECT_SIGNAL | \
+ RADIO_CAPS_DETECT_STEREO | \
+ RADIO_CAPS_SET_MONO | \
+ RADIO_CAPS_HW_SEARCH | \
+ RADIO_CAPS_HW_AFC | \
+ RADIO_CAPS_LOCK_SENSITIVITY
+
+#define GEMTEK_PCI_MUTE 0x00
+#define GEMTEK_PCI_RSET 0x10
+
+#define GEMTEK_PCI_SIGNAL 0x08
+#define GEMTEK_PCI_STEREO 0x08
+
+#define GTP_WREN_ON (1 << 2)
+#define GTP_WREN_OFF (0 << 2)
+
+#define GTP_DATA_ON (1 << 1)
+#define GTP_DATA_OFF (0 << 1)
+
+#define GTP_CLCK_ON (1 << 0)
+#define GTP_CLCK_OFF (0 << 0)
+
+#define GTP_READ_CLOCK_LOW (GTP_WREN_OFF | GTP_DATA_ON | GTP_CLCK_OFF)
+#define GTP_READ_CLOCK_HIGH (GTP_WREN_OFF | GTP_DATA_ON | GTP_CLCK_ON)
+
+/* define our interface to the high-level radio driver */
+
+struct radio_hw_if gtp_hw_if = {
+ NULL, /* open */
+ NULL, /* close */
+ gtp_get_info,
+ gtp_set_info,
+ gtp_search
+};
+
+struct gtp_softc {
+ struct device sc_dev;
+
+ int mute;
+ u_int8_t vol;
+ u_int32_t freq;
+ u_int32_t stereo;
+ u_int32_t lock;
+
+ struct tea5757_t tea;
+};
+
+struct cfattach gtp_ca = {
+ sizeof(struct gtp_softc), gtp_match, gtp_attach
+};
+
+struct cfdriver gtp_cd = {
+ NULL, "gtp", DV_DULL
+};
+
+void gtp_set_mute(struct gtp_softc *);
+void gtp_write_bit(bus_space_tag_t, bus_space_handle_t, bus_size_t, int);
+void gtp_init(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void gtp_rset(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+int gtp_state(bus_space_tag_t, bus_space_handle_t);
+u_int32_t gtp_hardware_read(bus_space_tag_t, bus_space_handle_t,
+ bus_size_t);
+
+int
+gtp_match(struct device *parent, void *match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ /* FIXME:
+ * Guillemot produces the card that
+ * was originally developed by Gemtek
+ */
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_GEMTEK &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_GEMTEK_PR103)
+ return (1);
+ return (0);
+}
+
+void
+gtp_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct gtp_softc *sc = (struct gtp_softc *) self;
+ struct pci_attach_args *pa = aux;
+ struct cfdata *cf = sc->sc_dev.dv_cfdata;
+ pci_chipset_tag_t pc = pa->pa_pc;
+ pcireg_t csr;
+
+ if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0, &sc->tea.iot,
+ &sc->tea.ioh, NULL, NULL, 0)) {
+ printf(": can't map i/o space\n");
+ return;
+ }
+
+ /* Enable the card */
+ csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+ pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+ csr | PCI_COMMAND_MASTER_ENABLE);
+
+ sc->vol = 0;
+ sc->mute = 0;
+ sc->freq = MIN_FM_FREQ;
+ sc->stereo = TEA5757_STEREO;
+ sc->lock = TEA5757_S030;
+ sc->tea.offset = 0;
+ sc->tea.flags = cf->cf_flags;
+ sc->tea.init = gtp_init;
+ sc->tea.rset = gtp_rset;
+ sc->tea.write_bit = gtp_write_bit;
+ sc->tea.read = gtp_hardware_read;
+
+ printf(": Gemtek PR103\n");
+
+ radio_attach_mi(&gtp_hw_if, sc, &sc->sc_dev);
+}
+
+int
+gtp_get_info(void *v, struct radio_info *ri)
+{
+ struct gtp_softc *sc = v;
+
+ ri->mute = sc->mute;
+ ri->volume = sc->vol ? 255 : 0;
+ ri->stereo = sc->stereo == TEA5757_STEREO ? 1 : 0;
+ ri->caps = GEMTEK_PCI_CAPS;
+ ri->rfreq = 0;
+ ri->lock = tea5757_decode_lock(sc->lock);
+
+ /* Frequency read unsupported */
+ ri->freq = sc->freq;
+
+ ri->info = gtp_state(sc->tea.iot, sc->tea.ioh);
+ gtp_set_mute(sc);
+
+ return (0);
+}
+
+int
+gtp_set_info(void *v, struct radio_info *ri)
+{
+ struct gtp_softc *sc = v;
+
+ sc->mute = ri->mute ? 1 : 0;
+ sc->vol = ri->volume ? 255 : 0;
+ sc->stereo = ri->stereo ? TEA5757_STEREO: TEA5757_MONO;
+ sc->lock = tea5757_encode_lock(ri->lock);
+ ri->freq = sc->freq = tea5757_set_freq(&sc->tea,
+ sc->lock, sc->stereo, ri->freq);
+ gtp_set_mute(sc);
+
+ return (0);
+}
+
+int
+gtp_search(void *v, int f)
+{
+ struct gtp_softc *sc = v;
+
+ tea5757_search(&sc->tea, sc->lock, sc->stereo, f);
+ gtp_set_mute(sc);
+
+ return (0);
+}
+
+void
+gtp_set_mute(struct gtp_softc *sc)
+{
+ if (sc->mute || !sc->vol)
+ bus_space_write_2(sc->tea.iot, sc->tea.ioh, 0, GEMTEK_PCI_MUTE);
+ else
+ sc->freq = tea5757_set_freq(&sc->tea,
+ sc->lock, sc->stereo, sc->freq);
+}
+
+void
+gtp_write_bit(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off,
+ int bit)
+{
+ u_int8_t data;
+
+ data = bit ? GTP_DATA_ON : GTP_DATA_OFF;
+ bus_space_write_1(iot, ioh, off, GTP_WREN_ON | GTP_CLCK_OFF | data);
+ bus_space_write_1(iot, ioh, off, GTP_WREN_ON | GTP_CLCK_ON | data);
+ bus_space_write_1(iot, ioh, off, GTP_WREN_ON | GTP_CLCK_OFF | data);
+}
+
+void
+gtp_init(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t d)
+{
+ bus_space_write_1(iot, ioh, off, GTP_WREN_ON | GTP_DATA_ON | GTP_CLCK_OFF);
+}
+
+void
+gtp_rset(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t d)
+{
+ bus_space_write_1(iot, ioh, off, GEMTEK_PCI_RSET);
+}
+
+u_int32_t
+gtp_hardware_read(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off)
+{
+ /* UNSUPPORTED */
+ return 0;
+}
+
+int
+gtp_state(bus_space_tag_t iot, bus_space_handle_t ioh)
+{
+ int ret;
+
+ bus_space_write_2(iot, ioh, 0,
+ GTP_DATA_ON | GTP_WREN_OFF | GTP_CLCK_OFF);
+ ret = bus_space_read_2(iot, ioh, 0) &
+ GEMTEK_PCI_STEREO? 0 : RADIO_INFO_STEREO;
+ bus_space_write_2(iot, ioh, 0,
+ GTP_DATA_ON | GTP_WREN_OFF | GTP_CLCK_ON);
+ ret |= bus_space_read_2(iot, ioh, 0) &
+ GEMTEK_PCI_SIGNAL? 0 : RADIO_INFO_SIGNAL;
+
+ return ret;
+}
diff --git a/sys/dev/pci/maxiradio.c b/sys/dev/pci/maxiradio.c
deleted file mode 100644
index f0f2461d421..00000000000
--- a/sys/dev/pci/maxiradio.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/* $OpenBSD: maxiradio.c,v 1.4 2002/01/07 18:32:19 mickey Exp $ */
-/* $RuOBSD: maxiradio.c,v 1.5 2001/10/18 16:51:36 pva Exp $ */
-
-/*
- * Copyright (c) 2001 Maxim Tsyplakov <tm@oganer.net>
- * Vladimir Popov <jumbo@narod.ru>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Guillemot Maxi Radio FM2000 PCI Radio Card Device Driver */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/radioio.h>
-
-#include <machine/bus.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcidevs.h>
-
-#include <dev/ic/tea5757.h>
-#include <dev/radio_if.h>
-
-int mr_match(struct device *, void *, void *);
-void mr_attach(struct device *, struct device *, void *);
-
-int mr_get_info(void *, struct radio_info *);
-int mr_set_info(void *, struct radio_info *);
-int mr_search(void *, int);
-
-/* config base I/O address ? */
-#define PCI_CBIO 0x6400
-
-#define MAXIRADIO_CAPS RADIO_CAPS_DETECT_SIGNAL | \
- RADIO_CAPS_SET_MONO | \
- RADIO_CAPS_HW_SEARCH | \
- RADIO_CAPS_HW_AFC | \
- RADIO_CAPS_LOCK_SENSITIVITY
-#if 0
- RADIO_CAPS_DETECT_STEREO |
-#endif /* 0 */
-
-#define MAXIRADIO_MUTE 0x00
-#define MAXIRADIO_UNMUTE 0x10
-
-#define MAXIRADIO_SIGNAL 0x08
-
-#define MR_WREN_ON (1 << 2)
-#define MR_WREN_OFF (0 << 2)
-
-#define MR_DATA_ON (1 << 1)
-#define MR_DATA_OFF (0 << 1)
-
-#define MR_CLCK_ON (1 << 0)
-#define MR_CLCK_OFF (0 << 0)
-
-#define MR_READ_CLOCK_LOW (MR_WREN_OFF | MR_DATA_ON | MR_CLCK_OFF)
-#define MR_READ_CLOCK_HIGH (MR_WREN_OFF | MR_DATA_ON | MR_CLCK_ON)
-
-/* define our interface to the high-level radio driver */
-
-struct radio_hw_if mr_hw_if = {
- NULL, /* open */
- NULL, /* close */
- mr_get_info,
- mr_set_info,
- mr_search
-};
-
-struct mr_softc {
- struct device sc_dev;
-
- int mute;
- u_int8_t vol;
- u_int32_t freq;
- u_int32_t stereo;
- u_int32_t lock;
-
- struct tea5757_t tea;
-};
-
-struct cfattach mr_ca = {
- sizeof(struct mr_softc), mr_match, mr_attach
-};
-
-struct cfdriver mr_cd = {
- NULL, "mr", DV_DULL
-};
-
-void mr_set_mute(struct mr_softc *);
-void mr_write_bit(bus_space_tag_t, bus_space_handle_t, bus_size_t, int);
-void mr_init(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
-void mr_rset(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
-int mr_state(bus_space_tag_t, bus_space_handle_t);
-u_int32_t mr_hardware_read(bus_space_tag_t, bus_space_handle_t,
- bus_size_t);
-
-int
-mr_match(struct device *parent, void *match, void *aux)
-{
- struct pci_attach_args *pa = aux;
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_GUILLEMOT &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_GUILLEMOT_MAXIRADIO)
- return (1);
- return (0);
-}
-
-void
-mr_attach(struct device *parent, struct device *self, void *aux)
-{
- struct mr_softc *sc = (struct mr_softc *) self;
- struct pci_attach_args *pa = aux;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
- pci_chipset_tag_t pc = pa->pa_pc;
- pcireg_t csr;
-
- if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
- &sc->tea.iot, &sc->tea.ioh, NULL, NULL, 0)) {
- printf(": can't map i/o space\n");
- return;
- }
-
- /* Enable the card */
- csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
- pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
- csr | PCI_COMMAND_MASTER_ENABLE);
-
- sc->freq = MIN_FM_FREQ;
- sc->vol = 0;
- sc->mute = 0;
- sc->stereo = TEA5757_STEREO;
- sc->lock = TEA5757_S030;
- sc->tea.offset = 0;
- sc->tea.flags = cf->cf_flags;
- sc->tea.init = mr_init;
- sc->tea.rset = mr_rset;
- sc->tea.write_bit = mr_write_bit;
- sc->tea.read = mr_hardware_read;
-
- printf(": Guillemot MaxiRadio FM2000 PCI\n");
-
- radio_attach_mi(&mr_hw_if, sc, &sc->sc_dev);
-}
-
-int
-mr_get_info(void *v, struct radio_info *ri)
-{
- struct mr_softc *sc = v;
-
- ri->mute = sc->mute;
- ri->volume = sc->vol ? 255 : 0;
- ri->stereo = sc->stereo == TEA5757_STEREO ? 1 : 0;
- ri->caps = MAXIRADIO_CAPS;
- ri->rfreq = 0;
- ri->lock = tea5757_decode_lock(sc->lock);
-
- ri->freq = sc->freq = tea5757_decode_freq(mr_hardware_read(sc->tea.iot,
- sc->tea.ioh, sc->tea.offset), sc->tea.flags & TEA5757_TEA5759);
-
- ri->info = mr_state(sc->tea.iot, sc->tea.ioh);
-
- return (0);
-}
-
-int
-mr_set_info(void *v, struct radio_info *ri)
-{
- struct mr_softc *sc = v;
-
- sc->mute = ri->mute ? 1 : 0;
- sc->vol = ri->volume ? 255 : 0;
- sc->stereo = ri->stereo ? TEA5757_STEREO: TEA5757_MONO;
- sc->lock = tea5757_encode_lock(ri->lock);
- ri->freq = sc->freq = tea5757_set_freq(&sc->tea,
- sc->lock, sc->stereo, ri->freq);
- mr_set_mute(sc);
-
- return (0);
-}
-
-int
-mr_search(void *v, int f)
-{
- struct mr_softc *sc = v;
-
- tea5757_search(&sc->tea, sc->lock, sc->stereo, f);
- mr_set_mute(sc);
-
- return (0);
-}
-
-void
-mr_set_mute(struct mr_softc *sc)
-{
- int mute;
-
- mute = (sc->mute || !sc->vol) ? MAXIRADIO_MUTE : MAXIRADIO_UNMUTE;
- bus_space_write_1(sc->tea.iot, sc->tea.ioh, 0, mute);
-}
-
-void
-mr_write_bit(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off,
- int bit)
-{
- u_int8_t data;
-
- data = bit ? MR_DATA_ON : MR_DATA_OFF;
- bus_space_write_1(iot, ioh, off, MR_WREN_ON | MR_CLCK_OFF | data);
- DELAY(5);
- bus_space_write_1(iot, ioh, off, MR_WREN_ON | MR_CLCK_ON | data);
- DELAY(5);
- bus_space_write_1(iot, ioh, off, MR_WREN_ON | MR_CLCK_OFF | data);
- DELAY(5);
-}
-
-void
-mr_init(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t d)
-{
- bus_space_write_1(iot, ioh, off, MR_WREN_ON | MR_DATA_ON | MR_CLCK_OFF);
-}
-
-void
-mr_rset(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t d)
-{
- bus_space_write_1(iot, ioh, off, MAXIRADIO_UNMUTE);
-}
-
-/* COMPLETELY UNTESTED */
-u_int32_t
-mr_hardware_read(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off)
-{
- u_int32_t reg = 0ul;
- int i;
-
- bus_space_write_1(iot, ioh, off, MR_READ_CLOCK_LOW);
- DELAY(5);
-
- i = 24;
- while (i--) {
- bus_space_write_1(iot, ioh, off, MR_READ_CLOCK_HIGH);
- DELAY(5);
- bus_space_write_1(iot, ioh, off, MR_READ_CLOCK_LOW);
- DELAY(5);
- reg |= bus_space_read_1(iot, ioh, off) & MR_DATA_ON ? 1 : 0;
- reg <<= 1;
- }
-
- reg >>= 1;
-
- return (reg & (TEA5757_DATA | TEA5757_FREQ));
-}
-
-int
-mr_state(bus_space_tag_t iot, bus_space_handle_t ioh)
-{
- /* XXX: where is a stereo bit ? */
- return bus_space_read_1(iot, ioh, 0) & MAXIRADIO_SIGNAL ?
- (0 << 1) : (1 << 1);
-}
diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs
index f2e0c9310af..0c843edb00c 100644
--- a/sys/dev/pci/pcidevs
+++ b/sys/dev/pci/pcidevs
@@ -1,4 +1,4 @@
- $OpenBSD: pcidevs,v 1.514 2002/06/02 10:07:54 deraadt Exp $
+ $OpenBSD: pcidevs,v 1.515 2002/06/03 16:13:21 mickey Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/*
@@ -566,7 +566,7 @@ vendor ADDTRON 0x4033 Addtron
vendor INDCOMPSRC 0x494f Industrial Computer Source
vendor NETVIN 0x4a14 NetVin
vendor BUSLOGIC2 0x4b10 Buslogic
-vendor GUILLEMOT 0x5046 Guillemot
+vendor GEMTEK 0x5046 Gemtek
vendor S3 0x5333 S3
vendor NETPOWER2 0x5700 NetPower
vendor C4T 0x6374 c't Magazin
@@ -1195,7 +1195,7 @@ product GLOBALSUN GL24110P 0x1101 GL24110P
product GLOBALSUN GL24110P02 0x1102 GL24110P02
/* Guillemot products */
-product GUILLEMOT MAXIRADIO 0x1001 MAXIRADIO
+product GEMTEK PR103 0x1001 PR103
/* Hewlett-Packard products */
product HP A4977A 0x1005 A4977A Visualize EG