platform_config.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. *
  3. * $Id: platform_config.h
  4. *
  5. * Copyright (C) 2019 Bk, sensortek Inc.
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file COPYING in the main directory of this archive for
  9. * more details.
  10. *
  11. */
  12. #ifndef __PLATFORM_CONFIG_H__
  13. #define __PLATFORM_CONFIG_H__
  14. #include <linux/types.h>
  15. #include <linux/time.h>
  16. #include <linux/kernel.h>
  17. #include <linux/random.h>
  18. #include <linux/string.h>
  19. #include <linux/mutex.h>
  20. #include <linux/slab.h>
  21. #ifdef CONFIG_IIO
  22. #include <linux/iio/events.h>
  23. #include <linux/iio/buffer.h>
  24. #include <linux/iio/iio.h>
  25. #include <linux/iio/trigger.h>
  26. #include <linux/iio/trigger_consumer.h>
  27. #include <linux/iio/triggered_buffer.h>
  28. #include <linux/iio/sysfs.h>
  29. #endif
  30. typedef enum
  31. {
  32. ADDR_8BIT,
  33. ADDR_16BIT,
  34. } I2C_REG_ADDR_TYPE;
  35. typedef enum
  36. {
  37. SPI_MODE0,
  38. SPI_MODE1,
  39. SPI_MODE2,
  40. SPI_MODE3,
  41. } SPI_TRANSFER_MODE;
  42. struct spi_manager
  43. {
  44. struct spi_device *spi;
  45. struct mutex lock;
  46. SPI_TRANSFER_MODE trans_mode;
  47. void *any;
  48. u8 *spi_buffer; /* SPI buffer, used for SPI transfer. */
  49. } ;
  50. struct i2c_manager
  51. {
  52. struct i2c_client *client;
  53. struct mutex lock;
  54. I2C_REG_ADDR_TYPE addr_type;
  55. void *any;
  56. } ;
  57. #define kzalloc(size, mode) kzalloc(size, mode)
  58. #define kfree(ptr) kfree(ptr)
  59. extern const struct stk_bus_ops stk_spi_bops;
  60. extern const struct stk_bus_ops stk_i2c_bops;
  61. extern const struct stk_timer_ops stk_t_ops;
  62. extern const struct stk_gpio_ops stk_g_ops;
  63. #endif // __PLATFORM_CONFIG_H__