From patchwork Mon Dec 9 08:38:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 180984 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4062844ile; Mon, 9 Dec 2019 00:39:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwIw/SIti79z4Kz399pjBVAaieebBmhlSU/1e63O/nIBKNpGOrQ4nxmwpUE4Ghr9BIz99Ir X-Received: by 2002:aca:b2c5:: with SMTP id b188mr16277049oif.55.1575880762702; Mon, 09 Dec 2019 00:39:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575880762; cv=none; d=google.com; s=arc-20160816; b=MHQDKOMmTg6lEtCsQWv6DW2hs53CpfC9uo1ePUT1FfzMfSQZ2BvqeTdF849l3XD/G3 SvJXvKMjyJrLfWZ7goCGcVyY3Z8MaO300QqIVG6dI0x4zxh/OpHb8fJJ26PssKu/mpj4 TUPpRgSNoyOG/qkoceca3hZChjz6N7iPwWeSgFMRCFHGZ1nXLLZUpEtTS6rZRt2gQJUT lH1QBrcL/DD/n+IIV/u4bAVDTph2JIzH6CS13x6xNFBWvGswHe1F9VhYvGnGgq3fts8V WyLG5krljEDfpS+Sna1GMIrvsyOUHHJBmgfeSHB+1u1jY6ib2rbeqCKxjbL8JnYEeAVT GoRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=He6t0UxaZpAmu7uu3983tFNonS2D3TSq+7lw5wWZaw4=; b=jIf5m+154kg3vzcmN52WMcm2ggtYgHONWMaddcdk6+JbTPWW1AHRg7h7/QSUQkwTJN PuyLzTh13mNdg8H7apqGh3xspvhrnskbfVkBk9tfBdzeeynmz0nmUR7xTuDqJK9YeOOm /DpAX4kmenj1towXAUm/SZX99amcNgmdic//naCBupVSVUhx7Pb6eNC5BANDwMOdiJ3g KgpdfeBL8e8h9RJN9wyb6gA4nXDgfN+rdAt3IyhAUjpGBhX3PleuVXb4Phq8zTh2P32/ hch+GS/JjUvTSZ8whtvCgpB6NTgQOzOaXaVNQG34CBMLL8qKi9cB256FURjhD8n3pG1B sZ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n7x3zaPS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p69si11960834oic.32.2019.12.09.00.39.22; Mon, 09 Dec 2019 00:39:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n7x3zaPS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727345AbfLIIjT (ORCPT + 27 others); Mon, 9 Dec 2019 03:39:19 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46838 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727306AbfLIIjS (ORCPT ); Mon, 9 Dec 2019 03:39:18 -0500 Received: by mail-lf1-f65.google.com with SMTP id f15so9173572lfl.13 for ; Mon, 09 Dec 2019 00:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=He6t0UxaZpAmu7uu3983tFNonS2D3TSq+7lw5wWZaw4=; b=n7x3zaPSm+SIgfnAzqehPd0Ye77W1oBMZ+fQegdK/G4C876Be+fF7to+xe+rruMqRe mMGdAd+oVM3Yazdrr/HiYHoXNCXkyeyLlDLcgzhiNadMHJXRlSGDrkQaMStVrgLikPx5 /ozr+FHlkpAHWtxCE5IjvPGqfIMwpXdi9nGmf6kuNuWHh/lSYIGUoQFesgyVJ/eJtfY+ ewrjENNWNO+0CxJXhA9himGXPEiADgXVqu0rIZiZ2no6k9D2erRztT2huyF1JYjowwXM O7kO1KcHE//XCOVUai1xc6zB2RplnzZB7oF9XNtn+vC0Rlbe7JYQhKTbZrkHO9hJk4xP 20YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=He6t0UxaZpAmu7uu3983tFNonS2D3TSq+7lw5wWZaw4=; b=Ezs1RcT6XTx3HPMKqDK2dVSv8wKVYWmRGTMBAp/P1mTsJDJot8TQI0G1ZohDg0YFYH lt1UNEF0aBg5DFYZMTNuQ4YGRhnGAnLCmcWjf5XbpOzJcZ3AuWFVfeMuabviXJtaQsGt X9hqUP8WdrY5aos5w9S+d9PbNoX4Wz77g5BP4DywGLDM5FD+Xrt8ymUj04IhpL1gOnBB 3xP/uSkKu+AewbttcjY2PjnJF94WHFYg8E9H6FZ5R8eBpHTaFMr7WE/1bojdFJ6TamZm Ov1NTR2r/EVOTdHBfOekMh2D2DyWt3CI4cSt5tbJ8YeCIK5wXSt2sJjJmna8r/LF4bA5 RfnA== X-Gm-Message-State: APjAAAUjf2NFFDepRrbF7wynHCfj+i0nOLGb6I0zOVYsn6YF4ACsDBHb lmLw25B/MsgzR0rhwAf4KeZA2w== X-Received: by 2002:a19:c3cc:: with SMTP id t195mr6029067lff.144.1575880755416; Mon, 09 Dec 2019 00:39:15 -0800 (PST) Received: from localhost.localdomain ([37.157.136.193]) by smtp.gmail.com with ESMTPSA id r26sm10438971lfm.82.2019.12.09.00.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 00:39:14 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: Vikash Garodia , Tomasz Figa , Aniket Masule , Stanimir Varbanov Subject: [PATCH 2/6] media: venus: introduce core selection Date: Mon, 9 Dec 2019 10:38:20 +0200 Message-Id: <20191209083824.806-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209083824.806-1-stanimir.varbanov@linaro.org> References: <20191209083824.806-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aniket Masule Presently the core (vcodec pipelines) assignment is static. Here we introduce dynamic load balancing across the cores depending on the current session load. The load on earch core is calculated and core with minimum load is assigned to given instance. This will be applicable on Venus v4 with more than one vcodec cores. Signed-off-by: Aniket Masule Co-developed-by: Stanimir Varbanov Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 3 + drivers/media/platform/qcom/venus/helpers.c | 17 +- drivers/media/platform/qcom/venus/helpers.h | 1 - .../media/platform/qcom/venus/hfi_helper.h | 1 + .../media/platform/qcom/venus/hfi_parser.h | 5 + .../media/platform/qcom/venus/pm_helpers.c | 173 ++++++++++++++++-- .../media/platform/qcom/venus/pm_helpers.h | 26 +++ drivers/media/platform/qcom/venus/vdec.c | 11 +- drivers/media/platform/qcom/venus/venc.c | 10 +- 9 files changed, 211 insertions(+), 36 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 179ff861a618..7efa5669dda3 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -177,6 +177,8 @@ struct venus_core { struct delayed_work work; struct venus_caps caps[MAX_CODEC_NUM]; unsigned int codecs_count; + unsigned int core0_usage_count; + unsigned int core1_usage_count; }; struct vdec_controls { @@ -375,6 +377,7 @@ struct venus_inst { const struct hfi_inst_ops *ops; u32 session_type; union hfi_get_property hprop; + unsigned int core_acquired: 1; }; #define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index cbeeaf6077e0..043e0d8705a8 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -723,21 +723,6 @@ int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode) } EXPORT_SYMBOL_GPL(venus_helper_set_work_mode); -int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage) -{ - const u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE; - struct hfi_videocores_usage_type cu; - - inst->clk_data.core_id = usage; - if (!IS_V4(inst->core)) - return 0; - - cu.video_core_enable_mask = usage; - - return hfi_session_set_property(inst, ptype, &cu); -} -EXPORT_SYMBOL_GPL(venus_helper_set_core_usage); - int venus_helper_init_codec_freq_data(struct venus_inst *inst) { const struct codec_freq_data *data; @@ -1101,6 +1086,8 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) else inst->streamon_cap = 0; + venus_pm_release_core(inst); + mutex_unlock(&inst->lock); } EXPORT_SYMBOL_GPL(venus_helper_vb2_stop_streaming); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 44b50914cd12..b64875564064 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -34,7 +34,6 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, u32 buftype); int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); int venus_helper_init_codec_freq_data(struct venus_inst *inst); -int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs, unsigned int output2_bufs); diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index b70551e296b7..2a47f6c0a07a 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -550,6 +550,7 @@ struct hfi_bitrate { #define HFI_CAPABILITY_LCU_SIZE 0x14 #define HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS 0x15 #define HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE 0x16 +#define HFI_CAPABILITY_MAX_VIDEOCORES 0x2b struct hfi_capability { u32 capability_type; diff --git a/drivers/media/platform/qcom/venus/hfi_parser.h b/drivers/media/platform/qcom/venus/hfi_parser.h index 3e931c747e19..264e6dd2415f 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.h +++ b/drivers/media/platform/qcom/venus/hfi_parser.h @@ -107,4 +107,9 @@ static inline u32 frate_step(struct venus_inst *inst) return cap_step(inst, HFI_CAPABILITY_FRAMERATE); } +static inline u32 core_num_max(struct venus_inst *inst) +{ + return cap_max(inst, HFI_CAPABILITY_MAX_VIDEOCORES); +} + #endif diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 4e4aace2d8c8..794c9210ea46 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -14,6 +14,7 @@ #include #include "core.h" +#include "hfi_parser.h" #include "hfi_venus_io.h" #include "pm_helpers.h" @@ -450,6 +451,163 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) return 0; } +static void +min_loaded_core(struct venus_inst *inst, u32 *min_coreid, u32 *min_load) +{ + u32 mbs_per_sec, load, core1_load = 0, core2_load = 0; + u32 cores_max = core_num_max(inst); + struct venus_core *core = inst->core; + struct venus_inst *inst_pos; + + mutex_lock(&core->lock); + + list_for_each_entry(inst_pos, &core->instances, list) { + if (inst_pos == inst) + continue; + mbs_per_sec = load_per_instance(inst_pos); + load = mbs_per_sec * + inst_pos->clk_data.codec_freq_data->vpp_freq; + if (inst_pos->clk_data.core_id & VIDC_CORE_ID_3) { + core1_load += load / 2; + core2_load += load / 2; + } else if (inst_pos->clk_data.core_id & VIDC_CORE_ID_1) { + core1_load += load; + } else if (inst_pos->clk_data.core_id & VIDC_CORE_ID_2) { + core2_load += load; + } + } + + *min_coreid = core1_load <= core2_load ? + VIDC_CORE_ID_1 : VIDC_CORE_ID_2; + *min_load = min(core1_load, core2_load); + + if (cores_max < VIDC_CORE_ID_2) { + *min_coreid = VIDC_CORE_ID_1; + *min_load = core1_load; + } + + mutex_unlock(&core->lock); +} + +static int decide_core(struct venus_inst *inst) +{ + const u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE; + struct venus_core *core = inst->core; + u32 min_coreid, min_load, inst_load; + struct hfi_videocores_usage_type cu; + unsigned long max_freq; + + if (legacy_binding) { + if (inst->session_type == VIDC_SESSION_TYPE_DEC) + cu.video_core_enable_mask = VIDC_CORE_ID_1; + else + cu.video_core_enable_mask = VIDC_CORE_ID_2; + + goto done; + } + + if (inst->clk_data.core_id != VIDC_CORE_ID_DEFAULT) + return 0; + + inst_load = load_per_instance(inst); + inst_load *= inst->clk_data.codec_freq_data->vpp_freq; + max_freq = core->res->freq_tbl[0].freq; + + min_loaded_core(inst, &min_coreid, &min_load); + + if ((inst_load + min_load) > max_freq) { + dev_warn(core->dev, "HW is overloaded, needed: %u max: %lu\n", + inst_load, max_freq); + return -EINVAL; + } + + inst->clk_data.core_id = min_coreid; + cu.video_core_enable_mask = min_coreid; + +done: + return hfi_session_set_property(inst, ptype, &cu); +} + +static int acquire_core(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + unsigned int coreid_mask; + + if (inst->core_acquired) + return 0; + + inst->core_acquired = true; + + if (inst->clk_data.core_id & VIDC_CORE_ID_1) { + if (core->core0_usage_count++) + return 0; + + coreid_mask = VIDC_CORE_ID_1; + } + + if (inst->clk_data.core_id & VIDC_CORE_ID_2) { + if (core->core1_usage_count++) + return 0; + + coreid_mask |= VIDC_CORE_ID_2; + } + + return poweron_coreid(core, coreid_mask); +} + +static int release_core(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + unsigned int coreid_mask; + int ret; + + if (!inst->core_acquired) + return 0; + + if (inst->clk_data.core_id & VIDC_CORE_ID_1) { + if (--core->core0_usage_count) + goto done; + + coreid_mask = VIDC_CORE_ID_1; + } + + if (inst->clk_data.core_id & VIDC_CORE_ID_2) { + if (--core->core1_usage_count) + goto done; + + coreid_mask |= VIDC_CORE_ID_2; + } + + ret = poweroff_coreid(core, coreid_mask); + if (ret) + return ret; + +done: + inst->clk_data.core_id = VIDC_CORE_ID_DEFAULT; + inst->core_acquired = false; + return 0; +} + +static int coreid_power_v4(struct venus_inst *inst, int on) +{ + int ret; + + if (legacy_binding) + return 0; + + if (on == POWER_ON) { + ret = decide_core(inst); + if (ret) + return ret; + + ret = acquire_core(inst); + } else { + ret = release_core(inst); + } + + return ret; +} + static int vdec_get_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -654,22 +812,12 @@ static void core_put_v4(struct device *dev) static int core_power_v4(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); - const unsigned int coreid_mask = VIDC_CORE_ID_1 | VIDC_CORE_ID_2; int ret = 0; - if (on == POWER_ON) { + if (on == POWER_ON) ret = core_clks_enable(core); - if (ret) - return ret; - - if (!legacy_binding) - ret = poweron_coreid(core, coreid_mask); - } else { - if (!legacy_binding) - ret = poweroff_coreid(core, coreid_mask); - + else core_clks_disable(core); - } return ret; } @@ -779,6 +927,7 @@ static const struct venus_pm_ops pm_ops_v4 = { .venc_get = venc_get_v4, .venc_put = venc_put_v4, .venc_power = venc_power_v4, + .coreid_power = coreid_power_v4, .load_scale = load_scale_v4, }; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index d98b6dc20740..aa2f6afa2354 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -21,6 +21,8 @@ struct venus_pm_ops { void (*venc_put)(struct device *dev); int (*venc_power)(struct device *dev, int on); + int (*coreid_power)(struct venus_inst *inst, int on); + int (*load_scale)(struct venus_inst *inst); }; @@ -36,4 +38,28 @@ static inline int venus_pm_load_scale(struct venus_inst *inst) return core->pm_ops->load_scale(inst); } +static inline int venus_pm_acquire_core(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + const struct venus_pm_ops *pm_ops = core->pm_ops; + int ret = 0; + + if (pm_ops && pm_ops->coreid_power) + ret = pm_ops->coreid_power(inst, POWER_ON); + + return ret; +} + +static inline int venus_pm_release_core(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + const struct venus_pm_ops *pm_ops = core->pm_ops; + int ret = 0; + + if (pm_ops && pm_ops->coreid_power) + ret = pm_ops->coreid_power(inst, POWER_OFF); + + return ret; +} + #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 83ce30516591..7b7a4f3377cf 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -579,10 +579,6 @@ static int vdec_output_conf(struct venus_inst *inst) if (ret) return ret; - ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_1); - if (ret) - return ret; - if (core->res->hfi_version == HFI_VERSION_1XX) { ptype = HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER; ret = hfi_session_set_property(inst, ptype, &en); @@ -951,6 +947,10 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) mutex_lock(&inst->lock); + ret = venus_pm_acquire_core(inst); + if (ret) + return ret; + if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) ret = vdec_start_capture(inst); else @@ -1078,6 +1078,7 @@ static void vdec_session_release(struct venus_inst *inst) venus_helper_free_dpb_bufs(inst); venus_pm_load_scale(inst); + venus_pm_release_core(inst); INIT_LIST_HEAD(&inst->registeredbufs); mutex_unlock(&inst->lock); @@ -1337,6 +1338,8 @@ static int vdec_open(struct file *file) inst->num_output_bufs = 1; inst->codec_state = VENUS_DEC_STATE_DEINIT; inst->buf_count = 0; + inst->clk_data.core_id = VIDC_CORE_ID_DEFAULT; + inst->core_acquired = false; init_waitqueue_head(&inst->reconf_wait); venus_helper_init_instance(inst); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 5fa1724cb537..4f594fe4b661 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -656,10 +656,6 @@ static int venc_set_properties(struct venus_inst *inst) if (ret) return ret; - ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_2); - if (ret) - return ret; - ptype = HFI_PROPERTY_CONFIG_FRAME_RATE; frate.buffer_type = HFI_BUFFER_OUTPUT; frate.framerate = inst->fps * (1 << 16); @@ -992,6 +988,10 @@ static int venc_start_streaming(struct vb2_queue *q, unsigned int count) if (ret) goto bufs_done; + ret = venus_pm_acquire_core(inst); + if (ret) + goto deinit_sess; + ret = venc_set_properties(inst); if (ret) goto deinit_sess; @@ -1160,6 +1160,8 @@ static int venc_open(struct file *file) inst->core = core; inst->session_type = VIDC_SESSION_TYPE_ENC; + inst->clk_data.core_id = VIDC_CORE_ID_DEFAULT; + inst->core_acquired = false; venus_helper_init_instance(inst); From patchwork Mon Dec 9 08:38:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 180988 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4063169ile; Mon, 9 Dec 2019 00:39:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxPpLo/wRNMoLeJ4HardnPvPIH8SQUVS+AjjU6f8AS35aQRD22iM0IuSQEM3thPojdvh4TT X-Received: by 2002:a05:6808:aba:: with SMTP id r26mr11972057oij.4.1575880784606; Mon, 09 Dec 2019 00:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575880784; cv=none; d=google.com; s=arc-20160816; b=GE0njQjTszFDTnQIqjosvAny5/P3Vc7sOzt+Spg4ijxH9Il+c9J/d1UG7ZehuLSHqO lqsnhLvFt374GWqjfFifV/NEpnvGRvIxgkXK0WfceJnmESkahX3WI6Q1gaolNYGXZ01T vc2TV+OzqwULBFExYKuZSrLG58B4XPZHYPHqu2q2jWpSA4kHV6grX0HpGi8jL3wVR+Ad CIeYbhzz+uUO1Pyi5eaEP6TGpqi3M+Ew5GUundhmuRXsnC3AD/irkITsWI+kLX6O5Myd Pcya3wK9476MZEFHA4oSFZxglnsz45oLDTaZl+f9wVNw+TTy+h6oyvGOwhLzgbVusgcm TKmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=v49ydhRHchofWzIVQxqpzPrTtsddtPryUTJT2t4dhHg=; b=wbQZHid6rfOMCSWEegmE2l+laRC2VO4sHzSqrHkT3rlUTpJK8+0zSXBNcYqsoQQ0LH WWnGaf6sDsN4/y2oYaThpISUctFciNa4HYjuSCe5XBfYh78J+8ST7PQXCZiybyySPwje D4SWoCrBC2037zf9bDdsqJkYCcHnIb8gL61IKO8QjqGa7WnRPVXHROWLWNcalQBrpuc2 J1l2abXOynjQxTchc1svN1KXFuMfFydaLaWl5JrDRpTuA1nDxPtJiSXsRxtlRWIk2bSs 91phifASEyhnJ5XvSDBR5Z/S745krOE4p9Ix60kK8fdlXFAltx7na4V0H8NHvDh64b8S J1Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v9gYohOs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si12091701otm.261.2019.12.09.00.39.44; Mon, 09 Dec 2019 00:39:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v9gYohOs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727433AbfLIIjn (ORCPT + 27 others); Mon, 9 Dec 2019 03:39:43 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33703 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727319AbfLIIjT (ORCPT ); Mon, 9 Dec 2019 03:39:19 -0500 Received: by mail-lj1-f194.google.com with SMTP id 21so14644078ljr.0 for ; Mon, 09 Dec 2019 00:39:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v49ydhRHchofWzIVQxqpzPrTtsddtPryUTJT2t4dhHg=; b=v9gYohOsVaW5DeUzwcntIszGR11cpCwA1aGZQI/0YtSyva2+iY9Ho4nwPh1XkuEEcs ePzEjiMXfOWUfjkuL6au580P6z9q6aTIQ4BAFKeXFDBtnUhU+aVTh0lEAgY4C7HCpSV9 ORwIprAIN+8zsxiBuym7PqglNRmEVQycLevLaHhL1ebSrdLLpkdVn/rdkrrGJkyYQf8v c/52xy2F25iRJr8xYXD9Nv2jRKO5G/tG/EsYycAbXnJ/v4Fz6AxBSvRdmt06fg7z7xF1 U0uhvGFU/i/H8jRdR5icC6XyPExufkNMMEEbkYwB0qS9424ytO17ogMD6Dgb8ahdoFI9 ukiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v49ydhRHchofWzIVQxqpzPrTtsddtPryUTJT2t4dhHg=; b=OM1OE6SP7VPhqJB3qE7bt805TdVPc15YbN+oak3vTeTU+il+fHa7SMhexoNKhy2P1w TQUoD0ZK6wyf5Gs6iANccTIwTLy7vZCE2paEmjG9n1of5RX3bkIPxIzThZXuahUB/Vfn v/hIUACshS/lyykJHvgCnB1PswK06885tn0eXyDBKa+WFWbrW2Qw6Zua0MqkkEyELOy3 h52ZBAS4Q/zfE+Vcfhp9N2Nkk4f/87qCpRIt5Rd1kwq4+AuSOGU3Ap9YswUe6CgnT0C6 L9rp8FG1ZM+MquXK8qC9ObzPvqyboFz2VopOxrS1FC6m2WssTv0dXrOtEcUM+dK1Unvv CkfQ== X-Gm-Message-State: APjAAAWjWRp5Egb8RAHeF8LOc5hAvQeOSxnhgAR1rkjbTeG2K59X9sXe H8DfbaJNvoRDjLsAnWNxgMIr2rC+X7c= X-Received: by 2002:a2e:808a:: with SMTP id i10mr15268982ljg.151.1575880757072; Mon, 09 Dec 2019 00:39:17 -0800 (PST) Received: from localhost.localdomain ([37.157.136.193]) by smtp.gmail.com with ESMTPSA id r26sm10438971lfm.82.2019.12.09.00.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 00:39:16 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH 3/6] arm64: dts: sdm845: move venus clocks and pmdomains in parent Date: Mon, 9 Dec 2019 10:38:21 +0200 Message-Id: <20191209083824.806-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209083824.806-1-stanimir.varbanov@linaro.org> References: <20191209083824.806-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move venus DT subnode resources like clocks and pmdomains in the parent Venus DT node. This will make possible to support dynamic core selection on Venus v4. Signed-off-by: Stanimir Varbanov --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index f406a4340b05..540028fed3ae 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -2571,29 +2571,30 @@ compatible = "qcom,sdm845-venus"; reg = <0 0x0aa00000 0 0xff000>; interrupts = ; - power-domains = <&videocc VENUS_GDSC>; + power-domains = <&videocc VENUS_GDSC>, + <&videocc VCODEC0_GDSC>, + <&videocc VCODEC1_GDSC>; + power-domain-names = "venus", "vcodec0", "vcodec1"; clocks = <&videocc VIDEO_CC_VENUS_CTL_CORE_CLK>, <&videocc VIDEO_CC_VENUS_AHB_CLK>, - <&videocc VIDEO_CC_VENUS_CTL_AXI_CLK>; - clock-names = "core", "iface", "bus"; + <&videocc VIDEO_CC_VENUS_CTL_AXI_CLK>, + <&videocc VIDEO_CC_VCODEC0_CORE_CLK>, + <&videocc VIDEO_CC_VCODEC0_AXI_CLK>, + <&videocc VIDEO_CC_VCODEC1_CORE_CLK>, + <&videocc VIDEO_CC_VCODEC1_AXI_CLK>; + clock-names = "core", "iface", "bus", + "vcodec0_core", "vcodec0_bus", + "vcodec1_core", "vcodec1_bus"; iommus = <&apps_smmu 0x10a0 0x8>, <&apps_smmu 0x10b0 0x0>; memory-region = <&venus_mem>; video-core0 { compatible = "venus-decoder"; - clocks = <&videocc VIDEO_CC_VCODEC0_CORE_CLK>, - <&videocc VIDEO_CC_VCODEC0_AXI_CLK>; - clock-names = "core", "bus"; - power-domains = <&videocc VCODEC0_GDSC>; }; video-core1 { compatible = "venus-encoder"; - clocks = <&videocc VIDEO_CC_VCODEC1_CORE_CLK>, - <&videocc VIDEO_CC_VCODEC1_AXI_CLK>; - clock-names = "core", "bus"; - power-domains = <&videocc VCODEC1_GDSC>; }; }; From patchwork Mon Dec 9 08:38:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 180987 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4063031ile; Mon, 9 Dec 2019 00:39:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzE9OnKeWqMPnmHb/KQo1GPc29RkXbDVycRGzMMdD/9bI1x4g7iEXugWcPd6Jsmoom/tP4E X-Received: by 2002:aca:ed46:: with SMTP id l67mr22682213oih.53.1575880774359; Mon, 09 Dec 2019 00:39:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575880774; cv=none; d=google.com; s=arc-20160816; b=I7DutUlm3EyxW9pEw9N55/FsGXRWFmlQMaqWmrlsKXv+bGaexN9fyBdlK0vnTH0NXG +jyCjPAwNzMxPWBkjdtkEsRcIFUVVil+J5jKfpCdbL/xXEWWZkIv3Bx+yWtZWPmWaxy/ O8/O2+b09NgFSeW60ubq33+XlMie33B8iFlm4BZDhF3rfI/JGqsijujjUa2ve3Az13yw wjcSWtutmX6V8P8erMON6yJ3hse0Fa5PyUvx5/EwNjf1AYA33ggSy0eGuFPvFxCUKIkk 0LxRY4R61HdgZHZse1+8DW6pUeob+zE/pHE1zBVGU8CapT5yofXHAuxwKlqTgCVEFnj7 pjSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=M6xBk2t3JSq6Gm+btMkUw0HvLbeKjwldK9lPc/9p6IU=; b=MoYC2kxstnTos+W0/gmpC87WZG8L0gFgQbm240nvU6pWgWWPtbp47zhVaJBhUIFqwt A1vZANxhsFH9CIxMuHz92nZZ10FvBOo5YBviEVYuKY+Nm4vaLMTZzwApS36gNN8M9dIx /IP3QL8l2XlE9bof8H7QOKh1FAG3ReB901yn7bQpfi1BrL3jV8aM+5YucrTTrh1RYEga 1rg5X36mVnbQEvVqrN5ybO89vTBLsG3UzIn/iscwdfRsMyw8rGcNCMpoAvZzkvIUlbDV +1N2vKAirEMWIYdkE2t76fFWE1xQdGlbFJgtcU6uy2dXIGj6pbmt0gi47fuSkQMOqomE +CXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vFQKn9Bv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si11172049otp.143.2019.12.09.00.39.33; Mon, 09 Dec 2019 00:39:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vFQKn9Bv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727378AbfLIIjX (ORCPT + 27 others); Mon, 9 Dec 2019 03:39:23 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33704 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727334AbfLIIjU (ORCPT ); Mon, 9 Dec 2019 03:39:20 -0500 Received: by mail-lj1-f193.google.com with SMTP id 21so14644139ljr.0 for ; Mon, 09 Dec 2019 00:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M6xBk2t3JSq6Gm+btMkUw0HvLbeKjwldK9lPc/9p6IU=; b=vFQKn9BvVVUUQ4Y9uusSgffYFjQKPOk2bHHTZorOpYzW/4FB9kB6JzD1XbXDirsL66 NJhJcFSJBS9/9nXEbtC4h3cl0FQ9w3y0WHYi/zqUm06sd3JfJjSIfaZTPQfTVEvIL9Nx kwThT+MoV+y5uvtbP83Hoe1MPxjqQyz9E2MYnYL7N3U7Vt6onDSv+PlqO/P0Fxto37YB 9zAywrd1pHIk68ouG2NpoiLA4GEz04/VVpDXnRTcMbH9d5jo4uQBhJcUBy8qFLL1JgVM rD/gDDq6nMW+NtJi+oVMZx/sL53+sIDMBMcspigWp//UCstQBEPwEJqCo+xH8CoXmcCQ Z5UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M6xBk2t3JSq6Gm+btMkUw0HvLbeKjwldK9lPc/9p6IU=; b=QpjltNSXe+PYqt5cSpDScKcyjQ8ggi+C/+BzZ72aKJAJVE+PeoMK4YCXVXxPGYyHZa 1qYoL2RuNwmmtDsmUqsT7kBM4mJHHXsG4g/dI1lixXAKGNoC7aVV1Z5p6hnmWiCa03si dy+nGEfIfivZMXS7+6/3Zz6JT5577Zt9ZXL0iT74iZ/9EBEbVx67hn7Pzf3PkFC8uU9U B8kLZTgl9Nq3ulUEoJFSd7leb4s9xLpJMcw9E5wVdcmtdzhjalPxb4lXLQawGDyJ/0BW mshPwgR4FDIJqGT/2FotBF13j8tCO7gKO0gi/fpiiVf2jk0bMK4xgjIeIy7Yrs+xQnIr Pebg== X-Gm-Message-State: APjAAAUzI3ydpS8vWf+QYkRdY53gmxkaOE9+I5iUgbBhd0OC0z3Zjxuw 219+dG9HF2B7paaHyhgVlTze7Q== X-Received: by 2002:a2e:844e:: with SMTP id u14mr12502198ljh.183.1575880758682; Mon, 09 Dec 2019 00:39:18 -0800 (PST) Received: from localhost.localdomain ([37.157.136.193]) by smtp.gmail.com with ESMTPSA id r26sm10438971lfm.82.2019.12.09.00.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 00:39:18 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH 4/6] dt-bindings: media: venus: describe sdm845 with optional pmdomains Date: Mon, 9 Dec 2019 10:38:22 +0200 Message-Id: <20191209083824.806-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209083824.806-1-stanimir.varbanov@linaro.org> References: <20191209083824.806-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Describe an optional DT binding for sdm845 with power-domain-names and clocks in Venus DT node. After that the binding for sdm845 will have two options, the first will be to describe vcodec clocks and pmdomains in (encoder and decoder) subnodes and the second will be to describe vcodec clocks and pmdomains in the Venus DT node (the parent). Both option will be handled in driver, and the second one will give an opportunity to the driver to dynamically assign vcodec pipelines for every given instance depending on its load. Signed-off-by: Stanimir Varbanov --- .../devicetree/bindings/media/qcom,venus.txt | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt index b602c4c025e7..69a104fcb8eb 100644 --- a/Documentation/devicetree/bindings/media/qcom,venus.txt +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt @@ -35,6 +35,21 @@ - "iface" Video accelerator AHB clock - "bus" Video accelerator AXI clock - "mbus" Video MAXI clock +- clock-names: + Usage: required for sdm845 + Value type: + Definition: Should contain the following entries: + - "core" Core video accelerator clock + - "iface" Video accelerator AHB clock + - "bus" Video accelerator AXI clock +- clock-names: + Usage: optional for sdm845 + Value type: + Definition: Should contain the following entries: + - "vcodec0_core" Codec0 core clock + - "vcodec0_bus" Codec0 AXI clock + - "vcodec1_core" Codec1 core clock + - "vcoded1_bus" Codec1 AXI clock - power-domains: Usage: required Value type: @@ -72,7 +87,12 @@ Every of video-encoder or video-decoder subnode should have: Value type: Definition: Should contain the following entries: - "core" Subcore video accelerator clock - +- clock-names: + Usage: required for sdm845 + Value type: + Definition: Should contain the following entries: + - "core" Video codec accelerator clock + - "bus" Video codec AXI clock - power-domains: Usage: required for msm8996 Value type: