Lines Matching refs:i3cbus

95 i3c_bus_to_i3c_master(struct i3c_bus *i3cbus)  in i3c_bus_to_i3c_master()  argument
97 return container_of(i3cbus, struct i3c_master_controller, bus); in i3c_bus_to_i3c_master()
414 static void i3c_bus_cleanup(struct i3c_bus *i3cbus) in i3c_bus_cleanup() argument
417 idr_remove(&i3c_bus_idr, i3cbus->id); in i3c_bus_cleanup()
421 static int i3c_bus_init(struct i3c_bus *i3cbus) in i3c_bus_init() argument
425 init_rwsem(&i3cbus->lock); in i3c_bus_init()
426 INIT_LIST_HEAD(&i3cbus->devs.i2c); in i3c_bus_init()
427 INIT_LIST_HEAD(&i3cbus->devs.i3c); in i3c_bus_init()
428 i3c_bus_init_addrslots(i3cbus); in i3c_bus_init()
429 i3cbus->mode = I3C_BUS_MODE_PURE; in i3c_bus_init()
432 ret = idr_alloc(&i3c_bus_idr, i3cbus, 0, 0, GFP_KERNEL); in i3c_bus_init()
438 i3cbus->id = ret; in i3c_bus_init()
454 struct i3c_bus *i3cbus = dev_to_i3cbus(dev); in mode_show() local
457 i3c_bus_normaluse_lock(i3cbus); in mode_show()
458 if (i3cbus->mode < 0 || in mode_show()
459 i3cbus->mode >= ARRAY_SIZE(i3c_bus_mode_strings) || in mode_show()
460 !i3c_bus_mode_strings[i3cbus->mode]) in mode_show()
463 ret = sprintf(buf, "%s\n", i3c_bus_mode_strings[i3cbus->mode]); in mode_show()
464 i3c_bus_normaluse_unlock(i3cbus); in mode_show()
474 struct i3c_bus *i3cbus = dev_to_i3cbus(dev); in current_master_show() local
477 i3c_bus_normaluse_lock(i3cbus); in current_master_show()
478 ret = sprintf(buf, "%d-%llx\n", i3cbus->id, in current_master_show()
479 i3cbus->cur_master->info.pid); in current_master_show()
480 i3c_bus_normaluse_unlock(i3cbus); in current_master_show()
490 struct i3c_bus *i3cbus = dev_to_i3cbus(dev); in i3c_scl_frequency_show() local
493 i3c_bus_normaluse_lock(i3cbus); in i3c_scl_frequency_show()
494 ret = sprintf(buf, "%ld\n", i3cbus->scl_rate.i3c); in i3c_scl_frequency_show()
495 i3c_bus_normaluse_unlock(i3cbus); in i3c_scl_frequency_show()
505 struct i3c_bus *i3cbus = dev_to_i3cbus(dev); in i2c_scl_frequency_show() local
508 i3c_bus_normaluse_lock(i3cbus); in i2c_scl_frequency_show()
509 ret = sprintf(buf, "%ld\n", i3cbus->scl_rate.i2c); in i2c_scl_frequency_show()
510 i3c_bus_normaluse_unlock(i3cbus); in i2c_scl_frequency_show()
548 static int i3c_bus_set_mode(struct i3c_bus *i3cbus, enum i3c_bus_mode mode, in i3c_bus_set_mode() argument
551 struct i3c_master_controller *master = i3c_bus_to_i3c_master(i3cbus); in i3c_bus_set_mode()
553 i3cbus->mode = mode; in i3c_bus_set_mode()
555 switch (i3cbus->mode) { in i3c_bus_set_mode()
557 if (!i3cbus->scl_rate.i3c) in i3c_bus_set_mode()
558 i3cbus->scl_rate.i3c = I3C_BUS_TYP_I3C_SCL_RATE; in i3c_bus_set_mode()
562 if (!i3cbus->scl_rate.i3c) in i3c_bus_set_mode()
563 i3cbus->scl_rate.i3c = I3C_BUS_TYP_I3C_SCL_RATE; in i3c_bus_set_mode()
564 if (!i3cbus->scl_rate.i2c) in i3c_bus_set_mode()
565 i3cbus->scl_rate.i2c = max_i2c_scl_rate; in i3c_bus_set_mode()
568 if (!i3cbus->scl_rate.i2c) in i3c_bus_set_mode()
569 i3cbus->scl_rate.i2c = max_i2c_scl_rate; in i3c_bus_set_mode()
570 if (!i3cbus->scl_rate.i3c || in i3c_bus_set_mode()
571 i3cbus->scl_rate.i3c > i3cbus->scl_rate.i2c) in i3c_bus_set_mode()
572 i3cbus->scl_rate.i3c = i3cbus->scl_rate.i2c; in i3c_bus_set_mode()
579 i3cbus->scl_rate.i2c, i3cbus->scl_rate.i3c); in i3c_bus_set_mode()
585 if (i3cbus->scl_rate.i3c > I3C_BUS_MAX_I3C_SCL_RATE || in i3c_bus_set_mode()
586 i3cbus->scl_rate.i2c > I3C_BUS_I2C_FM_PLUS_SCL_RATE) in i3c_bus_set_mode()
2467 struct i3c_bus *i3cbus = i3c_master_get_bus(master); in i3c_master_register() local
2490 ret = i3c_bus_init(i3cbus); in i3c_master_register()
2495 dev_set_name(&master->dev, "i3c-%d", i3cbus->id); in i3c_master_register()
2524 ret = i3c_bus_set_mode(i3cbus, mode, i2c_scl_rate); in i3c_master_register()