aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/intel-mid/device_libs/platform_max3111.c
blob: afd1df94e0e5bcea59b27ad3449ec737b4ccb6da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * platform_max3111.c: max3111 platform data initilization file
 *
 * (C) Copyright 2013 Intel Corporation
 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 */

#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <asm/intel-mid.h>

static void __init *max3111_platform_data(void *info)
{
	struct spi_board_info *spi_info = info;
	int intr = get_gpio_by_name("max3111_int");

	spi_info->mode = SPI_MODE_0;
	if (intr == -1)
		return NULL;
	spi_info->irq = intr + INTEL_MID_IRQ_OFFSET;
	return NULL;
}

static const struct devs_id max3111_dev_id __initconst = {
	.name = "spi_max3111",
	.type = SFI_DEV_TYPE_SPI,
	.get_platform_data = &max3111_platform_data,
};

sfi_device(max3111_dev_id);