tvin_frontend.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * TVIN Decoder
  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_DECODER_H
  14. #define __TVIN_DECODER_H
  15. /* Standard Linux Headers */
  16. #include <linux/list.h>
  17. /* Amlogic Headers */
  18. #include <linux/amports/vframe.h>
  19. #include <linux/tvin/tvin.h>
  20. /* Local Headers */
  21. #include "tvin_global.h"
  22. struct tvin_frontend_s;
  23. typedef struct tvin_decoder_ops_s {
  24. /*
  25. * check whether the port is supported.
  26. * return 0 if not supported, return other if supported.
  27. */
  28. int (*support) (struct tvin_frontend_s *fe, enum tvin_port_e port);
  29. void (*open) (struct tvin_frontend_s *fe, enum tvin_port_e port);
  30. void (*start) (struct tvin_frontend_s *fe, enum tvin_sig_fmt_e fmt);
  31. void (*stop) (struct tvin_frontend_s *fe, enum tvin_port_e port);
  32. void (*close) (struct tvin_frontend_s *fe);
  33. int (*decode_isr) (struct tvin_frontend_s *fe, unsigned int hcnt64);
  34. } tvin_decoder_ops_t;
  35. typedef struct tvin_state_machine_ops_s {
  36. bool (*nosig) (struct tvin_frontend_s *fe);
  37. bool (*fmt_changed) (struct tvin_frontend_s *fe);
  38. enum tvin_sig_fmt_e (*get_fmt) (struct tvin_frontend_s *fe);
  39. void (*fmt_config)(struct tvin_frontend_s *fe);
  40. bool (*adc_cal)(struct tvin_frontend_s *fe);
  41. bool (*pll_lock) (struct tvin_frontend_s *fe);
  42. void (*get_sig_propery)(struct tvin_frontend_s *fe, struct tvin_sig_property_s *prop);
  43. #ifdef TVAFE_SET_CVBS_MANUAL_FMT_POS
  44. enum tvin_cvbs_pos_ctl_e (*set_cvbs_fmt_pos) (struct tvin_frontend_s *fe);
  45. #endif
  46. void (*vga_set_param)(struct tvafe_vga_parm_s *vga_parm, struct tvin_frontend_s *fe);
  47. void (*vga_get_param)(struct tvafe_vga_parm_s *vga_parm, struct tvin_frontend_s *fe);
  48. bool (*check_frame_skip)(struct tvin_frontend_s *fe);
  49. } tvin_state_machine_ops_t;
  50. typedef struct tvin_frontend_s {
  51. int index; /* support multi-frontend of same decoder */
  52. char name[15]; /* just name of frontend, not port name or format name */
  53. int port; /* current port */
  54. struct tvin_decoder_ops_s *dec_ops;
  55. struct tvin_state_machine_ops_s *sm_ops;
  56. unsigned int flag;
  57. struct list_head list;
  58. } tvin_frontend_t;
  59. int tvin_frontend_init(tvin_frontend_t *fe,
  60. tvin_decoder_ops_t *dec_ops, tvin_state_machine_ops_t *sm_ops, int index);
  61. int tvin_reg_frontend(struct tvin_frontend_s *fe);
  62. void tvin_unreg_frontend(struct tvin_frontend_s *fe);
  63. struct tvin_frontend_s * tvin_get_frontend(enum tvin_port_e port, int index);
  64. #endif