int mhi_esoc_register(struct mhi_device_ctxt *mhi_dev_ctxt)
{
	int ret_val = 0;
	struct device_node *np;
	struct pci_driver *mhi_driver;
	struct device *dev = &mhi_dev_ctxt->dev_info->pcie_device->dev;

	mhi_driver = mhi_dev_ctxt->dev_info->mhi_pcie_driver;
	np = dev->of_node;
	mhi_dev_ctxt->esoc_handle = devm_register_esoc_client(dev, "mdm");
	mhi_log(MHI_MSG_VERBOSE,
		"Of table of pcie struct device property is dev->of_node %p\n",
		np);
	if (IS_ERR_OR_NULL(mhi_dev_ctxt->esoc_handle)) {
		mhi_log(MHI_MSG_CRITICAL,
			"Failed to register for SSR, ret %lx\n",
			(uintptr_t)mhi_dev_ctxt->esoc_handle);
		return -EIO;
	}

	esoc_parse_link_type(mhi_dev_ctxt);

	mhi_dev_ctxt->esoc_ssr_handle = subsys_notif_register_notifier(
					mhi_dev_ctxt->esoc_handle->name,
					&mhi_ssr_nb);
	if (IS_ERR_OR_NULL(mhi_dev_ctxt->esoc_ssr_handle)) {
		ret_val = PTR_RET(mhi_dev_ctxt->esoc_ssr_handle);
		mhi_log(MHI_MSG_CRITICAL,
			"Can't find esoc desc ret 0x%lx\n",
			(uintptr_t)mhi_dev_ctxt->esoc_ssr_handle);
	}

	return ret_val;
}
static int __devinit pil_subsys_init(struct modem_data *drv,
					struct platform_device *pdev)
{
	int ret;
#ifdef CONFIG_MACH_LGE
	pr_info("pil_subsys_init : exter init\n");
#endif

#ifdef CONFIG_MACH_LGE
	pr_info("pil_subsys_init : exter init\n");
#endif

	drv->subsys_desc.name = "modem";
	drv->subsys_desc.dev = &pdev->dev;
	drv->subsys_desc.owner = THIS_MODULE;
	drv->subsys_desc.shutdown = modem_shutdown;
	drv->subsys_desc.powerup = modem_powerup;
	drv->subsys_desc.ramdump = modem_ramdump;
	drv->subsys_desc.crash_shutdown = modem_crash_shutdown;
	drv->subsys_desc.start = mss_start;
	drv->subsys_desc.stop = mss_stop;
	drv->subsys_desc.err_fatal_handler = modem_err_fatal_intr_handler;
	drv->subsys_desc.stop_ack_handler = modem_stop_ack_intr_handler;
	drv->subsys_desc.wdog_bite_handler = modem_wdog_bite_intr_handler;

	drv->subsys = subsys_register(&drv->subsys_desc);
	if (IS_ERR(drv->subsys)) {
		ret = PTR_ERR(drv->subsys);
		goto err_subsys;
	}

	drv->ramdump_dev = create_ramdump_device("modem", &pdev->dev);
	if (!drv->ramdump_dev) {
		pr_err("%s: Unable to create a modem ramdump device.\n",
			__func__);
		ret = -ENOMEM;
		goto err_ramdump;
	}

	drv->adsp_state_notifier = subsys_notif_register_notifier("adsp",
						&adsp_state_notifier_block);
	if (IS_ERR(drv->adsp_state_notifier)) {
		ret = PTR_ERR(drv->adsp_state_notifier);
		dev_err(&pdev->dev, "%s: Registration with the SSR notification driver failed (%d)",
			__func__, ret);
		goto err_irq;
	}
#ifdef CONFIG_MACH_LGE
	pr_info("pil_subsys_init : exit init\n");
#endif

	return 0;

err_irq:
	destroy_ramdump_device(drv->ramdump_dev);
err_ramdump:
	subsys_unregister(drv->subsys);
err_subsys:
	return ret;
}
static int mitigate_inrush_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct device_node *np = dev->of_node;
	int i, retval;
	struct subsystem *subsys;
	struct inrush_driver_data *drv_data;

	retval = of_property_count_strings(np,
					"qcom,dependent-subsystems");
	if (IS_ERR_VALUE(retval)) {
		dev_err(dev, "Failed to get dependent subsystems\n");
		return -EINVAL;
	}

	drv_data = kzalloc((retval * sizeof(struct subsystem) +
			sizeof(struct inrush_driver_data)), GFP_KERNEL);

	if (!drv_data)
		return -ENOMEM;

	drv_data->subsystems = (void *)drv_data +
				sizeof(struct inrush_driver_data);
	drv_data->subsys_count = retval;

	for (i = 0; i < drv_data->subsys_count; i++) {
		subsys = &drv_data->subsystems[i];
		subsys->drv_data = drv_data;
		of_property_read_string_index(np, "qcom,dependent-subsystems",
					i, &subsys->name);
		subsys->nb.notifier_call = mitigate_inrush_notifier_cb;
		subsys->notif_handle =
			subsys_notif_register_notifier(subsys->name,
							&subsys->nb);
		if (IS_ERR(subsys->notif_handle)) {
			dev_err(dev, "Notifier registration failed for %s\n",
						 subsys->name);
			retval = PTR_ERR(subsys->notif_handle);
			goto err_subsys_notif;
		}
	}

	drv_data->vreg = devm_regulator_get(dev, "vdd");
	if (IS_ERR(drv_data->vreg)) {
		dev_err(dev, "Failed to get regulator\n");
		return PTR_ERR(drv_data->vreg);
	}

	return 0;

