18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for the NXP SAA7164 PCIe bridge 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/init.h> 98c2ecf20Sopenharmony_ci#include <linux/module.h> 108c2ecf20Sopenharmony_ci#include <linux/pci.h> 118c2ecf20Sopenharmony_ci#include <linux/delay.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include "saa7164.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* The Bridge API needs to understand register widths (in bytes) for the 168c2ecf20Sopenharmony_ci * attached I2C devices, so we can simplify the virtual i2c mechansms 178c2ecf20Sopenharmony_ci * and keep the -i2c.c implementation clean. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci#define REGLEN_0bit 0 208c2ecf20Sopenharmony_ci#define REGLEN_8bit 1 218c2ecf20Sopenharmony_ci#define REGLEN_16bit 2 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistruct saa7164_board saa7164_boards[] = { 248c2ecf20Sopenharmony_ci [SAA7164_BOARD_UNKNOWN] = { 258c2ecf20Sopenharmony_ci /* Bridge will not load any firmware, without knowing 268c2ecf20Sopenharmony_ci * the rev this would be fatal. */ 278c2ecf20Sopenharmony_ci .name = "Unknown", 288c2ecf20Sopenharmony_ci }, 298c2ecf20Sopenharmony_ci [SAA7164_BOARD_UNKNOWN_REV2] = { 308c2ecf20Sopenharmony_ci /* Bridge will load the v2 f/w and dump descriptors */ 318c2ecf20Sopenharmony_ci /* Required during new board bringup */ 328c2ecf20Sopenharmony_ci .name = "Generic Rev2", 338c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV2, 348c2ecf20Sopenharmony_ci }, 358c2ecf20Sopenharmony_ci [SAA7164_BOARD_UNKNOWN_REV3] = { 368c2ecf20Sopenharmony_ci /* Bridge will load the v2 f/w and dump descriptors */ 378c2ecf20Sopenharmony_ci /* Required during new board bringup */ 388c2ecf20Sopenharmony_ci .name = "Generic Rev3", 398c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 408c2ecf20Sopenharmony_ci }, 418c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2200] = { 428c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2200", 438c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 448c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 458c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 468c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 478c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 488c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 498c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 508c2ecf20Sopenharmony_ci .unit = {{ 518c2ecf20Sopenharmony_ci .id = 0x1d, 528c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 538c2ecf20Sopenharmony_ci .name = "4K EEPROM", 548c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 558c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 568c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 578c2ecf20Sopenharmony_ci }, { 588c2ecf20Sopenharmony_ci .id = 0x04, 598c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 608c2ecf20Sopenharmony_ci .name = "TDA18271-1", 618c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 628c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 638c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 648c2ecf20Sopenharmony_ci }, { 658c2ecf20Sopenharmony_ci .id = 0x1b, 668c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 678c2ecf20Sopenharmony_ci .name = "TDA18271-2", 688c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 698c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 708c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 718c2ecf20Sopenharmony_ci }, { 728c2ecf20Sopenharmony_ci .id = 0x1e, 738c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 748c2ecf20Sopenharmony_ci .name = "TDA10048-1", 758c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 768c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x10 >> 1, 778c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 788c2ecf20Sopenharmony_ci }, { 798c2ecf20Sopenharmony_ci .id = 0x1f, 808c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 818c2ecf20Sopenharmony_ci .name = "TDA10048-2", 828c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 838c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x12 >> 1, 848c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 858c2ecf20Sopenharmony_ci } }, 868c2ecf20Sopenharmony_ci }, 878c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2200_2] = { 888c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2200", 898c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 908c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 918c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 928c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 938c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 948c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 958c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV2, 968c2ecf20Sopenharmony_ci .unit = {{ 978c2ecf20Sopenharmony_ci .id = 0x06, 988c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 998c2ecf20Sopenharmony_ci .name = "4K EEPROM", 1008c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 1018c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 1028c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1038c2ecf20Sopenharmony_ci }, { 1048c2ecf20Sopenharmony_ci .id = 0x04, 1058c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 1068c2ecf20Sopenharmony_ci .name = "TDA18271-1", 1078c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 1088c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 1098c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1108c2ecf20Sopenharmony_ci }, { 1118c2ecf20Sopenharmony_ci .id = 0x05, 1128c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 1138c2ecf20Sopenharmony_ci .name = "TDA10048-1", 1148c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 1158c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x10 >> 1, 1168c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1178c2ecf20Sopenharmony_ci }, { 1188c2ecf20Sopenharmony_ci .id = 0x1e, 1198c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 1208c2ecf20Sopenharmony_ci .name = "TDA18271-2", 1218c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 1228c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 1238c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1248c2ecf20Sopenharmony_ci }, { 1258c2ecf20Sopenharmony_ci .id = 0x1f, 1268c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 1278c2ecf20Sopenharmony_ci .name = "TDA10048-2", 1288c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 1298c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x12 >> 1, 1308c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1318c2ecf20Sopenharmony_ci } }, 1328c2ecf20Sopenharmony_ci }, 1338c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2200_3] = { 1348c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2200", 1358c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 1368c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 1378c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 1388c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 1398c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 1408c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 1418c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV2, 1428c2ecf20Sopenharmony_ci .unit = {{ 1438c2ecf20Sopenharmony_ci .id = 0x1d, 1448c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 1458c2ecf20Sopenharmony_ci .name = "4K EEPROM", 1468c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 1478c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 1488c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1498c2ecf20Sopenharmony_ci }, { 1508c2ecf20Sopenharmony_ci .id = 0x04, 1518c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 1528c2ecf20Sopenharmony_ci .name = "TDA18271-1", 1538c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 1548c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 1558c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1568c2ecf20Sopenharmony_ci }, { 1578c2ecf20Sopenharmony_ci .id = 0x05, 1588c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 1598c2ecf20Sopenharmony_ci .name = "TDA8290-1", 1608c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 1618c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 1628c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1638c2ecf20Sopenharmony_ci }, { 1648c2ecf20Sopenharmony_ci .id = 0x1b, 1658c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 1668c2ecf20Sopenharmony_ci .name = "TDA18271-2", 1678c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 1688c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 1698c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1708c2ecf20Sopenharmony_ci }, { 1718c2ecf20Sopenharmony_ci .id = 0x1c, 1728c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 1738c2ecf20Sopenharmony_ci .name = "TDA8290-2", 1748c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 1758c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 1768c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1778c2ecf20Sopenharmony_ci }, { 1788c2ecf20Sopenharmony_ci .id = 0x1e, 1798c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 1808c2ecf20Sopenharmony_ci .name = "TDA10048-1", 1818c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 1828c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x10 >> 1, 1838c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1848c2ecf20Sopenharmony_ci }, { 1858c2ecf20Sopenharmony_ci .id = 0x1f, 1868c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 1878c2ecf20Sopenharmony_ci .name = "TDA10048-2", 1888c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 1898c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x12 >> 1, 1908c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 1918c2ecf20Sopenharmony_ci } }, 1928c2ecf20Sopenharmony_ci }, 1938c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2200_4] = { 1948c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2200", 1958c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 1968c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 1978c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 1988c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 1998c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 2008c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 2018c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 2028c2ecf20Sopenharmony_ci .unit = {{ 2038c2ecf20Sopenharmony_ci .id = 0x1d, 2048c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 2058c2ecf20Sopenharmony_ci .name = "4K EEPROM", 2068c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 2078c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 2088c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2098c2ecf20Sopenharmony_ci }, { 2108c2ecf20Sopenharmony_ci .id = 0x04, 2118c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 2128c2ecf20Sopenharmony_ci .name = "TDA18271-1", 2138c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2148c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 2158c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2168c2ecf20Sopenharmony_ci }, { 2178c2ecf20Sopenharmony_ci .id = 0x05, 2188c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 2198c2ecf20Sopenharmony_ci .name = "TDA8290-1", 2208c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2218c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 2228c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2238c2ecf20Sopenharmony_ci }, { 2248c2ecf20Sopenharmony_ci .id = 0x1b, 2258c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 2268c2ecf20Sopenharmony_ci .name = "TDA18271-2", 2278c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 2288c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 2298c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2308c2ecf20Sopenharmony_ci }, { 2318c2ecf20Sopenharmony_ci .id = 0x1c, 2328c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 2338c2ecf20Sopenharmony_ci .name = "TDA8290-2", 2348c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 2358c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 2368c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2378c2ecf20Sopenharmony_ci }, { 2388c2ecf20Sopenharmony_ci .id = 0x1e, 2398c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 2408c2ecf20Sopenharmony_ci .name = "TDA10048-1", 2418c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2428c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x10 >> 1, 2438c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2448c2ecf20Sopenharmony_ci }, { 2458c2ecf20Sopenharmony_ci .id = 0x1f, 2468c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 2478c2ecf20Sopenharmony_ci .name = "TDA10048-2", 2488c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 2498c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x12 >> 1, 2508c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2518c2ecf20Sopenharmony_ci } }, 2528c2ecf20Sopenharmony_ci }, 2538c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2250] = { 2548c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2250", 2558c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 2568c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 2578c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 2588c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 2598c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 2608c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 2618c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 2628c2ecf20Sopenharmony_ci .unit = {{ 2638c2ecf20Sopenharmony_ci .id = 0x22, 2648c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 2658c2ecf20Sopenharmony_ci .name = "4K EEPROM", 2668c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 2678c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 2688c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2698c2ecf20Sopenharmony_ci }, { 2708c2ecf20Sopenharmony_ci .id = 0x04, 2718c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 2728c2ecf20Sopenharmony_ci .name = "TDA18271-1", 2738c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2748c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 2758c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2768c2ecf20Sopenharmony_ci }, { 2778c2ecf20Sopenharmony_ci .id = 0x07, 2788c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 2798c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (TOP)", 2808c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2818c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 2828c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2838c2ecf20Sopenharmony_ci }, { 2848c2ecf20Sopenharmony_ci .id = 0x08, 2858c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 2868c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (QAM)", 2878c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 2888c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 2898c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2908c2ecf20Sopenharmony_ci }, { 2918c2ecf20Sopenharmony_ci .id = 0x1e, 2928c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 2938c2ecf20Sopenharmony_ci .name = "TDA18271-2", 2948c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 2958c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 2968c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 2978c2ecf20Sopenharmony_ci }, { 2988c2ecf20Sopenharmony_ci .id = 0x20, 2998c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3008c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (TOP)", 3018c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 3028c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 3038c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3048c2ecf20Sopenharmony_ci }, { 3058c2ecf20Sopenharmony_ci .id = 0x23, 3068c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3078c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (QAM)", 3088c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 3098c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 3108c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3118c2ecf20Sopenharmony_ci } }, 3128c2ecf20Sopenharmony_ci }, 3138c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2250_2] = { 3148c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2250", 3158c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 3168c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 3178c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 3188c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 3198c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 3208c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 3218c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 3228c2ecf20Sopenharmony_ci .unit = {{ 3238c2ecf20Sopenharmony_ci .id = 0x28, 3248c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 3258c2ecf20Sopenharmony_ci .name = "4K EEPROM", 3268c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 3278c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 3288c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3298c2ecf20Sopenharmony_ci }, { 3308c2ecf20Sopenharmony_ci .id = 0x04, 3318c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 3328c2ecf20Sopenharmony_ci .name = "TDA18271-1", 3338c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 3348c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 3358c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3368c2ecf20Sopenharmony_ci }, { 3378c2ecf20Sopenharmony_ci .id = 0x07, 3388c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3398c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (TOP)", 3408c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 3418c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 3428c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3438c2ecf20Sopenharmony_ci }, { 3448c2ecf20Sopenharmony_ci .id = 0x08, 3458c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3468c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (QAM)", 3478c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 3488c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 3498c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3508c2ecf20Sopenharmony_ci }, { 3518c2ecf20Sopenharmony_ci .id = 0x24, 3528c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 3538c2ecf20Sopenharmony_ci .name = "TDA18271-2", 3548c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 3558c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 3568c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3578c2ecf20Sopenharmony_ci }, { 3588c2ecf20Sopenharmony_ci .id = 0x26, 3598c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3608c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (TOP)", 3618c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 3628c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 3638c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3648c2ecf20Sopenharmony_ci }, { 3658c2ecf20Sopenharmony_ci .id = 0x29, 3668c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3678c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (QAM)", 3688c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 3698c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 3708c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3718c2ecf20Sopenharmony_ci } }, 3728c2ecf20Sopenharmony_ci }, 3738c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2250_3] = { 3748c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2250", 3758c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 3768c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 3778c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 3788c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 3798c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 3808c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 3818c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 3828c2ecf20Sopenharmony_ci .unit = {{ 3838c2ecf20Sopenharmony_ci .id = 0x26, 3848c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 3858c2ecf20Sopenharmony_ci .name = "4K EEPROM", 3868c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 3878c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 3888c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3898c2ecf20Sopenharmony_ci }, { 3908c2ecf20Sopenharmony_ci .id = 0x04, 3918c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 3928c2ecf20Sopenharmony_ci .name = "TDA18271-1", 3938c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 3948c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 3958c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 3968c2ecf20Sopenharmony_ci }, { 3978c2ecf20Sopenharmony_ci .id = 0x07, 3988c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 3998c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (TOP)", 4008c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 4018c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 4028c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4038c2ecf20Sopenharmony_ci }, { 4048c2ecf20Sopenharmony_ci .id = 0x08, 4058c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 4068c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-1 (QAM)", 4078c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 4088c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 4098c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4108c2ecf20Sopenharmony_ci }, { 4118c2ecf20Sopenharmony_ci .id = 0x22, 4128c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 4138c2ecf20Sopenharmony_ci .name = "TDA18271-2", 4148c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4158c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 4168c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4178c2ecf20Sopenharmony_ci }, { 4188c2ecf20Sopenharmony_ci .id = 0x24, 4198c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 4208c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (TOP)", 4218c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4228c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x32 >> 1, 4238c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4248c2ecf20Sopenharmony_ci }, { 4258c2ecf20Sopenharmony_ci .id = 0x27, 4268c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 4278c2ecf20Sopenharmony_ci .name = "CX24228/S5H1411-2 (QAM)", 4288c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4298c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x34 >> 1, 4308c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4318c2ecf20Sopenharmony_ci } }, 4328c2ecf20Sopenharmony_ci }, 4338c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2200_5] = { 4348c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2200", 4358c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 4368c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 4378c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 4388c2ecf20Sopenharmony_ci .unit = {{ 4398c2ecf20Sopenharmony_ci .id = 0x23, 4408c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 4418c2ecf20Sopenharmony_ci .name = "4K EEPROM", 4428c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 4438c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 4448c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4458c2ecf20Sopenharmony_ci }, { 4468c2ecf20Sopenharmony_ci .id = 0x04, 4478c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 4488c2ecf20Sopenharmony_ci .name = "TDA18271-1", 4498c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 4508c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 4518c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4528c2ecf20Sopenharmony_ci }, { 4538c2ecf20Sopenharmony_ci .id = 0x05, 4548c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 4558c2ecf20Sopenharmony_ci .name = "TDA8290-1", 4568c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 4578c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 4588c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4598c2ecf20Sopenharmony_ci }, { 4608c2ecf20Sopenharmony_ci .id = 0x21, 4618c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 4628c2ecf20Sopenharmony_ci .name = "TDA18271-2", 4638c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4648c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 4658c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4668c2ecf20Sopenharmony_ci }, { 4678c2ecf20Sopenharmony_ci .id = 0x22, 4688c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_ANALOG_DEMODULATOR, 4698c2ecf20Sopenharmony_ci .name = "TDA8290-2", 4708c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4718c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x84 >> 1, 4728c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4738c2ecf20Sopenharmony_ci }, { 4748c2ecf20Sopenharmony_ci .id = 0x24, 4758c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 4768c2ecf20Sopenharmony_ci .name = "TDA10048-1", 4778c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 4788c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x10 >> 1, 4798c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4808c2ecf20Sopenharmony_ci }, { 4818c2ecf20Sopenharmony_ci .id = 0x25, 4828c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 4838c2ecf20Sopenharmony_ci .name = "TDA10048-2", 4848c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 4858c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x12 >> 1, 4868c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 4878c2ecf20Sopenharmony_ci } }, 4888c2ecf20Sopenharmony_ci }, 4898c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2255proto] = { 4908c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2255(proto)", 4918c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 4928c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 4938c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 4948c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 4958c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 4968c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 4978c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 4988c2ecf20Sopenharmony_ci .unit = {{ 4998c2ecf20Sopenharmony_ci .id = 0x27, 5008c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 5018c2ecf20Sopenharmony_ci .name = "4K EEPROM", 5028c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 5038c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 5048c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5058c2ecf20Sopenharmony_ci }, { 5068c2ecf20Sopenharmony_ci .id = 0x04, 5078c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 5088c2ecf20Sopenharmony_ci .name = "SI2157-1", 5098c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 5108c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 5118c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 5128c2ecf20Sopenharmony_ci }, { 5138c2ecf20Sopenharmony_ci .id = 0x06, 5148c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 5158c2ecf20Sopenharmony_ci .name = "LGDT3306", 5168c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 5178c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xb2 >> 1, 5188c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5198c2ecf20Sopenharmony_ci }, { 5208c2ecf20Sopenharmony_ci .id = 0x24, 5218c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 5228c2ecf20Sopenharmony_ci .name = "SI2157-2", 5238c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 5248c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 5258c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 5268c2ecf20Sopenharmony_ci }, { 5278c2ecf20Sopenharmony_ci .id = 0x26, 5288c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 5298c2ecf20Sopenharmony_ci .name = "LGDT3306-2", 5308c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 5318c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x1c >> 1, 5328c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5338c2ecf20Sopenharmony_ci } }, 5348c2ecf20Sopenharmony_ci }, 5358c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2255] = { 5368c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2255", 5378c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 5388c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 5398c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 5408c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 5418c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 5428c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 5438c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 5448c2ecf20Sopenharmony_ci .unit = {{ 5458c2ecf20Sopenharmony_ci .id = 0x28, 5468c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 5478c2ecf20Sopenharmony_ci .name = "4K EEPROM", 5488c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 5498c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 5508c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5518c2ecf20Sopenharmony_ci }, { 5528c2ecf20Sopenharmony_ci .id = 0x04, 5538c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 5548c2ecf20Sopenharmony_ci .name = "SI2157-1", 5558c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 5568c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 5578c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 5588c2ecf20Sopenharmony_ci }, { 5598c2ecf20Sopenharmony_ci .id = 0x06, 5608c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 5618c2ecf20Sopenharmony_ci .name = "LGDT3306-1", 5628c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 5638c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xb2 >> 1, 5648c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5658c2ecf20Sopenharmony_ci }, { 5668c2ecf20Sopenharmony_ci .id = 0x25, 5678c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 5688c2ecf20Sopenharmony_ci .name = "SI2157-2", 5698c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 5708c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 5718c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 5728c2ecf20Sopenharmony_ci }, { 5738c2ecf20Sopenharmony_ci .id = 0x27, 5748c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 5758c2ecf20Sopenharmony_ci .name = "LGDT3306-2", 5768c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 5778c2ecf20Sopenharmony_ci .i2c_bus_addr = 0x1c >> 1, 5788c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5798c2ecf20Sopenharmony_ci } }, 5808c2ecf20Sopenharmony_ci }, 5818c2ecf20Sopenharmony_ci [SAA7164_BOARD_HAUPPAUGE_HVR2205] = { 5828c2ecf20Sopenharmony_ci .name = "Hauppauge WinTV-HVR2205", 5838c2ecf20Sopenharmony_ci .porta = SAA7164_MPEG_DVB, 5848c2ecf20Sopenharmony_ci .portb = SAA7164_MPEG_DVB, 5858c2ecf20Sopenharmony_ci .portc = SAA7164_MPEG_ENCODER, 5868c2ecf20Sopenharmony_ci .portd = SAA7164_MPEG_ENCODER, 5878c2ecf20Sopenharmony_ci .porte = SAA7164_MPEG_VBI, 5888c2ecf20Sopenharmony_ci .portf = SAA7164_MPEG_VBI, 5898c2ecf20Sopenharmony_ci .chiprev = SAA7164_CHIP_REV3, 5908c2ecf20Sopenharmony_ci .unit = {{ 5918c2ecf20Sopenharmony_ci .id = 0x28, 5928c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_EEPROM, 5938c2ecf20Sopenharmony_ci .name = "4K EEPROM", 5948c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 5958c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xa0 >> 1, 5968c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_8bit, 5978c2ecf20Sopenharmony_ci }, { 5988c2ecf20Sopenharmony_ci .id = 0x04, 5998c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 6008c2ecf20Sopenharmony_ci .name = "SI2157-1", 6018c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_0, 6028c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 6038c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 6048c2ecf20Sopenharmony_ci }, { 6058c2ecf20Sopenharmony_ci .id = 0x06, 6068c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 6078c2ecf20Sopenharmony_ci .name = "SI2168-1", 6088c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 6098c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc8 >> 1, 6108c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 6118c2ecf20Sopenharmony_ci }, { 6128c2ecf20Sopenharmony_ci .id = 0x25, 6138c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_TUNER, 6148c2ecf20Sopenharmony_ci .name = "SI2157-2", 6158c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_1, 6168c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xc0 >> 1, 6178c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 6188c2ecf20Sopenharmony_ci }, { 6198c2ecf20Sopenharmony_ci .id = 0x27, 6208c2ecf20Sopenharmony_ci .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, 6218c2ecf20Sopenharmony_ci .name = "SI2168-2", 6228c2ecf20Sopenharmony_ci .i2c_bus_nr = SAA7164_I2C_BUS_2, 6238c2ecf20Sopenharmony_ci .i2c_bus_addr = 0xcc >> 1, 6248c2ecf20Sopenharmony_ci .i2c_reg_len = REGLEN_0bit, 6258c2ecf20Sopenharmony_ci } }, 6268c2ecf20Sopenharmony_ci }, 6278c2ecf20Sopenharmony_ci}; 6288c2ecf20Sopenharmony_ciconst unsigned int saa7164_bcount = ARRAY_SIZE(saa7164_boards); 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------ */ 6318c2ecf20Sopenharmony_ci/* PCI subsystem IDs */ 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_cistruct saa7164_subid saa7164_subids[] = { 6348c2ecf20Sopenharmony_ci { 6358c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6368c2ecf20Sopenharmony_ci .subdevice = 0x8880, 6378c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2250, 6388c2ecf20Sopenharmony_ci }, { 6398c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6408c2ecf20Sopenharmony_ci .subdevice = 0x8810, 6418c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2250, 6428c2ecf20Sopenharmony_ci }, { 6438c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6448c2ecf20Sopenharmony_ci .subdevice = 0x8980, 6458c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2200, 6468c2ecf20Sopenharmony_ci }, { 6478c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6488c2ecf20Sopenharmony_ci .subdevice = 0x8900, 6498c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_2, 6508c2ecf20Sopenharmony_ci }, { 6518c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6528c2ecf20Sopenharmony_ci .subdevice = 0x8901, 6538c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_3, 6548c2ecf20Sopenharmony_ci }, { 6558c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6568c2ecf20Sopenharmony_ci .subdevice = 0x88A1, 6578c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_3, 6588c2ecf20Sopenharmony_ci }, { 6598c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6608c2ecf20Sopenharmony_ci .subdevice = 0x8891, 6618c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2, 6628c2ecf20Sopenharmony_ci }, { 6638c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6648c2ecf20Sopenharmony_ci .subdevice = 0x8851, 6658c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2, 6668c2ecf20Sopenharmony_ci }, { 6678c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6688c2ecf20Sopenharmony_ci .subdevice = 0x8940, 6698c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_4, 6708c2ecf20Sopenharmony_ci }, { 6718c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6728c2ecf20Sopenharmony_ci .subdevice = 0x8953, 6738c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_5, 6748c2ecf20Sopenharmony_ci }, { 6758c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6768c2ecf20Sopenharmony_ci .subdevice = 0xf111, 6778c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2255, 6788c2ecf20Sopenharmony_ci /* Prototype card left here for documentation purposes. 6798c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2255proto, 6808c2ecf20Sopenharmony_ci */ 6818c2ecf20Sopenharmony_ci }, { 6828c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6838c2ecf20Sopenharmony_ci .subdevice = 0xf123, 6848c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2205, 6858c2ecf20Sopenharmony_ci }, { 6868c2ecf20Sopenharmony_ci .subvendor = 0x0070, 6878c2ecf20Sopenharmony_ci .subdevice = 0xf120, 6888c2ecf20Sopenharmony_ci .card = SAA7164_BOARD_HAUPPAUGE_HVR2205, 6898c2ecf20Sopenharmony_ci }, 6908c2ecf20Sopenharmony_ci}; 6918c2ecf20Sopenharmony_ciconst unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids); 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_civoid saa7164_card_list(struct saa7164_dev *dev) 6948c2ecf20Sopenharmony_ci{ 6958c2ecf20Sopenharmony_ci int i; 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci if (0 == dev->pci->subsystem_vendor && 6988c2ecf20Sopenharmony_ci 0 == dev->pci->subsystem_device) { 6998c2ecf20Sopenharmony_ci printk(KERN_ERR 7008c2ecf20Sopenharmony_ci "%s: Board has no valid PCIe Subsystem ID and can't\n" 7018c2ecf20Sopenharmony_ci "%s: be autodetected. Pass card=<n> insmod option to\n" 7028c2ecf20Sopenharmony_ci "%s: workaround that. Send complaints to the vendor\n" 7038c2ecf20Sopenharmony_ci "%s: of the TV card. Best regards,\n" 7048c2ecf20Sopenharmony_ci "%s: -- tux\n", 7058c2ecf20Sopenharmony_ci dev->name, dev->name, dev->name, dev->name, dev->name); 7068c2ecf20Sopenharmony_ci } else { 7078c2ecf20Sopenharmony_ci printk(KERN_ERR 7088c2ecf20Sopenharmony_ci "%s: Your board isn't known (yet) to the driver.\n" 7098c2ecf20Sopenharmony_ci "%s: Try to pick one of the existing card configs via\n" 7108c2ecf20Sopenharmony_ci "%s: card=<n> insmod option. Updating to the latest\n" 7118c2ecf20Sopenharmony_ci "%s: version might help as well.\n", 7128c2ecf20Sopenharmony_ci dev->name, dev->name, dev->name, dev->name); 7138c2ecf20Sopenharmony_ci } 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci printk(KERN_ERR "%s: Here are valid choices for the card=<n> insmod option:\n", 7168c2ecf20Sopenharmony_ci dev->name); 7178c2ecf20Sopenharmony_ci 7188c2ecf20Sopenharmony_ci for (i = 0; i < saa7164_bcount; i++) 7198c2ecf20Sopenharmony_ci printk(KERN_ERR "%s: card=%d -> %s\n", 7208c2ecf20Sopenharmony_ci dev->name, i, saa7164_boards[i].name); 7218c2ecf20Sopenharmony_ci} 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci/* TODO: clean this define up into the -cards.c structs */ 7248c2ecf20Sopenharmony_ci#define PCIEBRIDGE_UNITID 2 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_civoid saa7164_gpio_setup(struct saa7164_dev *dev) 7278c2ecf20Sopenharmony_ci{ 7288c2ecf20Sopenharmony_ci switch (dev->board) { 7298c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200: 7308c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_2: 7318c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_3: 7328c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_4: 7338c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_5: 7348c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250: 7358c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250_2: 7368c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250_3: 7378c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2255proto: 7388c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2255: 7398c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2205: 7408c2ecf20Sopenharmony_ci /* 7418c2ecf20Sopenharmony_ci HVR2200 / HVR2250 7428c2ecf20Sopenharmony_ci GPIO 2: s5h1411 / tda10048-1 demod reset 7438c2ecf20Sopenharmony_ci GPIO 3: s5h1411 / tda10048-2 demod reset 7448c2ecf20Sopenharmony_ci GPIO 7: IRBlaster Zilog reset 7458c2ecf20Sopenharmony_ci */ 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci /* HVR2255 7488c2ecf20Sopenharmony_ci * GPIO 2: lgdg3306-1 demod reset 7498c2ecf20Sopenharmony_ci * GPIO 3: lgdt3306-2 demod reset 7508c2ecf20Sopenharmony_ci */ 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_ci /* HVR2205 7538c2ecf20Sopenharmony_ci * GPIO 2: si2168-1 demod reset 7548c2ecf20Sopenharmony_ci * GPIO 3: si2168-2 demod reset 7558c2ecf20Sopenharmony_ci */ 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci /* Reset parts by going in and out of reset */ 7588c2ecf20Sopenharmony_ci saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 2); 7598c2ecf20Sopenharmony_ci saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 3); 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_ci msleep(20); 7628c2ecf20Sopenharmony_ci 7638c2ecf20Sopenharmony_ci saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 2); 7648c2ecf20Sopenharmony_ci saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 3); 7658c2ecf20Sopenharmony_ci break; 7668c2ecf20Sopenharmony_ci } 7678c2ecf20Sopenharmony_ci} 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_cistatic void hauppauge_eeprom(struct saa7164_dev *dev, u8 *eeprom_data) 7708c2ecf20Sopenharmony_ci{ 7718c2ecf20Sopenharmony_ci struct tveeprom tv; 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_ci tveeprom_hauppauge_analog(&tv, eeprom_data); 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_ci /* Make sure we support the board model */ 7768c2ecf20Sopenharmony_ci switch (tv.model) { 7778c2ecf20Sopenharmony_ci case 88001: 7788c2ecf20Sopenharmony_ci /* Development board - Limit circulation */ 7798c2ecf20Sopenharmony_ci /* WinTV-HVR2250 (PCIe, Retail, full-height bracket) 7808c2ecf20Sopenharmony_ci * ATSC/QAM (TDA18271/S5H1411) and basic analog, no IR, FM */ 7818c2ecf20Sopenharmony_ci case 88021: 7828c2ecf20Sopenharmony_ci /* WinTV-HVR2250 (PCIe, Retail, full-height bracket) 7838c2ecf20Sopenharmony_ci * ATSC/QAM (TDA18271/S5H1411) and basic analog, MCE CIR, FM */ 7848c2ecf20Sopenharmony_ci break; 7858c2ecf20Sopenharmony_ci case 88041: 7868c2ecf20Sopenharmony_ci /* WinTV-HVR2250 (PCIe, Retail, full-height bracket) 7878c2ecf20Sopenharmony_ci * ATSC/QAM (TDA18271/S5H1411) and basic analog, no IR, FM */ 7888c2ecf20Sopenharmony_ci break; 7898c2ecf20Sopenharmony_ci case 88061: 7908c2ecf20Sopenharmony_ci /* WinTV-HVR2250 (PCIe, Retail, full-height bracket) 7918c2ecf20Sopenharmony_ci * ATSC/QAM (TDA18271/S5H1411) and basic analog, FM */ 7928c2ecf20Sopenharmony_ci break; 7938c2ecf20Sopenharmony_ci case 89519: 7948c2ecf20Sopenharmony_ci case 89609: 7958c2ecf20Sopenharmony_ci /* WinTV-HVR2200 (PCIe, Retail, full-height) 7968c2ecf20Sopenharmony_ci * DVB-T (TDA18271/TDA10048) and basic analog, no IR */ 7978c2ecf20Sopenharmony_ci break; 7988c2ecf20Sopenharmony_ci case 89619: 7998c2ecf20Sopenharmony_ci /* WinTV-HVR2200 (PCIe, Retail, half-height) 8008c2ecf20Sopenharmony_ci * DVB-T (TDA18271/TDA10048) and basic analog, no IR */ 8018c2ecf20Sopenharmony_ci break; 8028c2ecf20Sopenharmony_ci case 151009: 8038c2ecf20Sopenharmony_ci /* First production board rev B2I6 */ 8048c2ecf20Sopenharmony_ci /* WinTV-HVR2205 (PCIe, Retail, full-height bracket) 8058c2ecf20Sopenharmony_ci * DVB-T/T2/C (SI2157/SI2168) and basic analog, FM */ 8068c2ecf20Sopenharmony_ci break; 8078c2ecf20Sopenharmony_ci case 151609: 8088c2ecf20Sopenharmony_ci /* First production board rev B2I6 */ 8098c2ecf20Sopenharmony_ci /* WinTV-HVR2205 (PCIe, Retail, half-height bracket) 8108c2ecf20Sopenharmony_ci * DVB-T/T2/C (SI2157/SI2168) and basic analog, FM */ 8118c2ecf20Sopenharmony_ci break; 8128c2ecf20Sopenharmony_ci case 151061: 8138c2ecf20Sopenharmony_ci /* First production board rev B1I6 */ 8148c2ecf20Sopenharmony_ci /* WinTV-HVR2255 (PCIe, Retail, full-height bracket) 8158c2ecf20Sopenharmony_ci * ATSC/QAM (SI2157/LGDT3306) and basic analog, FM */ 8168c2ecf20Sopenharmony_ci break; 8178c2ecf20Sopenharmony_ci default: 8188c2ecf20Sopenharmony_ci printk(KERN_ERR "%s: Warning: Unknown Hauppauge model #%d\n", 8198c2ecf20Sopenharmony_ci dev->name, tv.model); 8208c2ecf20Sopenharmony_ci break; 8218c2ecf20Sopenharmony_ci } 8228c2ecf20Sopenharmony_ci 8238c2ecf20Sopenharmony_ci printk(KERN_INFO "%s: Hauppauge eeprom: model=%d\n", dev->name, 8248c2ecf20Sopenharmony_ci tv.model); 8258c2ecf20Sopenharmony_ci} 8268c2ecf20Sopenharmony_ci 8278c2ecf20Sopenharmony_civoid saa7164_card_setup(struct saa7164_dev *dev) 8288c2ecf20Sopenharmony_ci{ 8298c2ecf20Sopenharmony_ci static u8 eeprom[256]; 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_ci if (dev->i2c_bus[0].i2c_rc == 0) { 8328c2ecf20Sopenharmony_ci if (saa7164_api_read_eeprom(dev, &eeprom[0], 8338c2ecf20Sopenharmony_ci sizeof(eeprom)) < 0) 8348c2ecf20Sopenharmony_ci return; 8358c2ecf20Sopenharmony_ci } 8368c2ecf20Sopenharmony_ci 8378c2ecf20Sopenharmony_ci switch (dev->board) { 8388c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200: 8398c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_2: 8408c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_3: 8418c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_4: 8428c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2200_5: 8438c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250: 8448c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250_2: 8458c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2250_3: 8468c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2255proto: 8478c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2255: 8488c2ecf20Sopenharmony_ci case SAA7164_BOARD_HAUPPAUGE_HVR2205: 8498c2ecf20Sopenharmony_ci hauppauge_eeprom(dev, &eeprom[0]); 8508c2ecf20Sopenharmony_ci break; 8518c2ecf20Sopenharmony_ci } 8528c2ecf20Sopenharmony_ci} 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci/* With most other drivers, the kernel expects to communicate with subdrivers 8558c2ecf20Sopenharmony_ci * through i2c. This bridge does not allow that, it does not expose any direct 8568c2ecf20Sopenharmony_ci * access to I2C. Instead we have to communicate through the device f/w for 8578c2ecf20Sopenharmony_ci * register access to 'processing units'. Each unit has a unique 8588c2ecf20Sopenharmony_ci * id, regardless of how the physical implementation occurs across 8598c2ecf20Sopenharmony_ci * the three physical i2c buses. The being said if we want leverge of 8608c2ecf20Sopenharmony_ci * the existing kernel drivers for tuners and demods we have to 'speak i2c', 8618c2ecf20Sopenharmony_ci * to this bridge implements 3 virtual i2c buses. This is a helper function 8628c2ecf20Sopenharmony_ci * for those. 8638c2ecf20Sopenharmony_ci * 8648c2ecf20Sopenharmony_ci * Description: Translate the kernels notion of an i2c address and bus into 8658c2ecf20Sopenharmony_ci * the appropriate unitid. 8668c2ecf20Sopenharmony_ci */ 8678c2ecf20Sopenharmony_ciint saa7164_i2caddr_to_unitid(struct saa7164_i2c *bus, int addr) 8688c2ecf20Sopenharmony_ci{ 8698c2ecf20Sopenharmony_ci /* For a given bus and i2c device address, return the saa7164 unique 8708c2ecf20Sopenharmony_ci * unitid. < 0 on error */ 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci struct saa7164_dev *dev = bus->dev; 8738c2ecf20Sopenharmony_ci struct saa7164_unit *unit; 8748c2ecf20Sopenharmony_ci int i; 8758c2ecf20Sopenharmony_ci 8768c2ecf20Sopenharmony_ci for (i = 0; i < SAA7164_MAX_UNITS; i++) { 8778c2ecf20Sopenharmony_ci unit = &saa7164_boards[dev->board].unit[i]; 8788c2ecf20Sopenharmony_ci 8798c2ecf20Sopenharmony_ci if (unit->type == SAA7164_UNIT_UNDEFINED) 8808c2ecf20Sopenharmony_ci continue; 8818c2ecf20Sopenharmony_ci if ((bus->nr == unit->i2c_bus_nr) && 8828c2ecf20Sopenharmony_ci (addr == unit->i2c_bus_addr)) 8838c2ecf20Sopenharmony_ci return unit->id; 8848c2ecf20Sopenharmony_ci } 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_ci return -1; 8878c2ecf20Sopenharmony_ci} 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci/* The 7164 API needs to know the i2c register length in advance. 8908c2ecf20Sopenharmony_ci * this is a helper function. Based on a specific chip addr and bus return the 8918c2ecf20Sopenharmony_ci * reg length. 8928c2ecf20Sopenharmony_ci */ 8938c2ecf20Sopenharmony_ciint saa7164_i2caddr_to_reglen(struct saa7164_i2c *bus, int addr) 8948c2ecf20Sopenharmony_ci{ 8958c2ecf20Sopenharmony_ci /* For a given bus and i2c device address, return the 8968c2ecf20Sopenharmony_ci * saa7164 registry address width. < 0 on error 8978c2ecf20Sopenharmony_ci */ 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci struct saa7164_dev *dev = bus->dev; 9008c2ecf20Sopenharmony_ci struct saa7164_unit *unit; 9018c2ecf20Sopenharmony_ci int i; 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_ci for (i = 0; i < SAA7164_MAX_UNITS; i++) { 9048c2ecf20Sopenharmony_ci unit = &saa7164_boards[dev->board].unit[i]; 9058c2ecf20Sopenharmony_ci 9068c2ecf20Sopenharmony_ci if (unit->type == SAA7164_UNIT_UNDEFINED) 9078c2ecf20Sopenharmony_ci continue; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci if ((bus->nr == unit->i2c_bus_nr) && 9108c2ecf20Sopenharmony_ci (addr == unit->i2c_bus_addr)) 9118c2ecf20Sopenharmony_ci return unit->i2c_reg_len; 9128c2ecf20Sopenharmony_ci } 9138c2ecf20Sopenharmony_ci 9148c2ecf20Sopenharmony_ci return -1; 9158c2ecf20Sopenharmony_ci} 9168c2ecf20Sopenharmony_ci/* TODO: implement a 'findeeprom' functio like the above and fix any other 9178c2ecf20Sopenharmony_ci * eeprom related todo's in -api.c. 9188c2ecf20Sopenharmony_ci */ 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_ci/* Translate a unitid into a x readable device name, for display purposes. */ 9218c2ecf20Sopenharmony_cichar *saa7164_unitid_name(struct saa7164_dev *dev, u8 unitid) 9228c2ecf20Sopenharmony_ci{ 9238c2ecf20Sopenharmony_ci char *undefed = "UNDEFINED"; 9248c2ecf20Sopenharmony_ci char *bridge = "BRIDGE"; 9258c2ecf20Sopenharmony_ci struct saa7164_unit *unit; 9268c2ecf20Sopenharmony_ci int i; 9278c2ecf20Sopenharmony_ci 9288c2ecf20Sopenharmony_ci if (unitid == 0) 9298c2ecf20Sopenharmony_ci return bridge; 9308c2ecf20Sopenharmony_ci 9318c2ecf20Sopenharmony_ci for (i = 0; i < SAA7164_MAX_UNITS; i++) { 9328c2ecf20Sopenharmony_ci unit = &saa7164_boards[dev->board].unit[i]; 9338c2ecf20Sopenharmony_ci 9348c2ecf20Sopenharmony_ci if (unit->type == SAA7164_UNIT_UNDEFINED) 9358c2ecf20Sopenharmony_ci continue; 9368c2ecf20Sopenharmony_ci 9378c2ecf20Sopenharmony_ci if (unitid == unit->id) 9388c2ecf20Sopenharmony_ci return unit->name; 9398c2ecf20Sopenharmony_ci } 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ci return undefed; 9428c2ecf20Sopenharmony_ci} 9438c2ecf20Sopenharmony_ci 944