Example #1
0
static int __exit omap_rtc_remove(struct platform_device *pdev)
{
	struct rtc_device	*rtc = platform_get_drvdata(pdev);
	struct resource		*mem = dev_get_drvdata(&rtc->dev);
	const struct platform_device_id *id_entry =
				platform_get_device_id(pdev);

	device_init_wakeup(&pdev->dev, 0);

	/* leave rtc running, but disable irqs */
	rtc_write(0, OMAP_RTC_INTERRUPTS_REG);

	free_irq(omap_rtc_timer, rtc);

	if (omap_rtc_timer != omap_rtc_alarm)
		free_irq(omap_rtc_alarm, rtc);

	rtc_device_unregister(rtc);
	if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
		rtc_writel(0, OMAP_RTC_KICK0_REG);

	/* Disable the clock/module */
	pm_runtime_put_sync(&pdev->dev);
	pm_runtime_disable(&pdev->dev);

	iounmap(rtc_base);
	release_mem_region(mem->start, resource_size(mem));
	return 0;
}
Example #2
0
static int da9052_backlight_probe(struct platform_device *pdev)
{
	struct backlight_device *bl;
	struct backlight_properties props;
	struct da9052_bl *wleds;

	wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL);
	if (!wleds)
		return -ENOMEM;

	wleds->da9052 = dev_get_drvdata(pdev->dev.parent);
	wleds->brightness = 0;
	wleds->led_reg = platform_get_device_id(pdev)->driver_data;
	wleds->state = DA9052_WLEDS_OFF;

	props.type = BACKLIGHT_RAW;
	props.max_brightness = DA9052_MAX_BRIGHTNESS;

	bl = devm_backlight_device_register(&pdev->dev, pdev->name,
					wleds->da9052->dev, wleds,
					&da9052_backlight_ops, &props);
	if (IS_ERR(bl)) {
		dev_err(&pdev->dev, "Failed to register backlight\n");
		return PTR_ERR(bl);
	}

	bl->props.max_brightness = DA9052_MAX_BRIGHTNESS;
	bl->props.brightness = 0;
	platform_set_drvdata(pdev, bl);

	return da9052_adjust_wled_brightness(wleds);
}
Example #3
0
static int omap_rtc_suspend(struct device *dev)
{
	u8 irqwake_stat;
	struct platform_device *pdev = to_platform_device(dev);
	const struct platform_device_id *id_entry =
					platform_get_device_id(pdev);

	irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);

	/* FIXME the RTC alarm is not currently acting as a wakeup event
	 * source on some platforms, and in fact this enable() call is just
	 * saving a flag that's never used...
	 */
	if (device_may_wakeup(dev)) {
		enable_irq_wake(omap_rtc_alarm);

		if (id_entry->driver_data & OMAP_RTC_HAS_IRQWAKEEN) {
			irqwake_stat = rtc_read(OMAP_RTC_IRQWAKEEN);
			irqwake_stat |= OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN;
			rtc_write(irqwake_stat, OMAP_RTC_IRQWAKEEN);
		}
	} else {
		rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
	}

	/* Disable the clock/module */
	pm_runtime_put_sync(dev);

	return 0;
}
Example #4
0
static int ad7606_par_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct iio_dev *indio_dev;
	void __iomem *addr;
	resource_size_t remap_size;
	int irq;

	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		dev_err(&pdev->dev, "no irq\n");
		return -ENODEV;
	}

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	addr = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(addr))
		return PTR_ERR(addr);

	remap_size = resource_size(res);

	indio_dev = ad7606_probe(&pdev->dev, irq, addr,
			  platform_get_device_id(pdev)->driver_data,
			  remap_size > 1 ? &ad7606_par16_bops :
			  &ad7606_par8_bops);

	if (IS_ERR(indio_dev))
		return PTR_ERR(indio_dev);

	platform_set_drvdata(pdev, indio_dev);

	return 0;
}
Example #5
0
static void
fec_stop(struct net_device *ndev)
{
	struct fec_enet_private *fep = netdev_priv(ndev);
	const struct platform_device_id *id_entry =
				platform_get_device_id(fep->pdev);
	u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8);

	/* We cannot expect a graceful transmit stop without link !!! */
	if (fep->link) {
		writel(1, fep->hwp + FEC_X_CNTRL); /* Graceful transmit stop */
		udelay(10);
		if (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_GRA))
			printk("fec_stop : Graceful transmit stop did not complete !\n");
	}

	/* Whack a reset.  We should wait for this. */
	writel(1, fep->hwp + FEC_ECNTRL);
	udelay(10);
	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);

	/* We have to keep ENET enabled to have MII interrupt stay working */
	if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
		writel(2, fep->hwp + FEC_ECNTRL);
		writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
	}
}
static inline void s3c_adc_select(struct adc_device *adc,
				  struct s3c_adc_client *client)
{
	unsigned con = readl(adc->regs + S3C2410_ADCCON);
	enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;

