Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Add TEA5767 FM radio driver. From Karuna Grewal.
details: https://anonhg.NetBSD.org/src/rev/bae7e3b78db3
branches: trunk
changeset: 991712:bae7e3b78db3
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Fri Jul 27 12:02:25 2018 +0000
description:
Add TEA5767 FM radio driver. From Karuna Grewal.
diffstat:
distrib/sets/lists/man/mi | 5 +-
doc/CHANGES | 5 +-
share/man/man4/Makefile | 6 +-
share/man/man4/tea5767radio.4 | 77 +++++++++
sys/dev/DEVNAMES | 3 +-
sys/dev/i2c/files.i2c | 8 +-
sys/dev/i2c/tea5767.c | 349 ++++++++++++++++++++++++++++++++++++++++++
sys/dev/i2c/tea5767reg.h | 79 +++++++++
8 files changed, 525 insertions(+), 7 deletions(-)
diffs (truncated from 622 to 300 lines):
diff -r 407e1cfe39c4 -r bae7e3b78db3 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Fri Jul 27 10:04:22 2018 +0000
+++ b/distrib/sets/lists/man/mi Fri Jul 27 12:02:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1601 2018/07/24 15:29:05 christos Exp $
+# $NetBSD: mi,v 1.1602 2018/07/27 12:02:26 rkujawa Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1803,6 +1803,7 @@
./usr/share/man/cat4/tcu.0 man-sys-catman .cat
./usr/share/man/cat4/tdfxdrm.0 man-sys-catman .cat
./usr/share/man/cat4/tdvfb.0 man-sys-catman .cat
+./usr/share/man/cat4/tea5767radio.0 man-sys-catman .cat
./usr/share/man/cat4/termios.0 man-sys-catman .cat
./usr/share/man/cat4/tfb.0 man-sys-catman .cat
./usr/share/man/cat4/thinkpad.0 man-sys-catman .cat
@@ -4875,6 +4876,7 @@
./usr/share/man/html4/tcu.html man-sys-htmlman html
./usr/share/man/html4/tdfxdrm.html man-sys-htmlman html
./usr/share/man/html4/tdvfb.html man-sys-htmlman html
+./usr/share/man/html4/tea5767radio.html man-sys-htmlman html
./usr/share/man/html4/termios.html man-sys-htmlman html
./usr/share/man/html4/tfb.html man-sys-htmlman html
./usr/share/man/html4/thinkpad.html man-sys-htmlman html
@@ -7867,6 +7869,7 @@
./usr/share/man/man4/tcu.4 man-sys-man .man
./usr/share/man/man4/tdfxdrm.4 man-sys-man .man
./usr/share/man/man4/tdvfb.4 man-sys-man .man
+./usr/share/man/man4/tea5767radio.4 man-sys-man .man
./usr/share/man/man4/termios.4 man-sys-man .man
./usr/share/man/man4/tfb.4 man-sys-man .man
./usr/share/man/man4/thinkpad.4 man-sys-man .man
diff -r 407e1cfe39c4 -r bae7e3b78db3 doc/CHANGES
--- a/doc/CHANGES Fri Jul 27 10:04:22 2018 +0000
+++ b/doc/CHANGES Fri Jul 27 12:02:25 2018 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2414 $>
+# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2415 $>
#
#
# [Note: This file does not mention every change made to the NetBSD source tree.
@@ -181,3 +181,6 @@
arm: Add support for ARMv7 performance event monitoring with tprof(4).
[jmcneill 20180715]
dhcpcd: Import 7.0.7. [roy 20180724]
+ tea5767radio(4): Add Philips/NXP TEA5767 I2C-controlled stereo FM radio
+ driver. [rkujawa 20180727]
+
diff -r 407e1cfe39c4 -r bae7e3b78db3 share/man/man4/Makefile
--- a/share/man/man4/Makefile Fri Jul 27 10:04:22 2018 +0000
+++ b/share/man/man4/Makefile Fri Jul 27 12:02:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.658 2018/07/15 05:16:40 maxv Exp $
+# $NetBSD: Makefile,v 1.659 2018/07/27 12:02:26 rkujawa Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -61,8 +61,8 @@
sm.4 smsh.4 sn.4 sony.4 spc.4 speaker.4 spif.4 sqphy.4 ss.4 \
st.4 ste.4 stge.4 sti.4 stpcide.4 sv.4 strip.4 \
svwsata.4 swsensor.4 swwdog.4 sysmon.4 \
- tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 termios.4 tfb.4 thinkpad.4 \
- ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tr.4 tra.4 \
+ tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 tea5767radio.4 termios.4 tfb.4
+ thinkpad.4 ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tr.4 tra.4 \
trm.4 tsllux.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 unix.4 userconf.4 \
vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 vioif.4 viomb.4 \
diff -r 407e1cfe39c4 -r bae7e3b78db3 share/man/man4/tea5767radio.4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/tea5767radio.4 Fri Jul 27 12:02:25 2018 +0000
@@ -0,0 +1,77 @@
+.\" $NetBSD: tea5767radio.4,v 1.1 2018/07/27 12:02:26 rkujawa Exp $
+.\"
+.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Karuna Grewal.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``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 FOUNDATION OR CONTRIBUTORS
+.\" 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.
+.\"
+.Dd July 6, 2018
+.Dt TEA5767RADIO
+.Os
+.Sh NAME
+.Nm tea5767
+.Nd Philips/NXP TEA5767 FM Chip
+.Sh SYNOPSIS
+.Cd "tea5767radio* at iic? addr 0x60 flags 0x00"
+.Cd "radio* at tea5767radio?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Philips/NXP TEA5767 FM stereo radio.
+.Pp
+The
+.Nm
+can tune in the range 87.5 \- 108.0 MHz, perform hardware signal search
+and supports mono/stereo toggling.
+.Pp
+The flags control the FM Band, XTAL and PLL values as follows:
+.Bl -tag -width Ds
+.It 0x01
+sets the FM Band to Japan.
+.It 0x02
+sets the PLL bit.
+.It 0x04
+sets the XTAL bit.
+.It 0x08
+force enables hardware search support.
+.Sh SEE ALSO
+.Xr iic 4 ,
+.Xr radio 4 ,
+.Xr radio 9 ,
+.Rs
+.%A TEA5767
+.%T Low-power FM stereo radio
+.%N Rev. 05
+.%D 26 January 2007
+.Re
+.Sh CAVEATS
+Many popular TEA5767 evaluation boards feature low quality 32.768kHz crystals.
+The inaccuracy of these crystals may often lead to malfunction of the hardware
+search funciton.
+Therefore, the
+.Nm
+driver tries to detect the crystal quality during attachment. If the crystal
+of insufficient accuracy was detected, hardware search function is disabled.
+It can be forcefully re-enabled by setting the 0x08 flag.
diff -r 407e1cfe39c4 -r bae7e3b78db3 sys/dev/DEVNAMES
--- a/sys/dev/DEVNAMES Fri Jul 27 10:04:22 2018 +0000
+++ b/sys/dev/DEVNAMES Fri Jul 27 12:02:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: DEVNAMES,v 1.311 2018/06/05 08:03:29 hkenken Exp $
+# $NetBSD: DEVNAMES,v 1.312 2018/07/27 12:02:26 rkujawa Exp $
#
# This file contains all used device names and defined attributes in
# alphabetical order. New devices added to the system somewhere should first
@@ -1325,6 +1325,7 @@
tdvfb MI
te vax
tea5757 MI
+tea5767radio MI
tfb MI
tga MI
ti MI
diff -r 407e1cfe39c4 -r bae7e3b78db3 sys/dev/i2c/files.i2c
--- a/sys/dev/i2c/files.i2c Fri Jul 27 10:04:22 2018 +0000
+++ b/sys/dev/i2c/files.i2c Fri Jul 27 12:02:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.i2c,v 1.93 2018/06/26 06:34:55 thorpej Exp $
+# $NetBSD: files.i2c,v 1.94 2018/07/27 12:02:26 rkujawa Exp $
obsolete defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
@@ -339,3 +339,9 @@
device tsllux: sysmon_envsys
attach tsllux at iic
file dev/i2c/tsl256x.c tsllux
+
+# Philips/NXP TEA5767
+device tea5767radio : radiodev
+attach tea5767radio at iic
+file dev/i2c/tea5767.c tea5767radio
+
diff -r 407e1cfe39c4 -r bae7e3b78db3 sys/dev/i2c/tea5767.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/i2c/tea5767.c Fri Jul 27 12:02:25 2018 +0000
@@ -0,0 +1,349 @@
+/* $NetBSD: tea5767.c,v 1.1 2018/07/27 12:02:26 rkujawa Exp $ */
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Karuna Grewal.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: tea5767.c,v 1.1 2018/07/27 12:02:26 rkujawa Exp $");
+
+#include <sys/proc.h>
+#include <sys/kernel.h>
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/systm.h>
+
+#include <dev/i2c/i2cvar.h>
+
+#include <sys/ioctl.h>
+#include <sys/radioio.h>
+#include <dev/radio_if.h>
+
+#include "tea5767reg.h"
+
+struct tea5767_tune {
+ int mute;
+ uint32_t freq;
+ int stereo;
+ bool is_pll_set;
+ bool is_xtal_set;
+ bool is_force_srch;
+ int fm_band; /* Set = JAPAN. */
+ int lock;
+ int adc_stop_level;
+};
+
+struct tea5767_softc {
+ device_t sc_dev;
+ /* Tunable properties. */
+ struct tea5767_tune tune;
+ /* I2C bus controller. */
+ i2c_tag_t sc_i2c_tag;
+ /* Device addr on I2C. */
+ i2c_addr_t sc_addr;
+ /* Device capabilities. */
+ uint32_t caps;
+};
+
+static int tea5767_get_info(void *, struct radio_info *);
+static int tea5767_set_info(void *, struct radio_info *);
+static int tea5767_search(void *, int);
+
+static int tea5767_match(device_t, cfdata_t, void *);
+static void tea5767_attach(device_t, device_t, void *);
+
+static const struct radio_hw_if tea5767_hw_if = {
+ NULL,
+ NULL,
+ tea5767_get_info,
+ tea5767_set_info,
+ tea5767_search
+};
+
+static const uint32_t tea5767_common_caps =
+ RADIO_CAPS_DETECT_STEREO |
+ RADIO_CAPS_SET_MONO |
+ RADIO_CAPS_HW_SEARCH |
+ RADIO_CAPS_LOCK_SENSITIVITY;
+
+CFATTACH_DECL_NEW(tea5767radio, sizeof(struct tea5767_softc), tea5767_match,
+ tea5767_attach, NULL, NULL);
+
+static int
+tea5767_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct i2c_attach_args *ia = aux;
+
+ if (ia->ia_addr == TEA5767_ADDR)
+ return I2C_MATCH_ADDRESS_ONLY;
+
+ return 0;
+}
+
+static void
+tea5767_attach(device_t parent, device_t self, void *aux)
+{
Home |
Main Index |
Thread Index |
Old Index