• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ platform_device_put函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中platform_device_put函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_device_put函数的具体用法?C++ platform_device_put怎么用?C++ platform_device_put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了platform_device_put函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: omap_hsmmc_init_one

static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
					int ctrl_nr)
{
	struct omap_hwmod *oh;
	struct omap_hwmod *ohs[1];
	struct omap_device *od;
	struct platform_device *pdev;
	char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
	struct omap_hsmmc_platform_data *mmc_data;
	struct omap_hsmmc_dev_attr *mmc_dev_attr;
	char *name;
	int res;

	mmc_data = kzalloc(sizeof(*mmc_data), GFP_KERNEL);
	if (!mmc_data)
		return;

	res = omap_hsmmc_pdata_init(hsmmcinfo, mmc_data);
	if (res < 0)
		goto free_mmc;

	name = "omap_hsmmc";
	res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
		     "mmc%d", ctrl_nr);
	WARN(res >= MAX_OMAP_MMC_HWMOD_NAME_LEN,
	     "String buffer overflow in MMC%d device setup\n", ctrl_nr);

	oh = omap_hwmod_lookup(oh_name);
	if (!oh) {
		pr_err("Could not look up %s\n", oh_name);
		goto free_name;
	}
	ohs[0] = oh;
	if (oh->dev_attr != NULL) {
		mmc_dev_attr = oh->dev_attr;
		mmc_data->controller_flags = mmc_dev_attr->flags;
	}

	pdev = platform_device_alloc(name, ctrl_nr - 1);
	if (!pdev) {
		pr_err("Could not allocate pdev for %s\n", name);
		goto free_name;
	}
	dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);

	od = omap_device_alloc(pdev, ohs, 1);
	if (IS_ERR(od)) {
		pr_err("Could not allocate od for %s\n", name);
		goto put_pdev;
	}

	res = platform_device_add_data(pdev, mmc_data,
			      sizeof(struct omap_hsmmc_platform_data));
	if (res) {
		pr_err("Could not add pdata for %s\n", name);
		goto put_pdev;
	}

	hsmmcinfo->pdev = pdev;

	res = omap_device_register(pdev);
	if (res) {
		pr_err("Could not register od for %s\n", name);
		goto free_od;
	}

	goto free_mmc;

free_od:
	omap_device_delete(od);

put_pdev:
	platform_device_put(pdev);

free_name:
	kfree(mmc_data->name);

free_mmc:
	kfree(mmc_data);
}
开发者ID:CyrusYzGTt,项目名称:linux,代码行数:80,代码来源:hsmmc.c


示例2: wm8350_register_led

/**
 * wm8350_register_led - Register a WM8350 LED output
 *
 * @param wm8350 The WM8350 device to configure.
 * @param lednum LED device index to create.
 * @param dcdc The DCDC to use for the LED.
 * @param isink The ISINK to use for the LED.
 * @param pdata Configuration for the LED.
 *
 * The WM8350 supports the use of an ISINK together with a DCDC to
 * provide a power-efficient LED driver.  This function registers the
 * regulators and instantiates the platform device for a LED.  The
 * operating modes for the LED regulators must be configured using
 * wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
 * wm8350_dcdc_set_slot() prior to calling this function.
 */
int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
			struct wm8350_led_platform_data *pdata)
{
	struct wm8350_led *led;
	struct platform_device *pdev;
	int ret;

	if (lednum >= ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
		dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
		return -ENODEV;
	}

	led = &wm8350->pmic.led[lednum];

	if (led->pdev) {
		dev_err(wm8350->dev, "LED %d already allocated\n", lednum);
		return -EINVAL;
	}

	pdev = platform_device_alloc("wm8350-led", lednum);
	if (pdev == NULL) {
		dev_err(wm8350->dev, "Failed to allocate LED %d\n", lednum);
		return -ENOMEM;
	}

	led->isink_consumer.dev_name = dev_name(&pdev->dev);
	led->isink_consumer.supply = "led_isink";
	led->isink_init.num_consumer_supplies = 1;
	led->isink_init.consumer_supplies = &led->isink_consumer;
	led->isink_init.constraints.min_uA = 0;
	led->isink_init.constraints.max_uA = pdata->max_uA;
	led->isink_init.constraints.valid_ops_mask
		= REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS;
	led->isink_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
	ret = wm8350_register_regulator(wm8350, isink, &led->isink_init);
	if (ret != 0) {
		platform_device_put(pdev);
		return ret;
	}

	led->dcdc_consumer.dev_name = dev_name(&pdev->dev);
	led->dcdc_consumer.supply = "led_vcc";
	led->dcdc_init.num_consumer_supplies = 1;
	led->dcdc_init.consumer_supplies = &led->dcdc_consumer;
	led->dcdc_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
	led->dcdc_init.constraints.valid_ops_mask =  REGULATOR_CHANGE_STATUS;
	ret = wm8350_register_regulator(wm8350, dcdc, &led->dcdc_init);
	if (ret != 0) {
		platform_device_put(pdev);
		return ret;
	}

	switch (isink) {
	case WM8350_ISINK_A:
		wm8350->pmic.isink_A_dcdc = dcdc;
		break;
	case WM8350_ISINK_B:
		wm8350->pmic.isink_B_dcdc = dcdc;
		break;
	}

	pdev->dev.platform_data = pdata;
	pdev->dev.parent = wm8350->dev;
	ret = platform_device_add(pdev);
	if (ret != 0) {
		dev_err(wm8350->dev, "Failed to register LED %d: %d\n",
			lednum, ret);
		platform_device_put(pdev);
		return ret;
	}

	led->pdev = pdev;

	return 0;
}
开发者ID:avagin,项目名称:linux,代码行数:91,代码来源:wm8350-regulator.c


示例3: dwc3_pci_probe

static int __devinit dwc3_pci_probe(struct pci_dev *pci,
		const struct pci_device_id *id)
{
	struct resource		res[2];
	struct platform_device	*dwc3;
	struct dwc3_pci		*glue;
	int			ret = -ENOMEM;
	int			devid;

	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
	if (!glue) {
		dev_err(&pci->dev, "not enough memory\n");
		goto err0;
	}

	glue->dev	= &pci->dev;

	ret = pci_enable_device(pci);
	if (ret) {
		dev_err(&pci->dev, "failed to enable pci device\n");
		goto err1;
	}

	pci_set_power_state(pci, PCI_D0);
	pci_set_master(pci);

	devid = dwc3_get_device_id();
	if (devid < 0)
		goto err2;

	dwc3 = platform_device_alloc("dwc3", devid);
	if (!dwc3) {
		dev_err(&pci->dev, "couldn't allocate dwc3 device\n");
		goto err3;
	}

	memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));

	res[0].start	= pci_resource_start(pci, 0);
	res[0].end	= pci_resource_end(pci, 0);
	res[0].name	= "dwc_usb3";
	res[0].flags	= IORESOURCE_MEM;

	res[1].start	= pci->irq;
	res[1].name	= "dwc_usb3";
	res[1].flags	= IORESOURCE_IRQ;

	ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
	if (ret) {
		dev_err(&pci->dev, "couldn't add resources to dwc3 device\n");
		goto err4;
	}

	pci_set_drvdata(pci, glue);

	dma_set_coherent_mask(&dwc3->dev, pci->dev.coherent_dma_mask);

	dwc3->dev.dma_mask = pci->dev.dma_mask;
	dwc3->dev.dma_parms = pci->dev.dma_parms;
	dwc3->dev.parent = &pci->dev;
	glue->dwc3	= dwc3;

	ret = platform_device_add(dwc3);
	if (ret) {
		dev_err(&pci->dev, "failed to register dwc3 device\n");
		goto err4;
	}

	return 0;

err4:
	pci_set_drvdata(pci, NULL);
	platform_device_put(dwc3);

err3:
	dwc3_put_device_id(devid);

err2:
	pci_disable_device(pci);

err1:
	kfree(glue);

err0:
	return ret;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:86,代码来源:dwc3-pci.c


示例4: tvenc_probe


//.........这里部分代码省略.........
		return -EPERM;

	mfd = platform_get_drvdata(pdev);
	mfd->ebi1_clk = ebi1_clk;

	if (!mfd)
		return -ENODEV;

	if (mfd->key != MFD_KEY)
		return -EINVAL;

	if (pdev_list_cnt >= MSM_FB_MAX_DEV_LIST)
		return -ENOMEM;

	if (tvenc_base == NULL)
		return -ENOMEM;

	mdp_dev = platform_device_alloc("mdp", pdev->id);
	if (!mdp_dev)
		return -ENOMEM;

	/*
                           
  */
	mfd->pdev = mdp_dev;
	mfd->dest = DISPLAY_TV;

	/*
                           
  */
	if (platform_device_add_data
	    (mdp_dev, pdev->dev.platform_data,
	     sizeof(struct msm_fb_panel_data))) {
		pr_err("tvenc_probe: platform_device_add_data failed!\n");
		platform_device_put(mdp_dev);
		return -ENOMEM;
	}
	/*
              
  */
	pdata = mdp_dev->dev.platform_data;
	pdata->on = tvenc_on;
	pdata->off = tvenc_off;
	pdata->next = pdev;

	/*
                                  
  */
	mfd->panel_info = pdata->panel_info;
#ifdef CONFIG_FB_MSM_MDP40
	mfd->fb_imgType = MDP_RGB_565;  /*            */
#else
	mfd->fb_imgType = MDP_YCRYCB_H2V1;
#endif

#ifdef CONFIG_MSM_BUS_SCALING
	if (!tvenc_bus_scale_handle && tvenc_pdata &&
		tvenc_pdata->bus_scale_table) {
		tvenc_bus_scale_handle =
			msm_bus_scale_register_client(
				tvenc_pdata->bus_scale_table);
		if (!tvenc_bus_scale_handle) {
			printk(KERN_ERR "%s not able to get bus scale\n",
				__func__);
		}
	}
#endif

	/*
                   
  */
	platform_set_drvdata(mdp_dev, mfd);

	/*
                          
  */
	rc = platform_device_add(mdp_dev);
	if (rc)
		goto tvenc_probe_err;

	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);



	pdev_list[pdev_list_cnt++] = pdev;

	return 0;

tvenc_probe_err:
#ifdef CONFIG_MSM_BUS_SCALING
	if (tvenc_pdata && tvenc_pdata->bus_scale_table &&
		tvenc_bus_scale_handle > 0) {
		msm_bus_scale_unregister_client(tvenc_bus_scale_handle);
		tvenc_bus_scale_handle = 0;
	}
#endif
	platform_device_put(mdp_dev);
	return rc;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:101,代码来源:tvenc.c


示例5: ipc_bridge_probe


