linux/drivers/i2c/busses/i2c-qcom-geni.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.

#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/dma/qcom-gpi-dma.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/soc/qcom/geni-se.h>
#include <linux/spinlock.h>

#define SE_I2C_TX_TRANS_LEN
#define SE_I2C_RX_TRANS_LEN
#define SE_I2C_SCL_COUNTERS

#define SE_I2C_ERR
#define SE_I2C_ABORT

/* M_CMD OP codes for I2C */
#define I2C_WRITE
#define I2C_READ
#define I2C_WRITE_READ
#define I2C_ADDR_ONLY
#define I2C_BUS_CLEAR
#define I2C_STOP_ON_BUS
/* M_CMD params for I2C */
#define PRE_CMD_DELAY
#define TIMESTAMP_BEFORE
#define STOP_STRETCH
#define TIMESTAMP_AFTER
#define POST_COMMAND_DELAY
#define IGNORE_ADD_NACK
#define READ_FINISHED_WITH_ACK
#define BYPASS_ADDR_PHASE
#define SLV_ADDR_MSK
#define SLV_ADDR_SHFT
/* I2C SCL COUNTER fields */
#define HIGH_COUNTER_MSK
#define HIGH_COUNTER_SHFT
#define LOW_COUNTER_MSK
#define LOW_COUNTER_SHFT
#define CYCLE_COUNTER_MSK

#define I2C_PACK_TX
#define I2C_PACK_RX

enum geni_i2c_err_code {};

#define DM_I2C_CB_ERR

#define I2C_AUTO_SUSPEND_DELAY
#define KHZ(freq)
#define PACKING_BYTES_PW

#define ABORT_TIMEOUT
#define XFER_TIMEOUT
#define RST_TIMEOUT

struct geni_i2c_dev {};

struct geni_i2c_desc {};

struct geni_i2c_err_log {};

static const struct geni_i2c_err_log gi2c_log[] =;

struct geni_i2c_clk_fld {};

/*
 * Hardware uses the underlying formula to calculate time periods of
 * SCL clock cycle. Firmware uses some additional cycles excluded from the
 * below formula and it is confirmed that the time periods are within
 * specification limits.
 *
 * time of high period of SCL: t_high = (t_high_cnt * clk_div) / source_clock
 * time of low period of SCL: t_low = (t_low_cnt * clk_div) / source_clock
 * time of full period of SCL: t_cycle = (t_cycle_cnt * clk_div) / source_clock
 * clk_freq_out = t / t_cycle
 * source_clock = 19.2 MHz
 */
static const struct geni_i2c_clk_fld geni_i2c_clk_map[] =;

static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c)
{}

static void qcom_geni_i2c_conf(struct geni_i2c_dev *gi2c)
{}

static void geni_i2c_err_misc(struct geni_i2c_dev *gi2c)
{}

static void geni_i2c_err(struct geni_i2c_dev *gi2c, int err)
{}

static irqreturn_t geni_i2c_irq(int irq, void *dev)
{}

static void geni_i2c_abort_xfer(struct geni_i2c_dev *gi2c)
{}

static void geni_i2c_rx_fsm_rst(struct geni_i2c_dev *gi2c)
{}

static void geni_i2c_tx_fsm_rst(struct geni_i2c_dev *gi2c)
{}

static void geni_i2c_rx_msg_cleanup(struct geni_i2c_dev *gi2c,
				     struct i2c_msg *cur)
{}

static void geni_i2c_tx_msg_cleanup(struct geni_i2c_dev *gi2c,
				     struct i2c_msg *cur)
{}

static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
				u32 m_param)
{}

static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
				u32 m_param)
{}

static void i2c_gpi_cb_result(void *cb, const struct dmaengine_result *result)
{}

static void geni_i2c_gpi_unmap(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
			       void *tx_buf, dma_addr_t tx_addr,
			       void *rx_buf, dma_addr_t rx_addr)
{}

static int geni_i2c_gpi(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
			struct dma_slave_config *config, dma_addr_t *dma_addr_p,
			void **buf, unsigned int op, struct dma_chan *dma_chan)
{}

static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], int num)
{}

static int geni_i2c_fifo_xfer(struct geni_i2c_dev *gi2c,
			      struct i2c_msg msgs[], int num)
{}

static int geni_i2c_xfer(struct i2c_adapter *adap,
			 struct i2c_msg msgs[],
			 int num)
{}

static u32 geni_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm geni_i2c_algo =;

#ifdef CONFIG_ACPI
static const struct acpi_device_id geni_i2c_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match);
#endif

static void release_gpi_dma(struct geni_i2c_dev *gi2c)
{}

static int setup_gpi_dma(struct geni_i2c_dev *gi2c)
{}

static int geni_i2c_probe(struct platform_device *pdev)
{}

static void geni_i2c_remove(struct platform_device *pdev)
{}

static void geni_i2c_shutdown(struct platform_device *pdev)
{}

static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
{}

static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
{}

static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev)
{}

static int __maybe_unused geni_i2c_resume_noirq(struct device *dev)
{}

static const struct dev_pm_ops geni_i2c_pm_ops =;

static const struct geni_i2c_desc i2c_master_hub =;

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

static struct platform_driver geni_i2c_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();