示例#1
0
static void test_clnt_svc_arrive(struct work_struct *work)
{
	int rc;

	D("%s begins\n", __func__);

	
	test_clnt = qmi_handle_create(test_clnt_notify, NULL);
	if (!test_clnt) {
		pr_err("%s: QMI client handle alloc failed\n", __func__);
		return;
	}

	D("%s: Lookup server name\n", __func__);
	rc = qmi_connect_to_service(test_clnt, TEST_SERVICE_SVC_ID,
				    TEST_SERVICE_INS_ID);
	if (rc < 0) {
		pr_err("%s: Server not found\n", __func__);
		qmi_handle_destroy(test_clnt);
		test_clnt = NULL;
		return;
	}
	test_clnt_reset = 0;
	D("%s complete\n", __func__);
}
static void audio_etm_svc_arrive(struct work_struct *work)
{
	struct audio_etm_drvdata *drvdata = container_of(work,
						struct audio_etm_drvdata,
						work_svc_arrive);

	drvdata->handle = qmi_handle_create(audio_etm_notify, drvdata);
	if (!drvdata->handle) {
		dev_err(drvdata->dev, "%s: QMI client handle alloc failed\n",
			__func__);
		return;
	}

	if (qmi_connect_to_service(drvdata->handle, CORESIGHT_QMI_SVC_ID,
				  CORESIGHT_QMI_VERSION,
				  CORESIGHT_SVC_INST_ID_AUDIO_V01) < 0) {
		dev_err(drvdata->dev,
			"%s: Could not connect handle to service\n", __func__);
		qmi_handle_destroy(drvdata->handle);
		drvdata->handle = NULL;
	}
}
static void ipa_q6_clnt_svc_arrive(struct work_struct *work)
{
	int rc;
	struct ipa_master_driver_init_complt_ind_msg_v01 ind;

	/* Create a Local client port for QMI communication */
	ipa_q6_clnt = qmi_handle_create(ipa_q6_clnt_notify, NULL);
	if (!ipa_q6_clnt) {
		IPAWANERR("QMI client handle alloc failed\n");
		return;
	}

	IPAWANDBG("Lookup server name, get client-hdl(%p)\n",
		ipa_q6_clnt);
	rc = qmi_connect_to_service(ipa_q6_clnt,
			IPA_Q6_SERVICE_SVC_ID,
			IPA_Q6_SVC_VERS,
			IPA_Q6_SERVICE_INS_ID);
	if (rc < 0) {
		IPAWANERR("Server not found\n");
		qmi_handle_destroy(ipa_q6_clnt);
		ipa_q6_clnt = NULL;
		return;
	}

	rc = qmi_register_ind_cb(ipa_q6_clnt, ipa_q6_clnt_ind_cb, NULL);
	if (rc < 0)
		IPAWANERR("Unable to register for indications\n");

	ipa_q6_clnt_reset = 0;
	IPAWANDBG("Q6 QMI service available now\n");
	/* Initialize modem IPA-driver */
	IPAWANDBG("send qmi_init_modem_send_sync_msg to modem\n");
	rc = qmi_init_modem_send_sync_msg();
	if (rc == -ENETRESET) {
		IPAWANERR("qmi_init_modem_send_sync_msg failed due to SSR!\n");
		/* Cleanup will take place when ipa_wwan_remove is called */
		return;
	}
	if (rc != 0) {
		IPAWANERR("qmi_init_modem_send_sync_msg failed\n");
		/*
		 * This is a very unexpected scenario, which requires a kernel
		 * panic in order to force dumps for QMI/Q6 side analysis.
		 */
		BUG();
		return;
	}
	qmi_modem_init_fin = true;
	ipa_proxy_clk_unvote();
	/* is_load_uc=FALSE indicates that SSR has occured */
	ipa_q6_handshake_complete(!is_load_uc);
	IPAWANDBG("complete, qmi_modem_init_fin : %d\n",
		qmi_modem_init_fin);

	if (qmi_indication_fin)	{
		IPAWANDBG("send indication to modem (%d)\n",
		qmi_indication_fin);
		memset(&ind, 0, sizeof(struct
				ipa_master_driver_init_complt_ind_msg_v01));
		ind.master_driver_init_status.result =
			IPA_QMI_RESULT_SUCCESS_V01;
		rc = qmi_send_ind(ipa_svc_handle, curr_conn,
			&ipa_master_driver_complete_indication_desc,
			&ind,
			sizeof(ind));
		IPAWANDBG("ipa_qmi_service_client good\n");
	} else {
		IPAWANERR("not send indication (%d)\n",
		qmi_indication_fin);
	}
}