Linux 4.1.18
[linux/fpc-iii.git] / arch / x86 / platform / intel-mid / device_libs / platform_ipc.c
bloba84b73d6c4a019657ee784ede1b7c2875fbc277e
1 /*
2 * platform_ipc.c: IPC platform library file
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/interrupt.h>
16 #include <linux/sfi.h>
17 #include <linux/gpio.h>
18 #include <asm/intel-mid.h>
19 #include "platform_ipc.h"
21 void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
22 struct devs_id *dev)
24 struct platform_device *pdev;
25 void *pdata = NULL;
26 static struct resource res __initdata = {
27 .name = "IRQ",
28 .flags = IORESOURCE_IRQ,
31 pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
32 pentry->name, pentry->irq);
35 * We need to call platform init of IPC devices to fill misc_pdata
36 * structure. It will be used in msic_init for initialization.
38 if (dev != NULL)
39 pdata = dev->get_platform_data(pentry);
42 * On Medfield the platform device creation is handled by the MSIC
43 * MFD driver so we don't need to do it here.
45 if (intel_mid_has_msic())
46 return;
48 pdev = platform_device_alloc(pentry->name, 0);
49 if (pdev == NULL) {
50 pr_err("out of memory for SFI platform device '%s'.\n",
51 pentry->name);
52 return;
54 res.start = pentry->irq;
55 platform_device_add_resources(pdev, &res, 1);
57 pdev->dev.platform_data = pdata;
58 intel_scu_device_register(pdev);
61 static const struct devs_id pmic_audio_dev_id __initconst = {
62 .name = "pmic_audio",
63 .type = SFI_DEV_TYPE_IPC,
64 .delay = 1,
65 .device_handler = &ipc_device_handler,
68 sfi_device(pmic_audio_dev_id);