#define DRV_NAME …
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/i2c-smbus.h>
#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/platform_data/itco_wdt.h>
#include <linux/platform_data/x86/p2sb.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#ifdef CONFIG_I2C_I801_MUX
#include <linux/gpio/machine.h>
#include <linux/platform_data/i2c-mux-gpio.h>
#endif
#define SMBHSTSTS(p) …
#define SMBHSTCNT(p) …
#define SMBHSTCMD(p) …
#define SMBHSTADD(p) …
#define SMBHSTDAT0(p) …
#define SMBHSTDAT1(p) …
#define SMBBLKDAT(p) …
#define SMBPEC(p) …
#define SMBAUXSTS(p) …
#define SMBAUXCTL(p) …
#define SMBSLVSTS(p) …
#define SMBSLVCMD(p) …
#define SMBNTFDADD(p) …
#define SMBBAR …
#define SMBHSTCFG …
#define TCOBASE …
#define TCOCTL …
#define SBREG_SMBCTRL …
#define SBREG_SMBCTRL_DNV …
#define SMBHSTCFG_HST_EN …
#define SMBHSTCFG_SMB_SMI_EN …
#define SMBHSTCFG_I2C_EN …
#define SMBHSTCFG_SPD_WD …
#define TCOCTL_EN …
#define SMBAUXSTS_CRCE …
#define SMBAUXSTS_STCO …
#define SMBAUXCTL_CRC …
#define SMBAUXCTL_E32B …
#define I801_QUICK …
#define I801_BYTE …
#define I801_BYTE_DATA …
#define I801_WORD_DATA …
#define I801_PROC_CALL …
#define I801_BLOCK_DATA …
#define I801_I2C_BLOCK_DATA …
#define I801_BLOCK_PROC_CALL …
#define SMBHSTCNT_INTREN …
#define SMBHSTCNT_KILL …
#define SMBHSTCNT_LAST_BYTE …
#define SMBHSTCNT_START …
#define SMBHSTCNT_PEC_EN …
#define SMBHSTSTS_BYTE_DONE …
#define SMBHSTSTS_INUSE_STS …
#define SMBHSTSTS_SMBALERT_STS …
#define SMBHSTSTS_FAILED …
#define SMBHSTSTS_BUS_ERR …
#define SMBHSTSTS_DEV_ERR …
#define SMBHSTSTS_INTR …
#define SMBHSTSTS_HOST_BUSY …
#define SMBSLVSTS_HST_NTFY_STS …
#define SMBSLVCMD_SMBALERT_DISABLE …
#define SMBSLVCMD_HST_NTFY_INTREN …
#define STATUS_ERROR_FLAGS …
#define STATUS_FLAGS …
#define SMBUS_LEN_SENTINEL …
#define PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS …
#define PCI_DEVICE_ID_INTEL_COMETLAKE_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS …
#define PCI_DEVICE_ID_INTEL_CDF_SMBUS …
#define PCI_DEVICE_ID_INTEL_DNV_SMBUS …
#define PCI_DEVICE_ID_INTEL_EBG_SMBUS …
#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS …
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS …
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 …
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 …
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 …
#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS …
#define PCI_DEVICE_ID_INTEL_AVOTON_SMBUS …
#define PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS …
#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS …
#define PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS …
#define PCI_DEVICE_ID_INTEL_GEMINILAKE_SMBUS …
#define PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_ICELAKE_N_SMBUS …
#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS …
#define PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS …
#define PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS …
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_P_SMBUS …
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_M_SMBUS …
#define PCI_DEVICE_ID_INTEL_BIRCH_STREAM_SMBUS …
#define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS …
#define PCI_DEVICE_ID_INTEL_ARROW_LAKE_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_S_SMBUS …
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_S_SMBUS …
#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_P_SMBUS …
#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_PCH_S_SMBUS …
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS …
#define PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS …
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS …
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS0 …
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1 …
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2 …
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_TIGERLAKE_LP_SMBUS …
#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS …
#define PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS …
#define PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS …
#define PCI_DEVICE_ID_INTEL_COMETLAKE_V_SMBUS …
#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_SOC_S_SMBUS …
struct i801_mux_config { … };
struct i801_priv { … };
#define FEATURE_SMBUS_PEC …
#define FEATURE_BLOCK_BUFFER …
#define FEATURE_BLOCK_PROC …
#define FEATURE_I2C_BLOCK_READ …
#define FEATURE_IRQ …
#define FEATURE_HOST_NOTIFY …
#define FEATURE_IDF …
#define FEATURE_TCO_SPT …
#define FEATURE_TCO_CNL …
static const char *i801_feature_names[] = …;
static unsigned int disable_features;
module_param(disable_features, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(…) …;
static int i801_get_block_len(struct i801_priv *priv)
{ … }
static int i801_check_and_clear_pec_error(struct i801_priv *priv)
{ … }
static int i801_check_pre(struct i801_priv *priv)
{ … }
static int i801_check_post(struct i801_priv *priv, int status)
{ … }
static int i801_wait_intr(struct i801_priv *priv)
{ … }
static int i801_wait_byte_done(struct i801_priv *priv)
{ … }
static int i801_transaction(struct i801_priv *priv, int xact)
{ … }
static int i801_block_transaction_by_block(struct i801_priv *priv,
union i2c_smbus_data *data,
char read_write, int command)
{ … }
static void i801_isr_byte_done(struct i801_priv *priv)
{ … }
static irqreturn_t i801_host_notify_isr(struct i801_priv *priv)
{ … }
static irqreturn_t i801_isr(int irq, void *dev_id)
{ … }
static int i801_block_transaction_byte_by_byte(struct i801_priv *priv,
union i2c_smbus_data *data,
char read_write, int command)
{ … }
static void i801_set_hstadd(struct i801_priv *priv, u8 addr, char read_write)
{ … }
static int i801_simple_transaction(struct i801_priv *priv, union i2c_smbus_data *data,
u8 addr, u8 hstcmd, char read_write, int command)
{ … }
static int i801_smbus_block_transaction(struct i801_priv *priv, union i2c_smbus_data *data,
u8 addr, u8 hstcmd, char read_write, int command)
{ … }
static int i801_i2c_block_transaction(struct i801_priv *priv, union i2c_smbus_data *data,
u8 addr, u8 hstcmd, char read_write, int command)
{ … }
static s32 i801_access(struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data *data)
{ … }
static u32 i801_func(struct i2c_adapter *adapter)
{ … }
static void i801_enable_host_notify(struct i2c_adapter *adapter)
{ … }
static void i801_disable_host_notify(struct i801_priv *priv)
{ … }
static const struct i2c_algorithm smbus_algorithm = …;
#define FEATURES_ICH4 …
#define FEATURES_ICH5 …
static const struct pci_device_id i801_ids[] = …;
MODULE_DEVICE_TABLE(pci, i801_ids);
#if defined CONFIG_X86 && defined CONFIG_DMI
static unsigned char apanel_addr __ro_after_init;
static __init const void __iomem *bios_signature(const void __iomem *bios)
{ … }
static void __init input_apanel_init(void)
{ … }
struct dmi_onboard_device_info { … };
static const struct dmi_onboard_device_info dmi_devices[] = …;
static void dmi_check_onboard_device(u8 type, const char *name,
struct i2c_adapter *adap)
{ … }
static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
{ … }
static const char *const acpi_smo8800_ids[] = …;
static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
{ … }
static bool is_dell_system_with_lis3lv02d(void)
{ … }
static const struct { … } dell_lis3lv02d_devices[] = …;
static void register_dell_lis3lv02d_i2c_device(struct i801_priv *priv)
{ … }
static void i801_probe_optional_targets(struct i801_priv *priv)
{ … }
#else
static void __init input_apanel_init(void) {}
static void i801_probe_optional_targets(struct i801_priv *priv) {}
#endif
#ifdef CONFIG_I2C_I801_MUX
static struct i801_mux_config i801_mux_config_asus_z8_d12 = …;
static struct i801_mux_config i801_mux_config_asus_z8_d18 = …;
static const struct dmi_system_id mux_dmi_table[] = …;
static int i801_notifier_call(struct notifier_block *nb, unsigned long action,
void *data)
{ … }
static void i801_add_mux(struct i801_priv *priv)
{ … }
static void i801_del_mux(struct i801_priv *priv)
{ … }
#else
static inline void i801_add_mux(struct i801_priv *priv) { }
static inline void i801_del_mux(struct i801_priv *priv) { }
#endif
static struct platform_device *
i801_add_tco_spt(struct pci_dev *pci_dev, struct resource *tco_res)
{ … }
static struct platform_device *
i801_add_tco_cnl(struct pci_dev *pci_dev, struct resource *tco_res)
{ … }
static void i801_add_tco(struct i801_priv *priv)
{ … }
#ifdef CONFIG_ACPI
static bool i801_acpi_is_smbus_ioport(const struct i801_priv *priv,
acpi_physical_address address)
{ … }
static acpi_status
i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
u64 *value, void *handler_context, void *region_context)
{ … }
static int i801_acpi_probe(struct i801_priv *priv)
{ … }
static void i801_acpi_remove(struct i801_priv *priv)
{ … }
#else
static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }
static inline void i801_acpi_remove(struct i801_priv *priv) { }
#endif
static void i801_setup_hstcfg(struct i801_priv *priv)
{ … }
static void i801_restore_regs(struct i801_priv *priv)
{ … }
static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ … }
static void i801_remove(struct pci_dev *dev)
{ … }
static void i801_shutdown(struct pci_dev *dev)
{ … }
static int i801_suspend(struct device *dev)
{ … }
static int i801_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(i801_pm_ops, i801_suspend, i801_resume);
static struct pci_driver i801_driver = …;
static int __init i2c_i801_init(struct pci_driver *drv)
{ … }
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_driver(…);