linux/drivers/i2c/muxes/i2c-mux-pca954x.c

// SPDX-License-Identifier: GPL-2.0
/*
 * I2C multiplexer
 *
 * Copyright (c) 2008-2009 Rodolfo Giometti <[email protected]>
 * Copyright (c) 2008-2009 Eurotech S.p.A. <[email protected]>
 *
 * This module supports the PCA954x and PCA984x series of I2C multiplexer/switch
 * chips made by NXP Semiconductors.
 * This includes the:
 *	 PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547,
 *	 PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849.
 *
 * It's also compatible to Maxims MAX735x I2C switch chips, which are controlled
 * as the NXP PCA9548 and the MAX736x chips that act like the PCA9544.
 *
 * This includes the:
 *	 MAX7356, MAX7357, MAX7358, MAX7367, MAX7368 and MAX7369
 *
 * These chips are all controlled via the I2C bus itself, and all have a
 * single 8-bit register. The upstream "parent" bus fans out to two,
 * four, or eight downstream busses or channels; which of these
 * are selected is determined by the chip type and register contents. A
 * mux can select only one sub-bus at a time; a switch can select any
 * combination simultaneously.
 *
 * Based on:
 *	pca954x.c from Kumar Gala <[email protected]>
 * Copyright (C) 2006
 *
 * Based on:
 *	pca954x.c from Ken Harrenstien
 * Copyright (C) 2004 Google, Inc. (Ken Harrenstien)
 *
 * Based on:
 *	i2c-virtual_cb.c from Brian Kuschak <[email protected]>
 * and
 *	pca9540.c from Jean Delvare <[email protected]>.
 */

#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <dt-bindings/mux/mux.h>

#define PCA954X_MAX_NCHANS

#define PCA954X_IRQ_OFFSET

/*
 * MAX7357's configuration register is writeable after POR, but
 * can be locked by setting the basic mode bit. MAX7358 configuration
 * register is locked by default and needs to be unlocked first.
 * The configuration register holds the following settings:
 */
#define MAX7357_CONF_INT_ENABLE
#define MAX7357_CONF_FLUSH_OUT
#define MAX7357_CONF_RELEASE_INT
#define MAX7357_CONF_DISCON_SINGLE_CHAN
#define MAX7357_CONF_PRECONNECT_TEST

#define MAX7357_POR_DEFAULT_CONF

enum pca_type {};

struct chip_desc {};

struct pca954x {};

/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */
static const struct chip_desc chips[] =;

static const struct i2c_device_id pca954x_id[] =;
MODULE_DEVICE_TABLE(i2c, pca954x_id);

static const struct of_device_id pca954x_of_match[] =;
MODULE_DEVICE_TABLE(of, pca954x_of_match);

/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer()
   for this as they will try to lock adapter a second time */
static int pca954x_reg_write(struct i2c_adapter *adap,
			     struct i2c_client *client, u8 val)
{}

static u8 pca954x_regval(struct pca954x *data, u8 chan)
{}

static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan)
{}

static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
{}

static ssize_t idle_state_show(struct device *dev,
				    struct device_attribute *attr,
				    char *buf)
{}

static ssize_t idle_state_store(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}

static DEVICE_ATTR_RW(idle_state);

static irqreturn_t pca954x_irq_handler(int irq, void *dev_id)
{}

static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type)
{}

static struct irq_chip pca954x_irq_chip =;

static int pca954x_irq_setup(struct i2c_mux_core *muxc)
{}

static void pca954x_cleanup(struct i2c_mux_core *muxc)
{}

static int pca954x_init(struct i2c_client *client, struct pca954x *data)
{}

static int pca954x_get_reset(struct device *dev, struct pca954x *data)
{}

static void pca954x_reset_deassert(struct pca954x *data)
{}

/*
 * I2C init/probing/exit functions
 */
static int pca954x_probe(struct i2c_client *client)
{}

static void pca954x_remove(struct i2c_client *client)
{}

static int pca954x_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume);

static struct i2c_driver pca954x_driver =;

module_i2c_driver();

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