/* SPDX-License-Identifier: GPL-2.0 */


#ifndef _LINUX_I2C_ATR_H
#define _LINUX_I2C_ATR_H

#include <linux/i2c.h>
#include <linux/types.h>

struct device;
struct fwnode_handle;
struct i2c_atr;


enum i2c_atr_flags {
	I2C_ATR_F_STATIC = BIT(0),
	I2C_ATR_F_PASSTHROUGH = BIT(1),
};


struct i2c_atr_ops {
	int (*attach_addr)(struct i2c_atr *atr, u32 chan_id,
			   u16 addr, u16 alias);
	void (*detach_addr)(struct i2c_atr *atr, u32 chan_id,
			    u16 addr);
};


struct i2c_atr_adap_desc {
	u32 chan_id;
	struct device *parent;
	struct fwnode_handle *bus_handle;
	size_t num_aliases;
	u16 *aliases;
};


struct i2c_atr *i2c_atr_new(struct i2c_adapter *parent, struct device *dev,
			    const struct i2c_atr_ops *ops, int max_adapters,
			    u32 flags);


void i2c_atr_delete(struct i2c_atr *atr);


int i2c_atr_add_adapter(struct i2c_atr *atr, struct i2c_atr_adap_desc *desc);


void i2c_atr_del_adapter(struct i2c_atr *atr, u32 chan_id);


void i2c_atr_set_driver_data(struct i2c_atr *atr, void *data);


void *i2c_atr_get_driver_data(struct i2c_atr *atr);

#endif 
