Message ID | 20240709160656.31146-5-quic_depengs@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers |
Received: from ny.mirrors.kernel.org ([147.75.199.223]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-14782-patchwork=linuxtv.org@vger.kernel.org>) id 1sRDRW-0008Rp-1p for patchwork@linuxtv.org; Tue, 09 Jul 2024 16:11:51 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3AB891C22E04 for <patchwork@linuxtv.org>; Tue, 9 Jul 2024 16:11:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A97381A2C24; Tue, 9 Jul 2024 16:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Le0/aSUi" X-Original-To: linux-media@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 ED7AB1A2C1D; Tue, 9 Jul 2024 16:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720541259; cv=none; b=MjDbz7ite1/aVfUe56UAEk1lODPGnWwPoAgvckAzvA0yDDSBGwYtBdBU7NIzf/9yAb6r3kYr3V4DFj1AcD0Y8Qspi2VBfiudOzXWKErofy2/bmsOwOj9yXdQa8nUDbznV6ikFHK4UIDHVVgqfRRWL2Bi8ZzhaOCbwqwr8W8yBNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720541259; c=relaxed/simple; bh=Ji3By/aaamdUCmBKhrsawpQ5xt4f5zEaP/LbJR5Xa4g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IcXg5eKQ579FZrvsalu9E8ttATScovTJ2k6VMRu7oyegoGKyq6xcZ6K/W8g7lCHKqL9AsYbpH8ZVga+i1/R0Pk4+B916eDDKMPoHgzm07bOFkq2nCM4yc0M7Znhy9WoyrRSaK0W1H5KfsiRFPs3ajdG3hIbLx1qhs0jVla6MonE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Le0/aSUi; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 469D81rK012640; Tue, 9 Jul 2024 16:07:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=reTo7YUOp3oxq7Nq799zPms/ OPCdV/BLShEpbgbQbPw=; b=Le0/aSUiqR9CPOGWYBHSL/pRtduksAtiA9vvnMYZ DacNpFNVX4QYevMtGzFCf8YG9mxEL9qJG6b4tLiQSUeGTmWSmOUrdvvY9tQ5AR10 1Pjdkc8099IuGsJVz/B7RlCeR4ayx++Xs7w5/4qUTtT2vOoLmkyDJDErvzHztncz lR1Q6M+HAM/7mNnA5OIMygiKZ7cldzLuErEBkotr05SFCife3T4TV8BNtUez50wU lARU3VGuQRME1pnDyzSPfC91xvJPrKVC1ayv2EyBKrwHten+JNFahVDoobsDREmI y5ozGiLnCiHs5gRPakEAualUC/zHDQbuXp+IszWA3UqEHg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406y3hep2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jul 2024 16:07:33 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 469G7WGO010227 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Jul 2024 16:07:32 GMT Received: from hu-depengs-sha.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 9 Jul 2024 09:07:26 -0700 From: Depeng Shao <quic_depengs@quicinc.com> To: <rfoss@kernel.org>, <todor.too@gmail.com>, <bryan.odonoghue@linaro.org>, <mchehab@kernel.org>, <robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org> CC: <quic_eberman@quicinc.com>, <quic_depengs@quicinc.com>, <linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@quicinc.com> Subject: [PATCH 04/13] media: qcom: camss: csiphy: Add an init callback to CSI PHY devices Date: Tue, 9 Jul 2024 21:36:47 +0530 Message-ID: <20240709160656.31146-5-quic_depengs@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240709160656.31146-1-quic_depengs@quicinc.com> References: <20240709160656.31146-1-quic_depengs@quicinc.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: YyJ-U-R_o1JqZh0EpBZ3_tdK7xOxhMDp X-Proofpoint-GUID: YyJ-U-R_o1JqZh0EpBZ3_tdK7xOxhMDp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-09_05,2024-07-09_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407090106 X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_PASS=-0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no |
Series |
media: qcom: camss: Add sm8550 support
|
|
Commit Message
Depeng Shao
July 9, 2024, 4:06 p.m. UTC
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Add a nop callback to CSIPHY devices. Later patches will enumerate with enabling code. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Depeng Shao <quic_depengs@quicinc.com> Reviewed-by: Elliot Berman <quic_eberman@quicinc.com> --- drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 6 ++++++ drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 6 ++++++ drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++++ drivers/media/platform/qcom/camss/camss-csiphy.h | 1 + 4 files changed, 17 insertions(+)
Comments
On 7/9/24 19:06, Depeng Shao wrote: > From: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > > Add a nop callback to CSIPHY devices. Later patches will enumerate with > enabling code. Please avoid references to "patches" in the commit messages, it'll be changes. I took a look at the next changes, and in my opinion the selected names .init / csiphy_init() / csiphy->res->hw_ops->init(csiphy) are confusing, since there is no intention for real hardware initialization, which is presumed by "hw_ops->init()", I see only routines to get some offsets and populate allocated memory with some values... Not closely a hw_ops. > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > Signed-off-by: Depeng Shao <quic_depengs@quicinc.com> > Reviewed-by: Elliot Berman <quic_eberman@quicinc.com> > --- > drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 6 ++++++ > drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 6 ++++++ > drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++++ > drivers/media/platform/qcom/camss/camss-csiphy.h | 1 + > 4 files changed, 17 insertions(+) > > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c > index cd4a8c369234..9d67e7fa6366 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c > +++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c > @@ -180,6 +180,11 @@ static irqreturn_t csiphy_isr(int irq, void *dev) > return IRQ_HANDLED; > } > > +static int csiphy_init(struct csiphy_device *csiphy) > +{ > + return 0; > +} > + > const struct csiphy_hw_ops csiphy_ops_2ph_1_0 = { > .get_lane_mask = csiphy_get_lane_mask, > .hw_version_read = csiphy_hw_version_read, > @@ -187,4 +192,5 @@ const struct csiphy_hw_ops csiphy_ops_2ph_1_0 = { > .lanes_enable = csiphy_lanes_enable, > .lanes_disable = csiphy_lanes_disable, > .isr = csiphy_isr, > + .init = csiphy_init, > }; > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > index bc4834ee2dcc..b60c32a195df 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > @@ -581,6 +581,11 @@ static void csiphy_lanes_disable(struct csiphy_device *csiphy, > CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(6)); > } > > +static int csiphy_init(struct csiphy_device *csiphy) > +{ > + return 0; > +} > + > const struct csiphy_hw_ops csiphy_ops_3ph_1_0 = { > .get_lane_mask = csiphy_get_lane_mask, > .hw_version_read = csiphy_hw_version_read, > @@ -588,4 +593,5 @@ const struct csiphy_hw_ops csiphy_ops_3ph_1_0 = { > .lanes_enable = csiphy_lanes_enable, > .lanes_disable = csiphy_lanes_disable, > .isr = csiphy_isr, > + .init = csiphy_init, > }; > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c > index 2f7361dfd461..ea5c7078ec8e 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy.c > +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c > @@ -576,6 +576,10 @@ int msm_csiphy_subdev_init(struct camss *camss, > csiphy->cfg.combo_mode = 0; > csiphy->res = &res->csiphy; > > + ret = csiphy->res->hw_ops->init(csiphy); Here. > + if (ret) > + return ret; > + > /* Memory */ > > csiphy->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]); > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h > index 47f0b6b09eba..bdf9a9c8bacc 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy.h > +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h > @@ -71,6 +71,7 @@ struct csiphy_hw_ops { > void (*lanes_disable)(struct csiphy_device *csiphy, > struct csiphy_config *cfg); > irqreturn_t (*isr)(int irq, void *dev); > + int (*init)(struct csiphy_device *csiphy); > }; > > struct csiphy_subdev_resources { -- Best wishes, Vladimir
On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >> + ret = csiphy->res->hw_ops->init(csiphy); > > Here. What name would make more sense to you ? --- bod
Hi Bryan, On 8/1/24 11:16, Bryan O'Donoghue wrote: > On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>> + ret = csiphy->res->hw_ops->init(csiphy); >> >> Here. > > What name would make more sense to you ? according to the implementation the .init() call just fills some data in memory, so I believe this could be handled at build time, if it's done carefully enough... -- Best wishes, Vladimir
Hi Vladimir, On 8/5/2024 5:26 AM, Vladimir Zapolskiy wrote: > Hi Bryan, > > On 8/1/24 11:16, Bryan O'Donoghue wrote: >> On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>>> + ret = csiphy->res->hw_ops->init(csiphy); >>> >>> Here. >> >> What name would make more sense to you ? > > according to the implementation the .init() call just fills some data in > memory, so I believe this could be handled at build time, if it's done > carefully enough... > This camss-csiphy-3ph-1-0.c is reused by many platforms, the old platforms have same CSI_COMMON_CTR register offset, their offset are 0x800, but some new platforms may have different CSI_COMMON_CTR register offset, for example, the CSI_COMMON_CTR register offset is 0x1000 in sm8550, then we need to add new file to support the new csiphy HW, e.g., camss-csiphy-3ph-2-0.c, so Bryan asked me to develop the CSIPHY driver based on his changes, then we just need few code to enable new CSIPHY. Regarding the hw_ops->init interface, since it fills HW register configurations and HW register offset, then maybe, it also can be called as HW operation. And looks like we can't move it to camss-csiphy.c since it does platform specific operation and it is related to the registers. Please feel free to share other comments if you don't agree with it. Thanks. Thanks, Depeng
On 07/08/2024 14:08, Depeng Shao wrote: > Hi Vladimir, > > On 8/5/2024 5:26 AM, Vladimir Zapolskiy wrote: >> Hi Bryan, >> >> On 8/1/24 11:16, Bryan O'Donoghue wrote: >>> On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>>>> + ret = csiphy->res->hw_ops->init(csiphy); >>>> >>>> Here. >>> >>> What name would make more sense to you ? >> >> according to the implementation the .init() call just fills some data in >> memory, so I believe this could be handled at build time, if it's done >> carefully enough... >> > > This camss-csiphy-3ph-1-0.c is reused by many platforms, the old > platforms have same CSI_COMMON_CTR register offset, their offset are > 0x800, but some new platforms may have different CSI_COMMON_CTR register > offset, for example, the CSI_COMMON_CTR register offset is 0x1000 in > sm8550, then we need to add new file to support the new csiphy HW, e.g., > camss-csiphy-3ph-2-0.c, so Bryan asked me to develop the CSIPHY driver > based on his changes, then we just need few code to enable new CSIPHY. > > Regarding the hw_ops->init interface, since it fills HW register > configurations and HW register offset, then maybe, it also can be called > as HW operation. > > And looks like we can't move it to camss-csiphy.c since it does platform > specific operation and it is related to the registers. > > Please feel free to share other comments if you don't agree with it. > Thanks. > > > Thanks, > Depeng So, I agree the phy init data could be obtained via resource structs but, rather than add yet more patches to this series, I'd say we can make the move to a separate resource struct pointer at a later date. Lets drop this patch and @Depeng we can then do + regs->offset = 0x800; media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs As a bonus that's one less patch for this series which @ 13 patches is already large. --- bod
Hi Bryan, On 8/7/2024 10:04 PM, Bryan O'Donoghue wrote: > On 07/08/2024 14:08, Depeng Shao wrote: >> Hi Vladimir, >> >> On 8/5/2024 5:26 AM, Vladimir Zapolskiy wrote: >>> Hi Bryan, >>> >>> On 8/1/24 11:16, Bryan O'Donoghue wrote: >>>> On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>>>>> + ret = csiphy->res->hw_ops->init(csiphy); >>>>> >>>>> Here. >>>> >>>> What name would make more sense to you ? >>> >>> according to the implementation the .init() call just fills some data in >>> memory, so I believe this could be handled at build time, if it's done >>> carefully enough... >>> >> >> This camss-csiphy-3ph-1-0.c is reused by many platforms, the old >> platforms have same CSI_COMMON_CTR register offset, their offset are >> 0x800, but some new platforms may have different CSI_COMMON_CTR >> register offset, for example, the CSI_COMMON_CTR register offset is >> 0x1000 in sm8550, then we need to add new file to support the new >> csiphy HW, e.g., camss-csiphy-3ph-2-0.c, so Bryan asked me to develop >> the CSIPHY driver based on his changes, then we just need few code to >> enable new CSIPHY. >> >> Regarding the hw_ops->init interface, since it fills HW register >> configurations and HW register offset, then maybe, it also can be >> called as HW operation. >> >> And looks like we can't move it to camss-csiphy.c since it does >> platform specific operation and it is related to the registers. >> >> Please feel free to share other comments if you don't agree with it. >> Thanks. >> >> >> Thanks, >> Depeng > > So, I agree the phy init data could be obtained via resource structs > but, rather than add yet more patches to this series, I'd say we can > make the move to a separate resource struct pointer at a later date. > > Lets drop this patch and @Depeng we can then do > > + regs->offset = 0x800; > > media: qcom: camss: csiphy-3ph: Use an offset variable to find common > control regs > Do you mean only drop "[PATCH 04/13] media: qcom: camss: csiphy: Add an init callback to CSI PHY devices"? [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct Do you mean this is still needed? Just don't move the code from csiphy_gen2_config_lanes to csiphy_init, right? [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs The offset change is also needed, just need to add the offset for different platform in csiphy_gen2_config_lanes . Please correct me if my understanding is wrong. Thanks. > As a bonus that's one less patch for this series which @ 13 patches is > already large. > > --- > bod Thanks, Depeng
On 07/08/2024 16:03, Depeng Shao wrote: > Hi Bryan, > > On 8/7/2024 10:04 PM, Bryan O'Donoghue wrote: >> On 07/08/2024 14:08, Depeng Shao wrote: >>> Hi Vladimir, >>> >>> On 8/5/2024 5:26 AM, Vladimir Zapolskiy wrote: >>>> Hi Bryan, >>>> >>>> On 8/1/24 11:16, Bryan O'Donoghue wrote: >>>>> On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>>>>>> + ret = csiphy->res->hw_ops->init(csiphy); >>>>>> >>>>>> Here. >>>>> >>>>> What name would make more sense to you ? >>>> >>>> according to the implementation the .init() call just fills some >>>> data in >>>> memory, so I believe this could be handled at build time, if it's done >>>> carefully enough... >>>> >>> >>> This camss-csiphy-3ph-1-0.c is reused by many platforms, the old >>> platforms have same CSI_COMMON_CTR register offset, their offset are >>> 0x800, but some new platforms may have different CSI_COMMON_CTR >>> register offset, for example, the CSI_COMMON_CTR register offset is >>> 0x1000 in sm8550, then we need to add new file to support the new >>> csiphy HW, e.g., camss-csiphy-3ph-2-0.c, so Bryan asked me to develop >>> the CSIPHY driver based on his changes, then we just need few code to >>> enable new CSIPHY. >>> >>> Regarding the hw_ops->init interface, since it fills HW register >>> configurations and HW register offset, then maybe, it also can be >>> called as HW operation. >>> >>> And looks like we can't move it to camss-csiphy.c since it does >>> platform specific operation and it is related to the registers. >>> >>> Please feel free to share other comments if you don't agree with it. >>> Thanks. >>> >>> >>> Thanks, >>> Depeng >> >> So, I agree the phy init data could be obtained via resource structs >> but, rather than add yet more patches to this series, I'd say we can >> make the move to a separate resource struct pointer at a later date. >> >> Lets drop this patch and @Depeng we can then do >> > >> + regs->offset = 0x800; >> >> media: qcom: camss: csiphy-3ph: Use an offset variable to find common >> control regs >> > > > Do you mean only drop "[PATCH 04/13] media: qcom: camss: csiphy: Add an > init callback to CSI PHY devices"? > > > [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to > data field inside csiphy struct > Do you mean this is still needed? Just don't move the code from > csiphy_gen2_config_lanes to csiphy_init, right? > > > [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to > find common control regs > The offset change is also needed, just need to add the offset for > different platform in csiphy_gen2_config_lanes . > > Please correct me if my understanding is wrong. Thanks. Correct. --- bod
Hi Bryan, On 8/7/2024 11:37 PM, Bryan O'Donoghue wrote: > On 07/08/2024 16:03, Depeng Shao wrote: >> Hi Bryan, >> >> On 8/7/2024 10:04 PM, Bryan O'Donoghue wrote: >>> On 07/08/2024 14:08, Depeng Shao wrote: >>>> Hi Vladimir, >>>> >>>> On 8/5/2024 5:26 AM, Vladimir Zapolskiy wrote: >>>>> Hi Bryan, >>>>> >>>>> On 8/1/24 11:16, Bryan O'Donoghue wrote: >>>>>> On 01/08/2024 00:43, Vladimir Zapolskiy wrote: >>>>>>>> + ret = csiphy->res->hw_ops->init(csiphy); >>>>>>> >>>>>>> Here. >>>>>> >>>>>> What name would make more sense to you ? >>>>> >>>>> according to the implementation the .init() call just fills some >>>>> data in >>>>> memory, so I believe this could be handled at build time, if it's done >>>>> carefully enough... >>>>> >>>> >>>> This camss-csiphy-3ph-1-0.c is reused by many platforms, the old >>>> platforms have same CSI_COMMON_CTR register offset, their offset are >>>> 0x800, but some new platforms may have different CSI_COMMON_CTR >>>> register offset, for example, the CSI_COMMON_CTR register offset is >>>> 0x1000 in sm8550, then we need to add new file to support the new >>>> csiphy HW, e.g., camss-csiphy-3ph-2-0.c, so Bryan asked me to >>>> develop the CSIPHY driver based on his changes, then we just need >>>> few code to enable new CSIPHY. >>>> >>>> Regarding the hw_ops->init interface, since it fills HW register >>>> configurations and HW register offset, then maybe, it also can be >>>> called as HW operation. >>>> >>>> And looks like we can't move it to camss-csiphy.c since it does >>>> platform specific operation and it is related to the registers. >>>> >>>> Please feel free to share other comments if you don't agree with it. >>>> Thanks. >>>> >>>> >>>> Thanks, >>>> Depeng >>> >>> So, I agree the phy init data could be obtained via resource structs >>> but, rather than add yet more patches to this series, I'd say we can >>> make the move to a separate resource struct pointer at a later date. >>> >>> Lets drop this patch and @Depeng we can then do >>> >> >>> + regs->offset = 0x800; >>> >>> media: qcom: camss: csiphy-3ph: Use an offset variable to find common >>> control regs >>> >> >> >> Do you mean only drop "[PATCH 04/13] media: qcom: camss: csiphy: Add >> an init callback to CSI PHY devices"? >> >> >> [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to >> data field inside csiphy struct >> Do you mean this is still needed? Just don't move the code from >> csiphy_gen2_config_lanes to csiphy_init, right? >> >> >> [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable >> to find common control regs >> The offset change is also needed, just need to add the offset for >> different platform in csiphy_gen2_config_lanes . >> >> Please correct me if my understanding is wrong. Thanks. > > Correct. > I'm updating the code based on above comments, but I meet crash issue if I move the offset assignment to csiphy_gen2_config_lanes, since the csiphy->res->hw_ops->reset(csiphy) is called earlier than csiphy_gen2_config_lanes, so if we don't have the .init interface, we only can move this offset value to `struct csiphy_subdev_resources`, but if we add the offset to `struct csiphy_subdev_resources`, then below two patches are also can be dropped. [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs Could you please comment on if I need to add the CSI_COMMON_CTR offset to res directly? Or add back the .init interface? --- [ 43.162439] Unable to handle kernel NULL pointer dereference at virtual address 000000000000000c [ 43.428307] Call trace: [ 43.430823] csiphy_reset+0x28/0x60 [qcom_camss] [ 43.435572] csiphy_set_power+0x1e8/0x2d4 [qcom_camss] [ 43.440846] pipeline_pm_power_one+0x74/0x10c [videodev] [ 43.446306] pipeline_pm_power+0x44/0xe0 [videodev] [ 43.451313] v4l2_pipeline_pm_get+0x44/0x80 [videodev] [ 43.456588] video_open+0x6c/0xc4 [qcom_camss] [ 43.461158] v4l2_open+0xb8/0x100 [videodev] [ 43.465549] chrdev_open+0x174/0x208 [ 43.469224] do_dentry_open+0x290/0x4b4 [ 43.473164] vfs_open+0x30/0xf0 [ 43.476397] path_openat+0xaec/0xd2c [ 43.480069] do_filp_open+0xb4/0x158 [ 43.483739] do_sys_openat2+0x84/0xe8 [ 43.487500] __arm64_sys_openat+0x70/0x98 [ 43.491619] invoke_syscall+0x40/0xf8 [ 43.495383] el0_svc_common+0xa8/0xd8 [ 43.499143] do_el0_svc+0x1c/0x28 [ 43.502545] el0_svc+0x38/0x68 [ 43.505691] el0t_64_sync_handler+0x90/0xfc [ 43.509989] el0t_64_sync+0x190/0x194 [ 43.513751] Code: 52800028 aa0003f3 52827100 5283e801 (b9400e8a) [ 43.520010] ---[ end trace 0000000000000000 ]--- Segmentation fault Thanks, Depeng
On 08/08/2024 15:02, Depeng Shao wrote: > I'm updating the code based on above comments, but I meet crash issue if > I move the offset assignment to csiphy_gen2_config_lanes, since the > csiphy->res->hw_ops->reset(csiphy) is called earlier than > csiphy_gen2_config_lanes, so if we don't have the .init interface, we > only can move this offset value to `struct csiphy_subdev_resources`, but > if we add the offset to `struct csiphy_subdev_resources`, then below two > patches are also can be dropped. > > > [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to > data field inside csiphy struct > [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to > find common control regs > > > Could you please comment on if I need to add the CSI_COMMON_CTR offset > to res directly? > Or add back the .init interface? Ah, I hadn't recalled why the .init was added -> because sequencing. Lets retain the patch but expand the commit log to explain why the init is being added, instead of jumping through hoops to restructure to get rid of it. --- bod
Hi Bryan, On 8/12/2024 7:32 PM, Bryan O'Donoghue wrote: > > Ah, I hadn't recalled why the .init was added -> because sequencing. > > Lets retain the patch but expand the commit log to explain why the init > is being added, instead of jumping through hoops to restructure to get > rid of it. > Thanks for the confirmation. I will retain the patch and add more commit log. Thanks, Depeng
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c index cd4a8c369234..9d67e7fa6366 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c @@ -180,6 +180,11 @@ static irqreturn_t csiphy_isr(int irq, void *dev) return IRQ_HANDLED; } +static int csiphy_init(struct csiphy_device *csiphy) +{ + return 0; +} + const struct csiphy_hw_ops csiphy_ops_2ph_1_0 = { .get_lane_mask = csiphy_get_lane_mask, .hw_version_read = csiphy_hw_version_read, @@ -187,4 +192,5 @@ const struct csiphy_hw_ops csiphy_ops_2ph_1_0 = { .lanes_enable = csiphy_lanes_enable, .lanes_disable = csiphy_lanes_disable, .isr = csiphy_isr, + .init = csiphy_init, }; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index bc4834ee2dcc..b60c32a195df 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -581,6 +581,11 @@ static void csiphy_lanes_disable(struct csiphy_device *csiphy, CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(6)); } +static int csiphy_init(struct csiphy_device *csiphy) +{ + return 0; +} + const struct csiphy_hw_ops csiphy_ops_3ph_1_0 = { .get_lane_mask = csiphy_get_lane_mask, .hw_version_read = csiphy_hw_version_read, @@ -588,4 +593,5 @@ const struct csiphy_hw_ops csiphy_ops_3ph_1_0 = { .lanes_enable = csiphy_lanes_enable, .lanes_disable = csiphy_lanes_disable, .isr = csiphy_isr, + .init = csiphy_init, }; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 2f7361dfd461..ea5c7078ec8e 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -576,6 +576,10 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->cfg.combo_mode = 0; csiphy->res = &res->csiphy; + ret = csiphy->res->hw_ops->init(csiphy); + if (ret) + return ret; + /* Memory */ csiphy->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]); diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h index 47f0b6b09eba..bdf9a9c8bacc 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -71,6 +71,7 @@ struct csiphy_hw_ops { void (*lanes_disable)(struct csiphy_device *csiphy, struct csiphy_config *cfg); irqreturn_t (*isr)(int irq, void *dev); + int (*init)(struct csiphy_device *csiphy); }; struct csiphy_subdev_resources {