Lines Matching refs:master
110 struct i3c_master_controller *master; in dev_to_i3cbus() local
115 master = dev_to_i3cmaster(dev); in dev_to_i3cbus()
117 return &master->bus; in dev_to_i3cbus()
122 struct i3c_master_controller *master; in dev_to_i3cdesc() local
127 master = dev_to_i3cmaster(dev); in dev_to_i3cdesc()
129 return master->this; in dev_to_i3cdesc()
545 struct i3c_master_controller *master = dev_to_i3cmaster(dev); in i3c_masterdev_release() local
548 if (master->wq) in i3c_masterdev_release()
549 destroy_workqueue(master->wq); in i3c_masterdev_release()
564 struct i3c_master_controller *master = i3c_bus_to_i3c_master(i3cbus); in i3c_bus_set_mode() local
591 dev_dbg(&master->dev, "i2c-scl = %ld Hz i3c-scl = %ld Hz\n", in i3c_bus_set_mode()
612 i3c_master_to_i2c_adapter(struct i3c_master_controller *master) in i3c_master_to_i2c_adapter() argument
614 return &master->i2c; in i3c_master_to_i2c_adapter()
623 i3c_master_alloc_i2c_dev(struct i3c_master_controller *master, in i3c_master_alloc_i2c_dev() argument
632 dev->common.master = master; in i3c_master_alloc_i2c_dev()
668 static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master, in i3c_master_send_ccc_cmd_locked() argument
673 if (!cmd || !master) in i3c_master_send_ccc_cmd_locked()
676 if (WARN_ON(master->init_done && in i3c_master_send_ccc_cmd_locked()
677 !rwsem_is_locked(&master->bus.lock))) in i3c_master_send_ccc_cmd_locked()
680 if (!master->ops->send_ccc_cmd) in i3c_master_send_ccc_cmd_locked()
686 if (master->ops->supports_ccc_cmd && in i3c_master_send_ccc_cmd_locked()
687 !master->ops->supports_ccc_cmd(master, cmd)) in i3c_master_send_ccc_cmd_locked()
690 ret = master->ops->send_ccc_cmd(master, cmd); in i3c_master_send_ccc_cmd_locked()
702 i3c_master_find_i2c_dev_by_addr(const struct i3c_master_controller *master, in i3c_master_find_i2c_dev_by_addr() argument
707 i3c_bus_for_each_i2cdev(&master->bus, dev) { in i3c_master_find_i2c_dev_by_addr()
725 int i3c_master_get_free_addr(struct i3c_master_controller *master, in i3c_master_get_free_addr() argument
728 return i3c_bus_get_free_addr(&master->bus, start_addr); in i3c_master_get_free_addr()
748 i3c_master_alloc_i3c_dev(struct i3c_master_controller *master, in i3c_master_alloc_i3c_dev() argument
757 dev->common.master = master; in i3c_master_alloc_i3c_dev()
764 static int i3c_master_rstdaa_locked(struct i3c_master_controller *master, in i3c_master_rstdaa_locked() argument
772 if (!master) in i3c_master_rstdaa_locked()
775 addrstat = i3c_bus_get_addr_slot_status(&master->bus, addr); in i3c_master_rstdaa_locked()
783 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_rstdaa_locked()
805 int i3c_master_entdaa_locked(struct i3c_master_controller *master) in i3c_master_entdaa_locked() argument
813 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_entdaa_locked()
820 static int i3c_master_enec_disec_locked(struct i3c_master_controller *master, in i3c_master_enec_disec_locked() argument
838 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_enec_disec_locked()
858 int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, in i3c_master_disec_locked() argument
861 return i3c_master_enec_disec_locked(master, addr, false, evts); in i3c_master_disec_locked()
879 int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, in i3c_master_enec_locked() argument
882 return i3c_master_enec_disec_locked(master, addr, true, evts); in i3c_master_enec_locked()
905 int i3c_master_defslvs_locked(struct i3c_master_controller *master) in i3c_master_defslvs_locked() argument
917 if (!master) in i3c_master_defslvs_locked()
920 bus = i3c_master_get_bus(master); in i3c_master_defslvs_locked()
924 if (i3cdev == master->this) in i3c_master_defslvs_locked()
946 defslvs->master.bcr = master->this->info.bcr; in i3c_master_defslvs_locked()
947 defslvs->master.dcr = master->this->info.dcr; in i3c_master_defslvs_locked()
948 defslvs->master.dyn_addr = master->this->info.dyn_addr << 1; in i3c_master_defslvs_locked()
949 defslvs->master.static_addr = I3C_BROADCAST_ADDR << 1; in i3c_master_defslvs_locked()
960 if (i3cdev == master->this) in i3c_master_defslvs_locked()
971 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_defslvs_locked()
978 static int i3c_master_setda_locked(struct i3c_master_controller *master, in i3c_master_setda_locked() argument
997 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_setda_locked()
1003 static int i3c_master_setdasa_locked(struct i3c_master_controller *master, in i3c_master_setdasa_locked() argument
1006 return i3c_master_setda_locked(master, static_addr, dyn_addr, true); in i3c_master_setdasa_locked()
1009 static int i3c_master_setnewda_locked(struct i3c_master_controller *master, in i3c_master_setnewda_locked() argument
1012 return i3c_master_setda_locked(master, oldaddr, newaddr, false); in i3c_master_setnewda_locked()
1015 static int i3c_master_getmrl_locked(struct i3c_master_controller *master, in i3c_master_getmrl_locked() argument
1035 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmrl_locked()
1057 static int i3c_master_getmwl_locked(struct i3c_master_controller *master, in i3c_master_getmwl_locked() argument
1070 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmwl_locked()
1087 static int i3c_master_getmxds_locked(struct i3c_master_controller *master, in i3c_master_getmxds_locked() argument
1101 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getmxds_locked()
1123 static int i3c_master_gethdrcap_locked(struct i3c_master_controller *master, in i3c_master_gethdrcap_locked() argument
1137 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_gethdrcap_locked()
1154 static int i3c_master_getpid_locked(struct i3c_master_controller *master, in i3c_master_getpid_locked() argument
1167 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getpid_locked()
1184 static int i3c_master_getbcr_locked(struct i3c_master_controller *master, in i3c_master_getbcr_locked() argument
1197 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getbcr_locked()
1209 static int i3c_master_getdcr_locked(struct i3c_master_controller *master, in i3c_master_getdcr_locked() argument
1222 ret = i3c_master_send_ccc_cmd_locked(master, &cmd); in i3c_master_getdcr_locked()
1236 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_retrieve_dev_info() local
1243 slot_status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_retrieve_dev_info()
1249 ret = i3c_master_getpid_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1253 ret = i3c_master_getbcr_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1257 ret = i3c_master_getdcr_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1262 ret = i3c_master_getmxds_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1270 i3c_master_getmrl_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1271 i3c_master_getmwl_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1274 ret = i3c_master_gethdrcap_locked(master, &dev->info); in i3c_master_retrieve_dev_info()
1284 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_put_i3c_addrs() local
1287 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_put_i3c_addrs()
1292 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_put_i3c_addrs()
1296 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_put_i3c_addrs()
1302 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_get_i3c_addrs() local
1309 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1318 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1331 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1336 i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, in i3c_master_get_i3c_addrs()
1344 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_get_i3c_addrs()
1351 static int i3c_master_attach_i3c_dev(struct i3c_master_controller *master, in i3c_master_attach_i3c_dev() argument
1368 if (master->this != dev && master->ops->attach_i3c_dev) { in i3c_master_attach_i3c_dev()
1369 ret = master->ops->attach_i3c_dev(dev); in i3c_master_attach_i3c_dev()
1376 list_add_tail(&dev->common.node, &master->bus.devs.i3c); in i3c_master_attach_i3c_dev()
1384 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_reattach_i3c_dev() local
1391 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_reattach_i3c_dev()
1395 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_reattach_i3c_dev()
1399 i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr, in i3c_master_reattach_i3c_dev()
1403 if (master->ops->reattach_i3c_dev) { in i3c_master_reattach_i3c_dev()
1404 ret = master->ops->reattach_i3c_dev(dev, old_dyn_addr); in i3c_master_reattach_i3c_dev()
1416 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_detach_i3c_dev() local
1419 if (master->this != dev && master->ops->detach_i3c_dev) in i3c_master_detach_i3c_dev()
1420 master->ops->detach_i3c_dev(dev); in i3c_master_detach_i3c_dev()
1426 static int i3c_master_attach_i2c_dev(struct i3c_master_controller *master, in i3c_master_attach_i2c_dev() argument
1431 if (master->ops->attach_i2c_dev) { in i3c_master_attach_i2c_dev()
1432 ret = master->ops->attach_i2c_dev(dev); in i3c_master_attach_i2c_dev()
1437 list_add_tail(&dev->common.node, &master->bus.devs.i2c); in i3c_master_attach_i2c_dev()
1444 struct i3c_master_controller *master = i2c_dev_get_master(dev); in i3c_master_detach_i2c_dev() local
1448 if (master->ops->detach_i2c_dev) in i3c_master_detach_i2c_dev()
1449 master->ops->detach_i2c_dev(dev); in i3c_master_detach_i2c_dev()
1452 static int i3c_master_early_i3c_dev_add(struct i3c_master_controller *master, in i3c_master_early_i3c_dev_add() argument
1462 i3cdev = i3c_master_alloc_i3c_dev(master, &info); in i3c_master_early_i3c_dev_add()
1468 ret = i3c_master_attach_i3c_dev(master, i3cdev); in i3c_master_early_i3c_dev_add()
1472 ret = i3c_master_setdasa_locked(master, i3cdev->info.static_addr, in i3c_master_early_i3c_dev_add()
1489 i3c_master_rstdaa_locked(master, i3cdev->boardinfo->init_dyn_addr); in i3c_master_early_i3c_dev_add()
1499 i3c_master_register_new_i3c_devs(struct i3c_master_controller *master) in i3c_master_register_new_i3c_devs() argument
1504 if (!master->init_done) in i3c_master_register_new_i3c_devs()
1507 i3c_bus_for_each_i3cdev(&master->bus, desc) { in i3c_master_register_new_i3c_devs()
1508 if (desc->dev || !desc->info.dyn_addr || desc == master->this) in i3c_master_register_new_i3c_devs()
1515 desc->dev->bus = &master->bus; in i3c_master_register_new_i3c_devs()
1517 desc->dev->dev.parent = &master->dev; in i3c_master_register_new_i3c_devs()
1521 dev_set_name(&desc->dev->dev, "%d-%llx", master->bus.id, in i3c_master_register_new_i3c_devs()
1529 dev_err(&master->dev, in i3c_master_register_new_i3c_devs()
1551 int i3c_master_do_daa(struct i3c_master_controller *master) in i3c_master_do_daa() argument
1555 i3c_bus_maintenance_lock(&master->bus); in i3c_master_do_daa()
1556 ret = master->ops->do_daa(master); in i3c_master_do_daa()
1557 i3c_bus_maintenance_unlock(&master->bus); in i3c_master_do_daa()
1562 i3c_bus_normaluse_lock(&master->bus); in i3c_master_do_daa()
1563 i3c_master_register_new_i3c_devs(master); in i3c_master_do_daa()
1564 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_do_daa()
1594 int i3c_master_set_info(struct i3c_master_controller *master, in i3c_master_set_info() argument
1600 if (!i3c_bus_dev_addr_is_avail(&master->bus, info->dyn_addr)) in i3c_master_set_info()
1604 master->secondary) in i3c_master_set_info()
1607 if (master->this) in i3c_master_set_info()
1610 i3cdev = i3c_master_alloc_i3c_dev(master, info); in i3c_master_set_info()
1614 master->this = i3cdev; in i3c_master_set_info()
1615 master->bus.cur_master = master->this; in i3c_master_set_info()
1617 ret = i3c_master_attach_i3c_dev(master, i3cdev); in i3c_master_set_info()
1630 static void i3c_master_detach_free_devs(struct i3c_master_controller *master) in i3c_master_detach_free_devs() argument
1635 list_for_each_entry_safe(i3cdev, i3ctmp, &master->bus.devs.i3c, in i3c_master_detach_free_devs()
1640 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_detach_free_devs()
1647 list_for_each_entry_safe(i2cdev, i2ctmp, &master->bus.devs.i2c, in i3c_master_detach_free_devs()
1650 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_detach_free_devs()
1689 static int i3c_master_bus_init(struct i3c_master_controller *master) in i3c_master_bus_init() argument
1701 list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) { in i3c_master_bus_init()
1702 status = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_bus_init()
1709 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_bus_init()
1713 i2cdev = i3c_master_alloc_i2c_dev(master, in i3c_master_bus_init()
1721 ret = i3c_master_attach_i2c_dev(master, i2cdev); in i3c_master_bus_init()
1732 ret = master->ops->bus_init(master); in i3c_master_bus_init()
1740 if (!master->this) { in i3c_master_bus_init()
1741 dev_err(&master->dev, in i3c_master_bus_init()
1751 ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); in i3c_master_bus_init()
1756 ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, in i3c_master_bus_init()
1769 list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) { in i3c_master_bus_init()
1778 ret = i3c_bus_get_addr_slot_status(&master->bus, in i3c_master_bus_init()
1785 i3c_bus_set_addr_slot_status(&master->bus, in i3c_master_bus_init()
1798 i3c_master_early_i3c_dev_add(master, i3cboardinfo); in i3c_master_bus_init()
1801 ret = i3c_master_do_daa(master); in i3c_master_bus_init()
1808 i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); in i3c_master_bus_init()
1811 if (master->ops->bus_cleanup) in i3c_master_bus_init()
1812 master->ops->bus_cleanup(master); in i3c_master_bus_init()
1815 i3c_master_detach_free_devs(master); in i3c_master_bus_init()
1820 static void i3c_master_bus_cleanup(struct i3c_master_controller *master) in i3c_master_bus_cleanup() argument
1822 if (master->ops->bus_cleanup) in i3c_master_bus_cleanup()
1823 master->ops->bus_cleanup(master); in i3c_master_bus_cleanup()
1825 i3c_master_detach_free_devs(master); in i3c_master_bus_cleanup()
1830 struct i3c_master_controller *master = i3cdev->common.master; in i3c_master_attach_boardinfo() local
1833 list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) { in i3c_master_attach_boardinfo()
1846 struct i3c_master_controller *master = i3c_dev_get_master(refdev); in i3c_master_search_i3c_dev_duplicate() local
1849 i3c_bus_for_each_i3cdev(&master->bus, i3cdev) { in i3c_master_search_i3c_dev_duplicate()
1873 int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, in i3c_master_add_i3c_dev_locked() argument
1883 if (!master) in i3c_master_add_i3c_dev_locked()
1886 newdev = i3c_master_alloc_i3c_dev(master, &info); in i3c_master_add_i3c_dev_locked()
1890 ret = i3c_master_attach_i3c_dev(master, newdev); in i3c_master_add_i3c_dev_locked()
1955 ret = i3c_master_setnewda_locked(master, in i3c_master_add_i3c_dev_locked()
1963 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1965 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
1980 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1982 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
1986 dev_err(&master->dev, in i3c_master_add_i3c_dev_locked()
1988 master->bus.id, newdev->info.pid); in i3c_master_add_i3c_dev_locked()
2011 of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, in of_i3c_master_add_i2c_boardinfo() argument
2015 struct device *dev = &master->dev; in of_i3c_master_add_i2c_boardinfo()
2039 list_add_tail(&boardinfo->node, &master->boardinfo.i2c); in of_i3c_master_add_i2c_boardinfo()
2046 of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, in of_i3c_master_add_i3c_boardinfo() argument
2050 struct device *dev = &master->dev; in of_i3c_master_add_i3c_boardinfo()
2062 addrstatus = i3c_bus_get_addr_slot_status(&master->bus, in of_i3c_master_add_i3c_boardinfo()
2074 addrstatus = i3c_bus_get_addr_slot_status(&master->bus, in of_i3c_master_add_i3c_boardinfo()
2088 list_add_tail(&boardinfo->node, &master->boardinfo.i3c); in of_i3c_master_add_i3c_boardinfo()
2093 static int of_i3c_master_add_dev(struct i3c_master_controller *master, in of_i3c_master_add_dev() argument
2099 if (!master || !node) in of_i3c_master_add_dev()
2111 ret = of_i3c_master_add_i2c_boardinfo(master, node, reg); in of_i3c_master_add_dev()
2113 ret = of_i3c_master_add_i3c_boardinfo(master, node, reg); in of_i3c_master_add_dev()
2118 static int of_populate_i3c_bus(struct i3c_master_controller *master) in of_populate_i3c_bus() argument
2120 struct device *dev = &master->dev; in of_populate_i3c_bus()
2130 ret = of_i3c_master_add_dev(master, node); in of_populate_i3c_bus()
2143 master->bus.scl_rate.i2c = val; in of_populate_i3c_bus()
2146 master->bus.scl_rate.i3c = val; in of_populate_i3c_bus()
2154 struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap); in i3c_master_i2c_adapter_xfer() local
2159 if (!xfers || !master || nxfers <= 0) in i3c_master_i2c_adapter_xfer()
2162 if (!master->ops->i2c_xfers) in i3c_master_i2c_adapter_xfer()
2172 i3c_bus_normaluse_lock(&master->bus); in i3c_master_i2c_adapter_xfer()
2173 dev = i3c_master_find_i2c_dev_by_addr(master, addr); in i3c_master_i2c_adapter_xfer()
2177 ret = master->ops->i2c_xfers(dev, xfers, nxfers); in i3c_master_i2c_adapter_xfer()
2178 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_i2c_adapter_xfer()
2206 struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap); in i3c_master_i2c_attach() local
2212 if (i3c_master_find_i2c_dev_by_addr(master, client->addr)) in i3c_master_i2c_attach()
2215 status = i3c_bus_get_addr_slot_status(&master->bus, client->addr); in i3c_master_i2c_attach()
2219 i3c_bus_set_addr_slot_status(&master->bus, client->addr, in i3c_master_i2c_attach()
2222 i2cdev = i3c_master_alloc_i2c_dev(master, client->addr, in i3c_master_i2c_attach()
2229 ret = i3c_master_attach_i2c_dev(master, i2cdev); in i3c_master_i2c_attach()
2238 i3c_bus_set_addr_slot_status(&master->bus, client->addr, in i3c_master_i2c_attach()
2246 struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap); in i3c_master_i2c_detach() local
2249 dev = i3c_master_find_i2c_dev_by_addr(master, client->addr); in i3c_master_i2c_detach()
2254 i3c_bus_set_addr_slot_status(&master->bus, dev->addr, in i3c_master_i2c_detach()
2272 struct i3c_master_controller *master; in i3c_i2c_notifier_call() local
2284 master = i2c_adapter_to_i3c_master(adap); in i3c_i2c_notifier_call()
2286 i3c_bus_maintenance_lock(&master->bus); in i3c_i2c_notifier_call()
2295 i3c_bus_maintenance_unlock(&master->bus); in i3c_i2c_notifier_call()
2304 static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master) in i3c_master_i2c_adapter_init() argument
2306 struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master); in i3c_master_i2c_adapter_init()
2311 adap->dev.parent = master->dev.parent; in i3c_master_i2c_adapter_init()
2312 adap->owner = master->dev.parent->driver->owner; in i3c_master_i2c_adapter_init()
2314 strncpy(adap->name, dev_name(master->dev.parent), sizeof(adap->name)); in i3c_master_i2c_adapter_init()
2328 list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) { in i3c_master_i2c_adapter_init()
2329 i2cdev = i3c_master_find_i2c_dev_by_addr(master, in i3c_master_i2c_adapter_init()
2339 static void i3c_master_i2c_adapter_cleanup(struct i3c_master_controller *master) in i3c_master_i2c_adapter_cleanup() argument
2343 i2c_del_adapter(&master->i2c); in i3c_master_i2c_adapter_cleanup()
2345 i3c_bus_for_each_i2cdev(&master->bus, i2cdev) in i3c_master_i2c_adapter_cleanup()
2349 static void i3c_master_unregister_i3c_devs(struct i3c_master_controller *master) in i3c_master_unregister_i3c_devs() argument
2353 i3c_bus_for_each_i3cdev(&master->bus, i3cdev) { in i3c_master_unregister_i3c_devs()
2377 queue_work(dev->common.master->wq, &slot->work); in i3c_master_queue_ibi()
2386 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_master_handle_ibi() local
2395 master->ops->recycle_ibi_slot(dev, slot); in i3c_master_handle_ibi()
2598 int i3c_master_register(struct i3c_master_controller *master, in i3c_master_register() argument
2604 struct i3c_bus *i3cbus = i3c_master_get_bus(master); in i3c_master_register()
2617 master->dev.parent = parent; in i3c_master_register()
2618 master->dev.of_node = of_node_get(parent->of_node); in i3c_master_register()
2619 master->dev.bus = &i3c_bus_type; in i3c_master_register()
2620 master->dev.type = &i3c_masterdev_type; in i3c_master_register()
2621 master->dev.release = i3c_masterdev_release; in i3c_master_register()
2622 master->ops = ops; in i3c_master_register()
2623 master->secondary = secondary; in i3c_master_register()
2624 INIT_LIST_HEAD(&master->boardinfo.i2c); in i3c_master_register()
2625 INIT_LIST_HEAD(&master->boardinfo.i3c); in i3c_master_register()
2627 ret = i3c_bus_init(i3cbus, master->dev.of_node); in i3c_master_register()
2631 device_initialize(&master->dev); in i3c_master_register()
2632 dev_set_name(&master->dev, "i3c-%d", i3cbus->id); in i3c_master_register()
2634 ret = of_populate_i3c_bus(master); in i3c_master_register()
2638 list_for_each_entry(i2cbi, &master->boardinfo.i2c, node) { in i3c_master_register()
2665 master->wq = alloc_workqueue("%s", 0, 0, dev_name(parent)); in i3c_master_register()
2666 if (!master->wq) { in i3c_master_register()
2671 ret = i3c_master_bus_init(master); in i3c_master_register()
2675 ret = device_add(&master->dev); in i3c_master_register()
2683 ret = i3c_master_i2c_adapter_init(master); in i3c_master_register()
2691 master->init_done = true; in i3c_master_register()
2692 i3c_bus_normaluse_lock(&master->bus); in i3c_master_register()
2693 i3c_master_register_new_i3c_devs(master); in i3c_master_register()
2694 i3c_bus_normaluse_unlock(&master->bus); in i3c_master_register()
2699 device_del(&master->dev); in i3c_master_register()
2702 i3c_master_bus_cleanup(master); in i3c_master_register()
2705 put_device(&master->dev); in i3c_master_register()
2717 void i3c_master_unregister(struct i3c_master_controller *master) in i3c_master_unregister() argument
2719 i3c_master_i2c_adapter_cleanup(master); in i3c_master_unregister()
2720 i3c_master_unregister_i3c_devs(master); in i3c_master_unregister()
2721 i3c_master_bus_cleanup(master); in i3c_master_unregister()
2722 device_unregister(&master->dev); in i3c_master_unregister()
2728 struct i3c_master_controller *master; in i3c_dev_setdasa_locked() local
2733 master = i3c_dev_get_master(dev); in i3c_dev_setdasa_locked()
2734 if (!master) in i3c_dev_setdasa_locked()
2741 return i3c_master_setdasa_locked(master, dev->info.static_addr, in i3c_dev_setdasa_locked()
2749 struct i3c_master_controller *master; in i3c_dev_do_priv_xfers_locked() local
2754 master = i3c_dev_get_master(dev); in i3c_dev_do_priv_xfers_locked()
2755 if (!master || !xfers) in i3c_dev_do_priv_xfers_locked()
2758 if (!master->ops->priv_xfers) in i3c_dev_do_priv_xfers_locked()
2761 return master->ops->priv_xfers(dev, xfers, nxfers); in i3c_dev_do_priv_xfers_locked()
2766 struct i3c_master_controller *master; in i3c_dev_disable_ibi_locked() local
2772 master = i3c_dev_get_master(dev); in i3c_dev_disable_ibi_locked()
2773 ret = master->ops->disable_ibi(dev); in i3c_dev_disable_ibi_locked()
2788 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_enable_ibi_locked() local
2794 ret = master->ops->enable_ibi(dev); in i3c_dev_enable_ibi_locked()
2804 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_request_ibi_locked() local
2808 if (!master->ops->request_ibi) in i3c_dev_request_ibi_locked()
2825 ret = master->ops->request_ibi(dev, req); in i3c_dev_request_ibi_locked()
2836 struct i3c_master_controller *master = i3c_dev_get_master(dev); in i3c_dev_free_ibi_locked() local
2844 master->ops->free_ibi(dev); in i3c_dev_free_ibi_locked()