Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 */
5
6#ifndef __IRIS_HFI_GEN2_PACKET_H__
7#define __IRIS_HFI_GEN2_PACKET_H__
8
9#include "iris_hfi_gen2_defines.h"
10
11struct iris_core;
12
13/**
14 * struct iris_hfi_header
15 *
16 * @size: size of the total packet in bytes including hfi_header
17 * @session_id: For session level hfi_header session_id is non-zero.
18 * For system level hfi_header session_id is zero.
19 * @header_id: unique header id for each hfi_header
20 * @reserved: reserved for future use
21 * @num_packets: number of hfi_packet that are included with the hfi_header
22 */
23struct iris_hfi_header {
24 u32 size;
25 u32 session_id;
26 u32 header_id;
27 u32 reserved[4];
28 u32 num_packets;
29};
30
31/**
32 * struct iris_hfi_packet
33 *
34 * @size: size of the hfi_packet in bytes including payload
35 * @type: one of the below hfi_packet types:
36 * HFI_CMD_*,
37 * HFI_PROP_*,
38 * HFI_ERROR_*,
39 * HFI_INFO_*,
40 * HFI_SYS_ERROR_*
41 * @flags: hfi_packet flags. It is represented as bit masks.
42 * host packet flags are "enum hfi_packet_host_flags"
43 * firmware packet flags are "enum hfi_packet_firmware_flags"
44 * @payload_info: payload information indicated by "enum hfi_packet_payload_info"
45 * @port: hfi_packet port type indicated by "enum hfi_packet_port_type"
46 * This is bitmask and may be applicable to multiple ports.
47 * @packet_id: host hfi_packet contains unique packet id.
48 * firmware returns host packet id in response packet
49 * wherever applicable. If not applicable firmware sets it to zero.
50 * @reserved: reserved for future use.
51 * @payload: flexible array of payload having additional packet information.
52 */
53struct iris_hfi_packet {
54 u32 size;
55 u32 type;
56 u32 flags;
57 u32 payload_info;
58 u32 port;
59 u32 packet_id;
60 u32 reserved[2];
61 u32 payload[];
62};
63
64/**
65 * struct iris_hfi_buffer
66 *
67 * @type: buffer type indicated by "enum hfi_buffer_type"
68 * FW needs to return proper type for any buffer command.
69 * @index: index of the buffer
70 * @base_address: base address of the buffer.
71 * This buffer address is always 4KBytes aligned.
72 * @addr_offset: accessible buffer offset from base address
73 * Decoder bitstream buffer: 256 Bytes aligned
74 * Firmware can uniquely identify a buffer based on
75 * base_address & addr_offset.
76 * HW can read memory only from base_address+addr_offset.
77 * @buffer_size: accessible buffer size in bytes starting from addr_offset
78 * @data_offset: data starts from "base_address + addr_offset + data_offset"
79 * RAW buffer: data_offset is 0. Restriction: 4KBytes aligned
80 * decoder bitstream buffer: no restriction (can be any value)
81 * @data_size: data size in bytes
82 * @flags: buffer flags. It is represented as bit masks.
83 * host buffer flags are "enum hfi_buffer_host_flags"
84 * firmware buffer flags are "enum hfi_buffer_firmware_flags"
85 * @timestamp: timestamp of the buffer in nano seconds (ns)
86 * It is Presentation timestamp (PTS) for encoder & decoder.
87 * Decoder: it is pass through from bitstream to raw buffer.
88 * firmware does not need to return as part of input buffer done.
89 * For any internal buffers: there is no timestamp. Host sets as 0.
90 * @reserved: reserved for future use
91 */
92struct iris_hfi_buffer {
93 u32 type;
94 u32 index;
95 u64 base_address;
96 u32 addr_offset;
97 u32 buffer_size;
98 u32 data_offset;
99 u32 data_size;
100 u64 timestamp;
101 u32 flags;
102 u32 reserved[5];
103};
104
105u32 iris_hfi_gen2_get_color_primaries(u32 primaries);
106u32 iris_hfi_gen2_get_transfer_char(u32 characterstics);
107u32 iris_hfi_gen2_get_matrix_coefficients(u32 coefficients);
108u32 iris_hfi_gen2_get_color_info(u32 matrix_coeff, u32 transfer_char, u32 primaries,
109 u32 colour_description_present_flag, u32 full_range,
110 u32 video_format, u32 video_signal_type_present_flag);
111
112void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_header *hdr);
113void iris_hfi_gen2_packet_image_version(struct iris_core *core, struct iris_hfi_header *hdr);
114void iris_hfi_gen2_packet_session_command(struct iris_inst *inst, u32 pkt_type,
115 u32 flags, u32 port, u32 session_id,
116 u32 payload_type, void *payload,
117 u32 payload_size);
118void iris_hfi_gen2_packet_session_property(struct iris_inst *inst,
119 u32 pkt_type, u32 flags, u32 port,
120 u32 payload_type, void *payload, u32 payload_size);
121void iris_hfi_gen2_packet_sys_interframe_powercollapse(struct iris_core *core,
122 struct iris_hfi_header *hdr);
123void iris_hfi_gen2_packet_sys_pc_prep(struct iris_core *core, struct iris_hfi_header *hdr);
124
125#endif