vsp1.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <linux/platform_data/vsp1.h>
  19. #include <media/media-device.h>
  20. #include <media/v4l2-device.h>
  21. #include <media/v4l2-subdev.h>
  22. #include "vsp1_regs.h"
  23. struct clk;
  24. struct device;
  25. struct vsp1_platform_data;
  26. struct vsp1_bru;
  27. struct vsp1_hsit;
  28. struct vsp1_lif;
  29. struct vsp1_lut;
  30. struct vsp1_rwpf;
  31. struct vsp1_sru;
  32. struct vsp1_uds;
  33. #define VPS1_MAX_RPF 5
  34. #define VPS1_MAX_UDS 3
  35. #define VPS1_MAX_WPF 4
  36. struct vsp1_device {
  37. struct device *dev;
  38. struct vsp1_platform_data *pdata;
  39. void __iomem *mmio;
  40. struct clk *clock;
  41. struct mutex lock;
  42. int ref_count;
  43. struct vsp1_bru *bru;
  44. struct vsp1_hsit *hsi;
  45. struct vsp1_hsit *hst;
  46. struct vsp1_lif *lif;
  47. struct vsp1_lut *lut;
  48. struct vsp1_rwpf *rpf[VPS1_MAX_RPF];
  49. struct vsp1_sru *sru;
  50. struct vsp1_uds *uds[VPS1_MAX_UDS];
  51. struct vsp1_rwpf *wpf[VPS1_MAX_WPF];
  52. struct list_head entities;
  53. struct v4l2_device v4l2_dev;
  54. struct media_device media_dev;
  55. };
  56. struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1);
  57. void vsp1_device_put(struct vsp1_device *vsp1);
  58. static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
  59. {
  60. return ioread32(vsp1->mmio + reg);
  61. }
  62. static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
  63. {
  64. iowrite32(data, vsp1->mmio + reg);
  65. }
  66. #endif /* __VSP1_H__ */