Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103831
b: refs/heads/master
c: df9b5d4
h: refs/heads/master
i:
  103829: 7bc66b6
  103827: 088d4ee
  103823: df06940
v: v3
  • Loading branch information
Jean Delvare authored and Mauro Carvalho Chehab committed Jul 20, 2008
1 parent ddef984 commit 735b8a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 36 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: 6275163e3ddbf0f0b34981bf6dc50b803e5a1c67
refs/heads/master: df9b5d4cf636f992276b6b595620d9b2a63095db
49 changes: 14 additions & 35 deletions trunk/drivers/media/video/bt8xx/bttv-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
#include <linux/jiffies.h>
#include <asm/io.h>

static struct i2c_algo_bit_data bttv_i2c_algo_bit_template;
static struct i2c_adapter bttv_i2c_adap_sw_template;
static struct i2c_adapter bttv_i2c_adap_hw_template;
static struct i2c_client bttv_i2c_client_template;

static int attach_inform(struct i2c_client *client);

static int i2c_debug;
Expand Down Expand Up @@ -104,7 +99,7 @@ static int bttv_bit_getsda(void *data)
return state;
}

static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = {
static struct i2c_algo_bit_data __devinitdata bttv_i2c_algo_bit_template = {
.setsda = bttv_bit_setsda,
.setscl = bttv_bit_setscl,
.getsda = bttv_bit_getsda,
Expand All @@ -113,14 +108,6 @@ static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = {
.timeout = 200,
};

static struct i2c_adapter bttv_i2c_adap_sw_template = {
.owner = THIS_MODULE,
.class = I2C_CLASS_TV_ANALOG,
.name = "bttv",
.id = I2C_HW_B_BT848,
.client_register = attach_inform,
};

/* ----------------------------------------------------------------------- */
/* I2C functions - hardware i2c */

Expand Down Expand Up @@ -270,20 +257,11 @@ static int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int
return retval;
}

static struct i2c_algorithm bttv_algo = {
static const struct i2c_algorithm bttv_algo = {
.master_xfer = bttv_i2c_xfer,
.functionality = functionality,
};

static struct i2c_adapter bttv_i2c_adap_hw_template = {
.owner = THIS_MODULE,
.class = I2C_CLASS_TV_ANALOG,
.name = "bt878",
.id = I2C_HW_B_BT848 /* FIXME */,
.algo = &bttv_algo,
.client_register = attach_inform,
};

/* ----------------------------------------------------------------------- */
/* I2C functions - common stuff */

Expand Down Expand Up @@ -332,10 +310,6 @@ void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg)
i2c_clients_command(&btv->c.i2c_adap, cmd, arg);
}

static struct i2c_client bttv_i2c_client_template = {
.name = "bttv internal",
};


/* read I2C */
int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for)
Expand Down Expand Up @@ -417,29 +391,34 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
/* init + register i2c algo-bit adapter */
int __devinit init_bttv_i2c(struct bttv *btv)
{
memcpy(&btv->i2c_client, &bttv_i2c_client_template,
sizeof(bttv_i2c_client_template));
strlcpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE);

if (i2c_hw)
btv->use_i2c_hw = 1;
if (btv->use_i2c_hw) {
/* bt878 */
memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_hw_template,
sizeof(bttv_i2c_adap_hw_template));
strlcpy(btv->c.i2c_adap.name, "bt878",
sizeof(btv->c.i2c_adap.name));
btv->c.i2c_adap.id = I2C_HW_B_BT848; /* FIXME */
btv->c.i2c_adap.algo = &bttv_algo;
} else {
/* bt848 */
/* Prevents usage of invalid delay values */
if (i2c_udelay<5)
i2c_udelay=5;
bttv_i2c_algo_bit_template.udelay=i2c_udelay;

memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_sw_template,
sizeof(bttv_i2c_adap_sw_template));
strlcpy(btv->c.i2c_adap.name, "bttv",
sizeof(btv->c.i2c_adap.name));
btv->c.i2c_adap.id = I2C_HW_B_BT848;
memcpy(&btv->i2c_algo, &bttv_i2c_algo_bit_template,
sizeof(bttv_i2c_algo_bit_template));
btv->i2c_algo.udelay = i2c_udelay;
btv->i2c_algo.data = btv;
btv->c.i2c_adap.algo_data = &btv->i2c_algo;
}
btv->c.i2c_adap.owner = THIS_MODULE;
btv->c.i2c_adap.class = I2C_CLASS_TV_ANALOG;
btv->c.i2c_adap.client_register = attach_inform;

btv->c.i2c_adap.dev.parent = &btv->c.pci->dev;
snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name),
Expand Down

0 comments on commit 735b8a6

Please sign in to comment.