Beispiel #1
0
static int rawchip_driver_probe(struct platform_device *pdev)
{
	int rc = 0;
	pr_info("%s\n", __func__);

	rawchipCtrl = kzalloc(sizeof(struct rawchip_ctrl), GFP_ATOMIC);
	if (!rawchipCtrl) {
		pr_err("%s: could not allocate mem for rawchip_dev\n", __func__);
		return -ENOMEM;
	}

	rc = setup_rawchip_cdev();
	if (rc < 0) {
		kfree(rawchipCtrl);
		return rc;
	}

	mutex_init(&rawchipCtrl->raw_ioctl_lock);
	rawchipCtrl->pdata = pdev->dev.platform_data;

	rc = rawchip_spi_init();
	if (rc < 0) {
		pr_err("%s: failed to register spi driver\n", __func__);
		return rc;
	}

	msm_rawchip_attr_node();

	return rc;
}
Beispiel #2
0
int rawchip_probe_init(void)
{
	int rc = 0;
	struct msm_camera_rawchip_info *pdata = rawchipCtrl->pdata;
	int read_id_retry = 0;

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

	if (rawchipCtrl == NULL) {
		pr_err("already failed in __msm_rawchip_probe\n");
		return -EINVAL;
	}

	rc = rawchip_spi_init();
	if (rc < 0) {
		pr_err("%s: failed to register spi driver\n", __func__);
		return rc;
	}

probe_read_id_retry:
	rc = rawchip_power_up(pdata);
	if (rc < 0)
		return rc;

	rc = rawchip_match_id();
	if (rc < 0) {
		if (read_id_retry < 3) {
			pr_info("retry read rawchip ID: %d\n", read_id_retry);
			read_id_retry++;
			rawchip_power_down(pdata);
			goto probe_read_id_retry;
		}
		goto probe_init_fail;
	}

	pr_info("%s: probe_success\n", __func__);
	return rc;

probe_init_fail:
	pr_err("%s: rawchip_probe_init failed\n", __func__);
	rawchip_power_down(pdata);
	return rc;
}