vdin.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * VDIN driver
  3. *
  4. * Author: Lin Xu <lin.xu@amlogic.com>
  5. * Bobby Yang <bo.yang@amlogic.com>
  6. *
  7. * Copyright (C) 2010 Amlogic Inc.
  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 version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef __TVIN_VDIN_H
  14. #define __TVIN_VDIN_H
  15. /* Standard Linux Headers */
  16. #include <linux/cdev.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/irqreturn.h>
  19. #include <linux/timer.h>
  20. #include <linux/workqueue.h>
  21. #include <linux/mutex.h>
  22. #include <linux/interrupt.h>
  23. /* Amlogic Headers */
  24. #include <linux/amports/vframe.h>
  25. #include <media/amlogic/656in.h>
  26. /* values of vdin_dev_t.flags */
  27. #define VDIN_FLAG_NULL 0x00000000
  28. #define VDIN_FLAG_DEC_STARTED 0x00000001
  29. //*** vdin device structure
  30. typedef struct tvin_dec_ops_s {
  31. int (*dec_run) (struct vframe_s *vf);
  32. } tvin_dec_ops_t;
  33. typedef struct vdin_dev_s {
  34. int index;
  35. unsigned int flags;
  36. unsigned int mem_start;
  37. unsigned int mem_size;
  38. unsigned int irq;
  39. unsigned int addr_offset; //address offset(vdin0/vdin1/...)
  40. unsigned int meas_th;
  41. unsigned int meas_tv;
  42. unsigned long pre_irq_time;
  43. struct tvin_parm_s para;
  44. struct cdev cdev;
  45. irqreturn_t (*vdin_isr) (int irq, void *dev_id);
  46. struct timer_list timer;
  47. spinlock_t dec_lock;
  48. struct tvin_dec_ops_s *dec_ops;
  49. spinlock_t isr_lock;
  50. struct tasklet_struct isr_tasklet;
  51. struct mutex mm_lock; /* lock for mmap */
  52. } vdin_dev_t;
  53. typedef struct vdin_regs_s {
  54. unsigned int val : 32;
  55. unsigned int reg : 14;
  56. unsigned int port : 2; // port port_addr port_data remark
  57. // 0 NA NA direct access
  58. // 1 VPP_CHROMA_ADDR_PORT VPP_CHROMA_DATA_PORT CM port registers
  59. // 2 NA NA reserved
  60. // 3 NA NA reserved
  61. unsigned int bit : 5;
  62. unsigned int wid : 5;
  63. unsigned int mode : 1; // 0:read, 1:write
  64. unsigned int rsv : 5;
  65. } vdin_regs_t;
  66. extern void tvin_dec_register(struct vdin_dev_s *devp, struct tvin_dec_ops_s *op);
  67. extern void tvin_dec_unregister(struct vdin_dev_s *devp);
  68. extern void vdin_info_update(struct vdin_dev_s *devp, struct tvin_parm_s *para);
  69. #endif // __TVIN_VDIN_H