err_subsys_notif:
	for (i = 0; i < drv_data->subsys_count; i++) {
		subsys = &drv_data->subsystems[i];
		subsys_notif_unregister_notifier(subsys->notif_handle,
						&subsys->nb);
	}
	kfree(drv_data);
	return retval;
}
Beispiel #4
0
static int last_amsslog_driver_probe(struct platform_device *pdev)
{
	struct resource *amsslog_res;
	struct proc_dir_entry *entry;
	void *subsys;
	int ret = 0;

	dev = &pdev->dev;
	amsslog_res = platform_get_resource_byname(pdev,
			IORESOURCE_MEM, "amsslog");
	if (!amsslog_res || !amsslog_res->start) {
		dev_err(dev, "last_amsslog resource invalid/absent\n");
		return -ENODEV;
	}

	amsslog_size = amsslog_res->end - amsslog_res->start + 1;
	amsslog_base = (char *)ioremap(amsslog_res->start, amsslog_size);
	if (amsslog_base == NULL) {
		dev_err(dev, "failed to map last_amsslog memory\n");
		return -ENOMEM;
	}

	amsslog_buf = (char *)__get_free_pages(GFP_KERNEL,
			get_order(amsslog_size));
	if (!amsslog_buf) {
		dev_err(dev, "Failed to allocate pages of order %d\n",
			get_order(amsslog_size));
		iounmap(amsslog_base);
		return -ENOMEM;
	}

	subsys = subsys_notif_register_notifier("modem",
			&modem_status_notifier);
	if (IS_ERR(subsys)) {
		dev_err(dev, "Failed to register modem state notifier\n");
		ret = -EINVAL;
		goto out;
	}

	entry = proc_create_data("last_amsslog", S_IRUSR, NULL,
			&last_amsslog_fops, NULL);
	if (!entry) {
		dev_err(dev,
			"failed to create last_amsslog proc entry\n");
		ret = -ENOMEM;
		goto out;
	}

out:
	if (!ret)
		dev_info(dev, "Last modem error log driver probe done !!\n");
	else {
		free_pages((unsigned long)amsslog_buf, get_order(amsslog_size));
		iounmap(amsslog_base);
		amsslog_base = NULL;
	}

	return ret;
}
Beispiel #5
0
static void subsys_notif_register_v2(struct notifier_block *mod_notif,
				struct notifier_block *lp_notif)
{
	subsys_notif_register_notifier("modem", mod_notif);
	subsys_notif_register_notifier(apr_get_lpass_subsys_name(), lp_notif);
}
Beispiel #6
0
static void subsys_notif_register_v3(struct notifier_block *mod_notif,
				struct notifier_block *lp_notif)
{
	subsys_notif_register_notifier("modem", mod_notif);
}
Beispiel #7
0
static __devinit int msm8x10_asoc_machine_probe(struct platform_device *pdev)
{
	struct snd_soc_card *card = &snd_soc_card_msm8x10;
	int ret;

	dev_dbg(&pdev->dev, "%s\n", __func__);
	if (!pdev->dev.of_node) {
		dev_err(&pdev->dev, "No platform supplied from device tree\n");
		return -EINVAL;
	}

	card->dev = &pdev->dev;
	platform_set_drvdata(pdev, card);

	ret = snd_soc_of_parse_card_name(card, "qcom,model");
	if (ret)
		goto err;

	ret = snd_soc_of_parse_audio_routing(card,
			"qcom,audio-routing");
	if (ret)
		goto err;

	mutex_init(&cdc_mclk_mutex);
	pcbcr = ioremap(MSM8X10_DINO_LPASS_DIGCODEC_CBCR, 4);
	if (!pcbcr) {
		ret = -ENOMEM;
		goto err1;
	}
	prcgr = ioremap(MSM8X10_DINO_LPASS_DIGCODEC_CMD_RCGR, 4);
	if (!prcgr) {
		ret = -ENOMEM;
		goto err1;
	}
	atomic_set(&mclk_rsc_ref, 0);
	mbhc_cfg.gpio_level_insert = of_property_read_bool(pdev->dev.of_node,
						"qcom,headset-jack-type-NC");
	mbhc_cfg.use_int_rbias = of_property_read_bool(pdev->dev.of_node,
						"qcom,mbhc-bias-internal");

	spdev = pdev;

	ret = snd_soc_register_card(card);
	if (ret == -EPROBE_DEFER)
		goto err1;
	else if (ret) {
		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
			ret);
		goto err1;
	}
	adsp_state_notifier =
	    subsys_notif_register_notifier("adsp",
					   &adsp_state_notifier_block);
	if (!adsp_state_notifier) {
		pr_err("%s: Failed to register adsp state notifier\n",
		       __func__);
	}
	if (msm_sec_mi2s_rx2_group)
		msm_mi2s_rx2_init();
	return 0;
err1:
	mutex_destroy(&cdc_mclk_mutex);
	if (pcbcr)
		iounmap(pcbcr);
	if (prcgr)
		iounmap(prcgr);
err:
	return ret;
}