summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttpci/budget-av.c
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2003-07-21 15:24:06 +0000
committerJohannes Stezenbach <devnull@localhost>2003-07-21 15:24:06 +0000
commit563f50f11a3ffbf4dfb41b19b6f0508c0ea533dd (patch)
tree7cdb3b3035a201fed099b93264c46c7c3c760f6f /linux/drivers/media/dvb/ttpci/budget-av.c
parentbece0ee41ada89cb339afdecf7501eec5883d189 (diff)
downloadmediapointer-dvb-s2-563f50f11a3ffbf4dfb41b19b6f0508c0ea533dd.tar.gz
mediapointer-dvb-s2-563f50f11a3ffbf4dfb41b19b6f0508c0ea533dd.tar.bz2
Patch by Michael Glaum, code by Metzler Bros.:
correctly read MAC from eeprom on TT and KNC1 cards
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/budget-av.c')
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-av.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c
index 82816933c..8730c0d4e 100644
--- a/linux/drivers/media/dvb/ttpci/budget-av.c
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c
@@ -64,6 +64,19 @@ static u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg)
return mm2[0];
}
+static int i2c_readregs(struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 *buf, u8 len)
+{
+ u8 mm1[] = { reg };
+ struct i2c_msg msgs[2] = {
+ { addr: id/2, flags: 0, buf: mm1, len: 1 },
+ { addr: id/2, flags: I2C_M_RD, buf: buf, len: len }
+ };
+
+ if (i2c->xfer(i2c, msgs, 2) != 2)
+ return -EIO;
+ return 0;
+}
+
static int i2c_writereg (struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 val)
{
@@ -177,6 +190,7 @@ static int budget_av_attach (struct saa7146_dev* dev,
{
struct budget_av *budget_av;
struct budget_info *bi = info->ext_priv;
+ u8 *mac;
int err;
DEB_EE(("dev: %p\n",dev));
@@ -243,6 +257,16 @@ static int budget_av_attach (struct saa7146_dev* dev,
/* fixme: find some sane values here... */
saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
+ mac = budget_av->budget.dvb_adapter->proposed_mac;
+ if (i2c_readregs(budget_av->budget.i2c_bus, 0xa0, 0x30, mac, 6)) {
+ printk("KNC1-%d: Could not read MAC from KNC1 card\n",
+ budget_av->budget.dvb_adapter->num);
+ memset(mac, 0, 6);
+ }
+ else
+ printk("KNC1-%d: MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ budget_av->budget.dvb_adapter->num,
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return 0;
}