	client->select_cb(client, 1);

	if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
		con &= ~S3C2410_ADCCON_MUXMASK;
	con &= ~S3C2410_ADCCON_STDBM;
	con &= ~S3C2410_ADCCON_STARTMASK;

	if (!client->is_ts) {
		if (cpu == TYPE_ADCV3)
			writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
		else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
			writel(client->channel & 0xf,
						adc->regs + S3C2443_ADCMUX);
		else
			con |= S3C2410_ADCCON_SELMUX(client->channel);
	}

	writel(con, adc->regs + S3C2410_ADCCON);
}
Example #7
0
static int __devexit dwc3_remove(struct platform_device *pdev)
{
	const struct platform_device_id *id = platform_get_device_id(pdev);
	struct dwc3	*dwc = platform_get_drvdata(pdev);
#ifndef CONFIG_USB_DWC_OTG_XCEIV
	struct resource	*res;
#endif
	unsigned int	features = id->driver_data;

#ifndef CONFIG_USB_DWC_OTG_XCEIV
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
#endif

	pm_runtime_put(&pdev->dev);
	pm_runtime_disable(&pdev->dev);

	dwc3_debugfs_exit(dwc);

	if (features & DWC3_HAS_PERIPHERAL)
		dwc3_gadget_exit(dwc);

	dwc3_core_exit(dwc);
#ifndef CONFIG_USB_DWC_OTG_XCEIV
	release_mem_region(res->start, resource_size(res));
	iounmap(dwc->regs);
#endif
	kfree(dwc->mem);

	return 0;
}
static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)
{
	const struct platform_device_id *platid = platform_get_device_id(pdev);
	const struct of_device_id *dtid = sdhci_get_of_device_id(pdev);
	struct sdhci_pltfm_data *pdata;
	struct sdhci_host *host = platform_get_drvdata(pdev);
	struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	int dead;
	u32 scratch;

	if (platid && platid->driver_data)
		pdata = (void *)platid->driver_data;
	else if (dtid && dtid->data)
		pdata = dtid->data;
	else
		pdata = pdev->dev.platform_data;

	dead = 0;
	scratch = readl(host->ioaddr + SDHCI_INT_STATUS);
	if (scratch == (u32)-1)
		dead = 1;

	sdhci_remove_host(host, dead);
	if (pdata && pdata->exit)
		pdata->exit(host);
	iounmap(host->ioaddr);
	release_mem_region(iomem->start, resource_size(iomem));
	sdhci_free_host(host);
	platform_set_drvdata(pdev, NULL);

	return 0;
}
Example #9
0
static int rcar_du_load(struct drm_device *dev, unsigned long flags)
{
	struct platform_device *pdev = dev->platformdev;
	struct device_node *np = pdev->dev.of_node;
	struct rcar_du_device *rcdu;
	struct resource *mem;
	int ret;

	if (np == NULL) {
		dev_err(dev->dev, "no platform data\n");
		return -ENODEV;
	}

	rcdu = devm_kzalloc(&pdev->dev, sizeof(*rcdu), GFP_KERNEL);
	if (rcdu == NULL) {
		dev_err(dev->dev, "failed to allocate private data\n");
		return -ENOMEM;
	}

	init_waitqueue_head(&rcdu->commit.wait);

	rcdu->dev = &pdev->dev;
	rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data
		   : (void *)platform_get_device_id(pdev)->driver_data;
	rcdu->ddev = dev;
	dev->dev_private = rcdu;

	/* I/O resources */
	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	rcdu->mmio = devm_ioremap_resource(&pdev->dev, mem);
	if (IS_ERR(rcdu->mmio))
		return PTR_ERR(rcdu->mmio);

	/* Initialize vertical blanking interrupts handling. Start with vblank
	 * disabled for all CRTCs.
	 */
	ret = drm_vblank_init(dev, (1 << rcdu->info->num_crtcs) - 1);
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to initialize vblank\n");
		goto done;
	}

	/* DRM/KMS objects */
	ret = rcar_du_modeset_init(rcdu);
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to initialize DRM/KMS\n");
		goto done;
	}

	dev->irq_enabled = 1;

	platform_set_drvdata(pdev, rcdu);

