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 LG TDVS-H06xF support
details: https://anonhg.NetBSD.org/src/rev/0e71722e5d85
branches: trunk
changeset: 767307:0e71722e5d85
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Jul 15 03:31:37 2011 +0000
description:
add LG TDVS-H06xF support
diffstat:
sys/dev/i2c/tvpll.c | 30 +++++++++++++++++++++++-------
sys/dev/i2c/tvpll_tuners.c | 19 ++++++++++---------
sys/dev/i2c/tvpllvar.h | 5 ++++-
3 files changed, 37 insertions(+), 17 deletions(-)
diffs (159 lines):
diff -r 699ad5f0cc77 -r 0e71722e5d85 sys/dev/i2c/tvpll.c
--- a/sys/dev/i2c/tvpll.c Fri Jul 15 03:30:08 2011 +0000
+++ b/sys/dev/i2c/tvpll.c Fri Jul 15 03:31:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tvpll.c,v 1.2 2011/07/14 23:45:43 jmcneill Exp $ */
+/* $NetBSD: tvpll.c,v 1.3 2011/07/15 03:31:37 jmcneill Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tvpll.c,v 1.2 2011/07/14 23:45:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tvpll.c,v 1.3 2011/07/15 03:31:37 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,8 +55,9 @@
tvpll_open(device_t parent, i2c_tag_t t, i2c_addr_t a, struct tvpll_data *p)
{
struct tvpll *tvpll;
+ int rv;
- tvpll = kmem_alloc(sizeof(struct tvpll), KM_NOSLEEP);
+ tvpll = kmem_alloc(sizeof(struct tvpll), KM_SLEEP);
if (tvpll == NULL)
return NULL;
@@ -65,6 +66,16 @@
tvpll->pll = p;
+ if (tvpll->pll->initdata) {
+ iic_acquire_bus(tvpll->tag, I2C_F_POLL);
+ rv = iic_exec(tvpll->tag, I2C_OP_WRITE_WITH_STOP, tvpll->addr,
+ &tvpll->pll->initdata[1], tvpll->pll->initdata[0],
+ NULL, 0, I2C_F_POLL);
+ iic_release_bus(tvpll->tag, I2C_F_POLL);
+ }
+
+ device_printf(parent, "tvpll: %s\n", tvpll->pll->name);
+
return tvpll;
}
@@ -104,10 +115,11 @@
b[1] = (d >> 0) & 0xff;
b[2] = pll->entries[i].config;
b[3] = pll->entries[i].cb;
+ b[4] = pll->entries[i].aux;
*fr = (d * pll->entries[i].stepsize) - pll->iffreq;
- log(LOG_DEBUG, "pllw %d %02x %02x %02x %02x\n", *fr, b[0], b[1], b[2], b[3]);
+ log(LOG_DEBUG, "pllw %d %02x %02x %02x %02x %02x\n", *fr, b[0], b[1], b[2], b[3], b[4]);
return 0;
}
@@ -117,16 +129,20 @@
{
int rv;
uint32_t fr;
- uint8_t b[4];
+ uint8_t b[5], ab[2];
fr = 0;
if((rv = tvpll_algo(tvpll, b, params, &fr)) != 0)
return rv;
+ iic_acquire_bus(tvpll->tag, I2C_F_POLL);
/* gate ctrl? */
-
- iic_acquire_bus(tvpll->tag, I2C_F_POLL);
+ if (b[4] != TVPLL_IGNORE_AUX) {
+ ab[0] = b[2] | 0x18;
+ ab[1] = b[4];
+ rv = iic_exec(tvpll->tag, I2C_OP_WRITE_WITH_STOP, tvpll->addr, ab, 2, NULL, 0, I2C_F_POLL);
+ }
rv = iic_exec(tvpll->tag, I2C_OP_WRITE_WITH_STOP, tvpll->addr, b, 4, NULL, 0, I2C_F_POLL);
iic_release_bus(tvpll->tag, I2C_F_POLL);
diff -r 699ad5f0cc77 -r 0e71722e5d85 sys/dev/i2c/tvpll_tuners.c
--- a/sys/dev/i2c/tvpll_tuners.c Fri Jul 15 03:30:08 2011 +0000
+++ b/sys/dev/i2c/tvpll_tuners.c Fri Jul 15 03:31:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tvpll_tuners.c,v 1.2 2011/07/14 23:45:26 jmcneill Exp $ */
+/* $NetBSD: tvpll_tuners.c,v 1.3 2011/07/15 03:31:37 jmcneill Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,16 +27,16 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tvpll_tuners.c,v 1.2 2011/07/14 23:45:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tvpll_tuners.c,v 1.3 2011/07/15 03:31:37 jmcneill Exp $");
#include <sys/param.h>
#include <dev/i2c/tvpllvar.h>
#include <dev/i2c/tvpll_tuners.h>
static struct tvpll_entry tuv1236d_pll_entries[] = {
- { 157250000, 62500, 0xc6, 0x41 },
- { 454000000, 62500, 0xc6, 0x42 },
- { 999999999, 62500, 0xc6, 0x44 },
+ { 157250000, 62500, 0xc6, 0x41, TVPLL_IGNORE_AUX },
+ { 454000000, 62500, 0xc6, 0x42, TVPLL_IGNORE_AUX },
+ { 999999999, 62500, 0xc6, 0x44, TVPLL_IGNORE_AUX },
};
struct tvpll_data tvpll_tuv1236d_pll = {
"Philips TUV1236D",
@@ -45,14 +45,15 @@
__arraycount(tuv1236d_pll_entries), tuv1236d_pll_entries
};
+static uint8_t tdvs_h06xf_initdata[] = { 2, 0xdf, 0x50 };
static struct tvpll_entry tdvs_h06xf_pll_entries[] = {
- { 165000000, 62500, 0xce, 0x01 },
- { 450000000, 62500, 0xce, 0x02 },
- { 999999999, 62500, 0xce, 0x04 },
+ { 165000000, 62500, 0xce, 0x01, 0x50 },
+ { 450000000, 62500, 0xce, 0x02, 0x50 },
+ { 999999999, 62500, 0xce, 0x04, 0x50 },
};
struct tvpll_data tvpll_tdvs_h06xf_pll = {
"LG TDVS-H06xF",
54000000, 863000000, 44000000,
- NULL, NULL,
+ tdvs_h06xf_initdata, NULL,
__arraycount(tdvs_h06xf_pll_entries), tdvs_h06xf_pll_entries
};
diff -r 699ad5f0cc77 -r 0e71722e5d85 sys/dev/i2c/tvpllvar.h
--- a/sys/dev/i2c/tvpllvar.h Fri Jul 15 03:30:08 2011 +0000
+++ b/sys/dev/i2c/tvpllvar.h Fri Jul 15 03:31:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tvpllvar.h,v 1.1 2011/07/11 00:01:52 jakllsch Exp $ */
+/* $NetBSD: tvpllvar.h,v 1.2 2011/07/15 03:31:37 jmcneill Exp $ */
/*
* Copyright (c) 2008 Jonathan A. Kollasch
@@ -34,6 +34,8 @@
#include <dev/i2c/i2cvar.h>
#include <dev/dtv/dtvio.h>
+#define TVPLL_IGNORE_AUX 0xff
+
struct tvpll_data {
const char * name;
uint32_t min;
@@ -47,6 +49,7 @@
uint32_t stepsize;
uint8_t config;
uint8_t cb;
+ uint8_t aux;
} *entries;
};
Home |
Main Index |
Thread Index |
Old Index