//.........这里部分代码省略.........
		goto free_in_ctlreq;
	}

	dev->readbuf = kmalloc(IPC_BRIDGE_MAX_READ_SZ, GFP_KERNEL);
	if (!dev->readbuf) {
		dev_err(&intf->dev, "fail to allocate read buffer\n");
		ret = -ENOMEM;
		goto free_readurb;
	}

	dev->out_ctlreq = kmalloc(sizeof(*dev->out_ctlreq), GFP_KERNEL);
	if (!dev->out_ctlreq) {
		dev_err(&intf->dev, "error allocating OUT control req\n");
		ret = -ENOMEM;
		goto free_readbuf;
	}

	dev->out_ctlreq->bRequestType =
			(USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
	dev->out_ctlreq->bRequest  = USB_CDC_SEND_ENCAPSULATED_COMMAND;
	dev->out_ctlreq->wValue = 0;
	dev->out_ctlreq->wIndex = intf->cur_altsetting->desc.bInterfaceNumber;

	dev->writeurb = usb_alloc_urb(0, GFP_KERNEL);
	if (!dev->writeurb) {
		dev_err(&intf->dev, "fail to allocate write urb\n");
		ret = -ENOMEM;
		goto free_out_ctlreq;
	}

	dev->udev = usb_get_dev(interface_to_usbdev(intf));
	dev->intf = intf;
	spin_lock_init(&dev->lock);
	init_completion(&dev->write_done);
	init_waitqueue_head(&dev->read_wait_q);
	INIT_LIST_HEAD(&dev->rx_list);
	mutex_init(&dev->open_mutex);
	mutex_init(&dev->read_mutex);
	mutex_init(&dev->write_mutex);
	usb_set_intfdata(intf, dev);
	usb_enable_autosuspend(udev);

	dev->pdev = platform_device_alloc("ipc_bridge", -1);
	if (!dev->pdev) {
		dev_err(&intf->dev, "fail to allocate pdev\n");
		ret = -ENOMEM;
		goto destroy_mutex;
	}

	ret = platform_device_add_data(dev->pdev, &ipc_bridge_pdata,
				sizeof(struct ipc_bridge_platform_data));
	if (ret) {
		dev_err(&intf->dev, "fail to add pdata\n");
		goto put_pdev;
	}

	ret = platform_device_add(dev->pdev);
	if (ret) {
		dev_err(&intf->dev, "fail to add pdev\n");
		goto put_pdev;
	}

	ret = ipc_bridge_submit_inturb(dev, GFP_KERNEL);
	if (ret) {
		dev_err(&intf->dev, "fail to start reading\n");
		goto del_pdev;
	}

	ipc_bridge_debugfs_init();
	return 0;

del_pdev:
	platform_device_del(dev->pdev);
put_pdev:
	platform_device_put(dev->pdev);
destroy_mutex:
	usb_disable_autosuspend(udev);
	mutex_destroy(&dev->write_mutex);
	mutex_destroy(&dev->read_mutex);
	mutex_destroy(&dev->open_mutex);
	usb_put_dev(dev->udev);
	usb_free_urb(dev->writeurb);
free_out_ctlreq:
	kfree(dev->out_ctlreq);
free_readbuf:
	kfree(dev->readbuf);
free_readurb:
	usb_free_urb(dev->readurb);
free_in_ctlreq:
	kfree(dev->in_ctlreq);
free_intbuf:
	kfree(dev->intbuf);
free_inturb:
	usb_free_urb(dev->inturb);
free_dev:
	kfree(dev);
	__ipc_bridge_dev = NULL;

	return ret;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:101,代码来源:ipc_bridge.c


示例6: msm8960_configure_headset_mic_gpios

static int msm8960_configure_headset_mic_gpios(void)
{
	int ret;
	struct pm_gpio param = {
		.direction      = PM_GPIO_DIR_OUT,
		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
		.output_value   = 1,
		.pull	   = PM_GPIO_PULL_NO,
		.vin_sel	= PM_GPIO_VIN_S4,
		.out_strength   = PM_GPIO_STRENGTH_MED,
		.function       = PM_GPIO_FUNC_NORMAL,
	};

	ret = gpio_request(PM8921_GPIO_PM_TO_SYS(23), "AV_SWITCH");
	if (ret) {
		pr_err("%s: Failed to request gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(23));
		return ret;
	}

	ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(23), &param);
	if (ret)
		pr_err("%s: Failed to configure gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(23));
	else
		gpio_direction_output(PM8921_GPIO_PM_TO_SYS(23), 0);

	ret = gpio_request(PM8921_GPIO_PM_TO_SYS(35), "US_EURO_SWITCH");
	if (ret) {
		pr_err("%s: Failed to request gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(35));
		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
		return ret;
	}
	ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(35), &param);
	if (ret)
		pr_err("%s: Failed to configure gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(35));
	else
		gpio_direction_output(PM8921_GPIO_PM_TO_SYS(35), 0);

	return 0;
}
static void msm8960_free_headset_mic_gpios(void)
{
	if (msm8960_headset_gpios_configured) {
		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
		gpio_free(PM8921_GPIO_PM_TO_SYS(35));
	}
}

static int __init msm8960_audio_init(void)
{
	int ret;

	if (!cpu_is_msm8960() && !cpu_is_msm8930()) {
		pr_err("%s: Not the right machine type\n", __func__);
		return -ENODEV ;
	}

	tabla_mbhc_cal = def_tabla_mbhc_cal();
	if (!tabla_mbhc_cal) {
		pr_err("Calibration data allocation failed\n");
		return -ENOMEM;
	}

	msm8960_snd_device = platform_device_alloc("soc-audio", 0);
	if (!msm8960_snd_device) {
		pr_err("Platform device allocation failed\n");
		kfree(tabla_mbhc_cal);
		return -ENOMEM;
	}

	platform_set_drvdata(msm8960_snd_device, &snd_soc_card_msm8960);
	ret = platform_device_add(msm8960_snd_device);
	if (ret) {
		platform_device_put(msm8960_snd_device);
		kfree(tabla_mbhc_cal);
		return ret;
	}

	if (msm8960_configure_headset_mic_gpios()) {
		pr_err("%s Fail to configure headset mic gpios\n", __func__);
		msm8960_headset_gpios_configured = 0;
	} else
		msm8960_headset_gpios_configured = 1;

	return ret;

}
开发者ID:mblaster,项目名称:android_kernel_huawei_hws7300u,代码行数:90,代码来源:msm8960.c


示例7: keyreset_probe


//.........这里部分代码省略.........
			goto err_get_pdata_fail;
		}
		ret = keyreset_parse_dt(pdev->dev.of_node, pdata);
		if (ret < 0) {
			KEY_LOGE("keyreset_parse_dt fail\n");
			ret = -ENOMEM;
			goto err_parse_fail;
		}
	} else {
		pdata = pdev->dev.platform_data;
		if(!pdata) {
			KEY_LOGE("keyreset_platform_data does not exist\n");
			ret = -ENOMEM;
			goto err_get_pdata_fail;
		}
	}

	state = devm_kzalloc(&pdev->dev, sizeof(*state), GFP_KERNEL);
	if (!state) {
		KEY_LOGE("fail to allocate state\n");
		ret = -ENOMEM;
		goto err_alloc_state;
	}

	state->pdev_child = platform_device_alloc(KEYCOMBO_NAME,
							PLATFORM_DEVID_AUTO);
	if (!state->pdev_child) {
		KEY_LOGE("fail to allocate pdev_child\n");
		ret = -ENOMEM;
		goto err_alloc_state;
	}
	state->pdev_child->dev.parent = &pdev->dev;
	INIT_WORK(&state->restart_work, do_restart);

	keyp = pdata->keys_down;
	while ((key = *keyp++)) {
		if (key >= KEY_MAX)
			continue;
		down_size++;
	}
	if (pdata->keys_up) {
		keyp = pdata->keys_up;
		while ((key = *keyp++)) {
			if (key >= KEY_MAX)
				continue;
			up_size++;
		}
	}
	size = sizeof(struct keycombo_platform_data);
	pdata_child = devm_kzalloc(&pdev->dev, sizeof(struct keycombo_platform_data),
				GFP_KERNEL);
	if (!pdata_child)
		goto error;

	pdata_child->keys_down = devm_kzalloc(&pdev->dev,
				sizeof(uint32_t) * (down_size + 1), GFP_KERNEL);
	if (!pdata_child->keys_down)
		goto error;

	memcpy(pdata_child->keys_down, pdata->keys_down,
						sizeof(uint32_t) * down_size);
	if (!pdata_child->keys_down)
		goto error;

	if (up_size > 0) {
		pdata_child->keys_up = devm_kzalloc(&pdev->dev,
					sizeof(uint32_t) * (up_size + 1), GFP_KERNEL);
		if (!pdata_child->keys_up)
			goto error;
		memcpy(pdata_child->keys_up, pdata->keys_up,
							sizeof(uint32_t) * up_size);
		if (!pdata_child->keys_up)
			goto error;
	}
	state->reset_fn = pdata->reset_fn;
	pdata_child->key_down_fn = do_reset_fn;
	pdata_child->priv = state;
	pdata_child->key_down_delay = pdata->key_down_delay;
	ret = platform_device_add_data(state->pdev_child, pdata_child, size);
	if (ret)
		goto error;
	platform_set_drvdata(pdev, state);

	KEY_LOGI("%s: ---\n", __func__);

	return platform_device_add(state->pdev_child);
error:
	platform_device_put(state->pdev_child);
err_alloc_state:
err_parse_fail:
	if (pdev->dev.of_node) {
		if(pdata->keys_up)
			kfree(pdata->keys_up);
		if(pdata->keys_down)
			kfree(pdata->keys_down);
		kfree(pdata);
	}
err_get_pdata_fail:
	return ret;
}
开发者ID:MethHeadAlert,项目名称:M9,代码行数:101,代码来源:keyreset.c


