|
| 1 | +/* |
| 2 | + * platform_msic_adc.c: MSIC ADC platform data initilization file |
| 3 | + * |
| 4 | + * (C) Copyright 2008 Intel Corporation |
| 5 | + * Author: |
| 6 | + * |
| 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. |
| 11 | + */ |
| 12 | + |
| 13 | +#include <linux/kernel.h> |
| 14 | +#include <linux/interrupt.h> |
| 15 | +#include <linux/scatterlist.h> |
| 16 | +#include <linux/init.h> |
| 17 | +#include <linux/sfi.h> |
| 18 | +#include <asm/intel-mid.h> |
| 19 | +#include <asm/intel_mid_gpadc.h> |
| 20 | +#include <asm/intel_mid_remoteproc.h> |
| 21 | +#include "platform_msic.h" |
| 22 | +#include "platform_msic_adc.h" |
| 23 | + |
| 24 | +void __init *msic_adc_platform_data(void *info) |
| 25 | +{ |
| 26 | + struct platform_device *pdev = NULL; |
| 27 | + struct sfi_device_table_entry *entry = info; |
| 28 | + static struct intel_mid_gpadc_platform_data msic_adc_pdata; |
| 29 | + int ret = 0; |
| 30 | + |
| 31 | + pdev = platform_device_alloc(ADC_DEVICE_NAME, -1); |
| 32 | + |
| 33 | + if (!pdev) { |
| 34 | + pr_err("out of memory for SFI platform dev %s\n", |
| 35 | + ADC_DEVICE_NAME); |
| 36 | + goto out; |
| 37 | + } |
| 38 | + |
| 39 | + msic_adc_pdata.intr = 0xffff7fc0; |
| 40 | + |
| 41 | + pdev->dev.platform_data = &msic_adc_pdata; |
| 42 | + |
| 43 | + ret = platform_device_add(pdev); |
| 44 | + if (ret) { |
| 45 | + pr_err("failed to add adc platform device\n"); |
| 46 | + platform_device_put(pdev); |
| 47 | + goto out; |
| 48 | + } |
| 49 | + |
| 50 | + install_irq_resource(pdev, entry->irq); |
| 51 | + |
| 52 | + register_rpmsg_service("rpmsg_msic_adc", RPROC_SCU, |
| 53 | + RP_MSIC_ADC); |
| 54 | +out: |
| 55 | + return &msic_adc_pdata; |
| 56 | +} |
0 commit comments