Skip to content

Commit 7d67edc

Browse files
lumagdikshita-agarwal
authored andcommitted
FROMGIT: media: iris: enable support for SC7280 platform
As a part of migrating code from the old Venus driver to the new Iris one, add support for the SC7280 platform. It is very similar to SM8250, but it (currently) uses no reset controls (there is an optional GCC-generated reset, it will be added later) and no AON registers region. Extend the VPU ops to support optional clocks and skip the AON shutdown for this platform. Link: https://gitlab.freedesktop.org/linux-media/media-committers/-/commit/542e3540ddd75f0a46dd365978476bcc1dda5b5a Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Vikash Garodia <[email protected]> Reviewed-by: Dikshita Agarwal <[email protected]>
1 parent d10e1ac commit 7d67edc

File tree

7 files changed

+119
-10
lines changed

7 files changed

+119
-10
lines changed

drivers/media/platform/qcom/iris/iris_platform_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum pipe_type {
4242
};
4343

4444
extern const struct iris_platform_data qcs8300_data;
45+
extern const struct iris_platform_data sc7280_data;
4546
extern const struct iris_platform_data sm8250_data;
4647
extern const struct iris_platform_data sm8550_data;
4748
extern const struct iris_platform_data sm8650_data;
@@ -50,7 +51,9 @@ extern const struct iris_platform_data sm8750_data;
5051
enum platform_clk_type {
5152
IRIS_AXI_CLK, /* AXI0 in case of platforms with multiple AXI clocks */
5253
IRIS_CTRL_CLK,
54+
IRIS_AHB_CLK,
5355
IRIS_HW_CLK,
56+
IRIS_HW_AHB_CLK,
5457
IRIS_AXI1_CLK,
5558
IRIS_CTRL_FREERUN_CLK,
5659
IRIS_HW_FREERUN_CLK,
@@ -224,6 +227,7 @@ struct iris_platform_data {
224227
u32 hw_response_timeout;
225228
struct ubwc_config_data *ubwc_config;
226229
u32 num_vpp_pipe;
230+
bool no_aon;
227231
u32 max_session_count;
228232
/* max number of macroblocks per frame supported */
229233
u32 max_core_mbpf;

drivers/media/platform/qcom/iris/iris_platform_gen1.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "iris_vpu_buffer.h"
1313
#include "iris_vpu_common.h"
1414

15+
#include "iris_platform_sc7280.h"
16+
1517
#define BITRATE_MIN 32000
1618
#define BITRATE_MAX 160000000
1719
#define BITRATE_PEAK_DEFAULT (BITRATE_DEFAULT * 2)
@@ -362,3 +364,54 @@ const struct iris_platform_data sm8250_data = {
362364
.enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl,
363365
.enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl),
364366
};
367+
368+
const struct iris_platform_data sc7280_data = {
369+
.get_instance = iris_hfi_gen1_get_instance,
370+
.init_hfi_command_ops = &iris_hfi_gen1_command_ops_init,
371+
.init_hfi_response_ops = iris_hfi_gen1_response_ops_init,
372+
.get_vpu_buffer_size = iris_vpu_buf_size,
373+
.vpu_ops = &iris_vpu2_ops,
374+
.set_preset_registers = iris_set_sm8250_preset_registers,
375+
.icc_tbl = sm8250_icc_table,
376+
.icc_tbl_size = ARRAY_SIZE(sm8250_icc_table),
377+
.bw_tbl_dec = sc7280_bw_table_dec,
378+
.bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec),
379+
.pmdomain_tbl = sm8250_pmdomain_table,
380+
.pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table),
381+
.opp_pd_tbl = sc7280_opp_pd_table,
382+
.opp_pd_tbl_size = ARRAY_SIZE(sc7280_opp_pd_table),
383+
.clk_tbl = sc7280_clk_table,
384+
.clk_tbl_size = ARRAY_SIZE(sc7280_clk_table),
385+
/* Upper bound of DMA address range */
386+
.dma_mask = 0xe0000000 - 1,
387+
.fwname = "qcom/vpu/vpu20_p1.mbn",
388+
.pas_id = IRIS_PAS_ID,
389+
.inst_caps = &platform_inst_cap_sm8250,
390+
.inst_fw_caps_dec = inst_fw_cap_sm8250_dec,
391+
.inst_fw_caps_dec_size = ARRAY_SIZE(inst_fw_cap_sm8250_dec),
392+
.inst_fw_caps_enc = inst_fw_cap_sm8250_enc,
393+
.inst_fw_caps_enc_size = ARRAY_SIZE(inst_fw_cap_sm8250_enc),
394+
.tz_cp_config_data = &tz_cp_config_sm8250,
395+
.hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
396+
.num_vpp_pipe = 1,
397+
.no_aon = true,
398+
.max_session_count = 16,
399+
.max_core_mbpf = 4096 * 2176 / 256 * 2 + 1920 * 1088 / 256,
400+
/* max spec for SC7280 is 4096x2176@60fps */
401+
.max_core_mbps = 4096 * 2176 / 256 * 60,
402+
.dec_input_config_params_default =
403+
sm8250_vdec_input_config_param_default,
404+
.dec_input_config_params_default_size =
405+
ARRAY_SIZE(sm8250_vdec_input_config_param_default),
406+
.enc_input_config_params = sm8250_venc_input_config_param,
407+
.enc_input_config_params_size =
408+
ARRAY_SIZE(sm8250_venc_input_config_param),
409+
410+
.dec_ip_int_buf_tbl = sm8250_dec_ip_int_buf_tbl,
411+
.dec_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_dec_ip_int_buf_tbl),
412+
.dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl,
413+
.dec_op_int_buf_tbl_size = ARRAY_SIZE(sm8250_dec_op_int_buf_tbl),
414+
415+
.enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl,
416+
.enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl),
417+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
*/
5+
6+
#ifndef __IRIS_PLATFORM_SC7280_H__
7+
#define __IRIS_PLATFORM_SC7280_H__
8+
9+
static const struct bw_info sc7280_bw_table_dec[] = {
10+
{ ((3840 * 2160) / 256) * 60, 1896000, },
11+
{ ((3840 * 2160) / 256) * 30, 968000, },
12+
{ ((1920 * 1080) / 256) * 60, 618000, },
13+
{ ((1920 * 1080) / 256) * 30, 318000, },
14+
};
15+
16+
static const char * const sc7280_opp_pd_table[] = { "cx" };
17+
18+
static const struct platform_clk_data sc7280_clk_table[] = {
19+
{IRIS_CTRL_CLK, "core" },
20+
{IRIS_AXI_CLK, "iface" },
21+
{IRIS_AHB_CLK, "bus" },
22+
{IRIS_HW_CLK, "vcodec_core" },
23+
{IRIS_HW_AHB_CLK, "vcodec_bus" },
24+
};
25+
26+
#endif