示例8: keyreset_remove

int keyreset_remove(struct platform_device *pdev)
{
	struct keyreset_state *state = platform_get_drvdata(pdev);
	platform_device_put(state->pdev_child);
	return 0;
}
开发者ID:MethHeadAlert,项目名称:M9,代码行数:6,代码来源:keyreset.c


示例9: t0_audio_init

static int __init t0_audio_init(void)
{
	struct wm1811_machine_priv *wm1811;
	const struct exynos_sound_platform_data *sound_pdata;
	int ret;

	wm1811 = kzalloc(sizeof *wm1811, GFP_KERNEL);
	if (!wm1811) {
		pr_err("Failed to allocate memory\n");
		ret = -ENOMEM;
		goto err_kzalloc;
	}
	snd_soc_card_set_drvdata(&t0_card, wm1811);

	t0_snd_device = platform_device_alloc("soc-audio", -1);
	if (!t0_snd_device) {
		ret = -ENOMEM;
		goto err_device_alloc;
	}

	ret = snd_soc_register_dais(&t0_snd_device->dev, t0_ext_dai,
						ARRAY_SIZE(t0_ext_dai));
	if (ret != 0)
		pr_err("Failed to register external DAIs: %d\n", ret);

	platform_set_drvdata(t0_snd_device, &t0_card);

	ret = platform_device_add(t0_snd_device);
	if (ret)
		platform_device_put(t0_snd_device);

	sound_pdata = exynos_sound_get_platform_data();
	if (!sound_pdata) {
		pr_info("%s: don't use sound pdata\n", __func__);
		goto err_out_free;
	}

	if (sound_pdata->set_lineout_switch)
		wm1811->lineout_switch_f = sound_pdata->set_lineout_switch;

	if (sound_pdata->set_ext_main_mic)
		wm1811->set_main_mic_f = sound_pdata->set_ext_main_mic;

	if (sound_pdata->set_ext_sub_mic)
		wm1811->set_sub_mic_f = sound_pdata->set_ext_sub_mic;
#if defined(CONFIG_SND_DUOS_MODEM_SWITCH)
	if (sound_pdata->set_modem_switch)
		wm1811->set_modem_switch_f = sound_pdata->set_modem_switch;
#endif
	if (sound_pdata->get_ground_det_value)
		wm1811->get_g_det_value_f = sound_pdata->get_ground_det_value;

	if (sound_pdata->get_ground_det_irq_num) {
		wm1811->get_g_det_irq_num_f =
				sound_pdata->get_ground_det_irq_num;
		ret = request_threaded_irq(wm1811->get_g_det_irq_num_f(), NULL,
					t0_g_det_thread, IRQF_TRIGGER_RISING |
					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
					"g_det irq", wm1811);
		if (ret != 0)
			pr_err("%s: Failed to register IRQ\n", __func__);

		/* to handle insert/removal when we're sleeping in a call */
		ret = enable_irq_wake(wm1811->get_g_det_irq_num_f());
		if (ret)
			pr_err("%s : Failed to enable_irq_wake\n", __func__);
	}

	return ret;

err_out_free:
	platform_device_put(t0_snd_device);
err_device_alloc:
	kfree(wm1811);
err_kzalloc:
	return ret;
}
开发者ID:perillamint,项目名称:tizen-linux-3.0,代码行数:77,代码来源:t0duos_wm1811.c


示例10: tcc_init_es8388

