Unverified Commit 0a5e9769 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

ASoC: SDCA: Parse XU Entity properties

parent c7b6c6b6
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,27 @@ struct sdca_entity_hide {
	struct hid_descriptor hid_desc;
};

/**
 * enum sdca_xu_reset_machanism - SDCA FDL Resets
 */
enum sdca_xu_reset_mechanism {
	SDCA_XU_RESET_FUNCTION				= 0x0,
	SDCA_XU_RESET_DEVICE				= 0x1,
	SDCA_XU_RESET_BUS				= 0x2,
};

/**
 * struct sdca_entity_xu - information specific to XU Entities
 * @max_delay: the maximum time in microseconds allowed for the Device
 * to change the ownership from Device to Host
 * @reset_mechanism: indicates the type of reset that can be requested
 * the end of an FDL.
 */
struct sdca_entity_xu {
	unsigned int max_delay;
	enum sdca_xu_reset_mechanism reset_mechanism;
};

/**
 * struct sdca_entity - information for one SDCA Entity
 * @label: String such as "OT 12".
@@ -1106,6 +1127,7 @@ struct sdca_entity_hide {
 * @pde: Power Domain Entity specific Entity properties.
 * @ge: Group Entity specific Entity properties.
 * @hide: HIDE Entity specific Entity properties.
 * @xu: XU Entity specific Entity properties.
 */
struct sdca_entity {
	const char *label;
@@ -1123,6 +1145,7 @@ struct sdca_entity {
		struct sdca_entity_pde pde;
		struct sdca_entity_ge ge;
		struct sdca_entity_hide hide;
		struct sdca_entity_xu xu;
	};
};

+25 −0
Original line number Diff line number Diff line
@@ -1398,6 +1398,28 @@ find_sdca_entity_hide(struct device *dev, struct sdw_slave *sdw,
	return 0;
}

static int find_sdca_entity_xu(struct device *dev,
			       struct fwnode_handle *entity_node,
			       struct sdca_entity *entity)
{
	struct sdca_entity_xu *xu = &entity->xu;
	u32 tmp;
	int ret;

	ret = fwnode_property_read_u32(entity_node,
				       "mipi-sdca-RxUMP-ownership-transition-max-delay",
				       &tmp);
	if (!ret)
		xu->max_delay = tmp;

	ret = fwnode_property_read_u32(entity_node, "mipi-sdca-FDL-reset-mechanism",
				       &tmp);
	if (!ret)
		xu->reset_mechanism = tmp;

	return 0;
}

static int find_sdca_entity(struct device *dev, struct sdw_slave *sdw,
			    struct fwnode_handle *function_node,
			    struct fwnode_handle *entity_node,
@@ -1430,6 +1452,9 @@ static int find_sdca_entity(struct device *dev, struct sdw_slave *sdw,
	case SDCA_ENTITY_TYPE_OT:
		ret = find_sdca_entity_iot(dev, entity_node, entity);
		break;
	case SDCA_ENTITY_TYPE_XU:
		ret = find_sdca_entity_xu(dev, entity_node, entity);
		break;
	case SDCA_ENTITY_TYPE_CS:
		ret = find_sdca_entity_cs(dev, entity_node, entity);
		break;