drivers/input/rmi4/rmi_bus.h

Source file repositories/reference/linux-study-clean/drivers/input/rmi4/rmi_bus.h

File Facts

System
Linux kernel
Corpus path
drivers/input/rmi4/rmi_bus.h
Extension
.h
Size
6095 bytes
Lines
200
Domain
Driver Families
Bucket
drivers/input
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct device_driver driver;

	u8 func;

	int (*probe)(struct rmi_function *fn);
	void (*remove)(struct rmi_function *fn);
	int (*config)(struct rmi_function *fn);
	int (*reset)(struct rmi_function *fn);
	irqreturn_t (*attention)(int irq, void *ctx);
	int (*suspend)(struct rmi_function *fn);
	int (*resume)(struct rmi_function *fn);
};

#define to_rmi_function_handler(d) \
		container_of_const(d, struct rmi_function_handler, driver)

int __must_check __rmi_register_function_handler(struct rmi_function_handler *,
						 struct module *, const char *);
#define rmi_register_function_handler(handler) \
	__rmi_register_function_handler(handler, THIS_MODULE, KBUILD_MODNAME)

void rmi_unregister_function_handler(struct rmi_function_handler *);

#define to_rmi_driver(d) \
	container_of(d, struct rmi_driver, driver)

#define to_rmi_device(d) container_of(d, struct rmi_device, dev)

static inline struct rmi_device_platform_data *
rmi_get_platform_data(struct rmi_device *d)
{
	return &d->xport->pdata;
}

bool rmi_is_physical_device(struct device *dev);

/**
 * rmi_reset - reset a RMI4 device
 * @d: Pointer to an RMI device
 *
 * Calls for a reset of each function implemented by a specific device.
 * Returns 0 on success or a negative error code.
 */
static inline int rmi_reset(struct rmi_device *d)
{
	return d->driver->reset_handler(d);
}

/**
 * rmi_read - read a single byte
 * @d: Pointer to an RMI device
 * @addr: The address to read from
 * @buf: The read buffer
 *
 * Reads a single byte of data using the underlying transport protocol
 * into memory pointed by @buf. It returns 0 on success or a negative
 * error code.
 */
static inline int rmi_read(struct rmi_device *d, u16 addr, u8 *buf)
{
	return d->xport->ops->read_block(d->xport, addr, buf, 1);
}

/**
 * rmi_read_block - read a block of bytes
 * @d: Pointer to an RMI device
 * @addr: The start address to read from
 * @buf: The read buffer
 * @len: Length of the read buffer
 *
 * Reads a block of byte data using the underlying transport protocol
 * into memory pointed by @buf. It returns 0 on success or a negative
 * error code.
 */
static inline int rmi_read_block(struct rmi_device *d, u16 addr,
				 void *buf, size_t len)
{
	return d->xport->ops->read_block(d->xport, addr, buf, len);
}

/**
 * rmi_write - write a single byte
 * @d: Pointer to an RMI device
 * @addr: The address to write to
 * @data: The data to write
 *
 * Writes a single byte using the underlying transport protocol. It
 * returns zero on success or a negative error code.
 */
static inline int rmi_write(struct rmi_device *d, u16 addr, u8 data)

Annotation

Implementation Notes