Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
i2c_新_假人做什么?_C_Linux Kernel_Linux Device Driver - Fatal编程技术网

i2c_新_假人做什么?

i2c_新_假人做什么?,c,linux-kernel,linux-device-driver,C,Linux Kernel,Linux Device Driver,我正在开发一个多功能显示器驱动程序。有一条i2c总线,由四个i2c客户端设备(在单个IC上)共享。将适配器连接到每个客户端时,将使用i2c\u new\u dummyAPI 为什么有必要为不同的客户机使用不同的适配器逻辑?mfd设备实际上是如何工作的?正如我们所知,I2C总线将具有规范定义中的127个客户端;用于读/写的7bit地址,带有1bit 第一个字节将是I2C设备地址,与此地址匹配的设备将下拉ACK位。接下来是数据,大多数情况下这是寄存器的地址 因此,如果您有四个I2C客户端,您将得到四

我正在开发一个多功能显示器驱动程序。有一条i2c总线,由四个i2c客户端设备(在单个IC上)共享。将适配器连接到每个客户端时,将使用
i2c\u new\u dummy
API


为什么有必要为不同的客户机使用不同的适配器逻辑?mfd设备实际上是如何工作的?

正如我们所知,
I2C
总线将具有规范定义中的127个客户端;用于读/写的
7bit
地址,带有
1bit

第一个字节将是
I2C
设备地址,与此地址匹配的设备将下拉
ACK
位。接下来是数据,大多数情况下这是寄存器的地址

因此,如果您有四个
I2C
客户端,您将得到四个设备和四个客户端句柄,即使它们包含在SOC

但有时候你并不需要那么多

另一种情况是在当前的SOC上,一个芯片(如tps65910)将具有很多功能,包括打开电压、编解码器等。每个驱动程序将使用
I2C
设置寄存器。您不能为一个驱动程序请求一个句柄,因此它调用
i2c\u new\u dummy

来自内核i2c core.c的评论

/**
 * i2c_new_dummy - return a new i2c device bound to a dummy driver
 * @adapter: the adapter managing the device
 * @address: seven bit address to be used
 * Context: can sleep
 *
 * This returns an I2C client bound to the "dummy" driver, intended for use
 * with devices that consume multiple addresses.  Examples of such chips
 * include various EEPROMS (like 24c04 and 24c08 models).
 *
 * These dummy devices have two main uses.  First, most I2C and SMBus calls
 * except i2c_transfer() need a client handle; the dummy will be that handle.
 * And second, this prevents the specified address from being bound to a
 * different driver.
 *
 * This returns the new i2c client, which should be saved for later use with
 * i2c_unregister_device(); or NULL to indicate an error.
 */