コード例 #1
0
int nfc_mei_phy_enable(void *phy_id)
{
	int r;
	struct nfc_mei_phy *phy = phy_id;

	pr_info("%s\n", __func__);

	if (phy->powered == 1)
		return 0;

	r = mei_cl_enable_device(phy->device);
	if (r < 0) {
		pr_err("Could not enable device\n");
		return r;
	}

	r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
	if (r) {
		pr_err("Event cb registration failed\n");
		mei_cl_disable_device(phy->device);
		phy->powered = 0;

		return r;
	}

	phy->powered = 1;

	return 0;
}
コード例 #2
0
ファイル: mei_phy.c プロジェクト: Kirill2013/kasan
static int nfc_mei_phy_enable(void *phy_id)
{
	int r;
	struct nfc_mei_phy *phy = phy_id;

	pr_info("%s\n", __func__);

	if (phy->powered == 1)
		return 0;

	r = mei_cl_enable_device(phy->device);
	if (r < 0) {
		pr_err("Could not enable device %d\n", r);
		return r;
	}

	r = mei_nfc_if_version(phy);
	if (r < 0) {
		pr_err("Could not enable device %d\n", r);
		goto err;
	}

	r = mei_nfc_connect(phy);
	if (r < 0) {
		pr_err("Could not connect to device %d\n", r);
		goto err;
	}

	r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
	if (r) {
		pr_err("Event cb registration failed %d\n", r);
		goto err;
	}

	phy->powered = 1;

	return 0;

err:
	phy->powered = 0;
	mei_cl_disable_device(phy->device);
	return r;
}
コード例 #3
0
ファイル: mei_phy.c プロジェクト: gnychis/ath9k_htc-backports
int nfc_mei_phy_enable(void *phy_id)
{
	int r;
	struct nfc_mei_phy *phy = phy_id;

	pr_info("%s\n", __func__);

	if (phy->powered == 1)
		return 0;

	r = mei_cl_enable_device(phy->device);
	if (r < 0) {
                pr_err("MEI_PHY: Could not enable device\n");
                return r;
	}

	phy->powered = 1;

	return 0;
}