done:
	if (ret)
		rcar_du_unload(dev);

	return ret;
}
static int samsung_keypad_is_s5pv210(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	enum samsung_keypad_type type =
		platform_get_device_id(pdev)->driver_data;

	return type == KEYPAD_TYPE_S5PV210;
}
Example #11
0
static int max197_probe(struct platform_device *pdev)
{
	int ch, ret;
	struct max197_data *data;
	struct max197_platform_data *pdata = dev_get_platdata(&pdev->dev);
	enum max197_chips chip = platform_get_device_id(pdev)->driver_data;

	if (pdata == NULL) {
		dev_err(&pdev->dev, "no platform data supplied\n");
		return -EINVAL;
	}

	if (pdata->convert == NULL) {
		dev_err(&pdev->dev, "no convert function supplied\n");
		return -EINVAL;
	}

	data = devm_kzalloc(&pdev->dev, sizeof(struct max197_data), GFP_KERNEL);
	if (!data) {
		dev_err(&pdev->dev, "devm_kzalloc failed\n");
		return -ENOMEM;
	}

	data->pdata = pdata;
	mutex_init(&data->lock);

	if (chip == max197) {
		data->limit = MAX197_LIMIT;
		data->scale = true;
	} else {
		data->limit = MAX199_LIMIT;
		data->scale = false;
	}

	for (ch = 0; ch < MAX197_NUM_CH; ch++)
		data->ctrl_bytes[ch] = (u8) ch;

	platform_set_drvdata(pdev, data);

	ret = sysfs_create_group(&pdev->dev.kobj, &max197_sysfs_group);
	if (ret) {
		dev_err(&pdev->dev, "sysfs create group failed\n");
		return ret;
	}

	data->hwmon_dev = hwmon_device_register(&pdev->dev);
	if (IS_ERR(data->hwmon_dev)) {
		ret = PTR_ERR(data->hwmon_dev);
		dev_err(&pdev->dev, "hwmon device register failed\n");
		goto error;
	}

	return 0;

error:
	sysfs_remove_group(&pdev->dev.kobj, &max197_sysfs_group);
	return ret;
}
Example #12
0
static int __devinit db1200_audio_probe(struct platform_device *pdev)
{
	const struct platform_device_id *pid = platform_get_device_id(pdev);
	struct snd_soc_card *card;

	card = db1200_cards[pid->driver_data];
	card->dev = &pdev->dev;
	return snd_soc_register_card(card);
}
Example #13
0
static void s3c_adc_try(struct adc_device *adc)
{
	struct s3c_adc_client *next = adc->ts_pend;
	enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
	unsigned int con;

	if (!next && !list_empty(&adc_pending)) {
		next = list_first_entry(&adc_pending,
					struct s3c_adc_client, pend);
		list_del(&next->pend);
	} else
/* SoC card */
static int snd_ctp_mc_probe(struct platform_device *pdev)
{
	int ret_val = 0;
	struct ctp_mc_private *ctx;
	struct ctp_audio_platform_data *pdata = pdev->dev.platform_data;

	pr_debug("In %s\n", __func__);
	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
	if (!ctx) {
		pr_err("allocation failed\n");
		return -ENOMEM;
	}
	/* register the soc card */
	snd_soc_card_ctp.dev = &pdev->dev;

	ctx->ops = (struct snd_soc_machine_ops *)platform_get_device_id(pdev)->driver_data;
	if (ctx->ops == NULL)
		return -EINVAL;

	ctx->ops->card_name(&snd_soc_card_ctp);
	ctx->ops->dai_link(&snd_soc_card_ctp);
	if (ctx->ops->dmic3_support) {
		ret_val = gpio_request(pdata->codec_gpio_dmic, "dmic_switch_gpio");
		if (!ret_val) {
			ctx->dmic_gpio = pdata->codec_gpio_dmic;
		} else {
			pr_err("req dmic_switch_gpio failed:%d\n", ret_val);
			return ret_val;
		}
	}
	ret_val = snd_ctp_register_jack_data(pdev, ctx);
	if (ret_val)
		goto free_jack;

	snd_soc_card_set_drvdata(&snd_soc_card_ctp, ctx);
	ret_val = snd_soc_register_card(&snd_soc_card_ctp);
	if (ret_val) {
		pr_err("snd_soc_register_card failed %d\n", ret_val);
		goto free_jack;
	}

	if (!snd_soc_card_ctp.instantiated) {
		pr_err("snd_soc_card_ctp is not instantiated.\n");
		ret_val = -ENODEV;
		goto free_jack;
	}

	platform_set_drvdata(pdev, &snd_soc_card_ctp);
	pr_debug("successfully exited probe\n");
	return ret_val;
free_jack:
	snd_ctp_unregister_jack(ctx, pdev);
	return ret_val;
}
static int syscon_match_pdevname(struct device *dev, void *data)
{
	struct platform_device *pdev = to_platform_device(dev);
	const struct platform_device_id *id = platform_get_device_id(pdev);

	if (id)
		if (!strcmp(id->name, (const char *)data))
			return 1;

	return !strcmp(dev_name(dev), (const char *)data);
}
Example #16
0
static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)
{
	const struct platform_device_id *platid = platform_get_device_id(pdev);
	struct device_node *np = pdev->dev.of_node;
	struct nmk_pinctrl *npct;
	unsigned int version = 0;
	int i;

	npct = devm_kzalloc(&pdev->dev, sizeof(*npct), GFP_KERNEL);
	if (!npct)
		return -ENOMEM;

	if (platid)
		version = platid->driver_data;
	else if (np)
		version = (unsigned int)
			of_match_device(nmk_pinctrl_match, &pdev->dev)->data;

	/* Poke in other ASIC variants here */
	if (version == PINCTRL_NMK_DB8500)
		nmk_pinctrl_db8500_init(&npct->soc);

	/*
	 * We need all the GPIO drivers to probe FIRST, or we will not be able
	 * to obtain references to the struct gpio_chip * for them, and we
	 * need this to proceed.
	 */
	for (i = 0; i < npct->soc->gpio_num_ranges; i++) {
		if (!nmk_gpio_chips[i]) {
			dev_warn(&pdev->dev, "GPIO chip %d not registered yet\n", i);
			devm_kfree(&pdev->dev, npct);
			return -EPROBE_DEFER;
		}
		npct->soc->gpio_ranges[i].gc = &nmk_gpio_chips[i]->chip;
	}

	nmk_pinctrl_desc.pins = npct->soc->pins;
	nmk_pinctrl_desc.npins = npct->soc->npins;
	npct->dev = &pdev->dev;
	npct->pctl = pinctrl_register(&nmk_pinctrl_desc, &pdev->dev, npct);
	if (!npct->pctl) {
		dev_err(&pdev->dev, "could not register Nomadik pinctrl driver\n");
		return -EINVAL;
	}

	/* We will handle a range of GPIO pins */
	for (i = 0; i < npct->soc->gpio_num_ranges; i++)
		pinctrl_add_gpio_range(npct->pctl, &npct->soc->gpio_ranges[i]);

	platform_set_drvdata(pdev, npct);
	dev_info(&pdev->dev, "initialized Nomadik pin control driver\n");

	return 0;
}
Example #17
0
static int __devinit ad7606_par_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct iio_dev *indio_dev;
	void __iomem *addr;
	resource_size_t remap_size;
	int ret, irq;

	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		dev_err(&pdev->dev, "no irq\n");
		return -ENODEV;
	}

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res)
		return -ENODEV;

	remap_size = resource_size(res);

	/* Request the regions */
	if (!request_mem_region(res->start, remap_size, "iio-ad7606")) {
		ret = -EBUSY;
		goto out1;
	}
	addr = ioremap(res->start, remap_size);
	if (!addr) {
		ret = -ENOMEM;
		goto out1;
	}

	indio_dev = ad7606_probe(&pdev->dev, irq, addr,
			  platform_get_device_id(pdev)->driver_data,
			  remap_size > 1 ? &ad7606_par16_bops :
			  &ad7606_par8_bops);

	if (IS_ERR(indio_dev))  {
		ret = PTR_ERR(indio_dev);
		goto out2;
	}

	platform_set_drvdata(pdev, indio_dev);

	return 0;

