vsp1.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * vsp1.h -- R-Car VSP1 Driver
  4. *
  5. * Copyright (C) 2013-2014 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __VSP1_H__
  10. #define __VSP1_H__
  11. #include <linux/io.h>
  12. #include <linux/list.h>
  13. #include <linux/mutex.h>
  14. #include <media/media-device.h>
  15. #include <media/v4l2-device.h>
  16. #include <media/v4l2-subdev.h>
  17. #include "vsp1_regs.h"
  18. struct clk;
  19. struct device;
  20. struct rcar_fcp_device;
  21. struct vsp1_drm;
  22. struct vsp1_entity;
  23. struct vsp1_platform_data;
  24. struct vsp1_brx;
  25. struct vsp1_clu;
  26. struct vsp1_hgo;
  27. struct vsp1_hgt;
  28. struct vsp1_hsit;
  29. struct vsp1_lif;
  30. struct vsp1_lut;
  31. struct vsp1_rwpf;
  32. struct vsp1_sru;
  33. struct vsp1_uds;
  34. struct vsp1_uif;
  35. #define VSP1_MAX_LIF 2
  36. #define VSP1_MAX_RPF 5
  37. #define VSP1_MAX_UDS 3
  38. #define VSP1_MAX_UIF 2
  39. #define VSP1_MAX_WPF 4
  40. #define VSP1_HAS_LUT (1 << 1)
  41. #define VSP1_HAS_SRU (1 << 2)
  42. #define VSP1_HAS_BRU (1 << 3)
  43. #define VSP1_HAS_CLU (1 << 4)
  44. #define VSP1_HAS_WPF_VFLIP (1 << 5)
  45. #define VSP1_HAS_WPF_HFLIP (1 << 6)
  46. #define VSP1_HAS_HGO (1 << 7)
  47. #define VSP1_HAS_HGT (1 << 8)
  48. #define VSP1_HAS_BRS (1 << 9)
  49. #define VSP1_HAS_EXT_DL (1 << 10)
  50. struct vsp1_device_info {
  51. u32 version;
  52. const char *model;
  53. unsigned int gen;
  54. unsigned int features;
  55. unsigned int lif_count;
  56. unsigned int rpf_count;
  57. unsigned int uds_count;
  58. unsigned int uif_count;
  59. unsigned int wpf_count;
  60. unsigned int num_bru_inputs;
  61. bool uapi;
  62. };
  63. #define vsp1_feature(vsp1, f) ((vsp1)->info->features & (f))
  64. struct vsp1_device {
  65. struct device *dev;
  66. const struct vsp1_device_info *info;
  67. u32 version;
  68. void __iomem *mmio;
  69. struct rcar_fcp_device *fcp;
  70. struct device *bus_master;
  71. struct vsp1_brx *brs;
  72. struct vsp1_brx *bru;
  73. struct vsp1_clu *clu;
  74. struct vsp1_hgo *hgo;
  75. struct vsp1_hgt *hgt;
  76. struct vsp1_hsit *hsi;
  77. struct vsp1_hsit *hst;
  78. struct vsp1_lif *lif[VSP1_MAX_LIF];
  79. struct vsp1_lut *lut;
  80. struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
  81. struct vsp1_sru *sru;
  82. struct vsp1_uds *uds[VSP1_MAX_UDS];
  83. struct vsp1_uif *uif[VSP1_MAX_UIF];
  84. struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
  85. struct list_head entities;
  86. struct list_head videos;
  87. struct v4l2_device v4l2_dev;
  88. struct media_device media_dev;
  89. struct media_entity_operations media_ops;
  90. struct vsp1_drm *drm;
  91. };
  92. int vsp1_device_get(struct vsp1_device *vsp1);
  93. void vsp1_device_put(struct vsp1_device *vsp1);
  94. int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index);
  95. static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
  96. {
  97. return ioread32(vsp1->mmio + reg);
  98. }
  99. static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
  100. {
  101. iowrite32(data, vsp1->mmio + reg);
  102. }
  103. #endif /* __VSP1_H__ */