vsp1.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * vsp1.h -- R-Car VSP1 Driver
  3. *
  4. * Copyright (C) 2013 Renesas 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_lif;
  27. struct vsp1_rwpf;
  28. struct vsp1_uds;
  29. #define VPS1_MAX_RPF 5
  30. #define VPS1_MAX_UDS 3
  31. #define VPS1_MAX_WPF 4
  32. struct vsp1_device {
  33. struct device *dev;
  34. struct vsp1_platform_data *pdata;
  35. void __iomem *mmio;
  36. struct clk *clock;
  37. struct clk *rt_clock;
  38. struct mutex lock;
  39. int ref_count;
  40. struct vsp1_lif *lif;
  41. struct vsp1_rwpf *rpf[VPS1_MAX_RPF];
  42. struct vsp1_uds *uds[VPS1_MAX_UDS];
  43. struct vsp1_rwpf *wpf[VPS1_MAX_WPF];
  44. struct list_head entities;
  45. struct v4l2_device v4l2_dev;
  46. struct media_device media_dev;
  47. };
  48. struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1);
  49. void vsp1_device_put(struct vsp1_device *vsp1);
  50. static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
  51. {
  52. return ioread32(vsp1->mmio + reg);
  53. }
  54. static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
  55. {
  56. iowrite32(data, vsp1->mmio + reg);
  57. }
  58. #endif /* __VSP1_H__ */