add LG TDVS-H06xF support

This commit is contained in:
jmcneill 2011-07-15 03:31:37 +00:00
parent f26b5f8df4
commit 389f86dedb
3 changed files with 37 additions and 17 deletions

View File

@ -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 @@ struct tvpll *
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_open(device_t parent, i2c_tag_t t, i2c_addr_t a, struct tvpll_data *p)
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 @@ tvpll_algo(struct tvpll *tvpll, uint8_t *b,
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 @@ tvpll_tune_dtv(struct tvpll *tvpll,
{
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;
/* gate ctrl? */
iic_acquire_bus(tvpll->tag, I2C_F_POLL);
/* gate ctrl? */
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);

View File

@ -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 @@ struct tvpll_data tvpll_tuv1236d_pll = {
__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
};

View File

@ -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 @@ struct tvpll_data {
uint32_t stepsize;
uint8_t config;
uint8_t cb;
uint8_t aux;
} *entries;
};