Lines Matching defs:slave

258  * @addr: 8-bit or 10-bit slave addr, including r/w bit
287 * @ara: I2C slave device used to respond to the SMBus Alert with Alert
309 * @slave: list of slave devices registered on the I2C bus
310 * @slave_running: slave device currently used
312 * @slave_dir: transfer direction for the current slave device
314 * slave)
342 struct i2c_client *slave[STM32F7_I2C_MAX_SLAVE];
888 /* Set slave address */
973 /* Set slave address */
1240 static bool stm32f7_i2c_is_addr_match(struct i2c_client *slave, u32 addcode)
1244 if (!slave)
1247 if (slave->flags & I2C_CLIENT_TEN) {
1250 * X = Bit 9 of slave address
1251 * Y = Bit 8 of slave address
1253 addr = slave->addr >> 8;
1258 addr = slave->addr & 0x7f;
1268 struct i2c_client *slave = i2c_dev->slave_running;
1274 /* Notify i2c slave that new read transfer is starting */
1275 i2c_slave_event(slave, I2C_SLAVE_READ_REQUESTED, &value);
1278 * Disable slave TX config in case of I2C combined message
1295 /* Notify i2c slave that new write transfer is starting */
1296 i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
1325 if (stm32f7_i2c_is_addr_match(i2c_dev->slave[i], addcode)) {
1326 i2c_dev->slave_running = i2c_dev->slave[i];
1329 /* Start I2C slave processing */
1341 struct i2c_client *slave, int *id)
1346 if (i2c_dev->slave[i] == slave) {
1352 dev_err(i2c_dev->dev, "Slave 0x%x not registered\n", slave->addr);
1358 struct i2c_client *slave, int *id)
1364 * slave[STM32F7_SLAVE_HOSTNOTIFY] support only SMBus Host address (0x8)
1365 * slave[STM32F7_SLAVE_7_10_BITS_ADDR] supports 7-bit and 10-bit slave address
1366 * slave[STM32F7_SLAVE_7_BITS_ADDR] supports 7-bit slave address only
1368 if (i2c_dev->smbus_mode && (slave->addr == 0x08)) {
1369 if (i2c_dev->slave[STM32F7_SLAVE_HOSTNOTIFY])
1377 (slave->flags & I2C_CLIENT_TEN))
1379 if (!i2c_dev->slave[i]) {
1386 dev_err(dev, "Slave 0x%x could not be registered\n", slave->addr);
1396 if (i2c_dev->slave[i])
1409 if (i2c_dev->slave[i])
1478 /* Notify i2c slave that a STOP flag has been detected */
1500 /* Check if the interrupt if for a slave device */
1718 dev_dbg(i2c_dev->dev, "Access to slave 0x%x timed out\n",
1780 dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr);
1841 static int stm32f7_i2c_reg_slave(struct i2c_client *slave)
1843 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
1849 if (slave->flags & I2C_CLIENT_PEC) {
1850 dev_err(dev, "SMBus PEC not supported in slave mode\n");
1855 dev_err(dev, "Too much slave registered\n");
1859 ret = stm32f7_i2c_get_free_slave_id(i2c_dev, slave, &id);
1873 i2c_dev->slave[id] = slave;
1880 if (slave->flags & I2C_CLIENT_TEN) {
1881 oar1 |= STM32F7_I2C_OAR1_OA1_10(slave->addr);
1884 oar1 |= STM32F7_I2C_OAR1_OA1_7(slave->addr);
1887 i2c_dev->slave[id] = slave;
1895 if (slave->flags & I2C_CLIENT_TEN) {
1900 oar2 |= STM32F7_I2C_OAR2_OA2_7(slave->addr);
1902 i2c_dev->slave[id] = slave;
1907 dev_err(dev, "I2C slave id not supported\n");
1931 static int stm32f7_i2c_unreg_slave(struct i2c_client *slave)
1933 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
1938 ret = stm32f7_i2c_get_slave_id(i2c_dev, slave, &id);
1942 WARN_ON(!i2c_dev->slave[id]);
1956 i2c_dev->slave[id] = NULL;