Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8166
b: refs/heads/master
c: 793cf9e
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab authored and Linus Torvalds committed Sep 9, 2005
1 parent 47d2fc6 commit 156f811
Show file tree
Hide file tree
Showing 28 changed files with 204 additions and 155 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1938038dd7e4188a8663e49242fa77dd2adb7ed
refs/heads/master: 793cf9e6a54c698e109a599c8b8e303658fcaae6
1 change: 1 addition & 0 deletions trunk/Documentation/video4linux/CARDLIST.tuner
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ tuner=62 - Philips TEA5767HN FM Radio
tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner
tuner=64 - LG TDVS-H062F/TUA6034
tuner=65 - Ymec TVF66T5-B/DFF
tuner=66 - LG NTSC (TALN mini series)
68 changes: 67 additions & 1 deletion trunk/drivers/media/common/ir-common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $
*
* some common structs and functions to handle infrared remotes via
* input layer ...
Expand Down Expand Up @@ -335,6 +334,72 @@ int ir_dump_samples(u32 *samples, int count)
return 0;
}

/* decode raw samples, pulse distance coding used by NEC remotes */
int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
{
int i,last,bit,len;
u32 curBit;
u32 value;

/* find start burst */
for (i = len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
len++;
} else {
if (len >= 29)
break;
len = 0;
}
}

/* start burst to short */
if (len < 29)
return 0xffffffff;

/* find start silence */
for (len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
break;
} else {
len++;
}
}

/* silence to short */
if (len < 7)
return 0xffffffff;

/* go decoding */
len = 0;
last = 1;
value = 0; curBit = 1;
for (; i < count * 32; i++) {
bit = getbit(samples,i);
if (last) {
if(bit) {
continue;
} else {
len = 1;
}
} else {
if (bit) {
if (len > (low + high) /2)
value |= curBit;
curBit <<= 1;
if (curBit == 1)
break;
} else {
len++;
}
}
last = bit;
}

return value;
}

/* decode raw samples, biphase coding, used by rc5 for example */
int ir_decode_biphase(u32 *samples, int count, int low, int high)
{
Expand Down Expand Up @@ -383,6 +448,7 @@ EXPORT_SYMBOL_GPL(ir_input_keydown);
EXPORT_SYMBOL_GPL(ir_extract_bits);
EXPORT_SYMBOL_GPL(ir_dump_samples);
EXPORT_SYMBOL_GPL(ir_decode_biphase);
EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);

/*
* Local variables:
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/btcx-risc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
$Id: btcx-risc.c,v 1.6 2005/02/21 13:57:59 kraxel Exp $
btcx-risc.c
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/btcx-risc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: btcx-risc.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $
*/
struct btcx_riscmem {
unsigned int size;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/ir-kbd-gpio.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $
*
* Copyright (c) 2003 Gerd Knorr
* Copyright (c) 2003 Pavel Machek
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/ir-kbd-i2c.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $
*
* keyboard input driver for i2c IR remote controls
*
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/msp3400.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $
*/

#ifndef MSP3400_H
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/mt20xx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $
*
* i2c tv tuner chip device driver
* controls microtune tuners, mt2032 + mt2050 at the moment.
Expand Down Expand Up @@ -494,6 +493,7 @@ int microtune_init(struct i2c_client *c)
memset(buf,0,sizeof(buf));
t->tv_freq = NULL;
t->radio_freq = NULL;
t->standby = NULL;
name = "unknown";

i2c_master_send(c,buf,1);
Expand Down
19 changes: 18 additions & 1 deletion trunk/drivers/media/video/tda8290.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $
*
* i2c tv tuner chip device driver
* controls the philips tda8290+75 tuner chip combo.
Expand All @@ -9,6 +8,9 @@
#include <linux/delay.h>
#include <media/tuner.h>

#define I2C_ADDR_TDA8290 0x4b
#define I2C_ADDR_TDA8275 0x61

/* ---------------------------------------------------------------------- */

struct freq_entry {
Expand Down Expand Up @@ -75,10 +77,12 @@ static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00,
static unsigned char i2c_set_VS[2] = { 0x30, 0x6F };
static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B };
static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 };
static unsigned char i2c_tda8290_standby[2] = { 0x00, 0x02 };
static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 };
static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 };
static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 };
static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF };
static unsigned char i2c_cb1_D0[2] = { 0x30, 0xD0 };
static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 };
static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 };
static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 };
Expand Down Expand Up @@ -117,6 +121,13 @@ static struct i2c_msg i2c_msg_epilog[] = {
{ I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on },
};

