mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dikshita Agarwal <quic_dikshita@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
	<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stanimir.k.varbanov@gmail.com>, <quic_vgarodia@quicinc.com>,
	<agross@kernel.org>, <andersson@kernel.org>, <mchehab@kernel.org>,
	<bryan.odonoghue@linaro.org>
Cc: <linux-arm-msm@vger.kernel.org>, <quic_abhinavk@quicinc.com>
Subject: Re: [PATCH v2 07/34] media: iris: initialize power resources
Date: Wed, 20 Dec 2023 13:34:38 +0530	[thread overview]
Message-ID: <5c3c686a-1500-7261-b112-1ea94d9e346e@quicinc.com> (raw)
In-Reply-To: <6c2e7cac-6f3d-42f0-84de-72a14e8f9ef5@linaro.org>



On 12/18/2023 8:39 PM, Konrad Dybcio wrote:
> On 18.12.2023 12:32, Dikshita Agarwal wrote:
>> Add support for initializing Iris "resources", which are clocks,
>> interconnects, power domains, reset clocks, and clock frequencies
>> used for Iris hardware.
>>
>> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>> ---
> [...]
> 
>> +	ret = init_resources(core);
>> +	if (ret) {
>> +		dev_err_probe(core->dev, ret,
>> +			      "%s: init resource failed with %d\n", __func__, ret);
>> +		return ret;
> You're supposed to return dev_err_probe, it propagates the errors
> this way
> 
Sure, fix this.
> Also, I think __func__ is excessive, throughout the code. You can
> very quickly grep for the error messages, which are quite unique.
> 
Ok, will remove __func__
> [...]
> 
>> +
>> +static const struct bus_info plat_bus_table[] = {
>> +	{ NULL, "iris-cnoc", 1000, 1000     },
>> +	{ NULL, "iris-ddr",  1000, 15000000 },
>> +};
>> +
>> +static const char * const plat_pd_table[] = { "iris-ctl", "vcodec", NULL };
>> +#define PD_COUNT 2
>> +
>> +static const char * const plat_opp_pd_table[] = { "mxc", "mmcx", NULL };
>> +#define OPP_PD_COUNT 2
>> +
>> +static const struct clock_info plat_clk_table[] = {
>> +	{ NULL, "gcc_video_axi0", GCC_VIDEO_AXI0_CLK, 0, 0 },
>> +	{ NULL, "core_clk",       VIDEO_CC_MVS0C_CLK, 0, 0 },
>> +	{ NULL, "vcodec_core",    VIDEO_CC_MVS0_CLK,  1, 0 },
>> +};
>> +
>> +static const char * const plat_clk_reset_table[] = { "video_axi_reset", NULL };
>> +#define RESET_COUNT 1
> Are you sure this won't change between platforms?
> [...]
> 
yes, these will change, but since at this point in the patches, I have not
introduced platform specific file, added these tables here.
I am moving these to platform specific file when I introduce that in
patch-13 [1].

[1]
https://patchwork.kernel.org/project/linux-media/patch/1702899149-21321-14-git-send-email-quic_dikshita@quicinc.com/
>> +static int init_bus(struct iris_core *core)
>> +{
>> +	struct bus_info *binfo = NULL;
>> +	u32 i = 0;
> no need to initialize
> 
Sure, will fix.
> [...]
> 
>> +static int init_clocks(struct iris_core *core)
>> +{
>> +	struct clock_info *cinfo = NULL;
>> +	u32 i;
>> +
>> +	core->clk_count = ARRAY_SIZE(plat_clk_table);
>> +	core->clock_tbl = devm_kzalloc(core->dev,
>> +				       sizeof(struct clock_info) * core->clk_count,
>> +				       GFP_KERNEL);
>> +	if (!core->clock_tbl)
>> +		return -ENOMEM;
>> +
>> +	for (i = 0; i < core->clk_count; i++) {
>> +		cinfo = &core->clock_tbl[i];
>> +		cinfo->name = plat_clk_table[i].name;
>> +		cinfo->clk_id = plat_clk_table[i].clk_id;
>> +		cinfo->has_scaling = plat_clk_table[i].has_scaling;
>> +		cinfo->clk = devm_clk_get(core->dev, cinfo->name);
>> +		if (IS_ERR(cinfo->clk)) {
>> +			dev_err(core->dev,
>> +				"%s: failed to get clock: %s\n", __func__, cinfo->name);
>> +			return PTR_ERR(cinfo->clk);
>> +		}
>> +	}
> Are you not going to use OPP for scaling the main RPMhPD with the core
> clock?
> 
We are using OPP for scaling the vcodec clk.
Could you please elaborate you query here, may be I didn't understand fully.
>> +
>> +	return 0;
>> +}
>> +
>> +static int init_reset_clocks(struct iris_core *core)
> init_resets
> 
> 'reset clocks' is an old downstream concept
> 
Sure, I can rename it.
>> +{
>> +	struct reset_info *rinfo = NULL;
>> +	u32 i = 0;
> unnecessary initializations
> 
Sure, will fix.
> [...]
> 
>> +
>> +int init_resources(struct iris_core *core)
>> +{
>> +	int ret;
>> +
>> +	ret = init_bus(core);
>> +	if (ret)
>> +		return ret;
>> +
>> +	ret = init_power_domains(core);
>> +	if (ret)
>> +		return ret;
>> +
>> +	ret = init_clocks(core);
>> +	if (ret)
>> +		return ret;
>> +
>> +	ret = init_reset_clocks(core);
>> +
>> +	return ret;
> return init_reset_clocks(core);
> 
>> +}
>> diff --git a/drivers/media/platform/qcom/vcodec/iris/resources.h b/drivers/media/platform/qcom/vcodec/iris/resources.h
>> new file mode 100644
>> index 0000000..d21bcc7e
>> --- /dev/null
>> +++ b/drivers/media/platform/qcom/vcodec/iris/resources.h
>> @@ -0,0 +1,36 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +
>> +#ifndef _RESOURCES_H_
>> +#define _RESOURCES_H_
>> +
>> +struct bus_info {
>> +	struct icc_path		*icc;
>> +	const char		*name;
>> +	u32			bw_min_kbps;
>> +	u32			bw_max_kbps;
> u64?
> 
Will check and do the needful.
>> +};
>> +
>> +struct power_domain_info {
>> +	struct device	*genpd_dev;
>> +	const char	*name;
>> +};
>> +
>> +struct clock_info {
>> +	struct clk	*clk;
>> +	const char	*name;
> I'm not sure why you need it
> 
>> +	u32		clk_id;
> Or this
> 
>> +	bool		has_scaling;
> Or this
> 
> you could probably do something like this:
> 
> struct big_iris_struct {
> 	[...]
> 	struct clk *core_clk;
> 	struct clk *memory_clk;
> 	struct clk *some_important_scaled_clock;
> 	struct clk_bulk_data less_important_nonscaling_clocks[X]
> }
> 
> and then make use of all of the great common upstream APIs to manage
> them!
> 
Will explore this and get back.
>> +	u64		prev;
>> +};
>> +
>> +struct reset_info {
>> +	struct reset_control	*rst;
>> +	const char		*name;
> this seems a bit excessive as well
> 
> Konrad

  reply	other threads:[~2023-12-20  8:04 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 11:31 [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 01/34] media: introduce common helpers for video firmware handling Dikshita Agarwal
2023-12-18 18:24   ` Dmitry Baryshkov
2023-12-20  8:01     ` Dikshita Agarwal
2023-12-20  8:12       ` Dmitry Baryshkov
2023-12-20 17:10         ` Abhinav Kumar
2023-12-20 20:56           ` Dmitry Baryshkov
2023-12-20 21:03             ` Abhinav Kumar
2023-12-19 11:40   ` Bryan O'Donoghue
2023-12-19 13:26     ` Dmitry Baryshkov
2023-12-20  8:01       ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 02/34] media: introduce common helpers for queues handling Dikshita Agarwal
2023-12-18 18:29   ` Dmitry Baryshkov
2023-12-20  8:03     ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 03/34] media: introduce common helpers for buffer size calculation Dikshita Agarwal
2023-12-18 18:32   ` Dmitry Baryshkov
2023-12-20  8:04     ` Dikshita Agarwal
2023-12-20  8:15       ` Dmitry Baryshkov
2023-12-18 11:31 ` [PATCH v2 04/34] dt-bindings: media: Add sm8550 dt schema Dikshita Agarwal
2023-12-18 16:10   ` Krzysztof Kozlowski
2023-12-18 18:17   ` Dmitry Baryshkov
2023-12-18 11:32 ` [PATCH v2 05/34] media: MAINTAINERS: Add Qualcomm Iris video accelerator driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 06/34] media: iris: register video device to platform driver Dikshita Agarwal
2023-12-18 18:40   ` Dmitry Baryshkov
2023-12-18 11:32 ` [PATCH v2 07/34] media: iris: initialize power resources Dikshita Agarwal
2023-12-18 15:09   ` Konrad Dybcio
2023-12-20  8:04     ` Dikshita Agarwal [this message]
2024-01-03 13:45       ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 08/34] media: iris: introduce state machine for iris core Dikshita Agarwal
2023-12-18 18:46   ` Dmitry Baryshkov
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 09/34] media: iris: initialize shared queues for host and firmware communication Dikshita Agarwal
2023-12-18 18:46   ` Dmitry Baryshkov
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 21:33   ` Konrad Dybcio
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 10/34] media: iris: add PIL functionality for video firmware Dikshita Agarwal
2023-12-18 21:40   ` Konrad Dybcio
2023-12-20  8:15     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 11/34] media: iris: introduce packetization layer for creating HFI packets Dikshita Agarwal
2023-12-18 21:50   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 12/34] media: iris: add video processing unit(VPU) specific register handling Dikshita Agarwal
2023-12-18 16:19   ` Krzysztof Kozlowski
2023-12-18 22:00   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 13/34] media: iris: introduce platform specific capabilities for core and instance Dikshita Agarwal
2023-12-18 22:08   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 14/34] media: iris: implement iris v4l2 file ops Dikshita Agarwal
2023-12-19 11:57   ` Bryan O'Donoghue
2023-12-18 11:32 ` [PATCH v2 15/34] media: iris: add handling for interrupt service routine(ISR) invoked by hardware Dikshita Agarwal
2023-12-19 11:48   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 16/34] media: iris: implement iris v4l2_ctrl_ops and prepare capabilities Dikshita Agarwal
2023-12-19 11:50   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 17/34] media: iris: implement vb2_ops queue setup Dikshita Agarwal
2023-12-19 11:56   ` Konrad Dybcio
2023-12-20  8:37     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 18/34] media: iris: introduce and implement iris vb2 mem ops Dikshita Agarwal
2023-12-19 11:58   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 19/34] media: iris: implement HFI to queue and release buffers Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 20/34] media: iris: add video hardware internal buffer count and size calculation Dikshita Agarwal
2023-12-19 12:06   ` Bryan O'Donoghue
2023-12-20  8:29     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 21/34] media: iris: implement internal buffer management Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 22/34] media: iris: introduce instance states Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 23/34] media: iris: implement iris v4l2 ioctl ops supported by decoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 24/34] media: iris: subscribe input and output properties to firmware Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 25/34] media: iris: subscribe src change and handle firmware responses Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 26/34] media: iris: implement vb2 streaming ops on capture and output planes Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 27/34] media: iris: implement vb2 ops for buf_queue and firmware response Dikshita Agarwal
2023-12-19 12:21   ` Konrad Dybcio
2023-12-20  8:25     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 28/34] media: iris: add instance sub states and implement DRC and Drain sequence Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 29/34] media: iris: implement power management Dikshita Agarwal
2023-12-19 12:24   ` Konrad Dybcio
2023-12-20  8:23     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 30/34] media: iris: register video encoder device to platform driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 31/34] media: iris: add platform specific instance capabilities for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 32/34] media: iris: implement iris v4l2 ioctl ops supported by encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 33/34] media: iris: add vb2 streaming and buffer ops for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 34/34] media: iris: add power management " Dikshita Agarwal
2023-12-19 12:26   ` Konrad Dybcio
2023-12-18 12:09 ` [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 14:36 ` Bryan O'Donoghue
2023-12-18 18:38 ` Dmitry Baryshkov
2023-12-19 12:10   ` Bryan O'Donoghue
2023-12-20  6:32   ` Vikash Garodia
2023-12-20  7:37     ` Dmitry Baryshkov
2023-12-20  8:14       ` Vikash Garodia
2023-12-20  8:39         ` Dmitry Baryshkov
2023-12-20  8:53           ` Vikash Garodia
2023-12-20  9:52             ` Dmitry Baryshkov
2023-12-20 18:55               ` Abhinav Kumar
2023-12-20 21:24                 ` Dmitry Baryshkov
2023-12-20  8:15     ` Krzysztof Kozlowski
2023-12-20  8:32       ` Vikash Garodia
2023-12-20 20:51 ` Nicolas Dufresne
2024-02-29 15:09 ` Vikash Garodia
2024-03-12 10:37   ` Hans Verkuil
2024-03-15 13:51     ` Vikash Garodia
2024-04-12  7:13 ` Hyunjun Ko
2024-04-12 13:52   ` Bryan O'Donoghue
2024-05-16  7:57 ` Hyunjun Ko
2024-05-16  8:06   ` Vikash Garodia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c3c686a-1500-7261-b112-1ea94d9e346e@quicinc.com \
    --to=quic_dikshita@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=stanimir.k.varbanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®