Lines Matching +full:mode +full:- +full:recovery
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * i2c.h - definitions for the Linux i2c bus interface
4 * Copyright (C) 1995-2000 Simon G. Vogl
5 * Copyright (C) 2013-2019 Wolfram Sang <wsa@kernel.org>
30 /* --- General options ------------------------------------------------ */
56 /* Return the Frequency mode string based on the bus frequency */
70 * i2c_master_recv - issue a single I2C message in master receive mode
84 * i2c_master_recv_dmasafe - issue a single I2C message in master receive mode
100 * i2c_master_send - issue a single I2C message in master transmit mode
114 * i2c_master_send_dmasafe - issue a single I2C message in master transmit mode
195 * struct i2c_device_identity - i2c client device identification
196 * @manufacturer_id: 0 - 4095, database maintained by NXP
197 * @part_id: 0 - 511, according to manufacturer
198 * @die_revision: 0 - 7, according to manufacturer
227 * enum i2c_driver_flags - Flags for an I2C device driver
236 * struct i2c_driver - represent an I2C device driver
238 * @probe: Callback for device binding - soon to be deprecated
243 * @command: Callback for bus-wide signaling (optional)
248 * @clients: List of detected clients we created (for i2c-core use only)
291 * 16-bit payload data reported by the slave device acting as master.
314 * struct i2c_client - represent an I2C slave device
318 * generic enough to hide second-sourcing and compatible revisions.
323 * @detected: member of an i2c_driver.clients list or i2c-core's
325 * @slave_cb: Callback when I2C slave mode of an adapter is used. The adapter
345 unsigned short addr; /* chip address - NOTE: 7bit */
355 i2c_slave_cb_t slave_cb; /* callback for slave mode */
373 return dev_get_drvdata(&client->dev); in i2c_get_clientdata()
378 dev_set_drvdata(&client->dev, data); in i2c_set_clientdata()
402 * struct i2c_board_info - template for device creation
406 * @dev_name: Overrides the default <busnr>-<addr> dev_name if set
423 * bus numbers identify adapters that aren't yet available. For add-on boards,
441 * I2C_BOARD_INFO - macro used to list an i2c device and its address
447 * fields (such as associated irq, or device-specific platform_data)
456 * Add-on boards should register/unregister their devices; e.g. a board
501 * Modules for add-on boards must use other calls.
517 * struct i2c_algorithm - represent I2C transfer method
530 * @reg_slave: Register given client to I2C slave mode of this adapter
531 * @unreg_slave: Unregister given client from I2C slave mode of this adapter
535 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
540 * Kernel Documentation file Documentation/i2c/fault-codes.rst. Otherwise, the
545 * If an adapter algorithm can't do I2C-level access, set master_xfer
574 * struct i2c_lock_operations - represent I2C locking operations
588 * struct i2c_timings - I2C timing information
612 * struct i2c_bus_recovery_info - I2C bus recovery information
616 * recovery. Populated internally for generic GPIO recovery.
617 * @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery.
618 * Populated internally for generic GPIO recovery.
620 * for generic SCL recovery. Populated internally, if sda_gpio is a valid
621 * GPIO, for generic GPIO recovery.
623 * generic SCL recovery. Populated internally, if sda_gpio is a valid GPIO,
624 * for generic GPIO recovery.
627 * @prepare_recovery: This will be called before starting recovery. Platform may
629 * @unprepare_recovery: This will be called after completing recovery. Platform
631 * @scl_gpiod: gpiod of the SCL line. Only required for GPIO recovery.
632 * @sda_gpiod: gpiod of the SDA line. Only required for GPIO recovery.
633 * @pinctrl: pinctrl used by GPIO recovery to change the state of the I2C pins.
636 * to the I2C bus. Optional. Populated internally for GPIO recovery, if
638 * @pins_gpio: recovery pinctrl state of SCL/SDA lines, when they are used as
639 * GPIOs. Optional. Populated internally for GPIO recovery, if this state
640 * is called "gpio" or "recovery" and pinctrl is valid.
654 /* gpio recovery */
664 /* Generic recovery routines */
668 * struct i2c_adapter_quirks - describe flaws of an i2c adapter
677 * per transfer, plus something called combined message or write-then-read.
680 * to support this mode. It implies max_num_msg = 2 and does the length checks
681 * with max_comb_*_len because combined message mode usually has its own
683 * write-then-anything or other variants. To support that, write-then-read has
684 * been broken out into smaller bits like write-first and read-second which can
705 /* convenience macro for typical write-then read case */
756 return dev_get_drvdata(&adap->dev); in i2c_get_adapdata()
761 dev_set_drvdata(&adap->dev, data); in i2c_set_adapdata()
768 struct device *parent = adapter->dev.parent; in i2c_parent_is_i2c_adapter()
770 if (parent != NULL && parent->type == &i2c_adapter_type) in i2c_parent_is_i2c_adapter()
784 * i2c_lock_bus - Get exclusive access to an I2C bus segment
792 adapter->lock_ops->lock_bus(adapter, flags); in i2c_lock_bus()
796 * i2c_trylock_bus - Try to get exclusive access to an I2C bus segment
806 return adapter->lock_ops->trylock_bus(adapter, flags); in i2c_trylock_bus()
810 * i2c_unlock_bus - Release exclusive access to an I2C bus segment
818 adapter->lock_ops->unlock_bus(adapter, flags); in i2c_unlock_bus()
822 * i2c_mark_adapter_suspended - Report suspended state of the adapter to the core
834 set_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags); in i2c_mark_adapter_suspended()
839 * i2c_mark_adapter_resumed - Report resumed state of the adapter to the core
849 clear_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags); in i2c_mark_adapter_resumed()
863 /* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
868 /* ----- functions exported by i2c.o */
887 return !IS_ERR_OR_NULL(client) && client->dev.driver; in i2c_client_has_driver()
890 /* call the i2c_client->command() of all attached clients with
904 return adap->algo->functionality(adap); in i2c_get_functionality()
914 * i2c_check_quirks() - Function for checking the quirk flags in an i2c adapter
922 if (!adap->quirks) in i2c_check_quirks()
924 return (adap->quirks->flags & quirks) == quirks; in i2c_check_quirks()
930 return adap->nr; in i2c_adapter_id()
935 return (msg->addr << 1) | (msg->flags & I2C_M_RD ? 1 : 0); in i2c_8bit_addr_from_msg()
943 * module_i2c_driver() - Helper macro for registering a modular I2C driver
955 * builtin_i2c_driver() - Helper macro for registering a builtin I2C driver
1012 return -ENOTSUPP; in of_i2c_get_board_info()
1048 return ERR_PTR(-ENODEV); in i2c_acpi_new_device_by_fwnode()