Lines Matching +full:reset +full:- +full:delays +full:- +full:us
1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
6 * https://www.mipi.org/mipi-sdca-v1-0-download
55 return -EINVAL; in patch_sdca_function_type()
95 struct device *dev = &adev->dev; in find_sdca_function()
103 if (sdca_data->num_functions >= SDCA_MAX_FUNCTION_COUNT) { in find_sdca_function()
105 return -EINVAL; in find_sdca_function()
108 ret = acpi_get_local_u64_address(adev->handle, &addr); in find_sdca_function()
114 return -ENODEV; in find_sdca_function()
122 * but the SDCA/DisCo specs defined the notion of "DC value" - a constant in find_sdca_function()
128 "mipi-sdca-control-0x5-subproperties"); in find_sdca_function()
130 return -ENODEV; in find_sdca_function()
132 ret = fwnode_property_read_u32(control5, "mipi-sdca-control-dc-value", in find_sdca_function()
143 ret = patch_sdca_function_type(sdca_data->interface_revision, &function_type); in find_sdca_function()
146 sdca_data->interface_revision, function_type); in find_sdca_function()
154 return -EINVAL; in find_sdca_function()
161 function_index = sdca_data->num_functions; in find_sdca_function()
162 sdca_data->function[function_index].adr = addr; in find_sdca_function()
163 sdca_data->function[function_index].type = function_type; in find_sdca_function()
164 sdca_data->function[function_index].name = function_name; in find_sdca_function()
165 sdca_data->function[function_index].node = function_node; in find_sdca_function()
166 sdca_data->num_functions++; in find_sdca_function()
172 * sdca_lookup_functions - Parse sdca_device_desc for each Function
183 struct device *sdev = &slave->dev; in sdca_lookup_functions()
184 struct acpi_device *adev = to_acpi_device_node(sdev->fwnode); in sdca_lookup_functions()
191 acpi_dev_for_each_child(adev, find_sdca_function, &slave->sdca_data); in sdca_lookup_functions()
209 "mipi-sdca-function-initialization-table"); in find_sdca_init_table()
210 if (!num_init_writes || num_init_writes == -EINVAL) { in find_sdca_init_table()
218 return -EINVAL; in find_sdca_init_table()
221 return -EINVAL; in find_sdca_init_table()
226 return -ENOMEM; in find_sdca_init_table()
229 "mipi-sdca-function-initialization-table", in find_sdca_init_table()
236 return -ENOMEM; in find_sdca_init_table()
243 function->num_init_table = num_init_writes; in find_sdca_init_table()
244 function->init_table = init_write; in find_sdca_init_table()
253 switch (SDCA_CTL_TYPE(entity->type, control->sel)) { in find_sdca_control_label()
539 return devm_kasprintf(dev, GFP_KERNEL, "Imp-Def %#x", control->sel); in find_sdca_control_label()
546 switch (SDCA_CTL_TYPE(entity->type, control->sel)) { in find_sdca_control_bits()
615 switch (SDCA_CTL_TYPE(entity->type, control->sel)) { in find_sdca_control_datatype()
786 switch (control->mode) { in find_sdca_control_volatile()
797 switch (SDCA_CTL_TYPE(entity->type, control->sel)) { in find_sdca_control_volatile()
848 num_range = fwnode_property_count_u8(control_node, "mipi-sdca-control-range"); in find_sdca_control_range()
849 if (!num_range || num_range == -EINVAL) in find_sdca_control_range()
856 return -ENOMEM; in find_sdca_control_range()
858 fwnode_property_read_u8_array(control_node, "mipi-sdca-control-range", in find_sdca_control_range()
863 range->cols = le16_to_cpu(limits[0]); in find_sdca_control_range()
864 range->rows = le16_to_cpu(limits[1]); in find_sdca_control_range()
865 range->data = (u32 *)&limits[2]; in find_sdca_control_range()
867 num_range = (num_range - (2 * sizeof(*limits))) / sizeof(*range->data); in find_sdca_control_range()
868 if (num_range != range->cols * range->rows) in find_sdca_control_range()
869 return -EINVAL; in find_sdca_control_range()
872 range->data[i] = le32_to_cpu(range->data[i]); in find_sdca_control_range()
887 snprintf(property, sizeof(property), "mipi-sdca-control-%s", label); in find_sdca_control_value()
890 if (ret == -EINVAL) in find_sdca_control_value()
896 for_each_set_bit(cn, (unsigned long *)&control->cn_list, in find_sdca_control_value()
897 BITS_PER_TYPE(control->cn_list)) { in find_sdca_control_value()
900 "mipi-sdca-control-cn-%d-%s", cn, label); in find_sdca_control_value()
907 control->values[i] = tmp; in find_sdca_control_value()
915 * TODO: Add support for -cn- properties, allowing different channels to have
925 ret = fwnode_property_read_u32(control_node, "mipi-sdca-control-access-mode", &tmp); in find_sdca_entity_control()
928 entity->label, control->sel, ret); in find_sdca_entity_control()
932 control->mode = tmp; in find_sdca_entity_control()
934 ret = fwnode_property_read_u32(control_node, "mipi-sdca-control-access-layer", &tmp); in find_sdca_entity_control()
937 entity->label, control->sel, ret); in find_sdca_entity_control()
941 control->layers = tmp; in find_sdca_entity_control()
943 ret = fwnode_property_read_u64(control_node, "mipi-sdca-control-cn-list", in find_sdca_entity_control()
944 &control->cn_list); in find_sdca_entity_control()
945 if (ret == -EINVAL) { in find_sdca_entity_control()
946 /* Spec allows not specifying cn-list if only the first number is used */ in find_sdca_entity_control()
947 control->cn_list = 0x1; in find_sdca_entity_control()
948 } else if (ret || !control->cn_list) { in find_sdca_entity_control()
950 entity->label, control->sel, ret); in find_sdca_entity_control()
954 control->values = devm_kcalloc(dev, hweight64(control->cn_list), in find_sdca_entity_control()
956 if (!control->values) in find_sdca_entity_control()
957 return -ENOMEM; in find_sdca_entity_control()
959 switch (control->mode) { in find_sdca_entity_control()
962 "dc-value"); in find_sdca_entity_control()
965 entity->label, control->sel, ret); in find_sdca_entity_control()
969 control->has_fixed = true; in find_sdca_entity_control()
974 "default-value"); in find_sdca_entity_control()
976 control->has_default = true; in find_sdca_entity_control()
979 "fixed-value"); in find_sdca_entity_control()
981 control->has_fixed = true; in find_sdca_entity_control()
984 control->deferrable = fwnode_property_read_bool(control_node, in find_sdca_entity_control()
985 "mipi-sdca-control-deferrable"); in find_sdca_entity_control()
991 control->is_volatile = find_sdca_control_volatile(entity, control); in find_sdca_entity_control()
993 ret = find_sdca_control_range(dev, control_node, &control->range); in find_sdca_entity_control()
996 entity->label, control->sel, ret); in find_sdca_entity_control()
1001 "mipi-sdca-control-interrupt-position", in find_sdca_entity_control()
1004 control->interrupt_position = tmp; in find_sdca_entity_control()
1006 control->interrupt_position = SDCA_NO_INTERRUPT; in find_sdca_entity_control()
1008 control->label = find_sdca_control_label(dev, entity, control); in find_sdca_entity_control()
1009 if (!control->label) in find_sdca_entity_control()
1010 return -ENOMEM; in find_sdca_entity_control()
1012 control->type = find_sdca_control_datatype(entity, control); in find_sdca_entity_control()
1013 control->nbits = find_sdca_control_bits(entity, control); in find_sdca_entity_control()
1016 entity->label, control->label, control->sel, in find_sdca_entity_control()
1017 control->mode, control->layers, control->cn_list, in find_sdca_entity_control()
1018 control->interrupt_position, control->deferrable ? "deferrable" : ""); in find_sdca_entity_control()
1033 ret = fwnode_property_read_u64(entity_node, "mipi-sdca-control-list", &control_list); in find_sdca_entity_controls()
1034 if (ret == -EINVAL) { in find_sdca_entity_controls()
1036 dev_warn(dev, "%s: missing control list\n", entity->label); in find_sdca_entity_controls()
1039 dev_err(dev, "%s: failed to read control list: %d\n", entity->label, ret); in find_sdca_entity_controls()
1048 return -ENOMEM; in find_sdca_entity_controls()
1056 /* DisCo uses upper-case for hex numbers */ in find_sdca_entity_controls()
1058 "mipi-sdca-control-0x%X-subproperties", control_sel); in find_sdca_entity_controls()
1063 entity->label, control_property); in find_sdca_entity_controls()
1064 return -EINVAL; in find_sdca_entity_controls()
1077 entity->num_controls = num_controls; in find_sdca_entity_controls()
1078 entity->controls = controls; in find_sdca_entity_controls()
1085 switch (terminal->type) { in find_sdca_iot_dataport()
1111 struct sdca_entity_iot *terminal = &entity->iot; in find_sdca_entity_iot()
1115 ret = fwnode_property_read_u32(entity_node, "mipi-sdca-terminal-type", &tmp); in find_sdca_entity_iot()
1117 dev_err(dev, "%s: terminal type missing: %d\n", entity->label, ret); in find_sdca_entity_iot()
1121 terminal->type = tmp; in find_sdca_entity_iot()
1122 terminal->is_dataport = find_sdca_iot_dataport(terminal); in find_sdca_entity_iot()
1124 if (!terminal->is_dataport) { in find_sdca_entity_iot()
1125 const char *type_name = sdca_find_terminal_name(terminal->type); in find_sdca_entity_iot()
1128 entity->label = devm_kasprintf(dev, GFP_KERNEL, "%s %s", in find_sdca_entity_iot()
1129 entity->label, type_name); in find_sdca_entity_iot()
1133 "mipi-sdca-terminal-reference-number", &tmp); in find_sdca_entity_iot()
1135 terminal->reference = tmp; in find_sdca_entity_iot()
1138 "mipi-sdca-terminal-connector-type", &tmp); in find_sdca_entity_iot()
1140 terminal->connector = tmp; in find_sdca_entity_iot()
1143 "mipi-sdca-terminal-transducer-count", &tmp); in find_sdca_entity_iot()
1145 terminal->num_transducer = tmp; in find_sdca_entity_iot()
1148 entity->label, terminal->type, terminal->reference, in find_sdca_entity_iot()
1149 terminal->connector, terminal->num_transducer); in find_sdca_entity_iot()
1158 struct sdca_entity_cs *clock = &entity->cs; in find_sdca_entity_cs()
1162 ret = fwnode_property_read_u32(entity_node, "mipi-sdca-cs-type", &tmp); in find_sdca_entity_cs()
1164 dev_err(dev, "%s: clock type missing: %d\n", entity->label, ret); in find_sdca_entity_cs()
1168 clock->type = tmp; in find_sdca_entity_cs()
1171 "mipi-sdca-clock-valid-max-delay", &tmp); in find_sdca_entity_cs()
1173 clock->max_delay = tmp; in find_sdca_entity_cs()
1175 dev_dbg(dev, "%s: clock type %#x delay %d\n", entity->label, in find_sdca_entity_cs()
1176 clock->type, clock->max_delay); in find_sdca_entity_cs()
1186 struct sdca_entity_pde *power = &entity->pde; in find_sdca_entity_pde()
1188 struct sdca_pde_delay *delays; in find_sdca_entity_pde() local
1193 "mipi-sdca-powerdomain-transition-max-delay"); in find_sdca_entity_pde()
1196 entity->label, num_delays); in find_sdca_entity_pde()
1197 return -EINVAL; in find_sdca_entity_pde()
1199 dev_err(dev, "%s: delays not multiple of %d\n", in find_sdca_entity_pde()
1200 entity->label, mult_delay); in find_sdca_entity_pde()
1201 return -EINVAL; in find_sdca_entity_pde()
1203 dev_err(dev, "%s: maximum number of transition delays exceeded\n", in find_sdca_entity_pde()
1204 entity->label); in find_sdca_entity_pde()
1205 return -EINVAL; in find_sdca_entity_pde()
1210 return -ENOMEM; in find_sdca_entity_pde()
1213 "mipi-sdca-powerdomain-transition-max-delay", in find_sdca_entity_pde()
1218 delays = devm_kcalloc(dev, num_delays, sizeof(*delays), GFP_KERNEL); in find_sdca_entity_pde()
1219 if (!delays) in find_sdca_entity_pde()
1220 return -ENOMEM; in find_sdca_entity_pde()
1223 delays[i].from_ps = delay_list[j++]; in find_sdca_entity_pde()
1224 delays[i].to_ps = delay_list[j++]; in find_sdca_entity_pde()
1225 delays[i].us = delay_list[j++]; in find_sdca_entity_pde()
1227 dev_dbg(dev, "%s: from %#x to %#x delay %dus\n", entity->label, in find_sdca_entity_pde()
1228 delays[i].from_ps, delays[i].to_ps, delays[i].us); in find_sdca_entity_pde()
1231 power->num_max_delay = num_delays; in find_sdca_entity_pde()
1232 power->max_delay = delays; in find_sdca_entity_pde()
1252 struct sdca_entity_ge *group = &entity->ge; in find_sdca_entity_ge()
1259 "mipi-sdca-ge-selectedmode-controls-affected"); in find_sdca_entity_ge()
1264 entity->label, num_affected); in find_sdca_entity_ge()
1268 entity->label); in find_sdca_entity_ge()
1269 return -EINVAL; in find_sdca_entity_ge()
1274 return -ENOMEM; in find_sdca_entity_ge()
1277 "mipi-sdca-ge-selectedmode-controls-affected", in find_sdca_entity_ge()
1280 group->num_modes = *affected_list; in find_sdca_entity_ge()
1283 group->modes = devm_kcalloc(dev, group->num_modes, sizeof(*group->modes), in find_sdca_entity_ge()
1285 if (!group->modes) in find_sdca_entity_ge()
1286 return -ENOMEM; in find_sdca_entity_ge()
1288 for (i = 0; i < group->num_modes; i++) { in find_sdca_entity_ge()
1290 struct sdca_ge_mode *mode = &group->modes[i]; in find_sdca_entity_ge()
1296 mode->val = raw->val; in find_sdca_entity_ge()
1297 mode->num_controls = raw->num_controls; in find_sdca_entity_ge()
1299 affected_iter += mode->num_controls * sizeof(raw->controls[0]); in find_sdca_entity_ge()
1303 mode->controls = devm_kcalloc(dev, mode->num_controls, in find_sdca_entity_ge()
1304 sizeof(*mode->controls), GFP_KERNEL); in find_sdca_entity_ge()
1305 if (!mode->controls) in find_sdca_entity_ge()
1306 return -ENOMEM; in find_sdca_entity_ge()
1308 for (j = 0; j < mode->num_controls; j++) { in find_sdca_entity_ge()
1309 mode->controls[j].id = raw->controls[j].id; in find_sdca_entity_ge()
1310 mode->controls[j].sel = raw->controls[j].sel; in find_sdca_entity_ge()
1311 mode->controls[j].cn = raw->controls[j].cn; in find_sdca_entity_ge()
1312 mode->controls[j].val = le32_to_cpu(raw->controls[j].val); in find_sdca_entity_ge()
1319 dev_err(dev, "%s: malformed affected controls list\n", entity->label); in find_sdca_entity_ge()
1320 return -EINVAL; in find_sdca_entity_ge()
1328 struct sdca_entity_hide *hide = &entity->hide; in find_sdca_entity_hide()
1329 unsigned int delay, *af_list = hide->af_number_list; in find_sdca_entity_hide()
1334 "mipi-sdca-RxUMP-ownership-transition-max-delay", &delay); in find_sdca_entity_hide()
1336 hide->max_delay = delay; in find_sdca_entity_hide()
1338 nval = fwnode_property_count_u32(entity_node, "mipi-sdca-HIDTx-supported-report-ids"); in find_sdca_entity_hide()
1340 hide->num_hidtx_ids = nval; in find_sdca_entity_hide()
1341 hide->hidtx_ids = devm_kcalloc(dev, hide->num_hidtx_ids, in find_sdca_entity_hide()
1342 sizeof(*hide->hidtx_ids), GFP_KERNEL); in find_sdca_entity_hide()
1343 if (!hide->hidtx_ids) in find_sdca_entity_hide()
1344 return -ENOMEM; in find_sdca_entity_hide()
1347 "mipi-sdca-HIDTx-supported-report-ids", in find_sdca_entity_hide()
1348 hide->hidtx_ids, in find_sdca_entity_hide()
1349 hide->num_hidtx_ids); in find_sdca_entity_hide()
1354 nval = fwnode_property_count_u32(entity_node, "mipi-sdca-HIDRx-supported-report-ids"); in find_sdca_entity_hide()
1356 hide->num_hidrx_ids = nval; in find_sdca_entity_hide()
1357 hide->hidrx_ids = devm_kcalloc(dev, hide->num_hidrx_ids, in find_sdca_entity_hide()
1358 sizeof(*hide->hidrx_ids), GFP_KERNEL); in find_sdca_entity_hide()
1359 if (!hide->hidrx_ids) in find_sdca_entity_hide()
1360 return -ENOMEM; in find_sdca_entity_hide()
1363 "mipi-sdca-HIDRx-supported-report-ids", in find_sdca_entity_hide()
1364 hide->hidrx_ids, in find_sdca_entity_hide()
1365 hide->num_hidrx_ids); in find_sdca_entity_hide()
1370 nval = fwnode_property_count_u32(entity_node, "mipi-sdca-hide-related-audio-function-list"); in find_sdca_entity_hide()
1374 return -EINVAL; in find_sdca_entity_hide()
1377 return -EINVAL; in find_sdca_entity_hide()
1380 hide->hide_reside_function_num = nval; in find_sdca_entity_hide()
1382 "mipi-sdca-hide-related-audio-function-list", af_list, nval); in find_sdca_entity_hide()
1384 nval = fwnode_property_count_u8(function_node, "mipi-sdca-hid-descriptor"); in find_sdca_entity_hide()
1386 fwnode_property_read_u8_array(function_node, "mipi-sdca-hid-descriptor", in find_sdca_entity_hide()
1387 (u8 *)&hide->hid_desc, nval); in find_sdca_entity_hide()
1389 if (hide->hid_desc.bNumDescriptors) { in find_sdca_entity_hide()
1390 nval = fwnode_property_count_u8(function_node, "mipi-sdca-report-descriptor"); in find_sdca_entity_hide()
1394 return -ENOMEM; in find_sdca_entity_hide()
1395 hide->hid_report_desc = report_desc; in find_sdca_entity_hide()
1396 fwnode_property_read_u8_array(function_node, "mipi-sdca-report-descriptor", in find_sdca_entity_hide()
1415 struct sdca_entity_xu *xu = &entity->xu; in find_sdca_entity_xu()
1420 "mipi-sdca-RxUMP-ownership-transition-max-delay", in find_sdca_entity_xu()
1423 xu->max_delay = tmp; in find_sdca_entity_xu()
1425 ret = fwnode_property_read_u32(entity_node, "mipi-sdca-FDL-reset-mechanism", in find_sdca_entity_xu()
1428 xu->reset_mechanism = tmp; in find_sdca_entity_xu()
1441 ret = fwnode_property_read_string(entity_node, "mipi-sdca-entity-label", in find_sdca_entity()
1442 &entity->label); in find_sdca_entity()
1445 function_node, entity->id, ret); in find_sdca_entity()
1449 ret = fwnode_property_read_u32(entity_node, "mipi-sdca-entity-type", &tmp); in find_sdca_entity()
1451 dev_err(dev, "%s: type missing: %d\n", entity->label, ret); in find_sdca_entity()
1455 entity->type = tmp; in find_sdca_entity()
1458 entity->label, entity->id, entity->type); in find_sdca_entity()
1460 switch (entity->type) { in find_sdca_entity()
1504 "mipi-sdca-entity-id-list"); in find_sdca_entities()
1508 return -EINVAL; in find_sdca_entities()
1512 return -EINVAL; in find_sdca_entities()
1518 return -ENOMEM; in find_sdca_entities()
1522 return -ENOMEM; in find_sdca_entities()
1524 fwnode_property_read_u32_array(function_node, "mipi-sdca-entity-id-list", in find_sdca_entities()
1535 /* DisCo uses upper-case for hex numbers */ in find_sdca_entities()
1537 "mipi-sdca-entity-id-0x%X-subproperties", entities[i].id); in find_sdca_entities()
1543 return -EINVAL; in find_sdca_entities()
1563 function->num_entities = num_entities + 1; in find_sdca_entities()
1564 function->entities = entities; in find_sdca_entities()
1574 for (i = 0; i < function->num_entities; i++) { in find_sdca_entity_by_label()
1575 struct sdca_entity *entity = &function->entities[i]; in find_sdca_entity_by_label()
1577 if (!strncmp(entity->label, entity_label, strlen(entity_label))) in find_sdca_entity_by_label()
1589 for (i = 0; i < function->num_entities; i++) { in find_sdca_entity_by_id()
1590 struct sdca_entity *entity = &function->entities[i]; in find_sdca_entity_by_id()
1592 if (entity->id == id) in find_sdca_entity_by_id()
1604 struct sdca_entity_iot *terminal = &entity->iot; in find_sdca_entity_connection_iot()
1611 "mipi-sdca-terminal-clock-connection"); in find_sdca_entity_connection_iot()
1615 ret = fwnode_property_read_string(clock_node, "mipi-sdca-entity-label", in find_sdca_entity_connection_iot()
1618 dev_err(dev, "%s: clock label missing: %d\n", entity->label, ret); in find_sdca_entity_connection_iot()
1626 entity->label, clock_label); in find_sdca_entity_connection_iot()
1628 return -EINVAL; in find_sdca_entity_connection_iot()
1631 terminal->clock = clock_entity; in find_sdca_entity_connection_iot()
1633 dev_dbg(dev, "%s -> %s\n", clock_entity->label, entity->label); in find_sdca_entity_connection_iot()
1644 struct sdca_entity_pde *power = &entity->pde; in find_sdca_entity_connection_pde()
1651 "mipi-sdca-powerdomain-managed-list"); in find_sdca_entity_connection_pde()
1655 dev_err(dev, "%s: managed list missing: %d\n", entity->label, num_managed); in find_sdca_entity_connection_pde()
1659 entity->label); in find_sdca_entity_connection_pde()
1660 return -EINVAL; in find_sdca_entity_connection_pde()
1665 return -ENOMEM; in find_sdca_entity_connection_pde()
1669 return -ENOMEM; in find_sdca_entity_connection_pde()
1672 "mipi-sdca-powerdomain-managed-list", in find_sdca_entity_connection_pde()
1679 entity->label, managed_list[i]); in find_sdca_entity_connection_pde()
1680 return -EINVAL; in find_sdca_entity_connection_pde()
1683 dev_dbg(dev, "%s -> %s\n", managed[i]->label, entity->label); in find_sdca_entity_connection_pde()
1686 power->num_managed = num_managed; in find_sdca_entity_connection_pde()
1687 power->managed = managed; in find_sdca_entity_connection_pde()
1699 for (i = 0; i < entity->ge.num_modes; i++) { in find_sdca_entity_connection_ge()
1700 struct sdca_ge_mode *mode = &entity->ge.modes[i]; in find_sdca_entity_connection_ge()
1702 for (j = 0; j < mode->num_controls; j++) { in find_sdca_entity_connection_ge()
1703 struct sdca_ge_control *affected = &mode->controls[j]; in find_sdca_entity_connection_ge()
1706 managed = find_sdca_entity_by_id(function, affected->id); in find_sdca_entity_connection_ge()
1709 entity->label, affected->id); in find_sdca_entity_connection_ge()
1710 return -EINVAL; in find_sdca_entity_connection_ge()
1713 if (managed->group && managed->group != entity) { in find_sdca_entity_connection_ge()
1716 managed->label, managed->group->label, in find_sdca_entity_connection_ge()
1717 entity->label); in find_sdca_entity_connection_ge()
1718 return -EINVAL; in find_sdca_entity_connection_ge()
1721 managed->group = entity; in find_sdca_entity_connection_ge()
1738 switch (entity->type) { in find_sdca_entity_connection()
1759 ret = fwnode_property_read_u64(entity_node, "mipi-sdca-input-pin-list", &pin_list); in find_sdca_entity_connection()
1760 if (ret == -EINVAL) { in find_sdca_entity_connection()
1764 dev_err(dev, "%s: failed to read pin list: %d\n", entity->label, ret); in find_sdca_entity_connection()
1768 * Each bit set in the pin-list refers to an entity_id in this in find_sdca_entity_connection()
1770 * for Function-level configurations. in find_sdca_entity_connection()
1772 dev_err(dev, "%s: pin 0 used as input\n", entity->label); in find_sdca_entity_connection()
1773 return -EINVAL; in find_sdca_entity_connection()
1781 return -ENOMEM; in find_sdca_entity_connection()
1790 snprintf(pin_property, sizeof(pin_property), "mipi-sdca-input-pin-%d", pin); in find_sdca_entity_connection()
1795 entity->label, pin_property); in find_sdca_entity_connection()
1796 return -EINVAL; in find_sdca_entity_connection()
1799 ret = fwnode_property_read_string(connected_node, "mipi-sdca-entity-label", in find_sdca_entity_connection()
1803 entity->label, pin, ret); in find_sdca_entity_connection()
1811 entity->label, connected_label); in find_sdca_entity_connection()
1813 return -EINVAL; in find_sdca_entity_connection()
1818 dev_dbg(dev, "%s -> %s\n", connected_entity->label, entity->label); in find_sdca_entity_connection()
1824 entity->num_sources = num_pins; in find_sdca_entity_connection()
1825 entity->sources = pins; in find_sdca_entity_connection()
1837 for (i = 0; i < function->num_entities - 1; i++) { in find_sdca_connections()
1838 struct sdca_entity *entity = &function->entities[i]; in find_sdca_connections()
1843 /* DisCo uses upper-case for hex numbers */ in find_sdca_connections()
1845 "mipi-sdca-entity-id-0x%X-subproperties", in find_sdca_connections()
1846 entity->id); in find_sdca_connections()
1852 return -EINVAL; in find_sdca_connections()
1872 ret = fwnode_property_read_u32(channel_node, "mipi-sdca-cluster-channel-id", &tmp); in find_sdca_cluster_channel()
1875 cluster->id, ret); in find_sdca_cluster_channel()
1879 channel->id = tmp; in find_sdca_cluster_channel()
1882 "mipi-sdca-cluster-channel-purpose", in find_sdca_cluster_channel()
1886 cluster->id, channel->id, ret); in find_sdca_cluster_channel()
1890 channel->purpose = tmp; in find_sdca_cluster_channel()
1893 "mipi-sdca-cluster-channel-relationship", in find_sdca_cluster_channel()
1897 cluster->id, channel->id, ret); in find_sdca_cluster_channel()
1901 channel->relationship = tmp; in find_sdca_cluster_channel()
1904 cluster->id, channel->id, channel->purpose, channel->relationship); in find_sdca_cluster_channel()
1917 ret = fwnode_property_read_u32(cluster_node, "mipi-sdca-channel-count", in find_sdca_cluster_channels()
1921 cluster->id, ret); in find_sdca_cluster_channels()
1925 cluster->id); in find_sdca_cluster_channels()
1926 return -EINVAL; in find_sdca_cluster_channels()
1931 return -ENOMEM; in find_sdca_cluster_channels()
1937 /* DisCo uses upper-case for hex numbers */ in find_sdca_cluster_channels()
1939 "mipi-sdca-channel-%d-subproperties", i + 1); in find_sdca_cluster_channels()
1944 cluster->id, channel_property); in find_sdca_cluster_channels()
1945 return -EINVAL; in find_sdca_cluster_channels()
1954 cluster->num_channels = num_channels; in find_sdca_cluster_channels()
1955 cluster->channels = channels; in find_sdca_cluster_channels()
1969 num_clusters = fwnode_property_count_u32(function_node, "mipi-sdca-cluster-id-list"); in find_sdca_clusters()
1970 if (!num_clusters || num_clusters == -EINVAL) { in find_sdca_clusters()
1978 return -EINVAL; in find_sdca_clusters()
1983 return -ENOMEM; in find_sdca_clusters()
1987 return -ENOMEM; in find_sdca_clusters()
1989 fwnode_property_read_u32_array(function_node, "mipi-sdca-cluster-id-list", in find_sdca_clusters()
2000 /* DisCo uses upper-case for hex numbers */ in find_sdca_clusters()
2002 "mipi-sdca-cluster-id-0x%X-subproperties", clusters[i].id); in find_sdca_clusters()
2008 return -EINVAL; in find_sdca_clusters()
2017 function->num_clusters = num_clusters; in find_sdca_clusters()
2018 function->clusters = clusters; in find_sdca_clusters()
2035 "mipi-sdca-file-set-id-list"); in find_sdca_filesets()
2036 if (num_sets == 0 || num_sets == -EINVAL) { in find_sdca_filesets()
2046 return -ENOMEM; in find_sdca_filesets()
2048 fwnode_property_read_u32_array(function_node, "mipi-sdca-file-set-id-list", in find_sdca_filesets()
2053 return -ENOMEM; in find_sdca_filesets()
2062 "mipi-sdca-file-set-id-0x%X", filesets_list[i]); in find_sdca_filesets()
2068 return -EINVAL; in find_sdca_filesets()
2072 return -EINVAL; in find_sdca_filesets()
2080 return -ENOMEM; in find_sdca_filesets()
2084 return -ENOMEM; in find_sdca_filesets()
2092 file->vendor_id = fileset_entries[j++]; in find_sdca_filesets()
2093 file->file_id = fileset_entries[j++]; in find_sdca_filesets()
2094 file->fdl_offset = fileset_entries[j++]; in find_sdca_filesets()
2097 file->file_id, file->vendor_id, file->fdl_offset); in find_sdca_filesets()
2100 set->id = filesets_list[i]; in find_sdca_filesets()
2101 set->num_files = num_files; in find_sdca_filesets()
2102 set->files = files; in find_sdca_filesets()
2105 function->fdl_data.swft = sdw->sdca_data.swft; in find_sdca_filesets()
2106 function->fdl_data.num_sets = num_sets; in find_sdca_filesets()
2107 function->fdl_data.sets = sets; in find_sdca_filesets()
2113 * sdca_parse_function - parse ACPI DisCo for a Function
2128 function->desc = function_desc; in sdca_parse_function()
2130 ret = fwnode_property_read_u32(function_desc->node, in sdca_parse_function()
2131 "mipi-sdca-function-busy-max-delay", &tmp); in sdca_parse_function()
2133 function->busy_max_delay = tmp; in sdca_parse_function()
2135 ret = fwnode_property_read_u32(function_desc->node, in sdca_parse_function()
2136 "mipi-sdca-function-reset-max-delay", &tmp); in sdca_parse_function()
2138 function->reset_max_delay = tmp; in sdca_parse_function()
2140 dev_dbg(dev, "%pfwP: name %s busy delay %dus reset delay %dus\n", in sdca_parse_function()
2141 function->desc->node, function->desc->name, in sdca_parse_function()
2142 function->busy_max_delay, function->reset_max_delay); in sdca_parse_function()
2144 ret = find_sdca_init_table(dev, function_desc->node, function); in sdca_parse_function()
2148 ret = find_sdca_entities(dev, sdw, function_desc->node, function); in sdca_parse_function()
2152 ret = find_sdca_connections(dev, function_desc->node, function); in sdca_parse_function()
2156 ret = find_sdca_clusters(dev, function_desc->node, function); in sdca_parse_function()
2160 ret = find_sdca_filesets(dev, sdw, function_desc->node, function); in sdca_parse_function()
2219 for (i = 0; i < entity->num_controls; i++) { in sdca_selector_find_control()
2220 struct sdca_control *control = &entity->controls[i]; in sdca_selector_find_control()
2222 if (control->sel == sel) in sdca_selector_find_control()
2226 dev_err(dev, "%s: control %#x: missing\n", entity->label, sel); in sdca_selector_find_control()
2236 struct sdca_control_range *range = &control->range; in sdca_control_find_range()
2238 if ((cols && range->cols != cols) || (rows && range->rows != rows) || in sdca_control_find_range()
2239 !range->data) { in sdca_control_find_range()
2241 entity->label, control->sel, range->cols, range->rows); in sdca_control_find_range()
2269 for (i = 0; i < function->num_clusters; i++) { in sdca_id_find_cluster()
2270 struct sdca_cluster *cluster = &function->clusters[i]; in sdca_id_find_cluster()
2272 if (cluster->id == id) in sdca_id_find_cluster()
2276 dev_err(dev, "%s: cluster %#x: missing\n", function->desc->name, id); in sdca_id_find_cluster()