linux/drivers/media/platform/omap3isp/isppreview.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * isppreview.h
   4 *
   5 * TI OMAP3 ISP - Preview module
   6 *
   7 * Copyright (C) 2010 Nokia Corporation
   8 * Copyright (C) 2009 Texas Instruments, Inc.
   9 *
  10 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  11 *           Sakari Ailus <sakari.ailus@iki.fi>
  12 */
  13
  14#ifndef OMAP3_ISP_PREVIEW_H
  15#define OMAP3_ISP_PREVIEW_H
  16
  17#include <linux/omap3isp.h>
  18#include <linux/types.h>
  19#include <media/v4l2-ctrls.h>
  20
  21#include "ispvideo.h"
  22
  23#define ISPPRV_BRIGHT_STEP              0x1
  24#define ISPPRV_BRIGHT_DEF               0x0
  25#define ISPPRV_BRIGHT_LOW               0x0
  26#define ISPPRV_BRIGHT_HIGH              0xFF
  27#define ISPPRV_BRIGHT_UNITS             0x1
  28
  29#define ISPPRV_CONTRAST_STEP            0x1
  30#define ISPPRV_CONTRAST_DEF             0x10
  31#define ISPPRV_CONTRAST_LOW             0x0
  32#define ISPPRV_CONTRAST_HIGH            0xFF
  33#define ISPPRV_CONTRAST_UNITS           0x1
  34
  35/* Additional features not listed in linux/omap3isp.h */
  36#define OMAP3ISP_PREV_CONTRAST          (1 << 17)
  37#define OMAP3ISP_PREV_BRIGHTNESS        (1 << 18)
  38#define OMAP3ISP_PREV_FEATURES_END      (1 << 19)
  39
  40enum preview_input_entity {
  41        PREVIEW_INPUT_NONE,
  42        PREVIEW_INPUT_CCDC,
  43        PREVIEW_INPUT_MEMORY,
  44};
  45
  46#define PREVIEW_OUTPUT_RESIZER          (1 << 1)
  47#define PREVIEW_OUTPUT_MEMORY           (1 << 2)
  48
  49/* Configure byte layout of YUV image */
  50enum preview_ycpos_mode {
  51        YCPOS_YCrYCb = 0,
  52        YCPOS_YCbYCr = 1,
  53        YCPOS_CbYCrY = 2,
  54        YCPOS_CrYCbY = 3
  55};
  56
  57/*
  58 * struct prev_params - Structure for all configuration
  59 * @busy: Bitmask of busy parameters (being updated or used)
  60 * @update: Bitmask of the parameters to be updated
  61 * @features: Set of features enabled.
  62 * @cfa: CFA coefficients.
  63 * @csup: Chroma suppression coefficients.
  64 * @luma: Luma enhancement coefficients.
  65 * @nf: Noise filter coefficients.
  66 * @dcor: Noise filter coefficients.
  67 * @gamma: Gamma coefficients.
  68 * @wbal: White Balance parameters.
  69 * @blkadj: Black adjustment parameters.
  70 * @rgb2rgb: RGB blending parameters.
  71 * @csc: Color space conversion (RGB to YCbCr) parameters.
  72 * @hmed: Horizontal median filter.
  73 * @yclimit: YC limits parameters.
  74 * @contrast: Contrast.
  75 * @brightness: Brightness.
  76 */
  77struct prev_params {
  78        u32 busy;
  79        u32 update;
  80        u32 features;
  81        struct omap3isp_prev_cfa cfa;
  82        struct omap3isp_prev_csup csup;
  83        struct omap3isp_prev_luma luma;
  84        struct omap3isp_prev_nf nf;
  85        struct omap3isp_prev_dcor dcor;
  86        struct omap3isp_prev_gtables gamma;
  87        struct omap3isp_prev_wbal wbal;
  88        struct omap3isp_prev_blkadj blkadj;
  89        struct omap3isp_prev_rgbtorgb rgb2rgb;
  90        struct omap3isp_prev_csc csc;
  91        struct omap3isp_prev_hmed hmed;
  92        struct omap3isp_prev_yclimit yclimit;
  93        u8 contrast;
  94        u8 brightness;
  95};
  96
  97/* Sink and source previewer pads */
  98#define PREV_PAD_SINK                   0
  99#define PREV_PAD_SOURCE                 1
 100#define PREV_PADS_NUM                   2
 101
 102/*
 103 * struct isp_prev_device - Structure for storing ISP Preview module information
 104 * @subdev: V4L2 subdevice
 105 * @pads: Media entity pads
 106 * @formats: Active formats at the subdev pad
 107 * @crop: Active crop rectangle
 108 * @input: Module currently connected to the input pad
 109 * @output: Bitmask of the active output
 110 * @video_in: Input video entity
 111 * @video_out: Output video entity
 112 * @params.params : Active and shadow parameters sets
 113 * @params.active: Bitmask of parameters active in set 0
 114 * @params.lock: Parameters lock, protects params.active and params.shadow
 115 * @underrun: Whether the preview entity has queued buffers on the output
 116 * @state: Current preview pipeline state
 117 *
 118 * This structure is used to store the OMAP ISP Preview module Information.
 119 */
 120struct isp_prev_device {
 121        struct v4l2_subdev subdev;
 122        struct media_pad pads[PREV_PADS_NUM];
 123        struct v4l2_mbus_framefmt formats[PREV_PADS_NUM];
 124        struct v4l2_rect crop;
 125
 126        struct v4l2_ctrl_handler ctrls;
 127
 128        enum preview_input_entity input;
 129        unsigned int output;
 130        struct isp_video video_in;
 131        struct isp_video video_out;
 132
 133        struct {
 134                unsigned int cfa_order;
 135                struct prev_params params[2];
 136                u32 active;
 137                spinlock_t lock;
 138        } params;
 139
 140        enum isp_pipeline_stream_state state;
 141        wait_queue_head_t wait;
 142        atomic_t stopping;
 143};
 144
 145struct isp_device;
 146
 147int omap3isp_preview_init(struct isp_device *isp);
 148void omap3isp_preview_cleanup(struct isp_device *isp);
 149
 150int omap3isp_preview_register_entities(struct isp_prev_device *prv,
 151                                       struct v4l2_device *vdev);
 152void omap3isp_preview_unregister_entities(struct isp_prev_device *prv);
 153
 154void omap3isp_preview_isr_frame_sync(struct isp_prev_device *prev);
 155void omap3isp_preview_isr(struct isp_prev_device *prev);
 156
 157int omap3isp_preview_busy(struct isp_prev_device *isp_prev);
 158
 159void omap3isp_preview_restore_context(struct isp_device *isp);
 160
 161#endif  /* OMAP3_ISP_PREVIEW_H */
 162