static struct i2c_msg i2c_msg_standby[] = {
{ I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge },
{ I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 },
{ I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge },
{ I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby },
};

static int tda8290_tune(struct i2c_client *c)
{
struct tuner *t = i2c_get_clientdata(c);
Expand Down Expand Up @@ -205,6 +216,11 @@ static int has_signal(struct i2c_client *c)
return (afc & 0x80)? 65535:0;
}

static void standby(struct i2c_client *c)
{
i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby));
}

int tda8290_init(struct i2c_client *c)
{
struct tuner *t = i2c_get_clientdata(c);
Expand All @@ -214,6 +230,7 @@ int tda8290_init(struct i2c_client *c)
t->tv_freq = set_tv_freq;
t->radio_freq = set_radio_freq;
t->has_signal = has_signal;
t->standby = standby;

i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge));
i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init));
Expand Down
39 changes: 25 additions & 14 deletions trunk/drivers/media/video/tda9887.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MODULE_LICENSE("GPL");
struct tda9887 {
struct i2c_client client;
v4l2_std_id std;
unsigned int radio;
enum tuner_mode mode;
unsigned int config;
unsigned int pinnacle_id;
unsigned int using_v4l2;
Expand Down Expand Up @@ -196,7 +196,7 @@ static struct tvnorm tvnorms[] = {
.b = ( cNegativeFmTV |
cQSS ),
.c = ( cDeemphasisON |
cDeemphasis50 ),
cDeemphasis75 ),
.e = ( cGating_36 |
cAudioIF_4_5 |
cVideoIF_45_75 ),
Expand Down Expand Up @@ -364,7 +364,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
struct tvnorm *norm = NULL;
int i;

if (t->radio) {
if (t->mode == T_RADIO) {
if (t->radio_mode == V4L2_TUNER_MODE_MONO)
norm = &radio_mono;
else
Expand All @@ -378,7 +378,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
}
}
if (NULL == norm) {
dprintk(PREFIX "Oops: no tvnorm entry found\n");
dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n");
return -1;
}

Expand Down Expand Up @@ -569,6 +569,10 @@ static int tda9887_configure(struct tda9887 *t)
tda9887_set_config(t,buf);
tda9887_set_insmod(t,buf);

if (t->mode == T_STANDBY) {
buf[1] |= cForcedMuteAudioON;
}


dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
buf[1],buf[2],buf[3]);
Expand Down Expand Up @@ -653,10 +657,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)

/* --- configuration --- */
case AUDC_SET_RADIO:
t->radio = 1;
{
t->mode = T_RADIO;
tda9887_configure(t);
break;

}
case TUNER_SET_STANDBY:
{
t->mode = T_STANDBY;
tda9887_configure(t);
break;
}
case AUDC_CONFIG_PINNACLE:
{
int *i = arg;
Expand Down Expand Up @@ -689,7 +700,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
struct video_channel *vc = arg;

CHECK_V4L2;
t->radio = 0;
t->mode = T_ANALOG_TV;
if (vc->norm < ARRAY_SIZE(map))
t->std = map[vc->norm];
tda9887_fixup_std(t);
Expand All @@ -701,7 +712,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
v4l2_std_id *id = arg;

SWITCH_V4L2;
t->radio = 0;
t->mode = T_ANALOG_TV;
t->std = *id;
tda9887_fixup_std(t);
tda9887_configure(t);
Expand All @@ -713,14 +724,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)

SWITCH_V4L2;
if (V4L2_TUNER_ANALOG_TV == f->type) {
if (t->radio == 0)
if (t->mode == T_ANALOG_TV)
return 0;
t->radio = 0;
t->mode = T_ANALOG_TV;
}
if (V4L2_TUNER_RADIO == f->type) {
if (t->radio == 1)
if (t->mode == T_RADIO)
return 0;
t->radio = 1;
t->mode = T_RADIO;
}
tda9887_configure(t);
break;
Expand All @@ -735,7 +746,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
};
struct v4l2_tuner* tuner = arg;

if (t->radio) {
if (t->mode == T_RADIO) {
__u8 reg = 0;
tuner->afc=0;
if (1 == i2c_master_recv(&t->client,&reg,1))
Expand All @@ -747,7 +758,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct v4l2_tuner* tuner = arg;

if (t->radio) {
if (t->mode == T_RADIO) {
t->radio_mode = tuner->audmode;
tda9887_configure (t);
}
Expand Down
Loading

0 comments on commit 156f811

Please sign in to comment.