/* SPDX-License-Identifier: GPL-2.0-only */ /* linux/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.h * * Copyright (c) 2011 Samsung Electronics Co., Ltd. * http://www.samsung.com * * Author: Andrzej Pietrasiewicz <[email protected]> */ #ifndef JPEG_CORE_H_ #define JPEG_CORE_H_ #include <linux/interrupt.h> #include <media/jpeg.h> #include <media/v4l2-device.h> #include <media/v4l2-fh.h> #include <media/v4l2-ctrls.h> #define S5P_JPEG_M2M_NAME … #define JPEG_MAX_CLOCKS … /* JPEG compression quality setting */ #define S5P_JPEG_COMPR_QUAL_BEST … #define S5P_JPEG_COMPR_QUAL_WORST … /* JPEG RGB to YCbCr conversion matrix coefficients */ #define S5P_JPEG_COEF11 … #define S5P_JPEG_COEF12 … #define S5P_JPEG_COEF13 … #define S5P_JPEG_COEF21 … #define S5P_JPEG_COEF22 … #define S5P_JPEG_COEF23 … #define S5P_JPEG_COEF31 … #define S5P_JPEG_COEF32 … #define S5P_JPEG_COEF33 … #define EXYNOS3250_IRQ_TIMEOUT … /* Flags that indicate a format can be used for capture/output */ #define SJPEG_FMT_FLAG_ENC_CAPTURE … #define SJPEG_FMT_FLAG_ENC_OUTPUT … #define SJPEG_FMT_FLAG_DEC_CAPTURE … #define SJPEG_FMT_FLAG_DEC_OUTPUT … #define SJPEG_FMT_FLAG_S5P … #define SJPEG_FMT_FLAG_EXYNOS3250 … #define SJPEG_FMT_FLAG_EXYNOS4 … #define SJPEG_FMT_RGB … #define SJPEG_FMT_NON_RGB … #define S5P_JPEG_ENCODE … #define S5P_JPEG_DECODE … #define S5P_JPEG_DISABLE … #define FMT_TYPE_OUTPUT … #define FMT_TYPE_CAPTURE … #define SJPEG_SUBSAMPLING_444 … #define SJPEG_SUBSAMPLING_422 … #define SJPEG_SUBSAMPLING_420 … #define S5P_JPEG_MAX_MARKER … /* Version numbers */ enum sjpeg_version { … }; enum exynos4_jpeg_result { … }; enum exynos4_jpeg_img_quality_level { … }; enum s5p_jpeg_ctx_state { … }; /** * struct s5p_jpeg - JPEG IP abstraction * @lock: the mutex protecting this structure * @slock: spinlock protecting the device contexts * @v4l2_dev: v4l2 device for mem2mem mode * @vfd_encoder: video device node for encoder mem2mem mode * @vfd_decoder: video device node for decoder mem2mem mode * @m2m_dev: v4l2 mem2mem device data * @regs: JPEG IP registers mapping * @irq: JPEG IP irq * @irq_ret: JPEG IP irq result value * @clocks: JPEG IP clock(s) * @dev: JPEG IP struct device * @variant: driver variant to be used * @irq_status: interrupt flags set during single encode/decode * operation */ struct s5p_jpeg { … }; struct s5p_jpeg_variant { … }; /** * struct s5p_jpeg_fmt - driver's internal color format data * @fourcc: the fourcc code, 0 if not applicable * @depth: number of bits per pixel * @colplanes: number of color planes (1 for packed formats) * @memplanes: number of memory planes (1 for packed formats) * @h_align: horizontal alignment order (align to 2^h_align) * @v_align: vertical alignment order (align to 2^v_align) * @subsampling:subsampling of a raw format or a JPEG * @flags: flags describing format applicability */ struct s5p_jpeg_fmt { … }; /** * struct s5p_jpeg_marker - collection of markers from jpeg header * @marker: markers' positions relative to the buffer beginning * @len: markers' payload lengths (without length field) * @n: number of markers in collection */ struct s5p_jpeg_marker { … }; /** * struct s5p_jpeg_q_data - parameters of one queue * @fmt: driver-specific format of this queue * @w: image width * @h: image height * @sos: JPEG_MARKER_SOS's position relative to the buffer beginning * @dht: JPEG_MARKER_DHT' positions relative to the buffer beginning * @dqt: JPEG_MARKER_DQT' positions relative to the buffer beginning * @sof: JPEG_MARKER_SOF0's position relative to the buffer beginning * @sof_len: JPEG_MARKER_SOF0's payload length (without length field itself) * @size: image buffer size in bytes */ struct s5p_jpeg_q_data { … }; /** * struct s5p_jpeg_ctx - the device context data * @jpeg: JPEG IP device for this context * @mode: compression (encode) operation or decompression (decode) * @compr_quality: destination image quality in compression (encode) mode * @restart_interval: JPEG restart interval for JPEG encoding * @subsampling: subsampling of a raw format or a JPEG * @out_q: source (output) queue information * @cap_q: destination (capture) queue queue information * @scale_factor: scale factor for JPEG decoding * @crop_rect: a rectangle representing crop area of the output buffer * @fh: V4L2 file handle * @hdr_parsed: set if header has been parsed during decompression * @crop_altered: set if crop rectangle has been altered by the user space * @ctrl_handler: controls handler * @state: state of the context */ struct s5p_jpeg_ctx { … }; /** * struct s5p_jpeg_buffer - description of memory containing input JPEG data * @size: buffer size * @curr: current position in the buffer * @data: pointer to the data */ struct s5p_jpeg_buffer { … }; /** * struct s5p_jpeg_addr - JPEG converter physical address set for DMA * @y: luminance plane physical address * @cb: Cb plane physical address * @cr: Cr plane physical address */ struct s5p_jpeg_addr { … }; #endif /* JPEG_CORE_H */