drivers/media/platform/qcom/iris/iris_probe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ static const struct of_device_id iris_dt_match[] = {
357357
.data = &qcs8300_data,
358358
},
359359
#if (!IS_ENABLED(CONFIG_VIDEO_QCOM_VENUS))
360+
{
361+
.compatible = "qcom,sc7280-venus",
362+
.data = &sc7280_data,
363+
},
360364
{
361365
.compatible = "qcom,sm8250-venus",
362366
.data = &sm8250_data,

drivers/media/platform/qcom/iris/iris_resources.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int iris_prepare_enable_clock(struct iris_core *core, enum platform_clk_type clk
112112

113113
clock = iris_get_clk_by_type(core, clk_type);
114114
if (!clock)
115-
return -EINVAL;
115+
return -ENOENT;
116116

117117
return clk_prepare_enable(clock);
118118
}

drivers/media/platform/qcom/iris/iris_vpu2.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
44
*/
55

6+
#include <linux/bits.h>
7+
#include <linux/iopoll.h>
8+
#include <linux/reset.h>
9+
610
#include "iris_instance.h"
711
#include "iris_vpu_common.h"
812

13+
#include "iris_vpu_register_defines.h"
14+
915
static u64 iris_vpu2_calc_freq(struct iris_inst *inst, size_t data_size)
1016
{
1117
struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps;

drivers/media/platform/qcom/iris/iris_vpu_common.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,14 @@ int iris_vpu_power_off_controller(struct iris_core *core)
222222

223223
writel(MSK_SIGNAL_FROM_TENSILICA | MSK_CORE_POWER_ON, core->reg_base + CPU_CS_X2RPMH);
224224

225-
writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL);
225+
if (!core->iris_platform_data->no_aon) {
226+
writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL);
226227

227-
ret = readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS,
228-
val, val & BIT(0), 200, 2000);
229-
if (ret)
230-
goto disable_power;
228+
ret = readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS,
229+
val, val & BIT(0), 200, 2000);
230+
if (ret)
231+
goto disable_power;
232+
}
231233

