/**
* enum sdca_entity_type - SDCA Entity Type codes
+ * @SDCA_ENTITY_TYPE_ENTITY_0: Entity 0, not actually from the
+ * specification but useful internally as an Entity structure
+ * is allocated for Entity 0, to hold Entity 0 controls.
* @SDCA_ENTITY_TYPE_IT: Input Terminal.
* @SDCA_ENTITY_TYPE_OT: Output Terminal.
* @SDCA_ENTITY_TYPE_MU: Mixer Unit.
* all Entity Types not described are reserved.
*/
enum sdca_entity_type {
+ SDCA_ENTITY_TYPE_ENTITY_0 = 0x00,
SDCA_ENTITY_TYPE_IT = 0x02,
SDCA_ENTITY_TYPE_OT = 0x03,
SDCA_ENTITY_TYPE_MU = 0x05,
return -EINVAL;
}
- entities = devm_kcalloc(dev, num_entities, sizeof(*entities), GFP_KERNEL);
+ /* Add 1 to make space for Entity 0 */
+ entities = devm_kcalloc(dev, num_entities + 1, sizeof(*entities), GFP_KERNEL);
if (!entities)
return -ENOMEM;
return ret;
}
- function->num_entities = num_entities;
+ /*
+ * Add Entity 0 at end of the array, makes it easy to skip during
+ * all the Entity searches involved in creating connections.
+ */
+ entities[num_entities].label = "entity0";
+
+ function->num_entities = num_entities + 1;
function->entities = entities;
return 0;
{
int i;
- for (i = 0; i < function->num_entities; i++) {
+ /* Entity 0 cannot have connections */
+ for (i = 0; i < function->num_entities - 1; i++) {
struct sdca_entity *entity = &function->entities[i];
char entity_property[SDCA_PROPERTY_LENGTH];
struct fwnode_handle *entity_node;