Lines Matching full:master
71 * In other words, transfer requests passed to the I3C master can be submitted
72 * in parallel and I3C master drivers have to use their own locking to make
109 struct i3c_master_controller *master; in dev_to_i3cbus() local
114 master = dev_to_i3cmaster(dev); in dev_to_i3cbus()
116 return &master->bus; in dev_to_i3cbus()
121 struct i3c_master_controller *master; in dev_to_i3cdesc() local
126 master = dev_to_i3cmaster(dev); in dev_to_i3cdesc()
128 return master->this; in dev_to_i3cdesc()
536 struct i3c_master_controller *master = dev_to_i3cmaster(dev); in i3c_masterdev_release() local
539 if (master->wq) in i3c_masterdev_release()
540 destroy_workqueue(master->wq); in i3c_masterdev_release()
555 struct i3c_master_controller *master = i3c_bus_to_i3c_master(i3cbus); in i3c_bus_set_mode() local
582 dev_dbg(&master->dev, "i2c-scl = %ld Hz i3c-scl = %ld Hz\n", in i3c_bus_set_mode()
603 i3c_master_to_i2c_adapter(struct i3c_master_controller *master) in i3c_master_to_i2c_adapter() argument
605 return &master->i2c; in i3c_master_to_i2c_adapter()
614 i3c_master_alloc_i2c_dev(struct i3c_master_controller *master, in i3c_master_alloc_i2c_dev() argument
623 dev->common.master = master; in i3c_master_alloc_i2c_dev()
660 static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master, in i3c_master_send_ccc_cmd_locked() argument
665 if (!cmd || !master) in i3c_master_send_ccc_cmd_locked()
668 if (WARN_ON(master->init_done && in i3c_master_send_ccc_cmd_locked()
669 !rwsem_is_locked(&master->bus.lock))) in i3c_master_send_ccc_cmd_locked()
672 if (!master->ops->send_ccc_cmd) in i3c_master_send_ccc_cmd_locked()
678 if (master->ops->supports_ccc_cmd && in i3c_master_send_ccc_cmd_locked()
679 !master->ops->supports_ccc_cmd(master, cmd)) in i3c_master_send_ccc_cmd_locked()
682 ret = master->ops->send_ccc_cmd(master, cmd); in i3c_master_send_ccc_cmd_locked()
694 i3c_master_find_i2c_dev_by_addr(const struct i3c_master_controller *master, in i3c_master_find_i2c_dev_by_addr() argument
699 i3c_bus_for_each_i2cdev(&master->bus, dev) { in i3c_master_find_i2c_dev_by_addr()
709 * @master: I3C master object
717 int i3c_master_get_free_addr(struct i3c_master_controller *master, in i3c_master_get_free_addr() argument
720 return i3c_bus_get_free_addr(&master->bus, start_addr); in i3c_master_get_free_addr()
740 i3c_master_alloc_i3c_dev(struct i3c_master_controller *master, in i3c_master_alloc_i3c_dev() argument
749 dev->common.master = master; in i3c_master_alloc_i3c_dev()
756 static int i3c_master_rstdaa_locked(struct i3c_master_controller *master, in i3c_master_rstdaa_locked() argument
764 if (!master) in i3c_master_rstdaa_locked()
767 addrstat = i3c_bus_get_addr_slot_status(&master->bus, addr); in i3c_master_rstdaa_locked()
775 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_rstdaa_locked()
784 * @master: master used to send frames on the bus
789 * behind dynamic address assignment has to be handled in the I3C master
797 int i3c_master_entdaa_locked(struct i3c_master_controller *master) in i3c_master_entdaa_locked() argument
805 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_entdaa_locked()
812 static int i3c_master_enec_disec_locked(struct i3c_master_controller *master, in i3c_master_enec_disec_locked() argument
830 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_enec_disec_locked()
838 * @master: master used to send frames on the bus
850 int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, in i3c_master_disec_locked() argument
853 return i3c_master_enec_disec_locked(master, addr, false, evts); in i3c_master_disec_locked()
859 * @master: master used to send frames on the bus
871 int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, in i3c_master_enec_locked() argument
874 return i3c_master_enec_disec_locked(master, addr, true, evts); in i3c_master_enec_locked()
880 * @master: master used to send frames on the bus
882 * Send a DEFSLVS CCC command containing all the devices known to the @master.
889 * It should also be called if a master ACKed an Hot-Join request and assigned
897 int i3c_master_defslvs_locked(struct i3c_master_controller *master) in i3c_master_defslvs_locked() argument
909 if (!master) in i3c_master_defslvs_locked()
912 bus = i3c_master_get_bus(master); in i3c_master_defslvs_locked()
916 if (i3cdev == master->this) in i3c_master_defslvs_locked()
924 /* No other master on the bus, skip DEFSLVS. */ in i3c_master_defslvs_locked()
938 defslvs->master.bcr = master->this->info.bcr; in i3c_master_defslvs_locked()
939 defslvs->master.dcr = master->this->info.dcr; in i3c_master_defslvs_locked()
940 defslvs->master.dyn_addr = master->this->info.dyn_addr << 1; in i3c_master_defslvs_locked()
941 defslvs->master.static_addr = I3C_BROADCAST_ADDR << 1; in i3c_master_defslvs_locked()
951 /* Skip the I3C dev representing this master. */ in i3c_master_defslvs_locked()
952 if (i3cdev == master->this) in i3c_master_defslvs_locked()
963 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_defslvs_locked()
970 static int i3c_master_setda_locked(struct i3c_master_controller *master, in i3c_master_setda_locked() argument
989 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_setda_locked()
995 static int i3c_master_setdasa_locked(struct i3c_master_controller *master, in i3c_master_setdasa_locked() argument
998 return i3c_master_setda_locked(master, static_addr, dyn_addr, true); in i3c_master_setdasa_locked()
1001 static int i3c_master_setnewda_locked(struct i3c_master_controller *master, in i3c_master_setnewda_locked() argument
1004 return i3c_master_setda_locked(master, oldaddr, newaddr, false); in i3c_master_setnewda_locked()
1007 static int i3c_master_getmrl_locked(struct i3c_master_controller *master, in i3c_master_getmrl_locked() argument
1027 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmrl_locked()
1049 static int i3c_master_getmwl_locked(struct i3c_master_controller *master, in i3c_master_getmwl_locked() argument
1062 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmwl_locked()
1079 static int i3c_master_getmxds_locked(struct i3c_master_controller *master, in i3c_master_getmxds_locked() argument
1093 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmxds_locked()
1115 static int i3c_master_gethdrcap_locked(struct i3c_master_controller *master, in i3c_master_gethdrcap_locked() argument
1129 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_gethdrcap_locked()
1146 static int i3c_master_getpid_locked(struct i3c_master_controller *master, in i3c_master_getpid_locked() argument
1159 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getpid_locked()
1176 static int i3c_master_getbcr_locked(struct i3c_master_controller *master, in i3c_master_getbcr_locked() argument
1189 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getbcr_locked()
1201 static int i3c_master_getdcr_locked(struct i3c_master_controller *master, in i3c_master_getdcr_locked() argument
1214 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getdcr_locked()
1228 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_retrieve_dev_info() local
1235 slot_status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_retrieve_dev_info()
1241 ret = i3c_master_getpid_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1245 ret = i3c_master_getbcr_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1249 ret = i3c_master_getdcr_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1254 ret = i3c_master_getmxds_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1262 i3c_master_getmrl_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1263 i3c_master_getmwl_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1266 ret = i3c_master_gethdrcap_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1276 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_put_i3c_addrs() local
1279 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_put_i3c_addrs()
1284 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_put_i3c_addrs()
1288 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_put_i3c_addrs()
1294 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_get_i3c_addrs() local
1301 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1306 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1319 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1324 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_get_i3c_addrs()
1332 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1339 static int i3c_master_attach_i3c_dev(struct i3c_master_controller *master, in i3c_master_attach_i3c_dev() argument
1355 /* Do not attach the master device itself. */ in i3c_master_attach_i3c_dev()
1356 if (master->this != dev && master->ops->attach_i3c_dev) { in i3c_master_attach_i3c_dev()
1357 ret = master->ops->attach_i3c_dev(dev); in i3c_master_attach_i3c_dev()
1364 list_add_tail(&dev->common.node, &master->bus.devs.i3c); in i3c_master_attach_i3c_dev()
1372 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_reattach_i3c_dev() local
1379 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_reattach_i3c_dev()
1383 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_reattach_i3c_dev()
1388 if (master->ops->reattach_i3c_dev) { in i3c_master_reattach_i3c_dev()
1389 ret = master->ops->reattach_i3c_dev(dev, old_dyn_addr); in i3c_master_reattach_i3c_dev()
1401 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_detach_i3c_dev() local
1403 /* Do not detach the master device itself. */ in i3c_master_detach_i3c_dev()
1404 if (master->this != dev && master->ops->detach_i3c_dev) in i3c_master_detach_i3c_dev()
1405 master->ops->detach_i3c_dev(dev); in i3c_master_detach_i3c_dev()
1411 static int i3c_master_attach_i2c_dev(struct i3c_master_controller *master, in i3c_master_attach_i2c_dev() argument
1416 if (master->ops->attach_i2c_dev) { in i3c_master_attach_i2c_dev()
1417 ret = master->ops->attach_i2c_dev(dev); in i3c_master_attach_i2c_dev()
1422 list_add_tail(&dev->common.node, &master->bus.devs.i2c); in i3c_master_attach_i2c_dev()
1429 struct i3c_master_controller *master = i2c_dev_get_master(dev); in i3c_master_detach_i2c_dev() local
1433 if (master->ops->detach_i2c_dev) in i3c_master_detach_i2c_dev()
1434 master->ops->detach_i2c_dev(dev); in i3c_master_detach_i2c_dev()
1437 static int i3c_master_early_i3c_dev_add(struct i3c_master_controller *master, in i3c_master_early_i3c_dev_add() argument
1446 i3cdev = i3c_master_alloc_i3c_dev(master, &info); in i3c_master_early_i3c_dev_add()
1452 ret = i3c_master_attach_i3c_dev(master, i3cdev); in i3c_master_early_i3c_dev_add()
1456 ret = i3c_master_setdasa_locked(master, i3cdev->info.static_addr, in i3c_master_early_i3c_dev_add()
1473 i3c_master_rstdaa_locked(master, i3cdev->boardinfo->init_dyn_addr); in i3c_master_early_i3c_dev_add()
1483 i3c_master_register_new_i3c_devs(struct i3c_master_controller *master) in i3c_master_register_new_i3c_devs() argument
1488 if (!master->init_done) in i3c_master_register_new_i3c_devs()
1491 i3c_bus_for_each_i3cdev(&master->bus, desc) { in i3c_master_register_new_i3c_devs()
1492 if (desc->dev || !desc->info.dyn_addr || desc == master->this) in i3c_master_register_new_i3c_devs()
1499 desc->dev->bus = &master->bus; in i3c_master_register_new_i3c_devs()
1501 desc->dev->dev.parent = &master->dev; in i3c_master_register_new_i3c_devs()
1505 dev_set_name(&desc->dev->dev, "%d-%llx", master->bus.id, in i3c_master_register_new_i3c_devs()
1513 dev_err(&master->dev, in i3c_master_register_new_i3c_devs()
1520 * @master: master doing the DAA
1526 * The I3C device object is returned in case the master wants to attach
1533 int i3c_master_do_daa(struct i3c_master_controller *master) in i3c_master_do_daa() argument
1537 i3c_bus_maintenance_lock(&master->bus); in i3c_master_do_daa()
1538 ret = master->ops->do_daa(master); in i3c_master_do_daa()
1539 i3c_bus_maintenance_unlock(&master->bus); in i3c_master_do_daa()
1544 i3c_bus_normaluse_lock(&master->bus); in i3c_master_do_daa()
1545 i3c_master_register_new_i3c_devs(master); in i3c_master_do_daa()
1546 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_do_daa()
1553 * i3c_master_set_info() - set master device information
1554 * @master: master used to send frames on the bus
1557 * Set master device info. This should be called from
1560 * Not all &i3c_device_info fields are meaningful for a master device.
1576 int i3c_master_set_info(struct i3c_master_controller *master, in i3c_master_set_info() argument
1582 if (!i3c_bus_dev_addr_is_avail(&master->bus, info->dyn_addr)) in i3c_master_set_info()
1586 master->secondary) in i3c_master_set_info()
1589 if (master->this) in i3c_master_set_info()
1592 i3cdev = i3c_master_alloc_i3c_dev(master, info); in i3c_master_set_info()
1596 master->this = i3cdev; in i3c_master_set_info()
1597 master->bus.cur_master = master->this; in i3c_master_set_info()
1599 ret = i3c_master_attach_i3c_dev(master, i3cdev); in i3c_master_set_info()
1612 static void i3c_master_detach_free_devs(struct i3c_master_controller *master) in i3c_master_detach_free_devs() argument
1617 list_for_each_entry_safe(i3cdev, i3ctmp, &master->bus.devs.i3c, in i3c_master_detach_free_devs()
1622 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_detach_free_devs()
1629 list_for_each_entry_safe(i2cdev, i2ctmp, &master->bus.devs.i2c, in i3c_master_detach_free_devs()
1632 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_detach_free_devs()
1641 * @master: main master initializing the bus
1646 * 1. Attach I2C devs to the master so that the master can fill its internal
1650 * the master controller. That's usually where the bus mode is selected
1662 * devices to the master.
1671 static int i3c_master_bus_init(struct i3c_master_controller *master) in i3c_master_bus_init() argument
1683 list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) { in i3c_master_bus_init()
1684 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_bus_init()
1691 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_bus_init()
1695 i2cdev = i3c_master_alloc_i2c_dev(master, i2cboardinfo); in i3c_master_bus_init()
1701 ret = i3c_master_attach_i2c_dev(master, i2cdev); in i3c_master_bus_init()
1712 ret = master->ops->bus_init(master); in i3c_master_bus_init()
1717 * The master device should have been instantiated in ->bus_init(), in i3c_master_bus_init()
1720 if (!master->this) { in i3c_master_bus_init()
1721 dev_err(&master->dev, in i3c_master_bus_init()
1731 ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); in i3c_master_bus_init()
1736 ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, in i3c_master_bus_init()
1749 list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) { in i3c_master_bus_init()
1758 ret = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_bus_init()
1765 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_bus_init()
1778 i3c_master_early_i3c_dev_add(master, i3cboardinfo); in i3c_master_bus_init()
1781 ret = i3c_master_do_daa(master); in i3c_master_bus_init()
1788 i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); in i3c_master_bus_init()
1791 if (master->ops->bus_cleanup) in i3c_master_bus_init()
1792 master->ops->bus_cleanup(master); in i3c_master_bus_init()
1795 i3c_master_detach_free_devs(master); in i3c_master_bus_init()
1800 static void i3c_master_bus_cleanup(struct i3c_master_controller *master) in i3c_master_bus_cleanup() argument
1802 if (master->ops->bus_cleanup) in i3c_master_bus_cleanup()
1803 master->ops->bus_cleanup(master); in i3c_master_bus_cleanup()
1805 i3c_master_detach_free_devs(master); in i3c_master_bus_cleanup()
1810 struct i3c_master_controller *master = i3cdev->common.master; in i3c_master_attach_boardinfo() local
1813 list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) { in i3c_master_attach_boardinfo()
1826 struct i3c_master_controller *master = i3c_dev_get_master(refdev); in i3c_master_search_i3c_dev_duplicate() local
1829 i3c_bus_for_each_i3cdev(&master->bus, i3cdev) { in i3c_master_search_i3c_dev_duplicate()
1839 * @master: master used to send frames on the bus
1846 * The I3C device object is returned in case the master wants to attach
1853 int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, in i3c_master_add_i3c_dev_locked() argument
1863 if (!master) in i3c_master_add_i3c_dev_locked()
1866 newdev = i3c_master_alloc_i3c_dev(master, &info); in i3c_master_add_i3c_dev_locked()
1870 ret = i3c_master_attach_i3c_dev(master, newdev); in i3c_master_add_i3c_dev_locked()
1925 * master in i3c_master_add_i3c_dev_locked()
1937 * the address assigned by the master. in i3c_master_add_i3c_dev_locked()
1939 ret = i3c_master_setnewda_locked(master, in i3c_master_add_i3c_dev_locked()
1947 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1949 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
1964 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1966 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
1970 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1972 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
1995 of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, in of_i3c_master_add_i2c_boardinfo() argument
1999 struct device *dev = &master->dev; in of_i3c_master_add_i2c_boardinfo()
2023 list_add_tail(&boardinfo->node, &master->boardinfo.i2c); in of_i3c_master_add_i2c_boardinfo()
2030 of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, in of_i3c_master_add_i3c_boardinfo() argument
2034 struct device *dev = &master->dev; in of_i3c_master_add_i3c_boardinfo()
2046 addrstatus = i3c_bus_get_addr_slot_status(&master->bus, in of_i3c_master_add_i3c_boardinfo()
2058 addrstatus = i3c_bus_get_addr_slot_status(&master->bus, in of_i3c_master_add_i3c_boardinfo()
2072 list_add_tail(&boardinfo->node, &master->boardinfo.i3c); in of_i3c_master_add_i3c_boardinfo()
2077 static int of_i3c_master_add_dev(struct i3c_master_controller *master, in of_i3c_master_add_dev() argument
2083 if (!master || !node) in of_i3c_master_add_dev()
2095 ret = of_i3c_master_add_i2c_boardinfo(master, node, reg); in of_i3c_master_add_dev()
2097 ret = of_i3c_master_add_i3c_boardinfo(master, node, reg); in of_i3c_master_add_dev()
2102 static int of_populate_i3c_bus(struct i3c_master_controller *master) in of_populate_i3c_bus() argument
2104 struct device *dev = &master->dev; in of_populate_i3c_bus()
2114 ret = of_i3c_master_add_dev(master, node); in of_populate_i3c_bus()
2127 master->bus.scl_rate.i2c = val; in of_populate_i3c_bus()
2130 master->bus.scl_rate.i3c = val; in of_populate_i3c_bus()
2138 struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap); in i3c_master_i2c_adapter_xfer() local
2143 if (!xfers || !master || nxfers <= 0) in i3c_master_i2c_adapter_xfer()
2146 if (!master->ops->i2c_xfers) in i3c_master_i2c_adapter_xfer()
2156 i3c_bus_normaluse_lock(&master->bus); in i3c_master_i2c_adapter_xfer()
2157 dev = i3c_master_find_i2c_dev_by_addr(master, addr); in i3c_master_i2c_adapter_xfer()
2161 ret = master->ops->i2c_xfers(dev, xfers, nxfers); in i3c_master_i2c_adapter_xfer()
2162 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_i2c_adapter_xfer()
2177 static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master) in i3c_master_i2c_adapter_init() argument
2179 struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master); in i3c_master_i2c_adapter_init()
2183 adap->dev.parent = master->dev.parent; in i3c_master_i2c_adapter_init()
2184 adap->owner = master->dev.parent->driver->owner; in i3c_master_i2c_adapter_init()
2186 strncpy(adap->name, dev_name(master->dev.parent), sizeof(adap->name)); in i3c_master_i2c_adapter_init()
2200 i3c_bus_for_each_i2cdev(&master->bus, i2cdev) in i3c_master_i2c_adapter_init()
2206 static void i3c_master_i2c_adapter_cleanup(struct i3c_master_controller *master) in i3c_master_i2c_adapter_cleanup() argument
2210 i2c_del_adapter(&master->i2c); in i3c_master_i2c_adapter_cleanup()
2212 i3c_bus_for_each_i2cdev(&master->bus, i2cdev) in i3c_master_i2c_adapter_cleanup()
2216 static void i3c_master_unregister_i3c_devs(struct i3c_master_controller *master) in i3c_master_unregister_i3c_devs() argument
2220 i3c_bus_for_each_i3cdev(&master->bus, i3cdev) { in i3c_master_unregister_i3c_devs()
2244 queue_work(dev->common.master->wq, &slot->work); in i3c_master_queue_ibi()
2253 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_handle_ibi() local
2262 master->ops->recycle_ibi_slot(dev, slot); in i3c_master_handle_ibi()
2412 * master driver struct_master_controller_ops->recycle_ibi() method.
2445 * i3c_master_register() - register an I3C master
2446 * @master: master used to send frames on the bus
2447 * @parent: the parent device (the one that provides this I3C master
2449 * @ops: the master controller operations
2450 * @secondary: true if you are registering a secondary master. Will return
2465 int i3c_master_register(struct i3c_master_controller *master, in i3c_master_register() argument
2471 struct i3c_bus *i3cbus = i3c_master_get_bus(master); in i3c_master_register()
2484 master->dev.parent = parent; in i3c_master_register()
2485 master->dev.of_node = of_node_get(parent->of_node); in i3c_master_register()
2486 master->dev.bus = &i3c_bus_type; in i3c_master_register()
2487 master->dev.type = &i3c_masterdev_type; in i3c_master_register()
2488 master->dev.release = i3c_masterdev_release; in i3c_master_register()
2489 master->ops = ops; in i3c_master_register()
2490 master->secondary = secondary; in i3c_master_register()
2491 INIT_LIST_HEAD(&master->boardinfo.i2c); in i3c_master_register()
2492 INIT_LIST_HEAD(&master->boardinfo.i3c); in i3c_master_register()
2498 device_initialize(&master->dev); in i3c_master_register()
2499 dev_set_name(&master->dev, "i3c-%d", i3cbus->id); in i3c_master_register()
2501 ret = of_populate_i3c_bus(master); in i3c_master_register()
2505 list_for_each_entry(i2cbi, &master->boardinfo.i2c, node) { in i3c_master_register()
2532 master->wq = alloc_workqueue("%s", 0, 0, dev_name(parent)); in i3c_master_register()
2533 if (!master->wq) { in i3c_master_register()
2538 ret = i3c_master_bus_init(master); in i3c_master_register()
2542 ret = device_add(&master->dev); in i3c_master_register()
2550 ret = i3c_master_i2c_adapter_init(master); in i3c_master_register()
2558 master->init_done = true; in i3c_master_register()
2559 i3c_bus_normaluse_lock(&master->bus); in i3c_master_register()
2560 i3c_master_register_new_i3c_devs(master); in i3c_master_register()
2561 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_register()
2566 device_del(&master->dev); in i3c_master_register()
2569 i3c_master_bus_cleanup(master); in i3c_master_register()
2572 put_device(&master->dev); in i3c_master_register()
2579 * i3c_master_unregister() - unregister an I3C master
2580 * @master: master used to send frames on the bus
2586 int i3c_master_unregister(struct i3c_master_controller *master) in i3c_master_unregister() argument
2588 i3c_master_i2c_adapter_cleanup(master); in i3c_master_unregister()
2589 i3c_master_unregister_i3c_devs(master); in i3c_master_unregister()
2590 i3c_master_bus_cleanup(master); in i3c_master_unregister()
2591 device_unregister(&master->dev); in i3c_master_unregister()
2601 struct i3c_master_controller *master; in i3c_dev_do_priv_xfers_locked() local
2606 master = i3c_dev_get_master(dev); in i3c_dev_do_priv_xfers_locked()
2607 if (!master || !xfers) in i3c_dev_do_priv_xfers_locked()
2610 if (!master->ops->priv_xfers) in i3c_dev_do_priv_xfers_locked()
2613 return master->ops->priv_xfers(dev, xfers, nxfers); in i3c_dev_do_priv_xfers_locked()
2618 struct i3c_master_controller *master; in i3c_dev_disable_ibi_locked() local
2624 master = i3c_dev_get_master(dev); in i3c_dev_disable_ibi_locked()
2625 ret = master->ops->disable_ibi(dev); in i3c_dev_disable_ibi_locked()
2640 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_enable_ibi_locked() local
2646 ret = master->ops->enable_ibi(dev); in i3c_dev_enable_ibi_locked()
2656 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_request_ibi_locked() local
2660 if (!master->ops->request_ibi) in i3c_dev_request_ibi_locked()
2677 ret = master->ops->request_ibi(dev, req); in i3c_dev_request_ibi_locked()
2688 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_free_ibi_locked() local
2696 master->ops->free_ibi(dev); in i3c_dev_free_ibi_locked()