232234
writel(REQ_POWER_DOWN_PREP, core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_CONTROL);
233235

@@ -250,6 +252,7 @@ int iris_vpu_power_off_controller(struct iris_core *core)
250252
writel(0x0, core->reg_base + WRAPPER_TZ_CTL_AXI_CLOCK_CONFIG);
251253

252254
disable_power:
255+
iris_disable_unprepare_clock(core, IRIS_AHB_CLK);
253256
iris_disable_unprepare_clock(core, IRIS_CTRL_CLK);
254257
iris_disable_unprepare_clock(core, IRIS_AXI_CLK);
255258
iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
@@ -261,6 +264,7 @@ void iris_vpu_power_off_hw(struct iris_core *core)
261264
{
262265
dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN], false);
263266
iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN]);
267+
iris_disable_unprepare_clock(core, IRIS_HW_AHB_CLK);
264268
iris_disable_unprepare_clock(core, IRIS_HW_CLK);
265269
}
266270

@@ -294,11 +298,17 @@ int iris_vpu_power_on_controller(struct iris_core *core)
294298

295299
ret = iris_prepare_enable_clock(core, IRIS_CTRL_CLK);
296300
if (ret)
297-
goto err_disable_clock;
301+
goto err_disable_axi_clock;
302+
303+
ret = iris_prepare_enable_clock(core, IRIS_AHB_CLK);
304+
if (ret && ret != -ENOENT)
305+
goto err_disable_ctrl_clock;
298306

299307
return 0;
300308

301-
err_disable_clock:
309+
err_disable_ctrl_clock:
310+
iris_disable_unprepare_clock(core, IRIS_CTRL_CLK);
311+
err_disable_axi_clock:
302312
iris_disable_unprepare_clock(core, IRIS_AXI_CLK);
303313
err_disable_power:
304314
iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
@@ -318,13 +328,19 @@ int iris_vpu_power_on_hw(struct iris_core *core)
318328
if (ret)
319329
goto err_disable_power;
320330

331+
ret = iris_prepare_enable_clock(core, IRIS_HW_AHB_CLK);
332+
if (ret && ret != -ENOENT)
333+
goto err_disable_hw_clock;
334+
321335
ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN], true);
322336
if (ret)
323-
goto err_disable_clock;
337+
goto err_disable_hw_ahb_clock;
324338

325339
return 0;
326340

327-
err_disable_clock:
341+
err_disable_hw_ahb_clock:
342+
iris_disable_unprepare_clock(core, IRIS_HW_AHB_CLK);
343+
err_disable_hw_clock:
328344
iris_disable_unprepare_clock(core, IRIS_HW_CLK);
329345
err_disable_power:
330346
iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN]);

0 commit comments

Comments
 (0)