本文整理汇总了C++中platform_get_device_id函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_get_device_id函数的具体用法?C++ platform_get_device_id怎么用?C++ platform_get_device_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_get_device_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: omap_rtc_remove
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;
}
开发者ID:mbgg,项目名称:linux,代码行数:29,代码来源:rtc-omap.c
示例2: da9052_backlight_probe
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);
}
开发者ID:383530895,项目名称:linux,代码行数:32,代码来源:da9052_bl.c
示例3: omap_rtc_suspend
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;
}
开发者ID:03199618,项目名称:linux,代码行数:30,代码来源:rtc-omap.c
示例4: ad7606_par_probe
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;
}
开发者ID:3null,项目名称:linux,代码行数:33,代码来源:ad7606_par.c
示例5: s3c_adc_select
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);
}
开发者ID:Jackeagle,项目名称:android_kernel_sony_c2305,代码行数:25,代码来源:adc.c
示例6: dwc3_remove
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;
}
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:30,代码来源:core.c
示例7: sdhci_pltfm_remove
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;
}
开发者ID:1N4148,项目名称:android_kernel_samsung_golden,代码行数:32,代码来源:sdhci-pltfm.c
示例8: rcar_du_load
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;
}
开发者ID:19Dan01,项目名称:linux,代码行数:59,代码来源:rcar_du_drv.c
示例9: samsung_keypad_is_s5pv210
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;
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:8,代码来源:samsung-keypad.c
示例10: max197_probe
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;
}
开发者ID:03199618,项目名称:linux,代码行数:58,代码来源:max197.c
示例11: db1200_audio_probe
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);
}
开发者ID:454053205,项目名称:linux,代码行数:9,代码来源:db1200.c
示例12: s3c_adc_try
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
开发者ID:Biktorgj,项目名称:Android_b2_Kernel,代码行数:11,代码来源:adc.c
示例13: snd_ctp_mc_probe
/* 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;
}
开发者ID:BitOBSessiOn,项目名称:android_kernel_asus_P01M,代码行数:55,代码来源:ctp_common.c
示例14: syscon_match_pdevname
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);
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:11,代码来源:syscon.c
示例15: nmk_pinctrl_probe
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;
}
开发者ID:AsherBond,项目名称:ceph-client,代码行数:54,代码来源:pinctrl-nomadik.c
示例16: ad7606_par_probe
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;
}
开发者ID:454053205,项目名称:linux,代码行数:52,代码来源:ad7606_par.c
示例17: of_match_node
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;
}
开发者ID:Babel-builder,项目名称:linux,代码行数:13,代码来源:samsung-usbphy.c
示例18: s3c_rtc_get_driver_data
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;
}
开发者ID:03199618,项目名称:linux,代码行数:13,代码来源:rtc-s3c.c
示例19: of_match_node
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;
}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:13,代码来源:sdhci-s3c.c
示例20: ehci_ath79_init
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;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:51,代码来源:ehci-ath79.c
注:本文中的platform_get_device_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论