camss-csid.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * camss-csid.h
  4. *
  5. * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
  6. *
  7. * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
  8. * Copyright (C) 2015-2018 Linaro Ltd.
  9. */
  10. #ifndef QC_MSM_CAMSS_CSID_H
  11. #define QC_MSM_CAMSS_CSID_H
  12. #include <linux/clk.h>
  13. #include <media/media-entity.h>
  14. #include <media/v4l2-ctrls.h>
  15. #include <media/v4l2-device.h>
  16. #include <media/v4l2-mediabus.h>
  17. #include <media/v4l2-subdev.h>
  18. #define MSM_CSID_PAD_SINK 0
  19. #define MSM_CSID_PAD_SRC 1
  20. #define MSM_CSID_PADS_NUM 2
  21. enum csid_payload_mode {
  22. CSID_PAYLOAD_MODE_INCREMENTING = 0,
  23. CSID_PAYLOAD_MODE_ALTERNATING_55_AA = 1,
  24. CSID_PAYLOAD_MODE_ALL_ZEROES = 2,
  25. CSID_PAYLOAD_MODE_ALL_ONES = 3,
  26. CSID_PAYLOAD_MODE_RANDOM = 4,
  27. CSID_PAYLOAD_MODE_USER_SPECIFIED = 5,
  28. };
  29. struct csid_testgen_config {
  30. u8 enabled;
  31. enum csid_payload_mode payload_mode;
  32. };
  33. struct csid_phy_config {
  34. u8 csiphy_id;
  35. u8 lane_cnt;
  36. u32 lane_assign;
  37. };
  38. struct csid_device {
  39. struct camss *camss;
  40. u8 id;
  41. struct v4l2_subdev subdev;
  42. struct media_pad pads[MSM_CSID_PADS_NUM];
  43. void __iomem *base;
  44. u32 irq;
  45. char irq_name[30];
  46. struct camss_clock *clock;
  47. int nclocks;
  48. struct regulator *vdda;
  49. struct completion reset_complete;
  50. struct csid_testgen_config testgen;
  51. struct csid_phy_config phy;
  52. struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM];
  53. struct v4l2_ctrl_handler ctrls;
  54. struct v4l2_ctrl *testgen_mode;
  55. const struct csid_format *formats;
  56. unsigned int nformats;
  57. };
  58. struct resources;
  59. int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
  60. const struct resources *res, u8 id);
  61. int msm_csid_register_entity(struct csid_device *csid,
  62. struct v4l2_device *v4l2_dev);
  63. void msm_csid_unregister_entity(struct csid_device *csid);
  64. void msm_csid_get_csid_id(struct media_entity *entity, u8 *id);
  65. #endif /* QC_MSM_CAMSS_CSID_H */