static int __init tcc_init_es8388(void)
{

	int ret;

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

    if( !(machine_is_m801_88() || machine_is_m805_892x() || machine_is_tcc8920()) ) {
        alsa_dbg("\n\n\n\n%s() do not execution....\n\n", __func__);
        return 0;
    }

#if defined(CONFIG_ARCH_TCC88XX)
    alsa_dbg("TCC Board probe [%s]\n", __FUNCTION__);

    /* h/w mute control */
    if(machine_is_m801_88()) {
        tcc_gpio_config(TCC_GPG(6), GPIO_FN(0));
        tcc_gpio_config(TCC_GPD(11), GPIO_FN(0));
        gpio_request(TCC_GPG(6), "SPK_MUTE_CTL");
        gpio_request(TCC_GPD(11), "HP_MUTE_CTL");
        
        gpio_direction_output(TCC_GPG(6), 0);    // Speaker mute
        gpio_direction_output(TCC_GPD(11), 1);   // HeadPhone mute
        tcc_hp_hw_mute(false);
        tcc_spk_hw_mute(false);

        tcc_soc_card.name = "M801";
    }

#elif defined(CONFIG_ARCH_TCC892X)
	alsa_dbg("TCC Board probe [%s]\n", __FUNCTION__);

	/* h/w mute control */
	if(machine_is_m805_892x())
	{
		if(system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) {
			tcc_gpio_config(TCC_GPE(18), GPIO_FN(0));
			gpio_request(TCC_GPE(18), "SPK_MUTE_CTL");
			gpio_direction_output(TCC_GPE(18), 0);	 // Speaker mute
			
			tcc_gpio_config(TCC_GPE(17), GPIO_FN(0));
			gpio_request(TCC_GPE(17), "HP_MUTE_CTL");
			gpio_direction_output(TCC_GPE(17), 1);	 // HeadPhone mute
		}
		else {
			#if defined(CONFIG_M805S_8923_0XA)
			tcc_gpio_config(TCC_GPG(11), GPIO_FN(0));
			gpio_request(TCC_GPG(11), "SPK_MUTE_CTL");
			gpio_direction_output(TCC_GPG(11), 0);	 // Speaker mute
			#else
			tcc_gpio_config(TCC_GPF(27), GPIO_FN(0));
			gpio_request(TCC_GPF(27), "SPK_MUTE_CTL");
			gpio_direction_output(TCC_GPF(27), 0);	 // Speaker mute
			#endif

			tcc_gpio_config(TCC_GPG(5), GPIO_FN(0));
			gpio_request(TCC_GPG(5), "HP_MUTE_CTL");
			gpio_direction_output(TCC_GPG(5), 1);	 // HeadPhone mute
		}

		tcc_hp_hw_mute(false);
		tcc_spk_hw_mute(false);

        tcc_soc_card.name = "M805";
	}

#else
    alsa_dbg("TCC Board probe [%s]\n [Error] Don't support architecture..\n", __FUNCTION__);
	return 0;
#endif


    tcc_hp_hw_mute(true);
    tcc_spk_hw_mute(true);

    tca_tcc_initport();

    ret = es8388_i2c_register();

	tcc_snd_device = platform_device_alloc("soc-audio", -1);
	if (!tcc_snd_device)
		return -ENOMEM;

	platform_set_drvdata(tcc_snd_device, &tcc_soc_card);

	ret = platform_device_add(tcc_snd_device);
	if (ret) {
        printk(KERN_ERR "Unable to add platform device\n");\
		platform_device_put(tcc_snd_device);
	}

	return ret;
}
开发者ID:AmesianX,项目名称:telechips-linux,代码行数:94,代码来源:tcc_board_es8388.c


示例11: uv_probe


//.........这里部分代码省略.........
	uv->onoff = false;

	if (pdata->get_adc_value)
		uv->pdata->get_adc_value = pdata->get_adc_value;

	mutex_init(&uv->power_lock);
	mutex_init(&uv->read_lock);

	/* allocate uv input device */
	uv->uv_input_dev = input_allocate_device();
	if (!uv->uv_input_dev) {
		pr_err("%s: could not allocate input device\n",
			__func__);
		goto err_input_allocate_device_uv;
	}

	input_set_drvdata(uv->uv_input_dev, uv);
	uv->uv_input_dev->name = "uv_sensor";
	input_set_capability(uv->uv_input_dev, EV_REL, REL_MISC);

	ret = input_register_device(uv->uv_input_dev);
	if (ret < 0) {
		pr_err("%s: could not register input device\n",
			__func__);
		input_free_device(uv->uv_input_dev);
		goto err_input_register_device_uv;
	}

	ret = sysfs_create_group(&uv->uv_input_dev->dev.kobj,
				&uv_attribute_group);
	if (ret) {
		pr_err("%s: could not create sysfs group\n",
			__func__);
		goto err_sysfs_create_group_uv;
	}

	/* timer init */
	hrtimer_init(&uv->uv_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	uv->uv_poll_delay = ns_to_ktime(200 * NSEC_PER_MSEC);
	uv->uv_timer.function = uv_timer_func;

	/* workqueue init */
	uv->uv_wq = create_singlethread_workqueue("uv_wq");
	if (!uv->uv_wq) {
		ret = -ENOMEM;
		pr_err("%s: could not create uv workqueue\n",
			__func__);
		goto err_create_uv_workqueue;
	}
	INIT_WORK(&uv->work_uv, work_func_uv);

	/* sysfs for uv sensor */
	ret = sensors_register(uv->uv_dev, uv, uv_sensor_attrs,
		"uv_sensor");
	if (ret) {
		pr_err("%s: could not register uv device(%d)\n",
			__func__, ret);
		goto err_sensor_register_failed;
	}

	ret = sensors_create_symlink(&uv->uv_input_dev->dev.kobj,
		uv->uv_input_dev->name);
	if (ret < 0) {
		pr_err("%s, sensors_create_symlinks failed!(%d)\n",
			__func__, ret);
		goto err_uv_input__sysfs_create_link;
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	uv->early_suspend.suspend = ssp_early_suspend;
	uv->early_suspend.resume = ssp_late_resume;
	register_early_suspend(&uv->early_suspend);
#endif

	platform_set_drvdata(pdev, uv);

	pr_info("%s, success\n", __func__);
	return 0;
err_uv_input__sysfs_create_link:
	sensors_unregister(uv->uv_dev, uv_sensor_attrs);
err_sensor_register_failed:
	destroy_workqueue(uv->uv_wq);
err_create_uv_workqueue:
	sysfs_remove_group(&uv->uv_input_dev->dev.kobj,
			   &uv_attribute_group);
err_sysfs_create_group_uv:
	input_unregister_device(uv->uv_input_dev);
err_input_register_device_uv:
err_input_allocate_device_uv:
	mutex_destroy(&uv->read_lock);
	mutex_destroy(&uv->power_lock);
	if (uv->pdata->adc_ap_exit)
		uv->pdata->adc_ap_exit(uv->pdev_uv_adc);
err_setup_adc:
	if (uv->pdev_uv_adc)
		platform_device_put(uv->pdev_uv_adc);
err_alloc_pdev:
	kfree(uv);
	return ret;
}
开发者ID:dangordon1212,项目名称:sgs4duos_kernel,代码行数:101,代码来源:ssp_c12sd.c


示例12: omap_hsmmc_init_one

static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
					int ctrl_nr)
{
	struct omap_hwmod *oh;
	struct omap_hwmod *ohs[1];
	struct omap_device *od;
	struct platform_device *pdev;
	char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
	struct omap_mmc_platform_data *mmc_data;
	struct omap_mmc_dev_attr *mmc_dev_attr;
	char *name;
	int res;

	mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
	if (!mmc_data) {
		pr_err("Cannot allocate memory for mmc device!\n");
		return;
	}

	res = omap_hsmmc_pdata_init(hsmmcinfo, mmc_data);
	if (res < 0)
		goto free_mmc;

	omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));

	name = "omap_hsmmc";
	res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
		     "mmc%d", ctrl_nr);
	WARN(res >= MAX_OMAP_MMC_HWMOD_NAME_LEN,
	     "String buffer overflow in MMC%d device setup\n", ctrl_nr);

	oh = omap_hwmod_lookup(oh_name);
	if (!oh) {
		pr_err("Could not look up %s\n", oh_name);
		goto free_name;
	}
	ohs[0] = oh;
	if (oh->dev_attr != NULL) {
		mmc_dev_attr = oh->dev_attr;
		mmc_data->controller_flags = mmc_dev_attr->flags;
		/*
		 * erratum 2.1.1.128 doesn't apply if board has
		 * a transceiver is attached
		 */
		if (hsmmcinfo->transceiver)
			mmc_data->controller_flags &=
				~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
	}

	pdev = platform_device_alloc(name, ctrl_nr - 1);
	if (!pdev) {
		pr_err("Could not allocate pdev for %s\n", name);
		goto free_name;
	}
	dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);

	od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
	if (!od) {
		pr_err("Could not allocate od for %s\n", name);
		goto put_pdev;
	}

	res = platform_device_add_data(pdev, mmc_data,
			      sizeof(struct omap_mmc_platform_data));
	if (res) {
		pr_err("Could not add pdata for %s\n", name);
		goto put_pdev;
	}

	hsmmcinfo->pdev = pdev;

	if (hsmmcinfo->deferred)
		goto free_mmc;

	res = omap_device_register(pdev);
	if (res) {
		pr_err("Could not register od for %s\n", name);
		goto free_od;
	}

	goto free_mmc;

