1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * platform_emc1403.c: emc1403 platform data initialization file
4  *
5  * (C) Copyright 2013 Intel Corporation
6  * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7  */
8 
9 #include <linux/init.h>
10 #include <linux/gpio.h>
11 #include <linux/i2c.h>
12 #include <asm/intel-mid.h>
13 
emc1403_platform_data(void * info)14 static 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 
21 	if (intr < 0)
22 		return NULL;
23 	if (intr2nd < 0)
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 
32 static 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 
39 sfi_device(emc1403_dev_id);
40