From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB4BB4657F8 for ; Wed, 6 May 2026 14:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778078924; cv=none; b=GfG8Alapm9fqRARiXLFj0rRZdCXsvBMJDxmvhs+bkkq0na53AO04vxolBCuUgCk7NCpjdz7DBAi8STM7m3gJW/qgf4HkVsf9mJrjraf3RkkGx4Wz72/VzNU9maG3t8TzGf+nOAdSK3YQkjn0xAA2LKbDy+vvkdk87dj2F6Hz00k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778078924; c=relaxed/simple; bh=tjshc45sU4NDeKpBxwXJx7JcPp9DPCMPsWPxeYE+In0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r9xwlMrYOMmqRCObdfl+M0pzbIGJEFTN2sc6y3AanYkg3vxEjP35eNnuiq57UIg4BWGhMEOJki1fpjVs/lP/ZgIMZvtQa0llAM3vACBtWH0xWx22aWTm5GXqICluPSrtb/R9AAA7unDvd0zCl9tY0qZE1y+Oq8ckus7DdqXiEjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ceomNAkv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=U7DWSfjU; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ceomNAkv"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="U7DWSfjU" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 646A04R31985937 for ; Wed, 6 May 2026 14:48:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= gBXTd60yitJVrz4Yyr33f4/s9WV5E4ilRPkk/RHgt1k=; b=ceomNAkvrfwJ+ir1 F3t2WczOY3Rb0C5KI2HbPVv0ycR4hZyz1jM7+bywELz3ibvKHaoGxp2esjSKbzVp fpiMbdggtGspYTMq9CFN5sThX2ddGnHq0UYoNOWF3Qlu7wlmgGMF19MuDLXYJQfP Ux9NbtSHh/Xcel0jr6eGZpWZQxnrvgwCtrBn3lfWSRol95mhCLmKKQ6beRQL6HfE kRp7aajwX3aa8rYQY485Mcm/DCWL/+TVaaKFxfVpgNhY8pfeZTUkB67JGPdr+Br9 XlJ81LF8b6j8kpAEIVteNDK1qIupbz6lezRLZNkjWx/60gIABoqpYZyo1cqaBwtX 9+5lqg== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e03gp10qp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 06 May 2026 14:48:33 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-36512f223d8so8447492a91.3 for ; Wed, 06 May 2026 07:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778078913; x=1778683713; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gBXTd60yitJVrz4Yyr33f4/s9WV5E4ilRPkk/RHgt1k=; b=U7DWSfjUh65JlB48EegDeN0PHp9auOmEHqkVW2kKl6Agsd5hv4bHLWIgfTkbkcY0OG z0zbTAEKB78nO69Z/0OpuCPmEPtNAtEnylOtor+fRcBMCD2hpk5u6XNCeMEjpXGKj299 jBIis6+l4hE59Skg7kBI+l+y7ENFntXL1oi9Py6mlGosqExqFpxLqHDVREDGylhd2tSP gzx+rpn9z37SkENp6m0tsxFCsfPHNjmKn1QK1YEpXzqRW2P+O1iIEyP3hbS1FHNa+rmO aGkUjsux/fF2z7eW2EMW8MwWVkIpgvT+pgExFV9uGfk0OAOQVyYfRBE3TnJAHmG6Ahm8 RJ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778078913; x=1778683713; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gBXTd60yitJVrz4Yyr33f4/s9WV5E4ilRPkk/RHgt1k=; b=kUiXqP6jwHu4ydtRbW3B7ooEQiC14YHQEMBunvt3kI/x15E3CPifL2Ca/HfUYyU9Vw p3eSL1cDyTwfWa1MmgCa7PtY8zjllnoCEKEKKa/O2gclsLOM9VqfnX7Xr8Ty6ZJOZpfH zKmD4sNu91dPGqDSOcLRS+IbtfADGbe0bMoe12g9PUyIfzOO7r6/2gZa6PwQPS8xfkhg LIg7fGfN5k2hWakagwpjYcaebUm9cTsgws4r0zBO9idVLV/rJbeOmp+LLF8BqmSZAq9M 8/vkdziXnbJ9C4Sn8s6ladytxt8CWaSoecMh60n56sN9d1g2SbL9JAXbLb7zR3dcwE7P ucWQ== X-Forwarded-Encrypted: i=1; AFNElJ/xXPmUd4JjEfUn7QN99dA8MTfQIC6IWmSZ1fo/1exANPkHlXmtkE80tTDSNQ99xajHIhVhC3M9RYwFKSo=@vger.kernel.org X-Gm-Message-State: AOJu0YzBJgp3ekXQmHhRMw330nl7OWlZMvt+3JTBwOfCgavKTrecWClL ZzGphOlY60I8PjsGdac1ovIySllq6ejmFU45kgK8dhfhkjS2wJlyYJBtRrHEn+tePcCe0kCm51q A/o8fUXCzF21k2f7b+Yh1KdUCKA6ZZIPhCr1YolxPIWlKa7AkgWvYgJoumvF1gbQWkMI= X-Gm-Gg: AeBDietmAs3CGD5FCM9azcfLBrlyzCE7s8wQgZFSlWnI0WEBzG6gphSMxlQsiDGtoO+ JfXe0eqBNJRmdPKPMnhXKewRG6kevUIEuYftI6k+qcqB9bj/88lUwI9h55ZsJB+eEq5cbPFTdkY 4501rclZMq14lZsGzDsubCS8qCy878ias2PpcuzXR0GOMvSdhTg3oxC9MC43/ylIrSCgeBNimEk ujXXebrNoVbTdtJPm8FEHLCSTxAHnYE9lD0QrR2UEyeF+f2xHdXcQyMVifWaC7tkImgWz8X6xO6 6dn1wwcn5jLtfs+Es5nVUNb5iGJmyloOqeLIpmsiCTHooSaIZpAkLoZL3KVy+G1+uQhnIx5806p B0fgCyHoVVETRvRHnBDS3Z9IootwP44h7U0kH96RNo3v6rjxbksS8pr0/i9h6lAvh X-Received: by 2002:a17:90b:254d:b0:35e:57cf:c0ae with SMTP id 98e67ed59e1d1-365ab9c8160mr4155578a91.7.1778078912573; Wed, 06 May 2026 07:48:32 -0700 (PDT) X-Received: by 2002:a17:90b:254d:b0:35e:57cf:c0ae with SMTP id 98e67ed59e1d1-365ab9c8160mr4155514a91.7.1778078911952; Wed, 06 May 2026 07:48:31 -0700 (PDT) Received: from [10.204.101.47] ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365b4c28b1asm2713330a91.8.2026.05.06.07.48.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2026 07:48:31 -0700 (PDT) Message-ID: <351f5afc-784d-4c1a-a386-199bd528723a@oss.qualcomm.com> Date: Wed, 6 May 2026 20:18:23 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 09/13] media: iris: Use power domain type to look up pd_devs index To: Vishnu Reddy , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Hans Verkuil , Stefan Schmidt , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stanimir Varbanov , Joerg Roedel , Will Deacon , Robin Murphy , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, iommu@lists.linux.dev References: <20260505-glymur-v4-0-17571dbd1caa@oss.qualcomm.com> <20260505-glymur-v4-9-17571dbd1caa@oss.qualcomm.com> Content-Language: en-US From: Vikash Garodia In-Reply-To: <20260505-glymur-v4-9-17571dbd1caa@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA2MDE0NSBTYWx0ZWRfXxkK/uLoRYvwV HXWXodMBYWbHUyOqECm7EDufqboXhtDdx4LjjoOn9TOuWc4fEN0GvJJSVdnyfawN6eOySpMFr4G B84hnKuWlyRBDqrNz5truaMcaLvJyxt+EK4ZeAAw5waWweNP3/xouK1Evduku7r75VHNOqe4Pfv BDOum+21RwPy8DKA2VIIAphdg2NeMAd3rccofLTi7l+R5Wt4umoYRNqS6t4sR7jsgkZq6Ofe+fY saKKD2PknfdGtNJRWabJ6YnPVz6iCT0+3xBqcnbatwGHeLUaG//Rn7BkRwrXxf272wc4QEEa/Bf 08uJ51K/zYR7q0l6R9RetwF3u57s4Xm6RHIJCSZZKKUdw3tEK5rfRu/BfHTKErftk5GEnIeyd1q q9166aFRMSJyOi8TiN4osxWup4zT06h97xs3mPkikaR5FFtLsWtngnHedg1c9HA56oqsL1hWX/E qTFasCjib4UpzcmpWhw== X-Proofpoint-ORIG-GUID: IATEZ7bRBm61QczwzXlQ8hD1K0hSVOI7 X-Proofpoint-GUID: IATEZ7bRBm61QczwzXlQ8hD1K0hSVOI7 X-Authority-Analysis: v=2.4 cv=W8wIkxWk c=1 sm=1 tr=0 ts=69fb54c1 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=ZJZrQh8Pd_IjRIY_cScA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-05_03,2026-05-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 phishscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605060145 On 5/5/2026 12:29 PM, Vishnu Reddy wrote: > The pmdomain_tbl was a array of strings holding only the power domain > names. Callers had to pass a pd_devs[] pointer indexed directly by the > platform_pm_domain_type enum value to iris_enable_power_domains() and > iris_disable_power_domains(). > > A future platform may need to introduce a new enum value that aliases > an existing one (e.g. IRIS_VCODEC1_POWER_DOMAIN aliasing the > IRIS_VPP0_HW_POWER_DOMAIN on Glymur), which would break the assumption > that enum values map 1:1 to pd_devs[] indices. > > To fix this, replace the string array with a new struct platform_pd_data > that pairs each power domain name with its platform_pm_domain_type. Add > a helper iris_get_pd_index_by_type() that walks this table and returns > the correct pd_devs[] index for a given type. > > Update iris_enable_power_domains() and iris_disable_power_domains() > to accept a platform_pm_domain_type instead of a struct device pointer. > They now call the helper internally to resolve the index, removing the > need for callers to do the index lookup themselves. > > This prepares the driver for adding new platforms where power domain enum > values cannot be used directly as pd_devs[] indices. > > Signed-off-by: Vishnu Reddy > --- > .../platform/qcom/iris/iris_platform_common.h | 9 +++- > .../media/platform/qcom/iris/iris_platform_gen1.c | 18 +++++--- > .../media/platform/qcom/iris/iris_platform_gen2.c | 24 ++++++---- > drivers/media/platform/qcom/iris/iris_probe.c | 4 +- > drivers/media/platform/qcom/iris/iris_resources.c | 44 +++++++++++++++++- > drivers/media/platform/qcom/iris/iris_resources.h | 6 ++- > drivers/media/platform/qcom/iris/iris_vpu3x.c | 7 ++- > drivers/media/platform/qcom/iris/iris_vpu4x.c | 52 ++++++++-------------- > drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 +++++----- > 9 files changed, 116 insertions(+), 71 deletions(-) > > diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h > index 30e9d4d288c6..7d59e6364e9d 100644 > --- a/drivers/media/platform/qcom/iris/iris_platform_common.h > +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h > @@ -212,6 +212,12 @@ enum platform_pm_domain_type { > IRIS_APV_HW_POWER_DOMAIN, > }; > > +struct platform_pd_data { > + enum platform_pm_domain_type *pd_types; > + const char **pd_names; > + u32 pd_count; > +}; > + > > -int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev) > +static int iris_get_pd_index_by_type(struct iris_core *core, enum platform_pm_domain_type pd_type) > { > + const struct platform_pd_data *pd_tbl; > + u32 pd_count, i; > + > + pd_tbl = core->iris_platform_data->pmdomain_tbl; > + pd_count = core->iris_platform_data->pmdomain_tbl->pd_count; pd_count can be dropped, use pd_tbl->pd_count instead. with that fixed, Reviewed-by: Vikash Garodia