Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27f4d2c0 authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

msm: kgsl: Get rid of a6xx_hfi_send_req function



Instead, directly call a6xx_hfi_send_generic_req. Also,
get rid of a6xx_hfi_send_get_value() as it is not used.

Change-Id: Idee3af33ff0e5e03a9f974c535f8bc1c7579d492
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent c7f6786e
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -841,9 +841,11 @@ static int a6xx_gmu_hfi_start_msg(struct adreno_device *adreno_dev)
	 * serves as a better means to identify targets that depend on
	 * legacy firmware.
	 */
	if (!ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG))
		return a6xx_hfi_send_req(adreno_dev,
					 H2F_MSG_START, &req);
	if (!ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG)) {
		req.hdr = CMD_MSG_HDR(H2F_MSG_START, sizeof(req));

		return a6xx_hfi_send_generic_req(adreno_dev, &req);
	}

	return 0;

@@ -1711,8 +1713,9 @@ static int a6xx_gmu_notify_slumber(struct adreno_device *adreno_dev)
			.bw = bus_level,
		};

		ret = a6xx_hfi_send_req(adreno_dev,
			H2F_MSG_PREPARE_SLUMBER, &req);
		req.hdr = CMD_MSG_HDR(H2F_MSG_PREPARE_SLUMBER, sizeof(req));

		ret = a6xx_hfi_send_generic_req(adreno_dev, &req);
		goto out;
	}

@@ -1800,11 +1803,12 @@ static int a6xx_gmu_dcvs_set(struct adreno_device *adreno_dev,
		return 0;
	}

	req.hdr = CMD_MSG_HDR(H2F_MSG_GX_BW_PERF_VOTE, sizeof(req));

	if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG))
		ret = a6xx_gmu_dcvs_nohfi(device, req.freq, req.bw);
	else
		ret = a6xx_hfi_send_req(adreno_dev, H2F_MSG_GX_BW_PERF_VOTE,
			&req);
		ret = a6xx_hfi_send_generic_req(adreno_dev, &req);

	if (ret) {
		dev_err_ratelimited(&gmu->pdev->dev,
+2 −67
Original line number Diff line number Diff line
@@ -466,27 +466,6 @@ static int a6xx_hfi_send_dcvstbl_v1(struct adreno_device *adreno_dev)
	return a6xx_hfi_send_generic_req(adreno_dev, &cmd);
}

static int a6xx_hfi_send_get_value(struct adreno_device *adreno_dev,
		struct hfi_get_value_req *req)
{
	struct hfi_get_value_cmd *cmd = &req->cmd;
	struct pending_cmd ret_cmd;
	struct hfi_get_value_reply_cmd *reply =
		(struct hfi_get_value_reply_cmd *)ret_cmd.results;
	int rc;

	cmd->hdr = CMD_MSG_HDR(H2F_MSG_GET_VALUE, sizeof(*cmd));

	rc = a6xx_hfi_send_cmd_wait_inline(adreno_dev, cmd, &ret_cmd);
	if (rc)
		return rc;

	memset(&req->data, 0, sizeof(req->data));
	memcpy(&req->data, &reply->data,
			(MSG_HDR_GET_SIZE(reply->hdr) - 2) << 2);
	return 0;
}

static int a6xx_hfi_send_test(struct adreno_device *adreno_dev)
{
	struct hfi_test_cmd cmd = {
@@ -644,6 +623,7 @@ int a6xx_hfi_send_lm_feature_ctrl(struct adreno_device *adreno_dev)

	nvmem_cell_read_u32(&device->pdev->dev, "isense_slope", &slope);

	req.hdr = CMD_MSG_HDR(H2F_MSG_SET_VALUE, sizeof(req));
	req.type = HFI_VALUE_LM_CS0;
	req.subtype = 0;
	req.data = slope;
@@ -652,7 +632,7 @@ int a6xx_hfi_send_lm_feature_ctrl(struct adreno_device *adreno_dev)
			device->pwrctrl.throttle_mask);

	if (!ret)
		ret = a6xx_hfi_send_req(adreno_dev, H2F_MSG_SET_VALUE, &req);
		ret = a6xx_hfi_send_generic_req(adreno_dev, &req);

	return ret;
}
@@ -793,51 +773,6 @@ void a6xx_hfi_stop(struct adreno_device *adreno_dev)

}

int a6xx_hfi_send_req(struct adreno_device *adreno_dev, unsigned int id,
	void *data)
{
	switch (id) {
	case H2F_MSG_GX_BW_PERF_VOTE: {
		struct hfi_gx_bw_perf_vote_cmd *cmd = data;

		cmd->hdr = CMD_MSG_HDR(id, sizeof(*cmd));

		return a6xx_hfi_send_generic_req(adreno_dev, cmd);
	}
	case H2F_MSG_PREPARE_SLUMBER: {
		struct hfi_prep_slumber_cmd *cmd = data;

		if (cmd->freq >= MAX_GX_LEVELS || cmd->bw >= MAX_GX_LEVELS)
			return -EINVAL;

		cmd->hdr = CMD_MSG_HDR(id, sizeof(*cmd));

		return a6xx_hfi_send_generic_req(adreno_dev, cmd);
	}
	case H2F_MSG_START: {
		struct hfi_start_cmd *cmd = data;

		cmd->hdr = CMD_MSG_HDR(id, sizeof(*cmd));

		return a6xx_hfi_send_generic_req(adreno_dev, cmd);
	}
	case H2F_MSG_GET_VALUE: {
		return a6xx_hfi_send_get_value(adreno_dev, data);
	}
	case H2F_MSG_SET_VALUE: {
		struct hfi_set_value_cmd *cmd = data;

		cmd->hdr = CMD_MSG_HDR(id, sizeof(*cmd));

		return a6xx_hfi_send_generic_req(adreno_dev, cmd);
	}
	default:
		break;
	}

	return -EINVAL;
}

/* HFI interrupt handler */
irqreturn_t a6xx_hfi_irq_handler(int irq, void *data)
{
+0 −11
Original line number Diff line number Diff line
@@ -601,17 +601,6 @@ void a6xx_hfi_stop(struct adreno_device *adreno_dev);
 */
int a6xx_hfi_init(struct adreno_device *adreno_dev);

/**
 * a6xx_hfi_send_req - Send an HFI packet to GMU
 * @adreno_dev: Pointer to the adreno device
 * @id: Packet id to be sent
 * @data: Container for the data sent as part of this pcket
 *
 * Return: 0 on success or negative error on failure
 */
int a6xx_hfi_send_req(struct adreno_device *adreno_dev,
	unsigned int id, void *data);

/* Helper function to get to a6xx hfi struct from adreno device */
struct a6xx_hfi *to_a6xx_hfi(struct adreno_device *adreno_dev);