#include <linux/atomic.h>
#include <linux/bug.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include "internals.h"
static DEFINE_IDR(i3c_bus_idr);
static DEFINE_MUTEX(i3c_core_lock);
static int __i3c_first_dynamic_bus_num;
static BLOCKING_NOTIFIER_HEAD(i3c_bus_notifier);
static void i3c_bus_maintenance_lock(struct i3c_bus *bus)
{ … }
static void i3c_bus_maintenance_unlock(struct i3c_bus *bus)
{ … }
void i3c_bus_normaluse_lock(struct i3c_bus *bus)
{ … }
void i3c_bus_normaluse_unlock(struct i3c_bus *bus)
{ … }
static struct i3c_master_controller *
i3c_bus_to_i3c_master(struct i3c_bus *i3cbus)
{ … }
static struct i3c_master_controller *dev_to_i3cmaster(struct device *dev)
{ … }
static const struct device_type i3c_device_type;
static struct i3c_bus *dev_to_i3cbus(struct device *dev)
{ … }
static struct i3c_dev_desc *dev_to_i3cdesc(struct device *dev)
{ … }
static ssize_t bcr_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(bcr);
static ssize_t dcr_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(dcr);
static ssize_t pid_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(pid);
static ssize_t dynamic_address_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(dynamic_address);
static const char * const hdrcap_strings[] = …;
static ssize_t hdrcap_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(hdrcap);
static ssize_t modalias_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static DEVICE_ATTR_RO(modalias);
static struct attribute *i3c_device_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int i3c_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
static const struct device_type i3c_device_type = …;
static int i3c_device_match(struct device *dev, const struct device_driver *drv)
{ … }
static int i3c_device_probe(struct device *dev)
{ … }
static void i3c_device_remove(struct device *dev)
{ … }
const struct bus_type i3c_bus_type = …;
EXPORT_SYMBOL_GPL(…);
static enum i3c_addr_slot_status
i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
{ … }
static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
enum i3c_addr_slot_status status)
{ … }
static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr)
{ … }
static int i3c_bus_get_free_addr(struct i3c_bus *bus, u8 start_addr)
{ … }
static void i3c_bus_init_addrslots(struct i3c_bus *bus)
{ … }
static void i3c_bus_cleanup(struct i3c_bus *i3cbus)
{ … }
static int i3c_bus_init(struct i3c_bus *i3cbus, struct device_node *np)
{ … }
void i3c_for_each_bus_locked(int (*fn)(struct i3c_bus *bus, void *data),
void *data)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_register_notifier(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_unregister_notifier(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
static void i3c_bus_notify(struct i3c_bus *bus, unsigned int action)
{ … }
static const char * const i3c_bus_mode_strings[] = …;
static ssize_t mode_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(mode);
static ssize_t current_master_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(current_master);
static ssize_t i3c_scl_frequency_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(i3c_scl_frequency);
static ssize_t i2c_scl_frequency_show(struct device *dev,
struct device_attribute *da,
char *buf)
{ … }
static DEVICE_ATTR_RO(i2c_scl_frequency);
static int i3c_set_hotjoin(struct i3c_master_controller *master, bool enable)
{ … }
static ssize_t hotjoin_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
int i3c_master_enable_hotjoin(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_master_disable_hotjoin(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t hotjoin_show(struct device *dev, struct device_attribute *da, char *buf)
{ … }
static DEVICE_ATTR_RW(hotjoin);
static struct attribute *i3c_masterdev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void i3c_masterdev_release(struct device *dev)
{ … }
static const struct device_type i3c_masterdev_type = …;
static int i3c_bus_set_mode(struct i3c_bus *i3cbus, enum i3c_bus_mode mode,
unsigned long max_i2c_scl_rate)
{ … }
static struct i3c_master_controller *
i2c_adapter_to_i3c_master(struct i2c_adapter *adap)
{ … }
static struct i2c_adapter *
i3c_master_to_i2c_adapter(struct i3c_master_controller *master)
{ … }
static void i3c_master_free_i2c_dev(struct i2c_dev_desc *dev)
{ … }
static struct i2c_dev_desc *
i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
u16 addr, u8 lvr)
{ … }
static void *i3c_ccc_cmd_dest_init(struct i3c_ccc_cmd_dest *dest, u8 addr,
u16 payloadlen)
{ … }
static void i3c_ccc_cmd_dest_cleanup(struct i3c_ccc_cmd_dest *dest)
{ … }
static void i3c_ccc_cmd_init(struct i3c_ccc_cmd *cmd, bool rnw, u8 id,
struct i3c_ccc_cmd_dest *dests,
unsigned int ndests)
{ … }
static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master,
struct i3c_ccc_cmd *cmd)
{ … }
static struct i2c_dev_desc *
i3c_master_find_i2c_dev_by_addr(const struct i3c_master_controller *master,
u16 addr)
{ … }
int i3c_master_get_free_addr(struct i3c_master_controller *master,
u8 start_addr)
{ … }
EXPORT_SYMBOL_GPL(…);
static void i3c_device_release(struct device *dev)
{ … }
static void i3c_master_free_i3c_dev(struct i3c_dev_desc *dev)
{ … }
static struct i3c_dev_desc *
i3c_master_alloc_i3c_dev(struct i3c_master_controller *master,
const struct i3c_device_info *info)
{ … }
static int i3c_master_rstdaa_locked(struct i3c_master_controller *master,
u8 addr)
{ … }
int i3c_master_entdaa_locked(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,
u8 addr, bool enable, u8 evts)
{ … }
int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr,
u8 evts)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr,
u8 evts)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_master_defslvs_locked(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
static int i3c_master_setda_locked(struct i3c_master_controller *master,
u8 oldaddr, u8 newaddr, bool setdasa)
{ … }
static int i3c_master_setdasa_locked(struct i3c_master_controller *master,
u8 static_addr, u8 dyn_addr)
{ … }
static int i3c_master_setnewda_locked(struct i3c_master_controller *master,
u8 oldaddr, u8 newaddr)
{ … }
static int i3c_master_getmrl_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_getmwl_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_getmxds_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_gethdrcap_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_getpid_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_getbcr_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_getdcr_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{ … }
static int i3c_master_retrieve_dev_info(struct i3c_dev_desc *dev)
{ … }
static void i3c_master_put_i3c_addrs(struct i3c_dev_desc *dev)
{ … }
static int i3c_master_get_i3c_addrs(struct i3c_dev_desc *dev)
{ … }
static int i3c_master_attach_i3c_dev(struct i3c_master_controller *master,
struct i3c_dev_desc *dev)
{ … }
static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
u8 old_dyn_addr)
{ … }
static void i3c_master_detach_i3c_dev(struct i3c_dev_desc *dev)
{ … }
static int i3c_master_attach_i2c_dev(struct i3c_master_controller *master,
struct i2c_dev_desc *dev)
{ … }
static void i3c_master_detach_i2c_dev(struct i2c_dev_desc *dev)
{ … }
static int i3c_master_early_i3c_dev_add(struct i3c_master_controller *master,
struct i3c_dev_boardinfo *boardinfo)
{ … }
static void
i3c_master_register_new_i3c_devs(struct i3c_master_controller *master)
{ … }
int i3c_master_do_daa(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_master_set_info(struct i3c_master_controller *master,
const struct i3c_device_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
{ … }
static int i3c_master_bus_init(struct i3c_master_controller *master)
{ … }
static void i3c_master_bus_cleanup(struct i3c_master_controller *master)
{ … }
static void i3c_master_attach_boardinfo(struct i3c_dev_desc *i3cdev)
{ … }
static struct i3c_dev_desc *
i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev)
{ … }
int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
u8 addr)
{ … }
EXPORT_SYMBOL_GPL(…);
#define OF_I3C_REG1_IS_I2C_DEV …
static int
of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master,
struct device_node *node, u32 *reg)
{ … }
static int
of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master,
struct device_node *node, u32 *reg)
{ … }
static int of_i3c_master_add_dev(struct i3c_master_controller *master,
struct device_node *node)
{ … }
static int of_populate_i3c_bus(struct i3c_master_controller *master)
{ … }
static int i3c_master_i2c_adapter_xfer(struct i2c_adapter *adap,
struct i2c_msg *xfers, int nxfers)
{ … }
static u32 i3c_master_i2c_funcs(struct i2c_adapter *adapter)
{ … }
static u8 i3c_master_i2c_get_lvr(struct i2c_client *client)
{ … }
static int i3c_master_i2c_attach(struct i2c_adapter *adap, struct i2c_client *client)
{ … }
static int i3c_master_i2c_detach(struct i2c_adapter *adap, struct i2c_client *client)
{ … }
static const struct i2c_algorithm i3c_master_i2c_algo = …;
static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long action,
void *data)
{ … }
static struct notifier_block i2cdev_notifier = …;
static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
{ … }
static void i3c_master_i2c_adapter_cleanup(struct i3c_master_controller *master)
{ … }
static void i3c_master_unregister_i3c_devs(struct i3c_master_controller *master)
{ … }
void i3c_master_queue_ibi(struct i3c_dev_desc *dev, struct i3c_ibi_slot *slot)
{ … }
EXPORT_SYMBOL_GPL(…);
static void i3c_master_handle_ibi(struct work_struct *work)
{ … }
static void i3c_master_init_ibi_slot(struct i3c_dev_desc *dev,
struct i3c_ibi_slot *slot)
{ … }
struct i3c_generic_ibi_slot { … };
struct i3c_generic_ibi_pool { … };
void i3c_generic_ibi_free_pool(struct i3c_generic_ibi_pool *pool)
{ … }
EXPORT_SYMBOL_GPL(…);
struct i3c_generic_ibi_pool *
i3c_generic_ibi_alloc_pool(struct i3c_dev_desc *dev,
const struct i3c_ibi_setup *req)
{ … }
EXPORT_SYMBOL_GPL(…);
struct i3c_ibi_slot *
i3c_generic_ibi_get_free_slot(struct i3c_generic_ibi_pool *pool)
{ … }
EXPORT_SYMBOL_GPL(…);
void i3c_generic_ibi_recycle_slot(struct i3c_generic_ibi_pool *pool,
struct i3c_ibi_slot *s)
{ … }
EXPORT_SYMBOL_GPL(…);
static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops)
{ … }
int i3c_master_register(struct i3c_master_controller *master,
struct device *parent,
const struct i3c_master_controller_ops *ops,
bool secondary)
{ … }
EXPORT_SYMBOL_GPL(…);
void i3c_master_unregister(struct i3c_master_controller *master)
{ … }
EXPORT_SYMBOL_GPL(…);
int i3c_dev_setdasa_locked(struct i3c_dev_desc *dev)
{ … }
int i3c_dev_do_priv_xfers_locked(struct i3c_dev_desc *dev,
struct i3c_priv_xfer *xfers,
int nxfers)
{ … }
int i3c_dev_disable_ibi_locked(struct i3c_dev_desc *dev)
{ … }
int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev)
{ … }
int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev,
const struct i3c_ibi_setup *req)
{ … }
void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
{ … }
static int __init i3c_init(void)
{ … }
subsys_initcall(i3c_init);
static void __exit i3c_exit(void)
{ … }
module_exit(i3c_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;