vsp1.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * vsp1.h -- R-Car VSP1 Driver
  3. *
  4. * Copyright (C) 2013-2014 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef __VSP1_H__
  14. #define __VSP1_H__
  15. #include <linux/io.h>
  16. #include <linux/list.h>
  17. #include <linux/mutex.h>
  18. #include <media/media-device.h>
  19. #include <media/v4l2-device.h>
  20. #include <media/v4l2-subdev.h>
  21. #include "vsp1_regs.h"
  22. struct clk;
  23. struct device;
  24. struct rcar_fcp_device;
  25. struct vsp1_drm;
  26. struct vsp1_entity;
  27. struct vsp1_platform_data;
  28. struct vsp1_bru;
  29. struct vsp1_clu;
  30. struct vsp1_hsit;
  31. struct vsp1_lif;
  32. struct vsp1_lut;
  33. struct vsp1_rwpf;
  34. struct vsp1_sru;
  35. struct vsp1_uds;
  36. #define VSP1_MAX_RPF 5
  37. #define VSP1_MAX_UDS 3
  38. #define VSP1_MAX_WPF 4
  39. #define VSP1_HAS_LIF (1 << 0)
  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. struct vsp1_device_info {
  47. u32 version;
  48. const char *model;
  49. unsigned int gen;
  50. unsigned int features;
  51. unsigned int rpf_count;
  52. unsigned int uds_count;
  53. unsigned int wpf_count;
  54. unsigned int num_bru_inputs;
  55. bool uapi;
  56. };
  57. struct vsp1_device {
  58. struct device *dev;
  59. const struct vsp1_device_info *info;
  60. u32 version;
  61. void __iomem *mmio;
  62. struct rcar_fcp_device *fcp;
  63. struct vsp1_bru *bru;
  64. struct vsp1_clu *clu;
  65. struct vsp1_hsit *hsi;
  66. struct vsp1_hsit *hst;
  67. struct vsp1_lif *lif;
  68. struct vsp1_lut *lut;
  69. struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
  70. struct vsp1_sru *sru;
  71. struct vsp1_uds *uds[VSP1_MAX_UDS];
  72. struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
  73. struct list_head entities;
  74. struct list_head videos;
  75. struct v4l2_device v4l2_dev;
  76. struct media_device media_dev;
  77. struct media_entity_operations media_ops;
  78. struct vsp1_drm *drm;
  79. };
  80. int vsp1_device_get(struct vsp1_device *vsp1);
  81. void vsp1_device_put(struct vsp1_device *vsp1);
  82. int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index);
  83. static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
  84. {
  85. return ioread32(vsp1->mmio + reg);
  86. }
  87. static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
  88. {
  89. iowrite32(data, vsp1->mmio + reg);
  90. }
  91. #endif /* __VSP1_H__ */