platform_emc1403.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * platform_emc1403.c: emc1403 platform data initilization file
  3. *
  4. * (C) Copyright 2013 Intel Corporation
  5. * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
  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. #include <linux/init.h>
  13. #include <linux/gpio.h>
  14. #include <linux/i2c.h>
  15. #include <asm/intel-mid.h>
  16. static void __init *emc1403_platform_data(void *info)
  17. {
  18. static short intr2nd_pdata;
  19. struct i2c_board_info *i2c_info = info;
  20. int intr = get_gpio_by_name("thermal_int");
  21. int intr2nd = get_gpio_by_name("thermal_alert");
  22. if (intr < 0)
  23. return NULL;
  24. if (intr2nd < 0)
  25. return NULL;
  26. i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
  27. intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
  28. return &intr2nd_pdata;
  29. }
  30. static const struct devs_id emc1403_dev_id __initconst = {
  31. .name = "emc1403",
  32. .type = SFI_DEV_TYPE_I2C,
  33. .delay = 1,
  34. .get_platform_data = &emc1403_platform_data,
  35. };
  36. sfi_device(emc1403_dev_id);