out2:
	iounmap(addr);
out1:
	release_mem_region(res->start, remap_size);

	return ret;
}
Example #18
0
static inline const struct samsung_usbphy_drvdata
*samsung_usbphy_get_driver_data(struct platform_device *pdev)
{
	if (pdev->dev.of_node) {
		const struct of_device_id *match;
		match = of_match_node(samsung_usbphy_dt_match,
							pdev->dev.of_node);
		return match->data;
	}

	return (struct samsung_usbphy_drvdata *)
				platform_get_device_id(pdev)->driver_data;
}
Example #19
0
static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
{
#ifdef CONFIG_OF
	struct s3c_rtc_drv_data *data;
	if (pdev->dev.of_node) {
		const struct of_device_id *match;
		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
		data = (struct s3c_rtc_drv_data *) match->data;
		return data->cpu_type;
	}
#endif
	return platform_get_device_id(pdev)->driver_data;
}
Example #20
0
static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
			struct platform_device *pdev)
{
#ifdef CONFIG_OF
	if (pdev->dev.of_node) {
		const struct of_device_id *match;
		match = of_match_node(sdhci_s3c_dt_match, pdev->dev.of_node);
		return (struct sdhci_s3c_drv_data *)match->data;
	}
#endif
	return (struct sdhci_s3c_drv_data *)
			platform_get_device_id(pdev)->driver_data;
}
Example #21
0
static int ehci_ath79_init(struct usb_hcd *hcd)
{
	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
	struct platform_device *pdev = to_platform_device(hcd->self.controller);
	const struct platform_device_id *id;
	int ret;

	id = platform_get_device_id(pdev);
	if (!id) {
		dev_err(hcd->self.controller, "missing device id\n");
		return -EINVAL;
	}

	switch (id->driver_data) {
	case EHCI_ATH79_IP_V1:
		ehci->has_synopsys_hc_bug = 1;

		ehci->caps = hcd->regs;
		ehci->regs = hcd->regs +
			HC_LENGTH(ehci,
				  ehci_readl(ehci, &ehci->caps->hc_capbase));
		break;

	case EHCI_ATH79_IP_V2:
		hcd->has_tt = 1;

		ehci->caps = hcd->regs + 0x100;
		ehci->regs = hcd->regs + 0x100 +
			HC_LENGTH(ehci,
				  ehci_readl(ehci, &ehci->caps->hc_capbase));
		break;

	default:
		BUG();
	}

	dbg_hcs_params(ehci, "reset");
	dbg_hcc_params(ehci, "reset");
	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
	ehci->sbrn = 0x20;

	ehci_reset(ehci);

	ret = ehci_init(hcd);
	if (ret)
		return ret;

	ehci_port_power(ehci, 0);

	return 0;
}
Example #22
0
static inline struct  exynos_tmu_platform_data *exynos_get_driver_data(
		struct platform_device *pdev)
{
#ifdef CONFIG_OF
	if (pdev->dev.of_node) {
		const struct of_device_id *match;
		match = of_match_node(exynos_tmu_match, pdev->dev.of_node);
		if (!match)
			return NULL;
		return (struct exynos_tmu_platform_data *) match->data;
	}
#endif
	return (struct exynos_tmu_platform_data *)
		platform_get_device_id(pdev)->driver_data;
}
Example #23
0
static inline void s3c_adc_convert(struct adc_device *adc)
{
	enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
	unsigned con;

	if (cpu != TYPE_ADCV5) {
		con = readl(adc->regs + S3C2410_ADCCON);
		con |= S3C2410_ADCCON_ENABLE_START;
		writel(con, adc->regs + S3C2410_ADCCON);
	} else {
		con = readl(adc->regs + SAMSUNG_ADC2_CON1);
		con |= SAMSUNG_ADC2_CON1_STC_EN;
		writel(con, adc->regs + SAMSUNG_ADC2_CON1);
	}
}
Example #24
0
enum arm_pmu_type armpmu_device_type(struct platform_device *pdev)
{
	const struct of_device_id	*of_id;
	const struct platform_device_id *pdev_id;

