File Index
Files and directories
Sign in
FILE

camss-format.h

File preview with syntax highlighting.

linux-6.19.14/drivers/media/platform/qcom/camss/camss-format.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * camss-format.h
 4 *
 5 * Qualcomm MSM Camera Subsystem - Format helpers
 6 *
 7 * Copyright (c) 2023, The Linux Foundation. All rights reserved.
 8 * Copyright (c) 2023 Qualcomm Technologies, Inc.
 9 */
10#ifndef __CAMSS_FORMAT_H__
11#define __CAMSS_FORMAT_H__
12
13#include <linux/types.h>
14
15#define PER_PLANE_DATA(plane, h_fract_num, h_fract_den, v_fract_num, v_fract_den, _bpp)         \
16	.hsub[(plane)].numerator	= (h_fract_num),                                        \
17	.hsub[(plane)].denominator	= (h_fract_den),                                        \
18	.vsub[(plane)].numerator	= (v_fract_num),                                        \
19	.vsub[(plane)].denominator	= (v_fract_den),                                        \
20	.bpp[(plane)]			= (_bpp)
21
22/*
23 * struct fract - Represents a fraction
24 * @numerator: Store the numerator part of the fraction
25 * @denominator: Store the denominator part of the fraction
26 */
27struct fract {
28	u8 numerator;
29	u8 denominator;
30};
31
32/*
33 * struct camss_format_info - ISP media bus format information
34 * @code: V4L2 media bus format code
35 * @mbus_bpp: Media bus bits per pixel
36 * @pixelformat: V4L2 pixel format FCC identifier
37 * @planes: Number of planes
38 * @hsub: Horizontal subsampling (for each plane)
39 * @vsub: Vertical subsampling (for each plane)
40 * @bpp: Bits per pixel when stored in memory (for each plane)
41 */
42struct camss_format_info {
43	u32 code;
44	u32 mbus_bpp;
45	u32 pixelformat;
46	u8 planes;
47	struct fract hsub[3];
48	struct fract vsub[3];
49	unsigned int bpp[3];
50};
51
52struct camss_formats {
53	unsigned int nformats;
54	const struct camss_format_info *formats;
55};
56
57u8 camss_format_get_bpp(const struct camss_format_info *formats, unsigned int nformats, u32 code);
58u32 camss_format_find_code(u32 *code, unsigned int n_code, unsigned int index, u32 req_code);
59int camss_format_find_format(u32 code, u32 pixelformat, const struct camss_format_info *formats,
60			     unsigned int nformats);
61
62#endif /* __CAMSS_FORMAT_H__ */
~/ Read-only file preview.