isdbt.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. *
  3. * drivers/media/isdbt/isdbt.h
  4. *
  5. * isdbt driver
  6. *
  7. * Copyright (C) (2014, Samsung Electronics)
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation version 2.
  12. *
  13. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  14. * kind, whether express or implied; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. */
  19. #ifndef __ISDBT_H__
  20. #define __ISDBT_H__
  21. #include <linux/types.h>
  22. #include <linux/init.h>
  23. #include <linux/module.h>
  24. #include <linux/kernel.h>
  25. #include <linux/fs.h>
  26. #include <linux/errno.h>
  27. #include <linux/fcntl.h>
  28. #include <linux/miscdevice.h>
  29. #include <linux/interrupt.h>
  30. #include <linux/irq.h>
  31. #include <linux/wait.h>
  32. #include <linux/ioctl.h>
  33. #include <linux/gpio.h>
  34. #include <linux/delay.h>
  35. #include <linux/mutex.h>
  36. #include <linux/workqueue.h>
  37. #include <linux/vmalloc.h>
  38. #include <linux/uaccess.h>
  39. #include <linux/io.h>
  40. #include <linux/atomic.h>
  41. #include <linux/i2c.h>
  42. #include <linux/spi/spi.h>
  43. #include <linux/wait.h>
  44. #include <linux/list.h>
  45. #include <linux/jiffies.h>
  46. #include <linux/wakelock.h>
  47. #include <linux/kthread.h>
  48. #include <linux/platform_device.h>
  49. #include <mach/gpio.h>
  50. /* ================================
  51. Edit the lines below
  52. ================================= */
  53. #define ISDBT_DEVICE_TREE
  54. //#define ISDBT_USE_PMIC
  55. #define UNUSED_GPIO -1 // If there is an unused gpio, use this definition.
  56. #define ISDBT_PWR_EN 36
  57. #define ISDBT_PWR_EN2 110
  58. #define ISDBT_RST 67
  59. #define ISDBT_INT 49
  60. #define ISDBT_SPI_MOSI 20
  61. #define ISDBT_SPI_MISO 21
  62. #define ISDBT_SPI_CS 22
  63. #define ISDBT_SPI_CLK 23
  64. #ifdef ISDBT_USE_PMIC
  65. #define ISDBT_PMIC_NAME "8226_l27"
  66. #define ISDBT_PMIC_VOLTAGE 1800000
  67. #endif
  68. // =============================
  69. /* Debug Msg Option */
  70. #define ISDBT_DEBUG
  71. #ifdef ISDBT_DEBUG
  72. #define DPRINTK(x...) printk(KERN_ERR "ISDBT " x)
  73. #else
  74. #define DPRINTK(x...) /* null */
  75. #endif
  76. #define ISDBT_DEV_NAME "isdbt"
  77. #define ISDBT_DEV_MAJOR 225
  78. #define ISDBT_DEV_MINOR 0
  79. struct isdbt_dt_platform_data {
  80. int isdbt_irq;
  81. int isdbt_pwr_en;
  82. int isdbt_pwr_en2;
  83. int isdbt_rst;
  84. int isdbt_spi_mosi;
  85. int isdbt_spi_miso;
  86. int isdbt_spi_cs;
  87. int isdbt_spi_clk;
  88. };
  89. struct isdbt_drv_func {
  90. int (*probe) (void);
  91. int (*remove) (void);
  92. int (*power_on) (unsigned long arg);
  93. void (*power_off) (void);
  94. int (*open)(struct inode *inode, struct file *filp);
  95. int (*release)(struct inode *inode, struct file *filp);
  96. ssize_t (*read) (struct file *filp, char *buf, size_t count, loff_t *f_pos);
  97. long (*ioctl)(struct file *filp, unsigned int cmd, unsigned long arg);
  98. int (*mmap)(struct file *filp, struct vm_area_struct *vma);
  99. irqreturn_t (*irq_handler)(int irq, void *handle);
  100. };
  101. #if defined(CONFIG_MTV_FC8150)
  102. struct isdbt_drv_func *fc8150_drv_func(void);
  103. #elif defined(CONFIG_MTV_FC8300)
  104. struct isdbt_drv_func *fc8300_drv_func(void);
  105. #elif defined(CONFIG_MTV_MTV222)
  106. struct isdbt_drv_func *mtv222_drv_func(void);
  107. #elif defined(CONFIG_MTV_MTV23x)
  108. struct isdbt_drv_func *mtv23x_drv_func(void);
  109. #else
  110. #error "an unsupported ISDBT driver"
  111. #endif
  112. #if defined(CONFIG_MTV_SPI)
  113. struct spi_device *isdbt_get_spi_handle(void);
  114. #endif
  115. bool isdbt_control_irq(bool set);
  116. void isdbt_control_gpio(bool poweron);
  117. struct spi_device *isdbt_get_if_handle(void);
  118. int isdbt_power_on(unsigned long arg);
  119. bool isdbt_power_off(void);
  120. int isdbt_spi_init(void);
  121. void isdbt_spi_exit(void);
  122. int isdbt_spi_probe(struct spi_device *spi);
  123. #endif /* __ISDBT_H__*/