162 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * isppreview.h4 *5 * TI OMAP3 ISP - Preview module6 *7 * Copyright (C) 2010 Nokia Corporation8 * 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_H15#define OMAP3_ISP_PREVIEW_H16 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 0x124#define ISPPRV_BRIGHT_DEF 0x025#define ISPPRV_BRIGHT_LOW 0x026#define ISPPRV_BRIGHT_HIGH 0xFF27#define ISPPRV_BRIGHT_UNITS 0x128 29#define ISPPRV_CONTRAST_STEP 0x130#define ISPPRV_CONTRAST_DEF 0x1031#define ISPPRV_CONTRAST_LOW 0x032#define ISPPRV_CONTRAST_HIGH 0xFF33#define ISPPRV_CONTRAST_UNITS 0x134 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 = 355};56 57/*58 * struct prev_params - Structure for all configuration59 * @busy: Bitmask of busy parameters (being updated or used)60 * @update: Bitmask of the parameters to be updated61 * @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 099#define PREV_PAD_SOURCE 1100#define PREV_PADS_NUM 2101 102/*103 * struct isp_prev_device - Structure for storing ISP Preview module information104 * @subdev: V4L2 subdevice105 * @pads: Media entity pads106 * @formats: Active formats at the subdev pad107 * @crop: Active crop rectangle108 * @input: Module currently connected to the input pad109 * @output: Bitmask of the active output110 * @video_in: Input video entity111 * @video_out: Output video entity112 * @params.params : Active and shadow parameters sets113 * @params.active: Bitmask of parameters active in set 0114 * @params.lock: Parameters lock, protects params.active and params.shadow115 * @underrun: Whether the preview entity has queued buffers on the output116 * @state: Current preview pipeline state117 *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