^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) // Copyright(c) 2015-17 Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/soundwire/sdw.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/soundwire/sdw_type.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "bus.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "sysfs_local.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) static void sdw_slave_release(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct sdw_slave *slave = dev_to_sdw_dev(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) kfree(slave);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct device_type sdw_slave_type = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .name = "sdw_slave",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) .release = sdw_slave_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .uevent = sdw_slave_uevent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int sdw_slave_add(struct sdw_bus *bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct sdw_slave_id *id, struct fwnode_handle *fwnode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct sdw_slave *slave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) slave = kzalloc(sizeof(*slave), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) if (!slave)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /* Initialize data structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) memcpy(&slave->id, id, sizeof(*id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) slave->dev.parent = bus->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) slave->dev.fwnode = fwnode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) if (id->unique_id == SDW_IGNORED_UNIQUE_ID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* name shall be sdw:link:mfg:part:class */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) dev_set_name(&slave->dev, "sdw:%x:%x:%x:%x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) bus->link_id, id->mfg_id, id->part_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) id->class_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* name shall be sdw:link:mfg:part:class:unique */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) dev_set_name(&slave->dev, "sdw:%x:%x:%x:%x:%x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) bus->link_id, id->mfg_id, id->part_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) id->class_id, id->unique_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) slave->dev.bus = &sdw_bus_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) slave->dev.of_node = of_node_get(to_of_node(fwnode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) slave->dev.type = &sdw_slave_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) slave->dev.groups = sdw_slave_status_attr_groups;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) slave->bus = bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) slave->status = SDW_SLAVE_UNATTACHED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) init_completion(&slave->enumeration_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) init_completion(&slave->initialization_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) slave->dev_num = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) init_completion(&slave->probe_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) slave->probed = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) slave->first_interrupt_done = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) for (i = 0; i < SDW_MAX_PORTS; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) init_completion(&slave->port_ready[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) mutex_lock(&bus->bus_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) list_add_tail(&slave->node, &bus->slaves);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) mutex_unlock(&bus->bus_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ret = device_register(&slave->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) dev_err(bus->dev, "Failed to add slave: ret %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * On err, don't free but drop ref as this will be freed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * when release method is invoked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) mutex_lock(&bus->bus_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) list_del(&slave->node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) mutex_unlock(&bus->bus_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) put_device(&slave->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) sdw_slave_debugfs_init(slave);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #if IS_ENABLED(CONFIG_ACPI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static bool find_slave(struct sdw_bus *bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct acpi_device *adev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct sdw_slave_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) unsigned long long addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) unsigned int link_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) status = acpi_evaluate_integer(adev->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) METHOD_NAME__ADR, NULL, &addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) dev_err(bus->dev, "_ADR resolution failed: %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /* Extract link id from ADR, Bit 51 to 48 (included) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) link_id = SDW_DISCO_LINK_ID(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* Check for link_id match */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (link_id != bus->link_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) sdw_extract_slave_id(bus, addr, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * sdw_acpi_find_slaves() - Find Slave devices in Master ACPI node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @bus: SDW bus instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Scans Master ACPI node for SDW child Slave devices and registers it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int sdw_acpi_find_slaves(struct sdw_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) struct acpi_device *adev, *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct acpi_device *adev2, *parent2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) parent = ACPI_COMPANION(bus->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if (!parent) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) dev_err(bus->dev, "Can't find parent for acpi bind\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) list_for_each_entry(adev, &parent->children, node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct sdw_slave_id id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct sdw_slave_id id2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) bool ignore_unique_id = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) if (!find_slave(bus, adev, &id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* brute-force O(N^2) search for duplicates */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) parent2 = parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) list_for_each_entry(adev2, &parent2->children, node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (adev == adev2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) if (!find_slave(bus, adev2, &id2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) if (id.sdw_version != id2.sdw_version ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) id.mfg_id != id2.mfg_id ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) id.part_id != id2.part_id ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) id.class_id != id2.class_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) if (id.unique_id != id2.unique_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) dev_dbg(bus->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) "Valid unique IDs %x %x for Slave mfg %x part %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) id.unique_id, id2.unique_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) id.mfg_id, id.part_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) ignore_unique_id = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) dev_err(bus->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) "Invalid unique IDs %x %x for Slave mfg %x part %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) id.unique_id, id2.unique_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) id.mfg_id, id.part_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (ignore_unique_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) id.unique_id = SDW_IGNORED_UNIQUE_ID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * don't error check for sdw_slave_add as we want to continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * adding Slaves
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) sdw_slave_add(bus, &id, acpi_fwnode_handle(adev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * sdw_of_find_slaves() - Find Slave devices in master device tree node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * @bus: SDW bus instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * Scans Master DT node for SDW child Slave devices and registers it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int sdw_of_find_slaves(struct sdw_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct device *dev = bus->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct device_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) for_each_child_of_node(bus->dev->of_node, node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) int link_id, ret, len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) unsigned int sdw_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) const char *compat = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct sdw_slave_id id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) const __be32 *addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) compat = of_get_property(node, "compatible", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) if (!compat)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ret = sscanf(compat, "sdw%01x%04hx%04hx%02hhx", &sdw_version,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) &id.mfg_id, &id.part_id, &id.class_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (ret != 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) dev_err(dev, "Invalid compatible string found %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) compat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) addr = of_get_property(node, "reg", &len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) if (!addr || (len < 2 * sizeof(u32))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) dev_err(dev, "Invalid Link and Instance ID\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) link_id = be32_to_cpup(addr++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) id.unique_id = be32_to_cpup(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) id.sdw_version = sdw_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* Check for link_id match */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if (link_id != bus->link_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) sdw_slave_add(bus, &id, of_fwnode_handle(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }