linux/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
<<
>>
Prefs
   1/*
   2 * camss-vfe.h
   3 *
   4 * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
   5 *
   6 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
   7 * Copyright (C) 2015-2017 Linaro Ltd.
   8 *
   9 * This program is free software; you can redistribute it and/or modify
  10 * it under the terms of the GNU General Public License version 2 and
  11 * only version 2 as published by the Free Software Foundation.
  12 *
  13 * This program is distributed in the hope that it will be useful,
  14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16 * GNU General Public License for more details.
  17 */
  18#ifndef QC_MSM_CAMSS_VFE_H
  19#define QC_MSM_CAMSS_VFE_H
  20
  21#include <linux/clk.h>
  22#include <linux/spinlock_types.h>
  23#include <media/media-entity.h>
  24#include <media/v4l2-device.h>
  25#include <media/v4l2-subdev.h>
  26
  27#include "camss-video.h"
  28
  29#define MSM_VFE_PAD_SINK 0
  30#define MSM_VFE_PAD_SRC 1
  31#define MSM_VFE_PADS_NUM 2
  32
  33#define MSM_VFE_LINE_NUM 4
  34#define MSM_VFE_IMAGE_MASTERS_NUM 7
  35#define MSM_VFE_COMPOSITE_IRQ_NUM 4
  36
  37#define MSM_VFE_VFE0_UB_SIZE 1023
  38#define MSM_VFE_VFE0_UB_SIZE_RDI (MSM_VFE_VFE0_UB_SIZE / 3)
  39#define MSM_VFE_VFE1_UB_SIZE 1535
  40#define MSM_VFE_VFE1_UB_SIZE_RDI (MSM_VFE_VFE1_UB_SIZE / 3)
  41
  42enum vfe_output_state {
  43        VFE_OUTPUT_OFF,
  44        VFE_OUTPUT_RESERVED,
  45        VFE_OUTPUT_SINGLE,
  46        VFE_OUTPUT_CONTINUOUS,
  47        VFE_OUTPUT_IDLE,
  48        VFE_OUTPUT_STOPPING
  49};
  50
  51enum vfe_line_id {
  52        VFE_LINE_NONE = -1,
  53        VFE_LINE_RDI0 = 0,
  54        VFE_LINE_RDI1 = 1,
  55        VFE_LINE_RDI2 = 2,
  56        VFE_LINE_PIX = 3
  57};
  58
  59struct vfe_output {
  60        u8 wm_num;
  61        u8 wm_idx[3];
  62
  63        int active_buf;
  64        struct camss_buffer *buf[2];
  65        struct camss_buffer *last_buffer;
  66        struct list_head pending_bufs;
  67
  68        unsigned int drop_update_idx;
  69
  70        enum vfe_output_state state;
  71        unsigned int sequence;
  72        int wait_sof;
  73        int wait_reg_update;
  74        struct completion sof;
  75        struct completion reg_update;
  76};
  77
  78struct vfe_line {
  79        enum vfe_line_id id;
  80        struct v4l2_subdev subdev;
  81        struct media_pad pads[MSM_VFE_PADS_NUM];
  82        struct v4l2_mbus_framefmt fmt[MSM_VFE_PADS_NUM];
  83        struct v4l2_rect compose;
  84        struct v4l2_rect crop;
  85        struct camss_video video_out;
  86        struct vfe_output output;
  87};
  88
  89struct vfe_device {
  90        u8 id;
  91        void __iomem *base;
  92        u32 irq;
  93        char irq_name[30];
  94        struct camss_clock *clock;
  95        int nclocks;
  96        struct completion reset_complete;
  97        struct completion halt_complete;
  98        struct mutex power_lock;
  99        int power_count;
 100        struct mutex stream_lock;
 101        int stream_count;
 102        spinlock_t output_lock;
 103        enum vfe_line_id wm_output_map[MSM_VFE_IMAGE_MASTERS_NUM];
 104        struct vfe_line line[MSM_VFE_LINE_NUM];
 105        u32 reg_update;
 106        u8 was_streaming;
 107};
 108
 109struct resources;
 110
 111int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res);
 112
 113int msm_vfe_register_entities(struct vfe_device *vfe,
 114                              struct v4l2_device *v4l2_dev);
 115
 116void msm_vfe_unregister_entities(struct vfe_device *vfe);
 117
 118void msm_vfe_get_vfe_id(struct media_entity *entity, u8 *id);
 119void msm_vfe_get_vfe_line_id(struct media_entity *entity, enum vfe_line_id *id);
 120
 121void msm_vfe_stop_streaming(struct vfe_device *vfe);
 122
 123#endif /* QC_MSM_CAMSS_VFE_H */
 124