예제 #1
0
파일: adsp-loader.c 프로젝트: Aetos7/Matr1x
static int adsp_loader_probe(struct platform_device *pdev)
{
	struct adsp_loader_private *priv;
	int rc = 0;

	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	platform_set_drvdata(pdev, priv);

	priv->pil_h = pil_get("adsp");
	if (IS_ERR(priv->pil_h)) {
		pr_err("%s: pil get adsp failed, error:%d\n", __func__, rc);
		devm_kfree(&pdev->dev, priv);
		goto fail;
	}

	/* Query the DSP to check if resources are available */
	msleep(Q6_PIL_GET_DELAY_MS);

	/* Set the state of the ADSP in APR driver */
	apr_set_q6_state(APR_SUBSYS_LOADED);

	/* Query for MMPM API */

	pr_info("%s: Q6/ADSP image is loaded\n", __func__);
fail:
	return rc;
}
static int adsp_loader_probe(struct platform_device *pdev)
{
	struct adsp_loader_private *priv;
	int rc = 0;
	const char *adsp_dt = "qcom,adsp-state";
	u32 adsp_state;

	rc = of_property_read_u32(pdev->dev.of_node, adsp_dt, &adsp_state);
	if (rc) {
		dev_err(&pdev->dev,
			"%s: ADSP state = %x\n", __func__, adsp_state);
		return rc;
	}

	if (adsp_state == APR_SUBSYS_DOWN) {
		priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
		if (!priv)
			return -ENOMEM;

		platform_set_drvdata(pdev, priv);

		priv->pil_h = subsystem_get("adsp");
		if (IS_ERR(priv->pil_h)) {
			pr_err("%s: pil get adsp failed, error:%d\n",
				__func__, rc);
			devm_kfree(&pdev->dev, priv);
			goto fail;
		}

		/* Set the state of the ADSP in APR driver */
		apr_set_q6_state(APR_SUBSYS_LOADED);
	} else if (adsp_state == APR_SUBSYS_LOADED) {
		dev_dbg(&pdev->dev,
			"%s:MDM9x25 ADSP state = %x\n", __func__, adsp_state);
		apr_set_q6_state(APR_SUBSYS_LOADED);
	}

	/* Query for MMPM API */

	pr_info("%s: Q6/ADSP image is loaded\n", __func__);
fail:
	return rc;
}
예제 #3
0
static void apr_set_subsys_state_v2(void)
{
	apr_set_q6_state(APR_SUBSYS_DOWN);
	apr_set_modem_state(APR_SUBSYS_UP);
}