	/* provided by of_device_id table */
	if (pdev->dev.of_node) {
		of_id = of_match_device(armpmu_of_device_ids, &pdev->dev);
		BUG_ON(!of_id);
		return (enum arm_pmu_type)of_id->data;
	}

	/* Provided by platform_device_id table */
	pdev_id = platform_get_device_id(pdev);
	BUG_ON(!pdev_id);
	return pdev_id->driver_data;
}
Example #25
0
/**
 * fec_ptp_read - read raw cycle counter (to be used by time counter)
 * @cc: the cyclecounter structure
 *
 * this function reads the cyclecounter registers and is called by the
 * cyclecounter structure used to construct a ns counter from the
 * arbitrary fixed point registers
 */
static cycle_t fec_ptp_read(const struct cyclecounter *cc)
{
	struct fec_enet_private *fep =
		container_of(cc, struct fec_enet_private, cc);
	const struct platform_device_id *id_entry =
		platform_get_device_id(fep->pdev);
	u32 tempval;

	tempval = readl(fep->hwp + FEC_ATIME_CTRL);
	tempval |= FEC_T_CTRL_CAPTURE;
	writel(tempval, fep->hwp + FEC_ATIME_CTRL);

	if (id_entry->driver_data & FEC_QUIRK_BUG_CAPTURE)
		udelay(1);

	return readl(fep->hwp + FEC_ATIME);
}
Example #26
0
static int max77693_pmic_probe(struct platform_device *pdev)
{
	enum max77693_types type = platform_get_device_id(pdev)->driver_data;
	struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
	const struct regulator_desc *regulators;
	unsigned int regulators_size;
	int i;
	struct regulator_config config = { };

	config.dev = iodev->dev;

	switch (type) {
	case TYPE_MAX77693:
		regulators = max77693_supported_regulators;
		regulators_size = ARRAY_SIZE(max77693_supported_regulators);
		config.driver_data = (void *)&max77693_chg_reg_data;
		break;
	case TYPE_MAX77843:
		regulators = max77843_supported_regulators;
		regulators_size = ARRAY_SIZE(max77843_supported_regulators);
		config.driver_data = (void *)&max77843_chg_reg_data;
		break;
	default:
		dev_err(&pdev->dev, "Unsupported device type: %u\n", type);
		return -ENODEV;
	}

	for (i = 0; i < regulators_size; i++) {
		struct regulator_dev *rdev;

		config.regmap = max77693_get_regmap(type, iodev,
						    regulators[i].id);

		rdev = devm_regulator_register(&pdev->dev,
						&regulators[i], &config);
		if (IS_ERR(rdev)) {
			dev_err(&pdev->dev,
				"Failed to initialize regulator-%d\n", i);
			return PTR_ERR(rdev);
		}
	}

	return 0;
}
Example #27
0
static int pmic_charger_probe(struct platform_device *pdev)
{
	struct pmic_charger *charger;
	struct pmic_charger_platform_data *pdata = pdev->dev.platform_data;

	charger = &pmic_charger;

	charger->ops = &axp192_charger_ops;
	charger->master = pdev->dev.parent;
	charger->type	= platform_get_device_id(pdev)->driver_data;
	charger->pdata = pdata;

	wake_lock_init(&charger->wakelock, WAKE_LOCK_SUSPEND, pdev->name);

	led_trigger_register_simple(pdev->name, &charger->led);

	pmic_sysfs_register_charger(charger->ops);

	if (pdata->init)
		pdata->init();

	pmic_init_charger(charger);

	charger->event =
		EVENT_ACIN_PLUGIN		|
		EVENT_ACIN_PLUGOUT		|
		EVENT_VBUS_PLUGIN		|
		EVENT_VBUS_PLUGOUT		|
		EVENT_ACIN_OVERVOLTAGE	|
		EVENT_VBUS_OVERVOLTAGE	|
		EVENT_CHIP_HOT			|
		EVENT_BATT_HOT			|
		EVENT_BATT_COLD			|
		EVENT_BATT_PLUGIN		|
		EVENT_BATT_CHARGING		|
		0;
	charger->nb.notifier_call = pmic_charger_event;
	pmic_request_irq(charger->master, &charger->nb, charger->event);

	platform_set_drvdata(pdev, charger);

	return 0;
}
Example #28
0
static void s3c_adc_dbgshow(struct adc_device *adc)
{
	enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;

	if (cpu == TYPE_ADCV5) {
		adc_dbg(adc, "CON1=%08x, CON2=%08x\n",
			readl(adc->regs + SAMSUNG_ADC2_CON1),
			readl(adc->regs + SAMSUNG_ADC2_CON2));
	} else if (cpu == TYPE_ADCV4) {
		adc_dbg(adc, "CON=%08x, DLY=%08x\n",
			readl(adc->regs + S3C2410_ADCCON),
			readl(adc->regs + S3C2410_ADCDLY));
	} else {
		adc_dbg(adc, "CON=%08x, TSC=%08x, DLY=%08x\n",
			readl(adc->regs + S3C2410_ADCCON),
			readl(adc->regs + S3C2410_ADCTSC),
			readl(adc->regs + S3C2410_ADCDLY));
	}
}
Example #29
0
static int __exit omap_rtc_remove(struct platform_device *pdev)
{
	const struct platform_device_id *id_entry =
				platform_get_device_id(pdev);

	device_init_wakeup(&pdev->dev, 0);

	/* leave rtc running, but disable irqs */
	rtc_write(0, OMAP_RTC_INTERRUPTS_REG);

	if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
		rtc_writel(0, OMAP_RTC_KICK0_REG);

	/* Disable the clock/module */
	pm_runtime_put_sync(&pdev->dev);
	pm_runtime_disable(&pdev->dev);

	return 0;
}
Example #30
0
static int bxt_pinctrl_probe(struct platform_device *pdev)
{
	const struct intel_pinctrl_soc_data *soc_data = NULL;
	const struct intel_pinctrl_soc_data **soc_table;
	struct acpi_device *adev;
	int i;

	adev = ACPI_COMPANION(&pdev->dev);
	if (adev) {
		const struct acpi_device_id *id;

		id = acpi_match_device(bxt_pinctrl_acpi_match, &pdev->dev);
		if (!id)
			return -ENODEV;

		soc_table = (const struct intel_pinctrl_soc_data **)
			id->driver_data;

		for (i = 0; soc_table[i]; i++) {
			if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
				soc_data = soc_table[i];
				break;
			}
		}
	} else {
		const struct platform_device_id *pid;

		pid = platform_get_device_id(pdev);
		if (!pid)
			return -ENODEV;

		soc_table = (const struct intel_pinctrl_soc_data **)
			pid->driver_data;
		soc_data = soc_table[pdev->id];
	}

	if (!soc_data)
		return -ENODEV;

	return intel_pinctrl_probe(pdev, soc_data);
}