free_od:
	omap_device_delete(od);

put_pdev:
	platform_device_put(pdev);

free_name:
	kfree(mmc_data->slots[0].name);

free_mmc:
	kfree(mmc_data);
}
开发者ID:SciAps,项目名称:android-kernel,代码行数:94,代码来源:hsmmc.c


示例13: dvblb_init

static int __init dvblb_init(void)
{
	int i, j, ret, failed;
	dev_t dev = MKDEV(DVBSOFTWARECA_MAJOR, 0);
	char device_name[50];

	failed=0;

	if ((ret = register_chrdev_region(dev, MAX_CA_DEVICES, "DVBSOFTWARECSA")) != 0) {
		printk(KERN_ERR "dvbsoftwareca: unable to get major %d\n", DVBSOFTWARECA_MAJOR);
		return ret;
	}

	cdev_init(&ca_devices_cdev, &ca_device_fops);

	if ((ret = cdev_add(&ca_devices_cdev, dev, MAX_CA_DEVICES)) != 0) {
		printk(KERN_ERR "dvbsoftwareca: unable register character device\n");
		return ret;
	}

 	dvb_class = class_create(THIS_MODULE, "dvbsoftwareca");
	if (IS_ERR(dvb_class)) {
		printk("dvbsoftwareca: unable to create dvb_class\n");
		return PTR_ERR(dvb_class);
	}
	dvb_class->dev_uevent = dvb_uevent;
	dvb_class->devnode = dvb_devnode;

	info("frontend loopback driver v"DVBSOFTWARECA_VERSION);
	printk("dvbsoftwareca: registering adapters\n");

	dvblb_basedev = platform_device_alloc("dvbsoftwareca", -1);
	if (!dvblb_basedev) {
		return -ENOMEM;
	}
	ret = platform_device_add(dvblb_basedev);
	if (ret) {
		platform_device_put(dvblb_basedev);
		return ret;
	}

	ret = register_netlink();
	if (ret) {
		printk("dvbsoftwareca: unable to register netlink socket\n");
		return -EFAULT;
	}

	for(i=0; i < 8; i++) {
		for(j=0; (j<8 && devices_counter<MAX_CA_DEVICES); j++) {
			struct file *filp;
			
			snprintf(device_name, 50, "/dev/dvb/adapter%d/frontend%d", i, j);
			filp = filp_open(device_name,00,O_RDONLY);

			if (!IS_ERR(filp) && filp!=NULL) {
				filp_close(filp, NULL);

				ret = create_ca_device(i, j, devices_counter++);
				if (ret != 0) {
					printk("dvbsoftwareca: Failed to add CA%d device for adapter%d\n", j, i);
					failed = 1;
					break;
				}
				printk("dvbsoftwareca: registered CA%d device for adapter%d\n", j, i);
			}

		}

		if (failed)
			break;
	}

	if (!failed)
		printk("dvbsoftwareca: registered %d CA devices\n", devices_counter);
	
	if (failed) {
		for(i = 0; i < devices_counter; i++) {
			destroy_ca_device(ca_devices[i]);
		}
		platform_device_unregister(dvblb_basedev);
		cdev_del(&ca_devices_cdev);
		unregister_chrdev_region(dev, MAX_CA_DEVICES);

		return -EFAULT;
	}

	return 0;
}
开发者ID:OpenPE,项目名称:enigma2pc,代码行数:88,代码来源:dvb_softwareca.c


示例14: n810_soc_init

