// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver for the NXP SAA7164 PCIe bridge * * Copyright (c) 2010-2015 Steven Toth <[email protected]> */ #include <linux/init.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/delay.h> #include "saa7164.h" /* The Bridge API needs to understand register widths (in bytes) for the * attached I2C devices, so we can simplify the virtual i2c mechansms * and keep the -i2c.c implementation clean. */ #define REGLEN_0bit … #define REGLEN_8bit … #define REGLEN_16bit … struct saa7164_board saa7164_boards[] = …; const unsigned int saa7164_bcount = …; /* ------------------------------------------------------------------ */ /* PCI subsystem IDs */ struct saa7164_subid saa7164_subids[] = …; const unsigned int saa7164_idcount = …; void saa7164_card_list(struct saa7164_dev *dev) { … } /* TODO: clean this define up into the -cards.c structs */ #define PCIEBRIDGE_UNITID … void saa7164_gpio_setup(struct saa7164_dev *dev) { … } static void hauppauge_eeprom(struct saa7164_dev *dev, u8 *eeprom_data) { … } void saa7164_card_setup(struct saa7164_dev *dev) { … } /* With most other drivers, the kernel expects to communicate with subdrivers * through i2c. This bridge does not allow that, it does not expose any direct * access to I2C. Instead we have to communicate through the device f/w for * register access to 'processing units'. Each unit has a unique * id, regardless of how the physical implementation occurs across * the three physical i2c buses. The being said if we want leverge of * the existing kernel drivers for tuners and demods we have to 'speak i2c', * to this bridge implements 3 virtual i2c buses. This is a helper function * for those. * * Description: Translate the kernels notion of an i2c address and bus into * the appropriate unitid. */ int saa7164_i2caddr_to_unitid(struct saa7164_i2c *bus, int addr) { … } /* The 7164 API needs to know the i2c register length in advance. * this is a helper function. Based on a specific chip addr and bus return the * reg length. */ int saa7164_i2caddr_to_reglen(struct saa7164_i2c *bus, int addr) { … } /* TODO: implement a 'findeeprom' functio like the above and fix any other * eeprom related todo's in -api.c. */ /* Translate a unitid into a x readable device name, for display purposes. */ char *saa7164_unitid_name(struct saa7164_dev *dev, u8 unitid) { … }