summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/ttpci-eeprom.c
diff options
context:
space:
mode:
authorIgor M. Liplianin <liplianin@me.by>2011-09-23 23:33:50 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-24 05:07:42 +0200
commit4e2c53fde651be6225d9f940c02b2eabc2f9591c (patch)
tree7427afe586aed591065cae6c6737be6f8df932b3 /drivers/media/dvb/ttpci/ttpci-eeprom.c
parent[media] media, rc: Use static inline functions to kill warnings (diff)
downloadlinux-4e2c53fde651be6225d9f940c02b2eabc2f9591c.tar.xz
linux-4e2c53fde651be6225d9f940c02b2eabc2f9591c.zip
[media] dvb: Add support for pctv452e
Signed-off-by: Igor M. Liplianin <liplianin@me.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/ttpci/ttpci-eeprom.c')
-rw-r--r--drivers/media/dvb/ttpci/ttpci-eeprom.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.c b/drivers/media/dvb/ttpci/ttpci-eeprom.c
index 7dd54b3026a2..32d43156c548 100644
--- a/drivers/media/dvb/ttpci/ttpci-eeprom.c
+++ b/drivers/media/dvb/ttpci/ttpci-eeprom.c
@@ -85,6 +85,35 @@ static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC)
return 0;
}
+int ttpci_eeprom_decode_mac(u8 *decodedMAC, u8 *encodedMAC)
+{
+ u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c,
+ 0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6,
+ 0x1d, 0x36, 0x64, 0x78};
+ u8 data[20];
+ int i;
+
+ memcpy(data, encodedMAC, 20);
+
+ for (i = 0; i < 20; i++)
+ data[i] ^= xor[i];
+ for (i = 0; i < 10; i++)
+ data[i] = ((data[2 * i + 1] << 8) | data[2 * i])
+ >> ((data[2 * i + 1] >> 6) & 3);
+
+ if (check_mac_tt(data))
+ return -ENODEV;
+
+ decodedMAC[0] = data[2];
+ decodedMAC[1] = data[1];
+ decodedMAC[2] = data[0];
+ decodedMAC[3] = data[6];
+ decodedMAC[4] = data[5];
+ decodedMAC[5] = data[4];
+ return 0;
+}
+EXPORT_SYMBOL(ttpci_eeprom_decode_mac);
+
static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC)
{
int ret;