static int __init n810_soc_init(void)
{
	int err;
	struct device *dev;

	if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
		return -ENODEV;

	n810_snd_device = platform_device_alloc("soc-audio", -1);
	if (!n810_snd_device)
		return -ENOMEM;

	platform_set_drvdata(n810_snd_device, &snd_soc_n810);
	err = platform_device_add(n810_snd_device);
	if (err)
		goto err1;

	dev = &n810_snd_device->dev;

	sys_clkout2_src = clk_get(dev, "sys_clkout2_src");
	if (IS_ERR(sys_clkout2_src)) {
		dev_err(dev, "Could not get sys_clkout2_src clock\n");
		err = PTR_ERR(sys_clkout2_src);
		goto err2;
	}
	sys_clkout2 = clk_get(dev, "sys_clkout2");
	if (IS_ERR(sys_clkout2)) {
		dev_err(dev, "Could not get sys_clkout2\n");
		err = PTR_ERR(sys_clkout2);
		goto err3;
	}
	/*
	 * Configure 12 MHz output on SYS_CLKOUT2. Therefore we must use
	 * 96 MHz as its parent in order to get 12 MHz
	 */
	func96m_clk = clk_get(dev, "func_96m_ck");
	if (IS_ERR(func96m_clk)) {
		dev_err(dev, "Could not get func 96M clock\n");
		err = PTR_ERR(func96m_clk);
		goto err4;
	}
	clk_set_parent(sys_clkout2_src, func96m_clk);
	clk_set_rate(sys_clkout2, 12000000);

	if (WARN_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) ||
		    (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0))) {
		err = -EINVAL;
		goto err4;
	}

	gpio_direction_output(N810_HEADSET_AMP_GPIO, 0);
	gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0);

	return 0;
err4:
	clk_put(sys_clkout2);
err3:
	clk_put(sys_clkout2_src);
err2:
	platform_device_del(n810_snd_device);
err1:
	platform_device_put(n810_snd_device);

	return err;
}
开发者ID:BozkurTR,项目名称:kernel,代码行数:65,代码来源:n810.c


示例15: msi_init

