Lines Matching +full:slave +full:- +full:addr

1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2015-17 Intel Corporation.
24 bus->id = rc; in sdw_get_id()
26 if (bus->controller_id == -1) in sdw_get_id()
27 bus->controller_id = rc; in sdw_get_id()
33 * sdw_bus_master_add() - add a bus Master instance
49 return -ENODEV; in sdw_bus_master_add()
61 bus->link_id); in sdw_bus_master_add()
65 if (!bus->ops) { in sdw_bus_master_add()
66 dev_err(bus->dev, "SoundWire Bus ops are not set\n"); in sdw_bus_master_add()
67 return -EINVAL; in sdw_bus_master_add()
70 if (!bus->compute_params) { in sdw_bus_master_add()
71 dev_err(bus->dev, in sdw_bus_master_add()
73 return -EINVAL; in sdw_bus_master_add()
79 * grabbed during configuration of a multi-bus stream. in sdw_bus_master_add()
81 lockdep_register_key(&bus->msg_lock_key); in sdw_bus_master_add()
82 __mutex_init(&bus->msg_lock, "msg_lock", &bus->msg_lock_key); in sdw_bus_master_add()
84 lockdep_register_key(&bus->bus_lock_key); in sdw_bus_master_add()
85 __mutex_init(&bus->bus_lock, "bus_lock", &bus->bus_lock_key); in sdw_bus_master_add()
87 INIT_LIST_HEAD(&bus->slaves); in sdw_bus_master_add()
88 INIT_LIST_HEAD(&bus->m_rt_list); in sdw_bus_master_add()
93 bus->multi_link = false; in sdw_bus_master_add()
94 if (bus->ops->read_prop) { in sdw_bus_master_add()
95 ret = bus->ops->read_prop(bus); in sdw_bus_master_add()
97 dev_err(bus->dev, in sdw_bus_master_add()
113 *bus->assigned = ~GENMASK(SDW_BROADCAST_DEV_NUM, SDW_ENUM_DEV_NUM); in sdw_bus_master_add()
116 set_bit(SDW_ENUM_DEV_NUM, bus->assigned); in sdw_bus_master_add()
117 set_bit(SDW_BROADCAST_DEV_NUM, bus->assigned); in sdw_bus_master_add()
120 set_bit(SDW_GROUP12_DEV_NUM, bus->assigned); in sdw_bus_master_add()
121 set_bit(SDW_GROUP13_DEV_NUM, bus->assigned); in sdw_bus_master_add()
122 set_bit(SDW_MASTER_DEV_NUM, bus->assigned); in sdw_bus_master_add()
128 * Create Slave devices based on Slaves described in in sdw_bus_master_add()
131 if (IS_ENABLED(CONFIG_ACPI) && ACPI_HANDLE(bus->dev)) in sdw_bus_master_add()
133 else if (IS_ENABLED(CONFIG_OF) && bus->dev->of_node) in sdw_bus_master_add()
136 ret = -ENOTSUPP; /* No ACPI/DT so error out */ in sdw_bus_master_add()
139 dev_err(bus->dev, "Finding slaves failed:%d\n", ret); in sdw_bus_master_add()
152 prop = &bus->prop; in sdw_bus_master_add()
153 bus->params.max_dr_freq = prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR; in sdw_bus_master_add()
154 bus->params.curr_dr_freq = bus->params.max_dr_freq; in sdw_bus_master_add()
155 bus->params.curr_bank = SDW_BANK0; in sdw_bus_master_add()
156 bus->params.next_bank = SDW_BANK1; in sdw_bus_master_add()
168 struct sdw_slave *slave = dev_to_sdw_dev(dev); in sdw_delete_slave() local
169 struct sdw_bus *bus = slave->bus; in sdw_delete_slave()
173 sdw_slave_debugfs_exit(slave); in sdw_delete_slave()
175 mutex_lock(&bus->bus_lock); in sdw_delete_slave()
177 if (slave->dev_num) { /* clear dev_num if assigned */ in sdw_delete_slave()
178 clear_bit(slave->dev_num, bus->assigned); in sdw_delete_slave()
179 if (bus->ops && bus->ops->put_device_num) in sdw_delete_slave()
180 bus->ops->put_device_num(bus, slave); in sdw_delete_slave()
182 list_del_init(&slave->node); in sdw_delete_slave()
183 mutex_unlock(&bus->bus_lock); in sdw_delete_slave()
190 * sdw_bus_master_delete() - delete the bus master instance
197 device_for_each_child(bus->dev, NULL, sdw_delete_slave); in sdw_bus_master_delete()
204 lockdep_unregister_key(&bus->bus_lock_key); in sdw_bus_master_delete()
205 lockdep_unregister_key(&bus->msg_lock_key); in sdw_bus_master_delete()
206 ida_free(&sdw_bus_ida, bus->id); in sdw_bus_master_delete()
221 return -ENODATA; in find_response_code()
224 return -ETIMEDOUT; in find_response_code()
227 return -EIO; in find_response_code()
233 int retry = bus->prop.err_threshold; in do_transfer()
238 resp = bus->ops->xfer_msg(bus, msg); in do_transfer()
242 if (ret == 0 || ret == -ENODATA) in do_transfer()
252 struct sdw_defer *defer = &bus->defer_msg; in do_transfer_defer()
253 int retry = bus->prop.err_threshold; in do_transfer_defer()
257 defer->msg = msg; in do_transfer_defer()
258 defer->length = msg->len; in do_transfer_defer()
259 init_completion(&defer->complete); in do_transfer_defer()
262 resp = bus->ops->xfer_msg_defer(bus); in do_transfer_defer()
265 if (ret == 0 || ret == -ENODATA) in do_transfer_defer()
277 if (ret != 0 && ret != -ENODATA) in sdw_transfer_unlocked()
278 dev_err(bus->dev, "trf on Slave %d failed:%d %s addr %x count %d\n", in sdw_transfer_unlocked()
279 msg->dev_num, ret, in sdw_transfer_unlocked()
280 (msg->flags & SDW_MSG_FLAG_WRITE) ? "write" : "read", in sdw_transfer_unlocked()
281 msg->addr, msg->len); in sdw_transfer_unlocked()
287 * sdw_transfer() - Synchronous transfer message to a SDW Slave device
295 mutex_lock(&bus->msg_lock); in sdw_transfer()
299 mutex_unlock(&bus->msg_lock); in sdw_transfer()
305 * sdw_show_ping_status() - Direct report of PING status, to be used by Peripheral drivers
313 if (!bus->ops->read_ping_status) in sdw_show_ping_status()
317 * wait for peripheral to sync if desired. 10-15ms should be more than in sdw_show_ping_status()
323 mutex_lock(&bus->msg_lock); in sdw_show_ping_status()
325 status = bus->ops->read_ping_status(bus); in sdw_show_ping_status()
327 mutex_unlock(&bus->msg_lock); in sdw_show_ping_status()
330 dev_warn(bus->dev, "%s: no peripherals attached\n", __func__); in sdw_show_ping_status()
332 dev_dbg(bus->dev, "PING status: %#x\n", status); in sdw_show_ping_status()
337 * sdw_transfer_defer() - Asynchronously transfer message to a SDW Slave device
347 if (!bus->ops->xfer_msg_defer) in sdw_transfer_defer()
348 return -ENOTSUPP; in sdw_transfer_defer()
351 if (ret != 0 && ret != -ENODATA) in sdw_transfer_defer()
352 dev_err(bus->dev, "Defer trf on Slave %d failed:%d\n", in sdw_transfer_defer()
353 msg->dev_num, ret); in sdw_transfer_defer()
358 int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave, in sdw_fill_msg() argument
359 u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf) in sdw_fill_msg() argument
362 msg->addr = addr; /* addr is 16 bit and truncated here */ in sdw_fill_msg()
363 msg->len = count; in sdw_fill_msg()
364 msg->dev_num = dev_num; in sdw_fill_msg()
365 msg->flags = flags; in sdw_fill_msg()
366 msg->buf = buf; in sdw_fill_msg()
368 if (addr < SDW_REG_NO_PAGE) /* no paging area */ in sdw_fill_msg()
371 if (addr >= SDW_REG_MAX) { /* illegal addr */ in sdw_fill_msg()
372 pr_err("SDW: Invalid address %x passed\n", addr); in sdw_fill_msg()
373 return -EINVAL; in sdw_fill_msg()
376 if (addr < SDW_REG_OPTIONAL_PAGE) { /* 32k but no page */ in sdw_fill_msg()
377 if (slave && !slave->prop.paging_support) in sdw_fill_msg()
379 /* no need for else as that will fall-through to paging */ in sdw_fill_msg()
385 return -EINVAL; in sdw_fill_msg()
388 if (!slave) { in sdw_fill_msg()
389 pr_err("SDW: No slave for paging addr\n"); in sdw_fill_msg()
390 return -EINVAL; in sdw_fill_msg()
393 if (!slave->prop.paging_support) { in sdw_fill_msg()
394 dev_err(&slave->dev, in sdw_fill_msg()
395 "address %x needs paging but no support\n", addr); in sdw_fill_msg()
396 return -EINVAL; in sdw_fill_msg()
399 msg->addr_page1 = FIELD_GET(SDW_SCP_ADDRPAGE1_MASK, addr); in sdw_fill_msg()
400 msg->addr_page2 = FIELD_GET(SDW_SCP_ADDRPAGE2_MASK, addr); in sdw_fill_msg()
401 msg->addr |= BIT(15); in sdw_fill_msg()
402 msg->page = true; in sdw_fill_msg()
411 static int sdw_ntransfer_no_pm(struct sdw_slave *slave, u32 addr, u8 flags, in sdw_ntransfer_no_pm() argument
420 size = min_t(size_t, count, (SDW_REGADDR + 1) - (addr & SDW_REGADDR)); in sdw_ntransfer_no_pm()
422 ret = sdw_fill_msg(&msg, slave, addr, size, slave->dev_num, flags, val); in sdw_ntransfer_no_pm()
426 ret = sdw_transfer(slave->bus, &msg); in sdw_ntransfer_no_pm()
427 if (ret < 0 && !slave->is_mockup_device) in sdw_ntransfer_no_pm()
430 addr += size; in sdw_ntransfer_no_pm()
432 count -= size; in sdw_ntransfer_no_pm()
439 * sdw_nread_no_pm() - Read "n" contiguous SDW Slave registers with no PM
440 * @slave: SDW Slave
441 * @addr: Register address
448 int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) in sdw_nread_no_pm() argument
450 return sdw_ntransfer_no_pm(slave, addr, SDW_MSG_FLAG_READ, count, val); in sdw_nread_no_pm()
455 * sdw_nwrite_no_pm() - Write "n" contiguous SDW Slave registers with no PM
456 * @slave: SDW Slave
457 * @addr: Register address
464 int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val) in sdw_nwrite_no_pm() argument
466 return sdw_ntransfer_no_pm(slave, addr, SDW_MSG_FLAG_WRITE, count, (u8 *)val); in sdw_nwrite_no_pm()
471 * sdw_write_no_pm() - Write a SDW Slave register with no PM
472 * @slave: SDW Slave
473 * @addr: Register address
476 int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value) in sdw_write_no_pm() argument
478 return sdw_nwrite_no_pm(slave, addr, 1, &value); in sdw_write_no_pm()
483 sdw_bread_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr) in sdw_bread_no_pm() argument
489 ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, in sdw_bread_no_pm()
502 sdw_bwrite_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 value) in sdw_bwrite_no_pm() argument
507 ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, in sdw_bwrite_no_pm()
515 int sdw_bread_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr) in sdw_bread_no_pm_unlocked() argument
521 ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, in sdw_bread_no_pm_unlocked()
534 int sdw_bwrite_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 value) in sdw_bwrite_no_pm_unlocked() argument
539 ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, in sdw_bwrite_no_pm_unlocked()
549 * sdw_read_no_pm() - Read a SDW Slave register with no PM
550 * @slave: SDW Slave
551 * @addr: Register address
553 int sdw_read_no_pm(struct sdw_slave *slave, u32 addr) in sdw_read_no_pm() argument
558 ret = sdw_nread_no_pm(slave, addr, 1, &buf); in sdw_read_no_pm()
566 int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) in sdw_update_no_pm() argument
570 tmp = sdw_read_no_pm(slave, addr); in sdw_update_no_pm()
575 return sdw_write_no_pm(slave, addr, tmp); in sdw_update_no_pm()
579 /* Read-Modify-Write Slave register */
580 int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) in sdw_update() argument
584 tmp = sdw_read(slave, addr); in sdw_update()
589 return sdw_write(slave, addr, tmp); in sdw_update()
594 * sdw_nread() - Read "n" contiguous SDW Slave registers
595 * @slave: SDW Slave
596 * @addr: Register address
600 * This version of the function will take a PM reference to the slave
605 int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) in sdw_nread() argument
609 ret = pm_runtime_get_sync(&slave->dev); in sdw_nread()
610 if (ret < 0 && ret != -EACCES) { in sdw_nread()
611 pm_runtime_put_noidle(&slave->dev); in sdw_nread()
615 ret = sdw_nread_no_pm(slave, addr, count, val); in sdw_nread()
617 pm_runtime_mark_last_busy(&slave->dev); in sdw_nread()
618 pm_runtime_put(&slave->dev); in sdw_nread()
625 * sdw_nwrite() - Write "n" contiguous SDW Slave registers
626 * @slave: SDW Slave
627 * @addr: Register address
631 * This version of the function will take a PM reference to the slave
636 int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val) in sdw_nwrite() argument
640 ret = pm_runtime_get_sync(&slave->dev); in sdw_nwrite()
641 if (ret < 0 && ret != -EACCES) { in sdw_nwrite()
642 pm_runtime_put_noidle(&slave->dev); in sdw_nwrite()
646 ret = sdw_nwrite_no_pm(slave, addr, count, val); in sdw_nwrite()
648 pm_runtime_mark_last_busy(&slave->dev); in sdw_nwrite()
649 pm_runtime_put(&slave->dev); in sdw_nwrite()
656 * sdw_read() - Read a SDW Slave register
657 * @slave: SDW Slave
658 * @addr: Register address
660 * This version of the function will take a PM reference to the slave
663 int sdw_read(struct sdw_slave *slave, u32 addr) in sdw_read() argument
668 ret = sdw_nread(slave, addr, 1, &buf); in sdw_read()
677 * sdw_write() - Write a SDW Slave register
678 * @slave: SDW Slave
679 * @addr: Register address
682 * This version of the function will take a PM reference to the slave
685 int sdw_write(struct sdw_slave *slave, u32 addr, u8 value) in sdw_write() argument
687 return sdw_nwrite(slave, addr, 1, &value); in sdw_write()
698 struct sdw_slave *slave; in sdw_get_slave() local
700 list_for_each_entry(slave, &bus->slaves, node) { in sdw_get_slave()
701 if (slave->dev_num == i) in sdw_get_slave()
702 return slave; in sdw_get_slave()
708 int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id) in sdw_compare_devid() argument
710 if (slave->id.mfg_id != id.mfg_id || in sdw_compare_devid()
711 slave->id.part_id != id.part_id || in sdw_compare_devid()
712 slave->id.class_id != id.class_id || in sdw_compare_devid()
713 (slave->id.unique_id != SDW_IGNORED_UNIQUE_ID && in sdw_compare_devid()
714 slave->id.unique_id != id.unique_id)) in sdw_compare_devid()
715 return -ENODEV; in sdw_compare_devid()
722 static int sdw_get_device_num(struct sdw_slave *slave) in sdw_get_device_num() argument
724 struct sdw_bus *bus = slave->bus; in sdw_get_device_num()
727 if (bus->ops && bus->ops->get_device_num) { in sdw_get_device_num()
728 bit = bus->ops->get_device_num(bus, slave); in sdw_get_device_num()
732 bit = find_first_zero_bit(bus->assigned, SDW_MAX_DEVICES); in sdw_get_device_num()
734 bit = -ENODEV; in sdw_get_device_num()
740 * Do not update dev_num in Slave data structure here, in sdw_get_device_num()
743 set_bit(bit, bus->assigned); in sdw_get_device_num()
749 static int sdw_assign_device_num(struct sdw_slave *slave) in sdw_assign_device_num() argument
751 struct sdw_bus *bus = slave->bus; in sdw_assign_device_num()
756 if (!slave->dev_num) { in sdw_assign_device_num()
757 if (!slave->dev_num_sticky) { in sdw_assign_device_num()
758 mutex_lock(&slave->bus->bus_lock); in sdw_assign_device_num()
759 dev_num = sdw_get_device_num(slave); in sdw_assign_device_num()
760 mutex_unlock(&slave->bus->bus_lock); in sdw_assign_device_num()
762 dev_err(bus->dev, "Get dev_num failed: %d\n", in sdw_assign_device_num()
766 slave->dev_num = dev_num; in sdw_assign_device_num()
767 slave->dev_num_sticky = dev_num; in sdw_assign_device_num()
770 slave->dev_num = slave->dev_num_sticky; in sdw_assign_device_num()
775 dev_dbg(bus->dev, in sdw_assign_device_num()
776 "Slave already registered, reusing dev_num:%d\n", in sdw_assign_device_num()
777 slave->dev_num); in sdw_assign_device_num()
779 /* Clear the slave->dev_num to transfer message on device 0 */ in sdw_assign_device_num()
780 dev_num = slave->dev_num; in sdw_assign_device_num()
781 slave->dev_num = 0; in sdw_assign_device_num()
783 ret = sdw_write_no_pm(slave, SDW_SCP_DEVNUMBER, dev_num); in sdw_assign_device_num()
785 dev_err(bus->dev, "Program device_num %d failed: %d\n", in sdw_assign_device_num()
791 slave->dev_num = slave->dev_num_sticky; in sdw_assign_device_num()
793 if (bus->ops && bus->ops->new_peripheral_assigned) in sdw_assign_device_num()
794 bus->ops->new_peripheral_assigned(bus, slave, dev_num); in sdw_assign_device_num()
800 u64 addr, struct sdw_slave_id *id) in sdw_extract_slave_id() argument
802 dev_dbg(bus->dev, "SDW Slave Addr: %llx\n", addr); in sdw_extract_slave_id()
804 id->sdw_version = SDW_VERSION(addr); in sdw_extract_slave_id()
805 id->unique_id = SDW_UNIQUE_ID(addr); in sdw_extract_slave_id()
806 id->mfg_id = SDW_MFG_ID(addr); in sdw_extract_slave_id()
807 id->part_id = SDW_PART_ID(addr); in sdw_extract_slave_id()
808 id->class_id = SDW_CLASS_ID(addr); in sdw_extract_slave_id()
810 dev_dbg(bus->dev, in sdw_extract_slave_id()
811 "SDW Slave class_id 0x%02x, mfg_id 0x%04x, part_id 0x%04x, unique_id 0x%x, version 0x%x\n", in sdw_extract_slave_id()
812 id->class_id, id->mfg_id, id->part_id, id->unique_id, id->sdw_version); in sdw_extract_slave_id()
819 struct sdw_slave *slave, *_s; in sdw_program_device_num() local
824 u64 addr; in sdw_program_device_num() local
828 /* No Slave, so use raw xfer api */ in sdw_program_device_num()
836 if (ret == -ENODATA) { /* end of device id reads */ in sdw_program_device_num()
837 dev_dbg(bus->dev, "No more devices to enumerate\n"); in sdw_program_device_num()
842 dev_err(bus->dev, "DEVID read fail:%d\n", ret); in sdw_program_device_num()
847 * Construct the addr and extract. Cast the higher shift in sdw_program_device_num()
850 addr = buf[5] | (buf[4] << 8) | (buf[3] << 16) | in sdw_program_device_num()
854 sdw_extract_slave_id(bus, addr, &id); in sdw_program_device_num()
858 list_for_each_entry_safe(slave, _s, &bus->slaves, node) { in sdw_program_device_num()
859 if (sdw_compare_devid(slave, id) == 0) { in sdw_program_device_num()
863 * To prevent skipping state-machine stages don't in sdw_program_device_num()
869 if (slave->status != SDW_SLAVE_UNATTACHED) in sdw_program_device_num()
873 * Assign a new dev_num to this Slave and in sdw_program_device_num()
878 ret = sdw_assign_device_num(slave); in sdw_program_device_num()
880 dev_err(bus->dev, in sdw_program_device_num()
896 * add Slave device even if there is no platform in sdw_program_device_num()
903 dev_err(bus->dev, "Slave Entry not found\n"); in sdw_program_device_num()
919 static void sdw_modify_slave_status(struct sdw_slave *slave, in sdw_modify_slave_status() argument
922 struct sdw_bus *bus = slave->bus; in sdw_modify_slave_status()
924 mutex_lock(&bus->bus_lock); in sdw_modify_slave_status()
926 dev_vdbg(bus->dev, in sdw_modify_slave_status()
927 "changing status slave %d status %d new status %d\n", in sdw_modify_slave_status()
928 slave->dev_num, slave->status, status); in sdw_modify_slave_status()
931 dev_dbg(&slave->dev, in sdw_modify_slave_status()
932 "initializing enumeration and init completion for Slave %d\n", in sdw_modify_slave_status()
933 slave->dev_num); in sdw_modify_slave_status()
935 reinit_completion(&slave->enumeration_complete); in sdw_modify_slave_status()
936 reinit_completion(&slave->initialization_complete); in sdw_modify_slave_status()
939 (slave->status == SDW_SLAVE_UNATTACHED)) { in sdw_modify_slave_status()
940 dev_dbg(&slave->dev, in sdw_modify_slave_status()
941 "signaling enumeration completion for Slave %d\n", in sdw_modify_slave_status()
942 slave->dev_num); in sdw_modify_slave_status()
944 complete_all(&slave->enumeration_complete); in sdw_modify_slave_status()
946 slave->status = status; in sdw_modify_slave_status()
947 mutex_unlock(&bus->bus_lock); in sdw_modify_slave_status()
950 static int sdw_slave_clk_stop_callback(struct sdw_slave *slave, in sdw_slave_clk_stop_callback() argument
956 mutex_lock(&slave->sdw_dev_lock); in sdw_slave_clk_stop_callback()
958 if (slave->probed) { in sdw_slave_clk_stop_callback()
959 struct device *dev = &slave->dev; in sdw_slave_clk_stop_callback()
960 struct sdw_driver *drv = drv_to_sdw_driver(dev->driver); in sdw_slave_clk_stop_callback()
962 if (drv->ops && drv->ops->clk_stop) in sdw_slave_clk_stop_callback()
963 ret = drv->ops->clk_stop(slave, mode, type); in sdw_slave_clk_stop_callback()
966 mutex_unlock(&slave->sdw_dev_lock); in sdw_slave_clk_stop_callback()
971 static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, in sdw_slave_clk_stop_prepare() argument
979 wake_en = slave->prop.wake_capable; in sdw_slave_clk_stop_prepare()
990 ret = sdw_read_no_pm(slave, SDW_SCP_SYSTEMCTRL); in sdw_slave_clk_stop_prepare()
992 if (ret != -ENODATA) in sdw_slave_clk_stop_prepare()
993 dev_err(&slave->dev, "SDW_SCP_SYSTEMCTRL read failed:%d\n", ret); in sdw_slave_clk_stop_prepare()
1000 ret = sdw_write_no_pm(slave, SDW_SCP_SYSTEMCTRL, val); in sdw_slave_clk_stop_prepare()
1002 if (ret < 0 && ret != -ENODATA) in sdw_slave_clk_stop_prepare()
1003 dev_err(&slave->dev, "SDW_SCP_SYSTEMCTRL write failed:%d\n", ret); in sdw_slave_clk_stop_prepare()
1010 int retry = bus->clk_stop_timeout; in sdw_bus_wait_for_clk_prep_deprep()
1016 if (val != -ENODATA) in sdw_bus_wait_for_clk_prep_deprep()
1017 dev_err(bus->dev, "SDW_SCP_STAT bread failed:%d\n", val); in sdw_bus_wait_for_clk_prep_deprep()
1022 dev_dbg(bus->dev, "clock stop %s done slave:%d\n", in sdw_bus_wait_for_clk_prep_deprep()
1029 retry--; in sdw_bus_wait_for_clk_prep_deprep()
1032 dev_dbg(bus->dev, "clock stop %s did not complete for slave:%d\n", in sdw_bus_wait_for_clk_prep_deprep()
1036 return -ETIMEDOUT; in sdw_bus_wait_for_clk_prep_deprep()
1040 * sdw_bus_prep_clk_stop: prepare Slave(s) for clock stop
1044 * Query Slave for clock stop mode and prepare for that mode.
1049 struct sdw_slave *slave; in sdw_bus_prep_clk_stop() local
1055 * each Slave and then wait for all Slave(s) to be in sdw_bus_prep_clk_stop()
1057 * If one of the Slave devices has lost sync and in sdw_bus_prep_clk_stop()
1058 * replies with Command Ignored/-ENODATA, we continue in sdw_bus_prep_clk_stop()
1061 list_for_each_entry(slave, &bus->slaves, node) { in sdw_bus_prep_clk_stop()
1062 if (!slave->dev_num) in sdw_bus_prep_clk_stop()
1065 if (slave->status != SDW_SLAVE_ATTACHED && in sdw_bus_prep_clk_stop()
1066 slave->status != SDW_SLAVE_ALERT) in sdw_bus_prep_clk_stop()
1069 /* Identify if Slave(s) are available on Bus */ in sdw_bus_prep_clk_stop()
1072 ret = sdw_slave_clk_stop_callback(slave, in sdw_bus_prep_clk_stop()
1075 if (ret < 0 && ret != -ENODATA) { in sdw_bus_prep_clk_stop()
1076 dev_err(&slave->dev, "clock stop pre-prepare cb failed:%d\n", ret); in sdw_bus_prep_clk_stop()
1080 /* Only prepare a Slave device if needed */ in sdw_bus_prep_clk_stop()
1081 if (!slave->prop.simple_clk_stop_capable) { in sdw_bus_prep_clk_stop()
1084 ret = sdw_slave_clk_stop_prepare(slave, in sdw_bus_prep_clk_stop()
1087 if (ret < 0 && ret != -ENODATA) { in sdw_bus_prep_clk_stop()
1088 dev_err(&slave->dev, "clock stop prepare failed:%d\n", ret); in sdw_bus_prep_clk_stop()
1094 /* Skip remaining clock stop preparation if no Slave is attached */ in sdw_bus_prep_clk_stop()
1106 * if there are no Slave devices present and the reply is in sdw_bus_prep_clk_stop()
1107 * Command_Ignored/-ENODATA, we don't need to continue with the in sdw_bus_prep_clk_stop()
1116 list_for_each_entry(slave, &bus->slaves, node) { in sdw_bus_prep_clk_stop()
1117 if (!slave->dev_num) in sdw_bus_prep_clk_stop()
1120 if (slave->status != SDW_SLAVE_ATTACHED && in sdw_bus_prep_clk_stop()
1121 slave->status != SDW_SLAVE_ALERT) in sdw_bus_prep_clk_stop()
1124 ret = sdw_slave_clk_stop_callback(slave, in sdw_bus_prep_clk_stop()
1128 if (ret < 0 && ret != -ENODATA) { in sdw_bus_prep_clk_stop()
1129 dev_err(&slave->dev, "clock stop post-prepare cb failed:%d\n", ret); in sdw_bus_prep_clk_stop()
1157 if (ret != -ENODATA) in sdw_bus_clk_stop()
1158 dev_err(bus->dev, "ClockStopNow Broadcast msg failed %d\n", ret); in sdw_bus_clk_stop()
1171 * This De-prepares the Slaves by exiting Clock Stop Mode 0. For the Slaves
1172 * exiting Clock Stop Mode 1, they will be de-prepared after they enumerate
1178 struct sdw_slave *slave; in sdw_bus_exit_clk_stop() local
1183 * In order to save on transition time, de-prepare in sdw_bus_exit_clk_stop()
1184 * each Slave and then wait for all Slave(s) to be in sdw_bus_exit_clk_stop()
1185 * de-prepared after clock resume. in sdw_bus_exit_clk_stop()
1187 list_for_each_entry(slave, &bus->slaves, node) { in sdw_bus_exit_clk_stop()
1188 if (!slave->dev_num) in sdw_bus_exit_clk_stop()
1191 if (slave->status != SDW_SLAVE_ATTACHED && in sdw_bus_exit_clk_stop()
1192 slave->status != SDW_SLAVE_ALERT) in sdw_bus_exit_clk_stop()
1195 /* Identify if Slave(s) are available on Bus */ in sdw_bus_exit_clk_stop()
1198 ret = sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, in sdw_bus_exit_clk_stop()
1201 dev_warn(&slave->dev, "clock stop pre-deprepare cb failed:%d\n", ret); in sdw_bus_exit_clk_stop()
1203 /* Only de-prepare a Slave device if needed */ in sdw_bus_exit_clk_stop()
1204 if (!slave->prop.simple_clk_stop_capable) { in sdw_bus_exit_clk_stop()
1207 ret = sdw_slave_clk_stop_prepare(slave, SDW_CLK_STOP_MODE0, in sdw_bus_exit_clk_stop()
1211 dev_warn(&slave->dev, "clock stop deprepare failed:%d\n", ret); in sdw_bus_exit_clk_stop()
1215 /* Skip remaining clock stop de-preparation if no Slave is attached */ in sdw_bus_exit_clk_stop()
1226 dev_warn(bus->dev, "clock stop deprepare wait failed:%d\n", ret); in sdw_bus_exit_clk_stop()
1229 list_for_each_entry(slave, &bus->slaves, node) { in sdw_bus_exit_clk_stop()
1230 if (!slave->dev_num) in sdw_bus_exit_clk_stop()
1233 if (slave->status != SDW_SLAVE_ATTACHED && in sdw_bus_exit_clk_stop()
1234 slave->status != SDW_SLAVE_ALERT) in sdw_bus_exit_clk_stop()
1237 ret = sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, in sdw_bus_exit_clk_stop()
1240 dev_warn(&slave->dev, "clock stop post-deprepare cb failed:%d\n", ret); in sdw_bus_exit_clk_stop()
1247 int sdw_configure_dpn_intr(struct sdw_slave *slave, in sdw_configure_dpn_intr() argument
1250 u32 addr; in sdw_configure_dpn_intr() local
1254 if (slave->bus->params.s_data_mode != SDW_PORT_DATA_MODE_NORMAL) { in sdw_configure_dpn_intr()
1255 dev_dbg(&slave->dev, "TEST FAIL interrupt %s\n", in sdw_configure_dpn_intr()
1260 addr = SDW_DPN_INTMASK(port); in sdw_configure_dpn_intr()
1271 ret = sdw_update_no_pm(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val); in sdw_configure_dpn_intr()
1273 dev_err(&slave->dev, in sdw_configure_dpn_intr()
1279 static int sdw_slave_set_frequency(struct sdw_slave *slave) in sdw_slave_set_frequency() argument
1281 u32 mclk_freq = slave->bus->prop.mclk_freq; in sdw_slave_set_frequency()
1282 u32 curr_freq = slave->bus->params.curr_dr_freq >> 1; in sdw_slave_set_frequency()
1290 * devices. They may also be used for 1.2+/non-SDCA devices. in sdw_slave_set_frequency()
1294 if (!slave->id.class_id && !slave->prop.clock_reg_supported) in sdw_slave_set_frequency()
1298 dev_err(&slave->dev, in sdw_slave_set_frequency()
1300 return -EINVAL; in sdw_slave_set_frequency()
1328 dev_err(&slave->dev, in sdw_slave_set_frequency()
1331 return -EINVAL; in sdw_slave_set_frequency()
1335 dev_err(&slave->dev, in sdw_slave_set_frequency()
1338 return -EINVAL; in sdw_slave_set_frequency()
1344 * map scale to Table 90 of SoundWire 1.2 spec - and check in sdw_slave_set_frequency()
1350 dev_err(&slave->dev, in sdw_slave_set_frequency()
1353 return -EINVAL; in sdw_slave_set_frequency()
1357 ret = sdw_write_no_pm(slave, SDW_SCP_BUS_CLOCK_BASE, base); in sdw_slave_set_frequency()
1359 dev_err(&slave->dev, in sdw_slave_set_frequency()
1365 ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B0, scale_index); in sdw_slave_set_frequency()
1367 dev_err(&slave->dev, in sdw_slave_set_frequency()
1371 ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B1, scale_index); in sdw_slave_set_frequency()
1373 dev_err(&slave->dev, in sdw_slave_set_frequency()
1376 dev_dbg(&slave->dev, in sdw_slave_set_frequency()
1383 static int sdw_initialize_slave(struct sdw_slave *slave) in sdw_initialize_slave() argument
1385 struct sdw_slave_prop *prop = &slave->prop; in sdw_initialize_slave()
1390 ret = sdw_slave_set_frequency(slave); in sdw_initialize_slave()
1394 if (slave->bus->prop.quirks & SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH) { in sdw_initialize_slave()
1396 status = sdw_read_no_pm(slave, SDW_SCP_INT1); in sdw_initialize_slave()
1398 dev_err(&slave->dev, in sdw_initialize_slave()
1403 dev_warn(&slave->dev, "Bus clash detected before INT mask is enabled\n"); in sdw_initialize_slave()
1404 ret = sdw_write_no_pm(slave, SDW_SCP_INT1, SDW_SCP_INT1_BUS_CLASH); in sdw_initialize_slave()
1406 dev_err(&slave->dev, in sdw_initialize_slave()
1412 if ((slave->bus->prop.quirks & SDW_MASTER_QUIRKS_CLEAR_INITIAL_PARITY) && in sdw_initialize_slave()
1413 !(prop->quirks & SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY)) { in sdw_initialize_slave()
1415 status = sdw_read_no_pm(slave, SDW_SCP_INT1); in sdw_initialize_slave()
1417 dev_err(&slave->dev, in sdw_initialize_slave()
1422 dev_warn(&slave->dev, "PARITY error detected before INT mask is enabled\n"); in sdw_initialize_slave()
1423 ret = sdw_write_no_pm(slave, SDW_SCP_INT1, SDW_SCP_INT1_PARITY); in sdw_initialize_slave()
1425 dev_err(&slave->dev, in sdw_initialize_slave()
1434 * implementation-defined interrupt mask. The Parity detection in sdw_initialize_slave()
1436 * device-dependent, it might e.g. only be enabled in in sdw_initialize_slave()
1437 * steady-state after a couple of frames. in sdw_initialize_slave()
1439 val = prop->scp_int1_mask; in sdw_initialize_slave()
1442 ret = sdw_update_no_pm(slave, SDW_SCP_INTMASK1, val, val); in sdw_initialize_slave()
1444 dev_err(&slave->dev, in sdw_initialize_slave()
1450 if (!prop->dp0_prop) in sdw_initialize_slave()
1454 val = prop->dp0_prop->imp_def_interrupts; in sdw_initialize_slave()
1457 ret = sdw_update_no_pm(slave, SDW_DP0_INTMASK, val, val); in sdw_initialize_slave()
1459 dev_err(&slave->dev, in sdw_initialize_slave()
1464 static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status) in sdw_handle_dp0_interrupt() argument
1469 status = sdw_read_no_pm(slave, SDW_DP0_INT); in sdw_handle_dp0_interrupt()
1471 dev_err(&slave->dev, in sdw_handle_dp0_interrupt()
1480 dev_err(&slave->dev, "Test fail for port 0\n"); in sdw_handle_dp0_interrupt()
1490 complete(&slave->port_ready[0]); in sdw_handle_dp0_interrupt()
1495 dev_err(&slave->dev, "BRA failed\n"); in sdw_handle_dp0_interrupt()
1508 ret = sdw_write_no_pm(slave, SDW_DP0_INT, clear); in sdw_handle_dp0_interrupt()
1510 dev_err(&slave->dev, in sdw_handle_dp0_interrupt()
1516 status2 = sdw_read_no_pm(slave, SDW_DP0_INT); in sdw_handle_dp0_interrupt()
1518 dev_err(&slave->dev, in sdw_handle_dp0_interrupt()
1531 dev_warn(&slave->dev, "Reached MAX_RETRY on DP0 read\n"); in sdw_handle_dp0_interrupt()
1536 static int sdw_handle_port_interrupt(struct sdw_slave *slave, in sdw_handle_port_interrupt() argument
1541 u32 addr; in sdw_handle_port_interrupt() local
1544 return sdw_handle_dp0_interrupt(slave, slave_status); in sdw_handle_port_interrupt()
1546 addr = SDW_DPN_INT(port); in sdw_handle_port_interrupt()
1547 status = sdw_read_no_pm(slave, addr); in sdw_handle_port_interrupt()
1549 dev_err(&slave->dev, in sdw_handle_port_interrupt()
1559 dev_err(&slave->dev, "Test fail for port:%d\n", port); in sdw_handle_port_interrupt()
1568 complete(&slave->port_ready[port]); in sdw_handle_port_interrupt()
1581 ret = sdw_write_no_pm(slave, addr, clear); in sdw_handle_port_interrupt()
1583 dev_err(&slave->dev, in sdw_handle_port_interrupt()
1589 status2 = sdw_read_no_pm(slave, addr); in sdw_handle_port_interrupt()
1591 dev_err(&slave->dev, in sdw_handle_port_interrupt()
1604 dev_warn(&slave->dev, "Reached MAX_RETRY on port read"); in sdw_handle_port_interrupt()
1609 static int sdw_handle_slave_alerts(struct sdw_slave *slave) in sdw_handle_slave_alerts() argument
1621 sdw_modify_slave_status(slave, SDW_SLAVE_ALERT); in sdw_handle_slave_alerts()
1623 ret = pm_runtime_get_sync(&slave->dev); in sdw_handle_slave_alerts()
1624 if (ret < 0 && ret != -EACCES) { in sdw_handle_slave_alerts()
1625 dev_err(&slave->dev, "Failed to resume device: %d\n", ret); in sdw_handle_slave_alerts()
1626 pm_runtime_put_noidle(&slave->dev); in sdw_handle_slave_alerts()
1631 ret = sdw_read_no_pm(slave, SDW_SCP_INT1); in sdw_handle_slave_alerts()
1633 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1639 ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, buf2); in sdw_handle_slave_alerts()
1641 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1646 if (slave->id.class_id) { in sdw_handle_slave_alerts()
1647 ret = sdw_read_no_pm(slave, SDW_DP0_INT); in sdw_handle_slave_alerts()
1649 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1660 * Check parity, bus clash and Slave (impl defined) in sdw_handle_slave_alerts()
1664 parity_check = slave->prop.scp_int1_mask & SDW_SCP_INT1_PARITY; in sdw_handle_slave_alerts()
1665 parity_quirk = !slave->first_interrupt_done && in sdw_handle_slave_alerts()
1666 (slave->prop.quirks & SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY); in sdw_handle_slave_alerts()
1669 dev_err(&slave->dev, "Parity error detected\n"); in sdw_handle_slave_alerts()
1674 if (slave->prop.scp_int1_mask & SDW_SCP_INT1_BUS_CLASH) in sdw_handle_slave_alerts()
1675 dev_err(&slave->dev, "Bus clash detected\n"); in sdw_handle_slave_alerts()
1687 if (slave->prop.scp_int1_mask & SDW_SCP_INT1_IMPL_DEF) { in sdw_handle_slave_alerts()
1688 dev_dbg(&slave->dev, "Slave impl defined interrupt\n"); in sdw_handle_slave_alerts()
1698 /* Check port 0 - 3 interrupts */ in sdw_handle_slave_alerts()
1704 sdw_handle_port_interrupt(slave, bit, in sdw_handle_slave_alerts()
1714 sdw_handle_port_interrupt(slave, in sdw_handle_slave_alerts()
1726 sdw_handle_port_interrupt(slave, in sdw_handle_slave_alerts()
1732 /* Update the Slave driver */ in sdw_handle_slave_alerts()
1734 mutex_lock(&slave->sdw_dev_lock); in sdw_handle_slave_alerts()
1736 if (slave->probed) { in sdw_handle_slave_alerts()
1737 struct device *dev = &slave->dev; in sdw_handle_slave_alerts()
1738 struct sdw_driver *drv = drv_to_sdw_driver(dev->driver); in sdw_handle_slave_alerts()
1740 if (slave->prop.use_domain_irq && slave->irq) in sdw_handle_slave_alerts()
1741 handle_nested_irq(slave->irq); in sdw_handle_slave_alerts()
1743 if (drv->ops && drv->ops->interrupt_callback) { in sdw_handle_slave_alerts()
1749 drv->ops->interrupt_callback(slave, &slave_intr); in sdw_handle_slave_alerts()
1753 mutex_unlock(&slave->sdw_dev_lock); in sdw_handle_slave_alerts()
1757 ret = sdw_write_no_pm(slave, SDW_SCP_INT1, clear); in sdw_handle_slave_alerts()
1759 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1765 slave->first_interrupt_done = true; in sdw_handle_slave_alerts()
1771 ret = sdw_read_no_pm(slave, SDW_SCP_INT1); in sdw_handle_slave_alerts()
1773 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1779 ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, buf2); in sdw_handle_slave_alerts()
1781 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1786 if (slave->id.class_id) { in sdw_handle_slave_alerts()
1787 ret = sdw_read_no_pm(slave, SDW_DP0_INT); in sdw_handle_slave_alerts()
1789 dev_err(&slave->dev, in sdw_handle_slave_alerts()
1802 * Exit loop if Slave is continuously in ALERT state even in sdw_handle_slave_alerts()
1811 dev_warn(&slave->dev, "Reached MAX_RETRY on alert read\n"); in sdw_handle_slave_alerts()
1814 pm_runtime_mark_last_busy(&slave->dev); in sdw_handle_slave_alerts()
1815 pm_runtime_put_autosuspend(&slave->dev); in sdw_handle_slave_alerts()
1820 static int sdw_update_slave_status(struct sdw_slave *slave, in sdw_update_slave_status() argument
1825 mutex_lock(&slave->sdw_dev_lock); in sdw_update_slave_status()
1827 if (slave->probed) { in sdw_update_slave_status()
1828 struct device *dev = &slave->dev; in sdw_update_slave_status()
1829 struct sdw_driver *drv = drv_to_sdw_driver(dev->driver); in sdw_update_slave_status()
1831 if (drv->ops && drv->ops->update_status) in sdw_update_slave_status()
1832 ret = drv->ops->update_status(slave, status); in sdw_update_slave_status()
1835 mutex_unlock(&slave->sdw_dev_lock); in sdw_update_slave_status()
1841 * sdw_handle_slave_status() - Handle Slave status
1843 * @status: Status for all Slave(s)
1849 struct sdw_slave *slave; in sdw_handle_slave_status() local
1855 mutex_lock(&bus->bus_lock); in sdw_handle_slave_status()
1856 if (test_bit(i, bus->assigned) == false) { in sdw_handle_slave_status()
1857 mutex_unlock(&bus->bus_lock); in sdw_handle_slave_status()
1860 mutex_unlock(&bus->bus_lock); in sdw_handle_slave_status()
1862 slave = sdw_get_slave(bus, i); in sdw_handle_slave_status()
1863 if (!slave) in sdw_handle_slave_status()
1867 slave->status != SDW_SLAVE_UNATTACHED) { in sdw_handle_slave_status()
1868 dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n", in sdw_handle_slave_status()
1869 i, slave->status); in sdw_handle_slave_status()
1870 sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); in sdw_handle_slave_status()
1873 ret = sdw_update_slave_status(slave, status[i]); in sdw_handle_slave_status()
1875 dev_warn(&slave->dev, "Update Slave status failed:%d\n", ret); in sdw_handle_slave_status()
1880 dev_dbg(bus->dev, "Slave attached, programming device number\n"); in sdw_handle_slave_status()
1900 /* Continue to check other slave statuses */ in sdw_handle_slave_status()
1902 mutex_lock(&bus->bus_lock); in sdw_handle_slave_status()
1903 if (test_bit(i, bus->assigned) == false) { in sdw_handle_slave_status()
1904 mutex_unlock(&bus->bus_lock); in sdw_handle_slave_status()
1907 mutex_unlock(&bus->bus_lock); in sdw_handle_slave_status()
1909 slave = sdw_get_slave(bus, i); in sdw_handle_slave_status()
1910 if (!slave) in sdw_handle_slave_status()
1917 if (slave->status == SDW_SLAVE_UNATTACHED) in sdw_handle_slave_status()
1920 dev_warn(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n", in sdw_handle_slave_status()
1921 i, slave->status); in sdw_handle_slave_status()
1923 sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); in sdw_handle_slave_status()
1927 ret = sdw_handle_slave_alerts(slave); in sdw_handle_slave_status()
1929 dev_err(&slave->dev, in sdw_handle_slave_status()
1930 "Slave %d alert handling failed: %d\n", in sdw_handle_slave_status()
1935 if (slave->status == SDW_SLAVE_ATTACHED) in sdw_handle_slave_status()
1938 prev_status = slave->status; in sdw_handle_slave_status()
1939 sdw_modify_slave_status(slave, SDW_SLAVE_ATTACHED); in sdw_handle_slave_status()
1946 ret = sdw_initialize_slave(slave); in sdw_handle_slave_status()
1948 dev_err(&slave->dev, in sdw_handle_slave_status()
1949 "Slave %d initialization failed: %d\n", in sdw_handle_slave_status()
1955 dev_err(&slave->dev, "Invalid slave %d status:%d\n", in sdw_handle_slave_status()
1960 ret = sdw_update_slave_status(slave, status[i]); in sdw_handle_slave_status()
1962 dev_err(&slave->dev, in sdw_handle_slave_status()
1963 "Update Slave status failed:%d\n", ret); in sdw_handle_slave_status()
1965 dev_dbg(&slave->dev, in sdw_handle_slave_status()
1966 "signaling initialization completion for Slave %d\n", in sdw_handle_slave_status()
1967 slave->dev_num); in sdw_handle_slave_status()
1969 complete_all(&slave->initialization_complete); in sdw_handle_slave_status()
1978 * This would be a no-op in case the peripheral was being resumed in sdw_handle_slave_status()
1981 pm_request_resume(&slave->dev); in sdw_handle_slave_status()
1991 struct sdw_slave *slave; in sdw_clear_slave_status() local
1994 /* Check all non-zero devices */ in sdw_clear_slave_status()
1996 mutex_lock(&bus->bus_lock); in sdw_clear_slave_status()
1997 if (test_bit(i, bus->assigned) == false) { in sdw_clear_slave_status()
1998 mutex_unlock(&bus->bus_lock); in sdw_clear_slave_status()
2001 mutex_unlock(&bus->bus_lock); in sdw_clear_slave_status()
2003 slave = sdw_get_slave(bus, i); in sdw_clear_slave_status()
2004 if (!slave) in sdw_clear_slave_status()
2007 if (slave->status != SDW_SLAVE_UNATTACHED) { in sdw_clear_slave_status()
2008 sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); in sdw_clear_slave_status()
2009 slave->first_interrupt_done = false; in sdw_clear_slave_status()
2010 sdw_update_slave_status(slave, SDW_SLAVE_UNATTACHED); in sdw_clear_slave_status()
2014 slave->unattach_request = request; in sdw_clear_slave_status()