platform_lis331.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * platform_lis331.c: lis331 platform data initialization 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/i2c.h>
  13. #include <linux/gpio.h>
  14. #include <asm/intel-mid.h>
  15. static void __init *lis331dl_platform_data(void *info)
  16. {
  17. static short intr2nd_pdata;
  18. struct i2c_board_info *i2c_info = info;
  19. int intr = get_gpio_by_name("accel_int");
  20. int intr2nd = get_gpio_by_name("accel_2");
  21. if (intr < 0)
  22. return NULL;
  23. if (intr2nd < 0)
  24. return NULL;
  25. i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
  26. intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
  27. return &intr2nd_pdata;
  28. }
  29. static const struct devs_id lis331dl_dev_id __initconst = {
  30. .name = "i2c_accel",
  31. .type = SFI_DEV_TYPE_I2C,
  32. .get_platform_data = &lis331dl_platform_data,
  33. };
  34. sfi_device(lis331dl_dev_id);