linux/drivers/media/platform/imagination/e5010-jpeg-enc-hw.h

43 lines
2.1 KiB
C
Raw Permalink Normal View History

media: imagination: Add E5010 JPEG Encoder driver This adds support for stateful V4L2 M2M based driver for Imagination E5010 JPEG Encoder [1] which supports baseline encoding with two different quantization tables and compression ratio as demanded. Support for both contiguous and non-contiguous YUV420 and YUV422 semiplanar formats is added along with alignment restrictions as required by the hardware. System and runtime PM hooks are added in the driver along with v4l2 crop and selection API support. Minimum resolution supported is 64x64 and Maximum resolution supported is 8192x8192. All v4l2-compliance tests are passing [2] : v4l2-compliance -s -f -a -d /dev/video0 -e /dev/video1 Total for e5010 device /dev/video0: 79, Succeeded: 79, Failed: 0, Warnings: 0 NOTE: video1 here is VIVID test pattern generator Also tests [3] were run manually to verify below driver features: - Runtime Power Management - Multi-instance JPEG Encoding - DMABUF import, export support - NV12, NV21, NV16, NV61 video format support - Compression quality S_CTRL - Cropping support using S_SELECTION Existing V4L2 M2M based JPEG drivers namely s5p-jpeg, imx-jpeg and rcar_jpu were referred while making this. TODO: Add MMU and memory tiling support [1]: AM62A TRM (Section 7.6 is for JPEG Encoder) : Link: https://www.ti.com/lit/pdf/spruj16 [2]: v4l2-compliance test : Link: https://gist.github.com/devarsht/1f039c631ca953a57f405cfce1b69e49 [3]: E5010 JPEG Encoder Manual tests : Performance: Link: https://gist.github.com/devarsht/c40672944fd71c9a53ab55adbfd9e28b Functionality: Link: https://gist.github.com/devarsht/8e88fcaabff016bb2bac83d89c9d23ce Compression Quality: Link: https://gist.github.com/devarsht/cbcc7cd97e8c48ba1486caa2b7884655 Multi Instance: Link: https://gist.github.com/devarsht/22c2fca08cd3441fb40f2c7a4cebc95a Crop support: Link: https://gist.github.com/devarsht/de6f5142f678bb1a5338abfd9f814abd Runtime PM: Link: https://gist.github.com/devarsht/70cd95d4440ddc678489d93885ddd4dd Co-developed-by: David Huang <d-huang@ti.com> Signed-off-by: David Huang <d-huang@ti.com> Signed-off-by: Devarsh Thakkar <devarsht@ti.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-06-19 01:06:47 +05:30
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Imagination E5010 JPEG Encoder driver.
*
* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
*
* Author: David Huang <d-huang@ti.com>
* Author: Devarsh Thakkar <devarsht@ti.com>
*/
#ifndef _E5010_JPEG_ENC_HW_H
#define _E5010_JPEG_ENC_HW_H
#include "e5010-core-regs.h"
#include "e5010-mmu-regs.h"
int e5010_hw_enable_output_address_error_irq(void __iomem *core_offset, u32 enable);
int e5010_hw_enable_picture_done_irq(void __iomem *core_offset, u32 enable);
int e5010_hw_enable_auto_clock_gating(void __iomem *core_offset, u32 enable);
int e5010_hw_enable_manual_clock_gating(void __iomem *core_offset, u32 enable);
int e5010_hw_enable_crc_check(void __iomem *core_offset, u32 enable);
int e5010_hw_set_input_source_to_memory(void __iomem *core_offset, u32 set);
int e5010_hw_set_input_luma_addr(void __iomem *core_offset, u32 val);
int e5010_hw_set_input_chroma_addr(void __iomem *core_offset, u32 val);
int e5010_hw_set_output_base_addr(void __iomem *core_offset, u32 val);
int e5010_hw_get_output_size(void __iomem *core_offset);
int e5010_hw_set_horizontal_size(void __iomem *core_offset, u32 val);
int e5010_hw_set_vertical_size(void __iomem *core_offset, u32 val);
int e5010_hw_set_luma_stride(void __iomem *core_offset, u32 bytesperline);
int e5010_hw_set_chroma_stride(void __iomem *core_offset, u32 bytesperline);
int e5010_hw_set_input_subsampling(void __iomem *core_offset, u32 val);
int e5010_hw_set_chroma_order(void __iomem *core_offset, u32 val);
int e5010_hw_set_qpvalue(void __iomem *core_offset, u32 offset, u32 value);
void e5010_reset(struct device *dev, void __iomem *core_offset, void __iomem *mmu_offset);
void e5010_hw_set_output_max_size(void __iomem *core_offset, u32 val);
void e5010_hw_clear_picture_done(void __iomem *core_offset, u32 clear);
void e5010_hw_encode_start(void __iomem *core_offset, u32 start);
void e5010_hw_clear_output_error(void __iomem *core_offset, u32 clear);
void e5010_hw_bypass_mmu(void __iomem *mmu_base, u32 enable);
bool e5010_hw_pic_done_irq(void __iomem *core_base);
bool e5010_hw_output_address_irq(void __iomem *core_base);
#endif