/** * enum i3c_error_code - I3C error codes * * @I3C_ERROR_UNKNOWN: unknown error, usually means the error is not I3C * related * @I3C_ERROR_M0: M0 error * @I3C_ERROR_M1: M1 error * @I3C_ERROR_M2: M2 error * * These are the standard error codes as defined by the I3C specification. * When -EIO is returned by the i3c_device_do_priv_xfers() or * i3c_device_send_hdr_cmds() one can check the error code in * &struct_i3c_priv_xfer.err or &struct i3c_hdr_cmd.err to get a better idea of * what went wrong. *
*/ enum i3c_error_code {
I3C_ERROR_UNKNOWN = 0,
I3C_ERROR_M0 = 1,
I3C_ERROR_M1,
I3C_ERROR_M2,
};
/** * struct i3c_priv_xfer - I3C SDR private transfer * @rnw: encodes the transfer direction. true for a read, false for a write * @len: transfer length in bytes of the transfer * @actual_len: actual length in bytes are transferred by the controller * @data: input/output buffer * @data.in: input buffer. Must point to a DMA-able buffer * @data.out: output buffer. Must point to a DMA-able buffer * @err: I3C error code
*/ struct i3c_priv_xfer {
u8 rnw;
u16 len;
u16 actual_len; union { void *in; constvoid *out;
} data; enum i3c_error_code err;
};
/** * struct i3c_device_info - I3C device information * @pid: Provisioned ID * @bcr: Bus Characteristic Register * @dcr: Device Characteristic Register * @static_addr: static/I2C address * @dyn_addr: dynamic address * @hdr_cap: supported HDR modes * @max_read_ds: max read speed information * @max_write_ds: max write speed information * @max_ibi_len: max IBI payload length * @max_read_turnaround: max read turn-around time in micro-seconds * @max_read_len: max private SDR read length in bytes * @max_write_len: max private SDR write length in bytes * * These are all basic information that should be advertised by an I3C device. * Some of them are optional depending on the device type and device * capabilities. * For each I3C slave attached to a master with * i3c_master_add_i3c_dev_locked(), the core will send the relevant CCC command * to retrieve these data.
*/ struct i3c_device_info {
u64 pid;
u8 bcr;
u8 dcr;
u8 static_addr;
u8 dyn_addr;
u8 hdr_cap;
u8 max_read_ds;
u8 max_write_ds;
u8 max_ibi_len;
u32 max_read_turnaround;
u16 max_read_len;
u16 max_write_len;
};
/* * I3C device internals are kept hidden from I3C device users. It's just * simpler to refactor things when everything goes through getter/setters, and * I3C device drivers should not have to worry about internal representation * anyway.
*/ struct i3c_device;
/* These macros should be used to i3c_device_id entries. */ #define I3C_MATCH_MANUF_AND_PART (I3C_MATCH_MANUF | I3C_MATCH_PART)
/** * module_i3c_driver() - Register a module providing an I3C driver * @__drv: the I3C driver to register * * Provide generic init/exit functions that simply register/unregister an I3C * driver. * Should be used by any driver that does not require extra init/cleanup steps.
*/ #define module_i3c_driver(__drv) \
module_driver(__drv, i3c_driver_register, i3c_driver_unregister)
/** * i3c_i2c_driver_register() - Register an i2c and an i3c driver * @i3cdrv: the I3C driver to register * @i2cdrv: the I2C driver to register * * This function registers both @i2cdev and @i3cdev, and fails if one of these * registrations fails. This is mainly useful for devices that support both I2C * and I3C modes. * Note that when CONFIG_I3C is not enabled, this function only registers the * I2C driver. * * Return: 0 if both registrations succeeds, a negative error code otherwise.
*/ static __always_inline int i3c_i2c_driver_register(struct i3c_driver *i3cdrv, struct i2c_driver *i2cdrv)
{ int ret;
ret = i2c_add_driver(i2cdrv); if (ret || !IS_ENABLED(CONFIG_I3C)) return ret;
ret = i3c_driver_register(i3cdrv); if (ret)
i2c_del_driver(i2cdrv);
return ret;
}
/** * i3c_i2c_driver_unregister() - Unregister an i2c and an i3c driver * @i3cdrv: the I3C driver to register * @i2cdrv: the I2C driver to register * * This function unregisters both @i3cdrv and @i2cdrv. * Note that when CONFIG_I3C is not enabled, this function only unregisters the * @i2cdrv.
*/ static __always_inline void i3c_i2c_driver_unregister(struct i3c_driver *i3cdrv, struct i2c_driver *i2cdrv)
{ if (IS_ENABLED(CONFIG_I3C))
i3c_driver_unregister(i3cdrv);
i2c_del_driver(i2cdrv);
}
/** * module_i3c_i2c_driver() - Register a module providing an I3C and an I2C * driver * @__i3cdrv: the I3C driver to register * @__i2cdrv: the I2C driver to register * * Provide generic init/exit functions that simply register/unregister an I3C * and an I2C driver. * This macro can be used even if CONFIG_I3C is disabled, in this case, only * the I2C driver will be registered. * Should be used by any driver that does not require extra init/cleanup steps.
*/ #define module_i3c_i2c_driver(__i3cdrv, __i2cdrv) \
module_driver(__i3cdrv, \
i3c_i2c_driver_register, \
i3c_i2c_driver_unregister, \
__i2cdrv)
int i3c_device_do_priv_xfers(struct i3c_device *dev, struct i3c_priv_xfer *xfers, int nxfers);
int i3c_device_do_setdasa(struct i3c_device *dev);
/** * struct i3c_ibi_setup - IBI setup object * @max_payload_len: maximum length of the payload associated to an IBI. If one * IBI appears to have a payload that is bigger than this * number, the IBI will be rejected. * @num_slots: number of pre-allocated IBI slots. This should be chosen so that * the system never runs out of IBI slots, otherwise you'll lose * IBIs. * @handler: IBI handler, every time an IBI is received. This handler is called * in a workqueue context. It is allowed to sleep and send new * messages on the bus, though it's recommended to keep the * processing done there as fast as possible to avoid delaying * processing of other queued on the same workqueue. * * Temporary structure used to pass information to i3c_device_request_ibi(). * This object can be allocated on the stack since i3c_device_request_ibi() * copies every bit of information and do not use it after * i3c_device_request_ibi() has returned.
*/ struct i3c_ibi_setup { unsignedint max_payload_len; unsignedint num_slots; void (*handler)(struct i3c_device *dev, conststruct i3c_ibi_payload *payload);
};
int i3c_device_request_ibi(struct i3c_device *dev, conststruct i3c_ibi_setup *setup); void i3c_device_free_ibi(struct i3c_device *dev); int i3c_device_enable_ibi(struct i3c_device *dev); int i3c_device_disable_ibi(struct i3c_device *dev);
#endif/* I3C_DEV_H */
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.