Lines Matching +full:i2c +full:- +full:controller

1 /* SPDX-License-Identifier: GPL-2.0 */
14 #include <linux/i2c.h>
31 * struct i3c_i2c_dev_desc - Common part of the I3C/I2C device descriptor
32 * @node: node element used to insert the slot into the I2C or I3C device
35 * I2C/I3C transfers
39 * This structure is describing common I3C/I2C dev information.
54 * struct i2c_dev_boardinfo - I2C device board information
55 * @node: used to insert the boardinfo object in the I2C boardinfo list
56 * @base: regular I2C board information
58 * the I2C device limitations
60 * This structure is used to attach board-level information to an I2C device.
61 * Each I2C device connected on the I3C bus should have one.
70 * struct i2c_dev_desc - I2C device descriptor
71 * @common: common part of the I2C device descriptor
72 * @boardinfo: pointer to the boardinfo attached to this I2C device
73 * @dev: I2C device object registered to the I2C framework
74 * @addr: I2C device address
76 * the I2C device limitations
78 * Each I2C device connected on the bus will have an i2c_dev_desc.
79 * This object is created by the core and later attached to the controller
80 * using &struct_i3c_master_controller->ops->attach_i2c_dev().
82 * &struct_i2c_dev_desc is the internal representation of an I2C device
95 * struct i3c_ibi_slot - I3C IBI (In-Band Interrupt) slot
102 * An IBI slot is an object pre-allocated by the controller and used when an
109 * simple kmalloc-based allocation, the generic IBI slot pool can be used.
119 * struct i3c_device_ibi_info - IBI information attached to a specific device
124 * work element queued to the controller workqueue
133 * handler will be called from the controller workqueue, and as such
146 * controller-private data.
159 * struct i3c_dev_boardinfo - I3C device board information
174 * This structure is used to attach board-level information to an I3C device.
188 * struct i3c_dev_desc - I3C device descriptor
192 * @ibi_lock: lock used to protect the &struct_i3c_device->ibi
196 * should never be accessed from I3C master controller drivers. Only core
197 * code should manipulate it in when updating the dev <-> desc link or
202 * core and passed to I3C master controller drivers when they're requested to
217 * struct i3c_device - I3C device object
240 * reference and should be adjusted on a per-controller/per-board basis.
251 * enum i3c_bus_mode - I3C bus mode
254 * @I3C_BUS_MODE_MIXED_FAST: I2C devices with 50ns spike filter are present on
256 * high SCL pulse has to stay below 50ns to trick I2C
258 * @I3C_BUS_MODE_MIXED_LIMITED: I2C devices without 50ns spike filter are
262 * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present
273 * enum i3c_addr_slot_status - I3C address slot status
276 * @I3C_ADDR_SLOT_I2C_DEV: address is assigned to an I2C device
295 * struct i3c_bus - I3C bus object
296 * @cur_master: I3C master currently driving the bus. Since I3C is multi-master
301 * @addrslots: a bitmap with 2-bits per-slot to encode the address status and
307 * @scl_rate.i2c: maximum rate for the clock signal when doing I2C transfers
308 * @scl_rate: SCL signal rate for I3C and I2C mode
312 * @devs.i2c: contains a list of I2C device descriptors representing I2C
315 * @devs: 2 lists containing all I3C/I2C devices connected to the bus
322 * devices: several drivers can send different I3C/I2C frames through
328 * by the I3C master to cope with the multi-master functionality, where one bus
339 unsigned long i2c; member
343 struct list_head i2c; member
349 * struct i3c_master_controller_ops - I3C master methods
352 * You can also put controller specific initialization in there.
355 * &i3c_master_controller_ops->bus_init().
363 * This is a good place to attach master controller specific
379 * attached or re-attached to the controller.
389 * @attach_i2c_dev: called every time an I2C device is attached to the bus.
390 * This is a good place to attach master controller specific
391 * data to I2C devices.
393 * @detach_i2c_dev: called when an I2C device is detached from the bus. Usually
396 * @i2c_xfers: do one or several I2C transfers. Note that, unlike i3c
398 * the transfers are DMA-safe. If drivers want to have DMA-safe
400 * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C
405 * length and number of pre-allocated slots).
406 * Some controllers support less IBI-capable devices than regular
407 * devices, so this method might return -%EBUSY if there's no
410 * @free_ibi: free an IBI previously requested with ->request_ibi(). The IBI
411 * should have been disabled with ->disable_irq() prior to that
412 * This method is mandatory only if ->request_ibi is not NULL.
413 * @enable_ibi: enable the IBI. Only valid if ->request_ibi() has been called
414 * prior to ->enable_ibi(). The controller should first enable
415 * the IBI on the controller end (for example, unmask the hardware
418 * This method is mandatory only if ->request_ibi is not NULL.
421 * controller end.
422 * This method is mandatory only if ->request_ibi is not NULL.
425 * in the IBI slot pool so that the controller can re-use it
427 * This method is mandatory only if ->request_ibi is not
458 * struct i3c_master_controller - I3C master controller object
459 * @dev: device to be registered to the device-model
462 * @i2c: I2C adapter used for backward compatibility. This adapter is
463 * registered to the I2C subsystem to be as transparent as possible to
464 * existing I2C drivers
469 * @boardinfo.i2c: list of I2C boardinfo objects
470 * @boardinfo: board-level information attached to devices connected on the bus
476 * be done from a sleep-able context
486 struct i2c_adapter i2c; member
492 struct list_head i2c; member
499 * i3c_bus_for_each_i2cdev() - iterate over all I2C devices present on the bus
501 * @dev: an I2C device descriptor pointer updated to point to the current slot
504 * Iterate over all I2C devs present on the bus.
507 list_for_each_entry(dev, &(bus)->devs.i2c, common.node)
510 * i3c_bus_for_each_i3cdev() - iterate over all I3C devices present on the bus
518 list_for_each_entry(dev, &(bus)->devs.i3c, common.node)
548 * i3c_dev_get_master_data() - get master private data attached to an I3C
557 return dev->common.master_priv; in i3c_dev_get_master_data()
561 * i3c_dev_set_master_data() - attach master private data to an I3C device
566 * This functions allows a master controller to attach per-device private data
572 dev->common.master_priv = data; in i3c_dev_set_master_data()
576 * i2c_dev_get_master_data() - get master private data attached to an I2C
578 * @dev: the I2C device descriptor to get private data from
585 return dev->common.master_priv; in i2c_dev_get_master_data()
589 * i2c_dev_set_master_data() - attach master private data to an I2C device
591 * @dev: the I2C device descriptor to attach private data to
594 * This functions allows a master controller to attach per-device private data
600 dev->common.master_priv = data; in i2c_dev_set_master_data()
604 * i3c_dev_get_master() - get master used to communicate with a device
607 * Return: the master controller driving @dev
612 return dev->common.master; in i3c_dev_get_master()
616 * i2c_dev_get_master() - get master used to communicate with a device
617 * @dev: I2C dev
619 * Return: the master controller driving @dev
624 return dev->common.master; in i2c_dev_get_master()
628 * i3c_master_get_bus() - get the bus attached to a master
636 return &master->bus; in i3c_master_get_bus()