mgb4_vout.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2021-2023 Digiteq Automotive
  4. * author: Martin Tuma <martin.tuma@digiteqautomotive.com>
  5. */
  6. #ifndef __MGB4_VOUT_H__
  7. #define __MGB4_VOUT_H__
  8. #include <media/v4l2-device.h>
  9. #include <media/v4l2-dev.h>
  10. #include <media/v4l2-ctrls.h>
  11. #include <media/videobuf2-core.h>
  12. #include <linux/debugfs.h>
  13. #include "mgb4_i2c.h"
  14. struct mgb4_vout_regs {
  15. u32 address;
  16. u32 config;
  17. u32 status;
  18. u32 resolution;
  19. u32 frame_limit;
  20. u32 hsync;
  21. u32 vsync;
  22. u32 padding;
  23. u32 timer;
  24. };
  25. struct mgb4_vout_config {
  26. int id;
  27. int dma_channel;
  28. int irq;
  29. struct mgb4_vout_regs regs;
  30. };
  31. struct mgb4_vout_dev {
  32. struct mgb4_dev *mgbdev;
  33. struct v4l2_device v4l2dev;
  34. struct video_device vdev;
  35. struct vb2_queue queue;
  36. struct mutex lock; /* vdev lock */
  37. spinlock_t qlock; /* buffer queue lock */
  38. struct list_head buf_list;
  39. struct work_struct dma_work;
  40. u32 width;
  41. u32 height;
  42. u32 freq;
  43. u32 padding;
  44. struct mgb4_i2c_client ser;
  45. const struct mgb4_vout_config *config;
  46. #ifdef CONFIG_DEBUG_FS
  47. struct dentry *debugfs;
  48. struct debugfs_regset32 regset;
  49. struct debugfs_reg32 regs[sizeof(struct mgb4_vout_regs) / 4];
  50. #endif
  51. };
  52. struct mgb4_vout_dev *mgb4_vout_create(struct mgb4_dev *mgbdev, int id);
  53. void mgb4_vout_free(struct mgb4_vout_dev *voutdev);
  54. #endif