s5p_mfc_opr.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * drivers/media/video/samsung/mfc5/s5p_mfc_opr.h
  3. *
  4. * Header file for Samsung MFC (Multi Function Codec - FIMV) driver
  5. * Contains declarations of hw related functions.
  6. *
  7. * Kamil Debski, Copyright (C) 2011 Samsung Electronics
  8. * http://www.samsung.com/
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef S5P_MFC_OPR_H_
  15. #define S5P_MFC_OPR_H_
  16. #include "s5p_mfc_common.h"
  17. int s5p_mfc_init_decode(struct s5p_mfc_ctx *ctx);
  18. int s5p_mfc_init_encode(struct s5p_mfc_ctx *mfc_ctx);
  19. /* Decoding functions */
  20. int s5p_mfc_set_dec_frame_buffer(struct s5p_mfc_ctx *ctx);
  21. int s5p_mfc_set_dec_stream_buffer(struct s5p_mfc_ctx *ctx, int buf_addr,
  22. unsigned int start_num_byte,
  23. unsigned int buf_size);
  24. /* Encoding functions */
  25. void s5p_mfc_set_enc_frame_buffer(struct s5p_mfc_ctx *ctx,
  26. unsigned long y_addr, unsigned long c_addr);
  27. int s5p_mfc_set_enc_stream_buffer(struct s5p_mfc_ctx *ctx,
  28. unsigned long addr, unsigned int size);
  29. void s5p_mfc_get_enc_frame_buffer(struct s5p_mfc_ctx *ctx,
  30. unsigned long *y_addr, unsigned long *c_addr);
  31. int s5p_mfc_set_enc_ref_buffer(struct s5p_mfc_ctx *mfc_ctx);
  32. int s5p_mfc_decode_one_frame(struct s5p_mfc_ctx *ctx,
  33. enum s5p_mfc_decode_arg last_frame);
  34. int s5p_mfc_encode_one_frame(struct s5p_mfc_ctx *mfc_ctx);
  35. /* Memory allocation */
  36. int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx);
  37. void s5p_mfc_set_dec_desc_buffer(struct s5p_mfc_ctx *ctx);
  38. void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx);
  39. int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx);
  40. void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx);
  41. int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx);
  42. void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx);
  43. void s5p_mfc_try_run(struct s5p_mfc_dev *dev);
  44. void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq);
  45. #define s5p_mfc_get_dspl_y_adr() (readl(dev->regs_base + \
  46. S5P_FIMV_SI_DISPLAY_Y_ADR) << \
  47. MFC_OFFSET_SHIFT)
  48. #define s5p_mfc_get_dec_y_adr() (readl(dev->regs_base + \
  49. S5P_FIMV_SI_DISPLAY_Y_ADR) << \
  50. MFC_OFFSET_SHIFT)
  51. #define s5p_mfc_get_dspl_status() readl(dev->regs_base + \
  52. S5P_FIMV_SI_DISPLAY_STATUS)
  53. #define s5p_mfc_get_frame_type() (readl(dev->regs_base + \
  54. S5P_FIMV_DECODE_FRAME_TYPE) \
  55. & S5P_FIMV_DECODE_FRAME_MASK)
  56. #define s5p_mfc_get_consumed_stream() readl(dev->regs_base + \
  57. S5P_FIMV_SI_CONSUMED_BYTES)
  58. #define s5p_mfc_get_int_reason() (readl(dev->regs_base + \
  59. S5P_FIMV_RISC2HOST_CMD) & \
  60. S5P_FIMV_RISC2HOST_CMD_MASK)
  61. #define s5p_mfc_get_int_err() readl(dev->regs_base + \
  62. S5P_FIMV_RISC2HOST_ARG2)
  63. #define s5p_mfc_err_dec(x) (((x) & S5P_FIMV_ERR_DEC_MASK) >> \
  64. S5P_FIMV_ERR_DEC_SHIFT)
  65. #define s5p_mfc_err_dspl(x) (((x) & S5P_FIMV_ERR_DSPL_MASK) >> \
  66. S5P_FIMV_ERR_DSPL_SHIFT)
  67. #define s5p_mfc_get_img_width() readl(dev->regs_base + \
  68. S5P_FIMV_SI_HRESOL)
  69. #define s5p_mfc_get_img_height() readl(dev->regs_base + \
  70. S5P_FIMV_SI_VRESOL)
  71. #define s5p_mfc_get_dpb_count() readl(dev->regs_base + \
  72. S5P_FIMV_SI_BUF_NUMBER)
  73. #define s5p_mfc_get_inst_no() readl(dev->regs_base + \
  74. S5P_FIMV_RISC2HOST_ARG1)
  75. #define s5p_mfc_get_enc_strm_size() readl(dev->regs_base + \
  76. S5P_FIMV_ENC_SI_STRM_SIZE)
  77. #define s5p_mfc_get_enc_slice_type() readl(dev->regs_base + \
  78. S5P_FIMV_ENC_SI_SLICE_TYPE)
  79. #endif /* S5P_MFC_OPR_H_ */