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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Bitbanging I2C bus driver using the GPIO API
 *
 * Copyright (C) 2007 Atmel Corporation
 */
#include <linux/completion.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c-algo-bit.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_data/i2c-gpio.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>

struct i2c_gpio_private_data {};

/*
 * Toggle SDA by changing the output value of the pin. This is only
 * valid for pins configured as open drain (i.e. setting the value
 * high effectively turns off the output driver.)
 */
static void i2c_gpio_setsda_val(void *data, int state)
{}

/*
 * Toggle SCL by changing the output value of the pin. This is used
 * for pins that are configured as open drain and for output-only
 * pins. The latter case will break the i2c protocol, but it will
 * often work in practice.
 */
static void i2c_gpio_setscl_val(void *data, int state)
{}

static int i2c_gpio_getsda(void *data)
{}

static int i2c_gpio_getscl(void *data)
{}

#ifdef CONFIG_I2C_GPIO_FAULT_INJECTOR

#define setsda(bd, val)
#define setscl(bd, val)
#define getsda(bd)
#define getscl(bd)

#define WIRE_ATTRIBUTE(wire)

WIRE_ATTRIBUTE();
WIRE_ATTRIBUTE();

static void i2c_gpio_incomplete_transfer(struct i2c_gpio_private_data *priv,
					u32 pattern, u8 pattern_size)
{}

static int fops_incomplete_addr_phase_set(void *data, u64 addr)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

static int fops_incomplete_write_byte_set(void *data, u64 addr)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

static int i2c_gpio_fi_act_on_scl_irq(struct i2c_gpio_private_data *priv,
				       irqreturn_t handler(int, void*))
{}

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

static int fops_lose_arbitration_set(void *data, u64 duration)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

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

static int fops_inject_panic_set(void *data, u64 duration)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

static void i2c_gpio_fault_injector_init(struct platform_device *pdev)
{}
#else
static inline void i2c_gpio_fault_injector_init(struct platform_device *pdev) {}
#endif /* CONFIG_I2C_GPIO_FAULT_INJECTOR*/

/* Get i2c-gpio properties from DT or ACPI table */
static void i2c_gpio_get_properties(struct device *dev,
				    struct i2c_gpio_platform_data *pdata)
{}

static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,
					   const char *con_id,
					   unsigned int index,
					   enum gpiod_flags gflags)
{}

static int i2c_gpio_probe(struct platform_device *pdev)
{}

static void i2c_gpio_remove(struct platform_device *pdev)
{}

static const struct of_device_id i2c_gpio_dt_ids[] =;

MODULE_DEVICE_TABLE(of, i2c_gpio_dt_ids);

static const struct acpi_device_id i2c_gpio_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, i2c_gpio_acpi_match);

static struct platform_driver i2c_gpio_driver =;

static int __init i2c_gpio_init(void)
{}
subsys_initcall(i2c_gpio_init);

static void __exit i2c_gpio_exit(void)
{}
module_exit(i2c_gpio_exit);

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