linux/drivers/i2c/busses/i2c-viapro.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
    Copyright (c) 1998 - 2002  Frodo Looijaard <[email protected]>,
    Philip Edelbrock <[email protected]>, Kyösti Mälkki <[email protected]>,
    Mark D. Studebaker <[email protected]>
    Copyright (C) 2005 - 2008  Jean Delvare <[email protected]>

*/

/*
   Supports the following VIA south bridges:

   Chip name          PCI ID  REV     I2C block
   VT82C596A          0x3050             no
   VT82C596B          0x3051             no
   VT82C686A          0x3057  0x30       no
   VT82C686B          0x3057  0x40       yes
   VT8231             0x8235             no?
   VT8233             0x3074             yes
   VT8233A            0x3147             yes?
   VT8235             0x3177             yes
   VT8237R            0x3227             yes
   VT8237A            0x3337             yes
   VT8237S            0x3372             yes
   VT8251             0x3287             yes
   CX700              0x8324             yes
   VX800/VX820        0x8353             yes
   VX855/VX875        0x8409             yes

   Note: we assume there can only be one device, with one SMBus interface.
*/

#include <linux/module.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/io.h>

static struct pci_dev *vt596_pdev;

#define SMBBA1
#define SMBBA2
#define SMBBA3

/* SMBus address offsets */
static unsigned short vt596_smba;
#define SMBHSTSTS
#define SMBHSTCNT
#define SMBHSTCMD
#define SMBHSTADD
#define SMBHSTDAT0
#define SMBHSTDAT1
#define SMBBLKDAT

/* PCI Address Constants */

/* SMBus data in configuration space can be found in two places,
   We try to select the better one */

static unsigned short SMBHSTCFG =;

/* Other settings */
#define MAX_TIMEOUT

/* VT82C596 constants */
#define VT596_QUICK
#define VT596_BYTE
#define VT596_BYTE_DATA
#define VT596_WORD_DATA
#define VT596_PROC_CALL
#define VT596_BLOCK_DATA
#define VT596_I2C_BLOCK_DATA


/* If force is set to anything different from 0, we forcibly enable the
   VT596. DANGEROUS! */
static bool force;
module_param(force, bool, 0);
MODULE_PARM_DESC();

/* If force_addr is set to anything different from 0, we forcibly enable
   the VT596 at the given address. VERY DANGEROUS! */
static u16 force_addr;
module_param_hw(force_addr, ushort, ioport, 0);
MODULE_PARM_DESC();


static struct pci_driver vt596_driver;
static struct i2c_adapter vt596_adapter;

#define FEATURE_I2CBLOCK
static unsigned int vt596_features;

#ifdef DEBUG
static void vt596_dump_regs(const char *msg, u8 size)
{}
#else
static inline void vt596_dump_regs(const char *msg, u8 size) { }
#endif

/* Return -1 on error, 0 on success */
static int vt596_transaction(u8 size)
{}

/* Return negative errno on error, 0 on success */
static s32 vt596_access(struct i2c_adapter *adap, u16 addr,
		unsigned short flags, char read_write, u8 command,
		int size, union i2c_smbus_data *data)
{}

static u32 vt596_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm smbus_algorithm =;

static struct i2c_adapter vt596_adapter =;

static int vt596_probe(struct pci_dev *pdev,
		       const struct pci_device_id *id)
{}

static const struct pci_device_id vt596_ids[] =;

MODULE_DEVICE_TABLE(pci, vt596_ids);

static struct pci_driver vt596_driver =;

static int __init i2c_vt596_init(void)
{}


static void __exit i2c_vt596_exit(void)
{}

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

module_init();
module_exit(i2c_vt596_exit);