treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441
[linux-block.git] / arch / x86 / platform / intel-mid / device_libs / platform_emc1403.c
CommitLineData
b886d83c 1// SPDX-License-Identifier: GPL-2.0-only
40a96d54 2/*
6a6256f9 3 * platform_emc1403.c: emc1403 platform data initialization file
40a96d54
DC
4 *
5 * (C) Copyright 2013 Intel Corporation
6 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
40a96d54
DC
7 */
8
9#include <linux/init.h>
10#include <linux/gpio.h>
11#include <linux/i2c.h>
12#include <asm/intel-mid.h>
13
14static void __init *emc1403_platform_data(void *info)
15{
16 static short intr2nd_pdata;
17 struct i2c_board_info *i2c_info = info;
18 int intr = get_gpio_by_name("thermal_int");
19 int intr2nd = get_gpio_by_name("thermal_alert");
20
a957a14b
DC
21 if (intr < 0)
22 return NULL;
23 if (intr2nd < 0)
40a96d54
DC
24 return NULL;
25
26 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
27 intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
28
29 return &intr2nd_pdata;
30}
31
32static const struct devs_id emc1403_dev_id __initconst = {
33 .name = "emc1403",
34 .type = SFI_DEV_TYPE_I2C,
35 .delay = 1,
36 .get_platform_data = &emc1403_platform_data,
37};
38
39sfi_device(emc1403_dev_id);