static int __init msi_init(void)
{
	int ret;

	if (acpi_disabled)
		return -ENODEV;

	dmi_check_system(msi_dmi_table);
	if (!quirks)
		/* quirks may be NULL if no match in DMI table */
		quirks = &quirk_load_scm_model;
	if (force)
		quirks = &quirk_old_ec_model;

	if (!quirks->old_ec_model)
		get_threeg_exists();

	if (auto_brightness < 0 || auto_brightness > 2)
		return -EINVAL;

	/* Register backlight stuff */

	if (!quirks->old_ec_model || acpi_video_backlight_support()) {
		pr_info("Brightness ignored, must be controlled by ACPI video driver\n");
	} else {
		struct backlight_properties props;
		memset(&props, 0, sizeof(struct backlight_properties));
		props.type = BACKLIGHT_PLATFORM;
		props.max_brightness = MSI_LCD_LEVEL_MAX - 1;
		msibl_device = backlight_device_register("msi-laptop-bl", NULL,
							 NULL, &msibl_ops,
							 &props);
		if (IS_ERR(msibl_device))
			return PTR_ERR(msibl_device);
	}

	ret = platform_driver_register(&msipf_driver);
	if (ret)
		goto fail_backlight;

	/* Register platform stuff */

	msipf_device = platform_device_alloc("msi-laptop-pf", -1);
	if (!msipf_device) {
		ret = -ENOMEM;
		goto fail_platform_driver;
	}

	ret = platform_device_add(msipf_device);
	if (ret)
		goto fail_platform_device1;

	if (quirks->load_scm_model && (load_scm_model_init(msipf_device) < 0)) {
		ret = -EINVAL;
		goto fail_platform_device1;
	}

	ret = sysfs_create_group(&msipf_device->dev.kobj,
				 &msipf_attribute_group);
	if (ret)
		goto fail_platform_device2;

	if (!quirks->old_ec_model) {
		if (threeg_exists)
			ret = device_create_file(&msipf_device->dev,
						&dev_attr_threeg);
		if (ret)
			goto fail_platform_device2;
	} else {
		ret = sysfs_create_group(&msipf_device->dev.kobj,
					 &msipf_old_attribute_group);
		if (ret)
			goto fail_platform_device2;

		/* Disable automatic brightness control by default because
		 * this module was probably loaded to do brightness control in
		 * software. */

		if (auto_brightness != 2)
			set_auto_brightness(auto_brightness);
	}

	pr_info("driver " MSI_DRIVER_VERSION " successfully loaded\n");

	return 0;

fail_platform_device2:

	if (quirks->load_scm_model) {
		i8042_remove_filter(msi_laptop_i8042_filter);
		cancel_delayed_work_sync(&msi_rfkill_dwork);
		cancel_work_sync(&msi_rfkill_work);
		rfkill_cleanup();
	}
	platform_device_del(msipf_device);

fail_platform_device1:

	platform_device_put(msipf_device);

//.........这里部分代码省略.........
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:101,代码来源:msi-laptop.c


示例16: vega_audio_init

static int __init vega_audio_init(void)
{
	int ret;
	u32 val;

#ifdef USE_GPR
	val = __raw_readl(S5P64XX_GPRPUD);
	val &= ~((3<<8) | (3<<10) | (3<<14) | (3<<16) | (3<<18) | (3<<28) | (3<<30));
	val |= ((0<<8) | (0<<10) | (0<<14) | (0<<16) | (0<<18) | (0<<28) | (1<<30));
	__raw_writel(val, S5P64XX_GPRPUD);

	val = __raw_readl(S5P64XX_GPRCON0);
	val &= ~((0xf<<16) | (0xf<<20) | (0xf<<28));
	val |= (5<<16) | (5<<20) | (5<<28);
	__raw_writel(val, S5P64XX_GPRCON0);

	val = __raw_readl(S5P64XX_GPRCON1);
	val &= ~((0xf<<0) | (0xf<<4) | (0xf<<24) | (0xf<<28));
	val |= (5<<0) | (5<<4) | (5<<24) | (5<<28);
	__raw_writel(val, S5P64XX_GPRCON1);

#else
	val = __raw_readl(S5P64XX_GPCPUD);
	val &= ~((3<<8) | (3<<10) | (3<<14));
	val |= ((0<<8) | (0<<10) | (0<<14));
	__raw_writel(val, S5P64XX_GPCPUD);

	val = __raw_readl(S5P64XX_GPCCON);
	val &= ~((0xf<<16) | (0xf<<20) | (0xf<<28));
	val |= (5<<16) | (5<<20) | (5<<28);
	__raw_writel(val, S5P64XX_GPCCON);

	val = __raw_readl(S5P64XX_GPHPUD);
	val &= ~((3<<12) | (3<<14) | (3<<16) | (3<<18));
	val |= ((0<<12) | (1<<14) | (0<<16) | (0<18));
	__raw_writel(val, S5P64XX_GPHPUD);

	val = __raw_readl(S5P64XX_GPHCON0);
	val &= ~((0xf<<24) | (0xf<<28));
	val |= (5<<24) | (5<<28);
	__raw_writel(val, S5P64XX_GPHCON0);

	val = __raw_readl(S5P64XX_GPHCON1);
	val &= ~((0xf<<0) | (0xf<<4));
	val |= (5<<0) | (5<<4);
	__raw_writel(val, S5P64XX_GPHCON1);

	val = __raw_readl(S3C_CLK_OUT);
	val &= ~(0xff << 12);
	val |= (0x1<<12) | (0<<16);
	__raw_writel(val, S3C_CLK_OUT);
#endif

	smdk6440_snd_device = platform_device_alloc("soc-audio", 0);
	if (!smdk6440_snd_device)
		return -ENOMEM;

	platform_set_drvdata(smdk6440_snd_device, &smdk6440_snd_devdata);
	smdk6440_snd_devdata.dev = &smdk6440_snd_device->dev;
	ret = platform_device_add(smdk6440_snd_device);

	if (ret)
		platform_device_put(smdk6440_snd_device);
	
	return ret;
}
开发者ID:ZhizhouTian,项目名称:s3c-linux,代码行数:66,代码来源:smdk6440_wm8580.c


示例17: ebi2_lcd_probe

static int ebi2_lcd_probe(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;
	struct platform_device *mdp_dev = NULL;
	struct msm_fb_panel_data *pdata = NULL;
	int rc, i;

	if (pdev->id == 0) {
		for (i = 0; i < pdev->num_resources; i++) {
			if (!strncmp(pdev->resource[i].name, "base", 4)) {
				ebi2_base = ioremap(pdev->resource[i].start,
						pdev->resource[i].end -
						pdev->resource[i].start + 1);
				if (!ebi2_base) {
					printk(KERN_ERR
						"ebi2_base ioremap failed!\n");
					return -ENOMEM;
				}
				ebi2_lcd_cfg0 = (void *)(ebi2_base + 0x20);
				ebi2_lcd_cfg1 = (void *)(ebi2_base + 0x24);
			} else if (!strncmp(pdev->resource[i].name,
						"lcd01", 5)) {
				lcd01_base = ioremap(pdev->resource[i].start,
						pdev->resource[i].end -
						pdev->resource[i].start + 1);
				if (!lcd01_base) {
					printk(KERN_ERR
						"lcd01_base ioremap failed!\n");
					return -ENOMEM;
				}
			} else if (!strncmp(pdev->resource[i].name,
						"lcd02", 5)) {
				lcd02_base = ioremap(pdev->resource[i].start,
						pdev->resource[i].end -
						pdev->resource[i].start + 1);
				if (!lcd02_base) {
					printk(KERN_ERR
						"lcd02_base ioremap failed!\n");
					return -ENOMEM;
				}
			}
		}
		ebi2_lcd_resource_initialized = 1;
		return 0;
	}

	if (!ebi2_lcd_resource_initialized)
		return -EPERM;

	mfd = platform_get_drvdata(pdev);

	if (!mfd)
		return -ENODEV;

	if (mfd->key != MFD_KEY)
		return -EINVAL;

	if (pdev_list_cnt >= MSM_FB_MAX_DEV_LIST)
		return -ENOMEM;

	if (ebi2_base == NULL)
		return -ENOMEM;

	mdp_dev = platform_device_alloc("mdp", pdev->id);
	if (!mdp_dev)
		return -ENOMEM;

	/* link to the latest pdev */
	mfd->pdev = mdp_dev;
	mfd->dest = DISPLAY_LCD;

	/* add panel data */
	if (platform_device_add_data
	    (mdp_dev, pdev->dev.platform_data,
	     sizeof(struct msm_fb_panel_data))) {
		printk(KERN_ERR "ebi2_lcd_probe: platform_device_add_data failed!\n");
		platform_device_put(mdp_dev);
		return -ENOMEM;
	}

	/* data chain */
	pdata = mdp_dev->dev.platform_data;
	pdata->on = panel_next_on;
	pdata->off = panel_next_off;
	pdata->next = pdev;

	/* get/set panel specific fb info */
	mfd->panel_info = pdata->panel_info;

	if (mfd->panel_info.bpp == 24)
		mfd->fb_imgType = MDP_RGB_888;
	else
		mfd->fb_imgType = MDP_RGB_565;

	/* config msm ebi2 lcd register */
	if (mfd->panel_info.pdest == DISPLAY_1) {
		outp32(ebi2_base,
		       (inp32(ebi2_base) & (~(EBI2_PRIM_LCD_CLR))) |
		       EBI2_PRIM_LCD_SEL);
		/*
//.........这里部分代码省略.........
开发者ID:ochiman,项目名称:e405-kernel,代码行数:101,代码来源:ebi2_lcd.c


示例18: init_nsc

static int __init init_nsc(void)
{
	int rc = 0;
	int lo, hi, err;
	int nscAddrBase = TPM_ADDR;
	struct tpm_chip *chip;
	unsigned long base;

	/* verify that it is a National part (SID) */
	if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) {
		nscAddrBase = (tpm_read_index(TPM_SUPERIO_ADDR, 0x2C)<<8)|
			(tpm_read_index(TPM_SUPERIO_ADDR, 0x2B)&0xFE);
		if (tpm_read_index(nscAddrBase, NSC_SID_INDEX) != 0xF6)
			return -ENODEV;
	}

	err = platform_driver_register(&nsc_drv);
	if (err)
		re 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ platform_device_register函数代码示例发布时间:2022-05-30
下一篇:
C++ platform_device_del函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap