From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796274180; b=WmcleNQBfiI0LxZ2wWESgTx8CtTlqyK//97Cgcq/AJzGtpr4jXyE08ucm2jspecw1Cxh gL+7qNE1FJ08l07ZaopOOY2JV5g79NnrCLresNxZx33k09ygPNG7YDUiIp+cujZi1l0Lc vgebr0Grx1e3TJ+Ht3NeBxkGa7aVoDzbWZ8WONgwNyt5rWBkzNrvDopEfJ1UrulAVTiwv M6+4wpPx3bhIpQ5Wqc2zOc9RDFipFEIlfCTSuiNJzuFocf9GsFVIRzZ1dDcmA4Nccz1OB ybNbhHz59uV1Z0LVvDhlZ6Nw2xVUNWk5pRWGJIwmdB/DSibGcSM+QV0Pw96mwOIvG8Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796274180; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-ORIG-GUID:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=ezcpUUuXDfZTpWX52tnnnR5McY185QYPpTNOc1gtJwI=; b=Iz0dcXwY76NLAAN7gTGea9nAi86bU88DYN7b/MYqk7v13Q7kjCAe+oEqchvL1Sc+4Ll4 tsZP/gzvbkmsQXdWC0OPmM+E6PqrOR2lsCrBrnSrWZoukq7/sjDymaHasFNwjSlPCxdIz ylOdDVkAy9WieZrXqBordbuGfAQU/owkdo7P5/y5oEap4zKh4EiYKX6bulf4lIegJTsAD 3L6FM3j7+ff/SsqySs3EZ+LYB5V5LSYKwlZEIcjCeVD6+lb9v988NTtciNcaICPcu3fyV ml1sdBg08o6TY9GCZ/hMaOepeifLDuzNROM0NaRCUBvLSACEXwnKhuB34uUC8KP9lrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=UCcPbvyJ; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=jgNWsKml; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA006606A330 for ; Thu, 3 Dec 2026 05:02:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EA006606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=UCcPbvyJ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=jgNWsKml 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 6B33698M707862 for ; Thu, 3 Dec 2026 05:02:59 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= ezcpUUuXDfZTpWX52tnnnR5McY185QYPpTNOc1gtJwI=; b=UCcPbvyJkg/WoeFk S0Phd3LdoldAZELsQuOh8SZUjtQYs2B6zzGaadU54ulE+d0S6kRdO497Q16WWjRD 5KomRHX0Lq94BYagTsyV4AEN8GJCxSB5m/++hdGWnnKWLYYRrANq8FJk48t47Ji7 gG+rJad6LcwxX0HfvhA0gt9kjeOfBqstGjuYzSJCPNihmKC0Du65YUO8kp1exevL i0G+rfe/+XPaS5dsaxRef8K590FGRhFRB7QiZZSUF8cWh25CO29Yi4y0qeykBBT3 RqmR5pB9qhwb9yew3Te9TAb3BjAiQjpRZlcz+nuhOXDDB631t87fS6kap+RF16VV KH6vjQ== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jaqrtaea4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Dec 2026 05:02:58 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8a0592d4539so16416301b3a.3 for ; Wed, 02 Dec 2026 21:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796274177; x=1796878977; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=ezcpUUuXDfZTpWX52tnnnR5McY185QYPpTNOc1gtJwI=; b=jgNWsKmlSwv6SH+d34RMZ/DqioKpzJkNY+hRoXuiQI/Qcbc8Zpr+SfTCBdv6LKbAEd uvE1o5M9bHNQAuH5/Wn8v09/gljvhPvhxWLK66DK+DhMrQxDZUmnc7S/kciC4Iht/riq oT1/XEfwUdzEh0XCEtnez38AuBwicK8NHbhFXVx2W2OexVZ1NLWmCW5G7nnJ7WsdqXOW SZ+vWMO1i0tIreLksmOcNO46se0ccv69R2AKzIzh98x8cNCD+SJfTRZZrWCLRfeEqV/X 4voIn/7S4xt9uKxaIA6lE6+lIcsfyCUaMnQj47PqpE1cJdHlY7Mn9/F6ikY9dB/tIrMJ ragw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796274177; x=1796878977; h=content-transfer-encoding:content-type: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:content-type; bh=ezcpUUuXDfZTpWX52tnnnR5McY185QYPpTNOc1gtJwI=; b=oP9OgdwViuRhYv3QPwJwrWbyumqy+ePjbPdFXk6QcEqY4jLiuP+CICPDpQ7wlEKqjw MswyeMLOdm7Tb99QQiDmfZnziVLn3s6vT2VCwom+S7NXd5mq04+IOPpPWHgSnyGYop1P zsAdsoBVry4TH+KYA7t9riGfJn0UCCGYWRIJSaosTgk0u17Yw3gHChvG+nkZhbbviSzV L4JNzFauQI2i7yjOHIRz3AUMIjArrZ5JG2+PPKRzVdOCbwFcO7BWNTNZidaQs8TSe53s zsfohUVfEkT7JR9Olz8TqLz4XXHEJNcW7r7GvaQih9S+N7m9V7fPB2P82+Gie4Hi5NTj gcaQ== X-Forwarded-Encrypted: i=1; AL+hErEV+0ryGQk0tbyxry3ZTFD/4ObGRRbf61/s7+ESEPeO0NLypktUenPpejaodvqibru8lKID/rQ1I6e336U=@vger.kernel.org X-Gm-Message-State: APuU4Z8rfY1pDMMWwbzi1w5+JmSrRfB2+jXI+FayRJ/vrWMrGzsXwqfP xoPwBBsn/7dDqVwWn0ZjP7xVi5ytPMH1twqjjBbUkDDetV+2fL78+JLHfX9EJ8tEbZAe5gHLXR8 1hw5p/GeTuRy1XRviH4wIHEGHHSOVHK8C1Kmj7Q7UzriVSrNUsfHPpHTtFSLfywjObao= X-Gm-Gg: AZFdTZc3X+0dbSL3k4TZE4UvQhTRhJw7OT6eYAAIgZyiNtfES2fcouLChegsyk/s7IA VmcwOJJPZEenze9KQZ6ps5mzoFgyMYnu5Voi1m4jz81p67Hbbwdgq7sw+PVqV3ZCb/H/RdEc8LZ gjNpFBwvQDo17y39MFv3SvqDMwOOhucIA3ZNLf1nuRg5B0PIK8N2dexkjupzp/7gguIa4MP06ig IJMBv1bj7KG7R4gm6AQmdSj/RbXL+97gCeMFCDzNGZu7gVUm2l1ruxtAmhWJZF7vKMWzJsiWTKc 52rXcdIZ5c7Yz0C+tpPnRtGO6fB+XfM/5XheqW8ZjmDp/ucDvKDXBr58+CR4IWpPdRDO8WD7hCp 57r6jcee2ljWb2eaSxtS5sRko3zcPPpj9woySdIaAMXNuq/iAxb3635l1DRABL47FkpoN/cTwFJ naCb7F X-Received: by 2002:a05:6a21:7014:b0:3f8:443c:4cea with SMTP id adf61e73a8af0-4014d25dd90mr46916032637.45.1796274177336; Wed, 02 Dec 2026 21:02:57 -0800 (PST) X-Received: by 2002:a05:6a21:7014:b0:3f8:443c:4cea with SMTP id adf61e73a8af0-4014d25dd90mr46916000637.45.1796274176765; Wed, 02 Dec 2026 21:02:56 -0800 (PST) Received: from [192.168.0.167] ([24.165.82.17]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c908a56acfsm22089501b3a.23.2026.12.02.21.02.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 21:02:55 -0800 (PST) Message-ID: Date: Wed, 2 Dec 2026 21:02:54 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h To: Bryan O'Donoghue , Anusha Arun Nandi Cc: Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , gjorgji.rosikopulos@oss.qualcomm.com, hariram.purushothaman@oss.qualcomm.com, akapatra@quicinc.com, linux-phy@lists.infradead.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20261201210207.1049452-1-anusha.nandi@oss.qualcomm.com> <20261201210207.1049452-4-anusha.nandi@oss.qualcomm.com> <29bdc9ed-8625-4717-90d4-f77d4b148a80@kernel.org> Content-Language: en-US From: Jigarkumar Zala In-Reply-To: <29bdc9ed-8625-4717-90d4-f77d4b148a80@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: rdTGqskJ9fl9Qt7c61j2zZO-Acz_Yo6o X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAxOSBTYWx0ZWRfXwpCJAA75s9Yv 5/OlnoLDoPPq8DbHNjJOGqv/jwVa19KGEMpIBi9fjwb42eYPuQgIbgXYka5BPRbJ3zHRMmtIwZE hsaLo5ErDNc07N/8Ig89JLP4Tmhey3A= X-Proofpoint-ORIG-GUID: rdTGqskJ9fl9Qt7c61j2zZO-Acz_Yo6o X-Authority-Analysis: v=2.4 cv=B54sQ+tM c=1 sm=1 tr=0 ts=6b10f802 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=DEjEkZBjyNSUHtkqXcrZmg==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=CuRDjQI_VnWlUPjBu7wA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDAxOSBTYWx0ZWRfX1SvYLNBwK0Dj W61kpfPtgcdbISP1tQIX2xzJa4QQKSy9ltmaw0fC2FWHcl9LCgYb7/kWZHdtbIbST7eXbIbIPMh sDVZuPFHhA5FUNFM07f3fWufxvUnOM0dpV/nyUzZOeqB2QleCJsB9Kxx7/W7JVrRLvoGY/5jSHG xY1roWsVGzbn+y9uzaA45xebruIbWEGMJWHW/JPg2gFGZdsdpovxbejOYV9gdqnIENiQmTR8G3t +x38u0ZYPlcyzEYt5b/9/RfkuNiS76I/7Ps29TXwj0s9WZ6yklkgTQKQLwMZK3RAhDYFTnUJsO8 Mq2RqSDAusduxqqEPOixRZeSQoIAW0bivgU+gKM/TkmeZpoeuEhR8BTSH/MWLBcDLUW1imXMEy9 wnULEgsreXJ0jQU4gq6xYv24meFDqKm62OGjh735EcAqNgnToHieywckeUxPjMb8c2HDpuFicYa RY522FOEEHsAsZC9xTg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_01,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030019 Hi Bryan, On 12/1/2026 9:20 PM, Bryan O'Donoghue wrote: > On 01/12/2026 21:02, Anusha Arun Nandi wrote: >> Restructure phy-qcom-mipi-csi2-3ph-dphy.c: its functions >> (csi2phy_dev_to_regs(), hw_version_read()/reset()/settle_cnt_calc()/ >> gen2_config_lanes()/lanes_enable()/lanes_disable()) and the D-PHY >> hw_ops table move into phy-qcom-mipi-csi2-core.c, while its register >> data (lane_regs_x1e80100[] and the x1e80100 soc_cfg plus its clk/ >> supply/genpd name arrays) moves into a new >> phy-qcom-mipi-csi2-dphy-regs.h. There is no longer a separate >> code-bearing D-PHY source file: core.c now holds every PHY-framework >> and D-PHY register-programming function plus the hw_ops table that >> binds them, and the new header holds nothing but const data, #included >> at the top of core.c. The per-SoC soc_cfg reaches the hw_ops table >> through an extern in the shared phy-qcom-mipi-csi2.h. >> This keeps the maintainability and readability. >> >> The CSIPHY_3PH_CMN_* common-control register macros and the >> CSIPHY_DEFAULT_PARAMS/_SETTLE_CNT_LOWER_BYTE/_SKEW_CAL param_type >> values both move into that shared header too, since the new >> dphy-regs.h's register tables need the param_type values and >> core.c's register-write/read functions need the CTRL/STATUS offset >> macros, the mipi_csi2_dphy_4nm_x1e extern drops out of the shared >> header, since the soc_cfg object is now static and consumed only by >> core.c. >> >> No functional change: register addresses, values, and param_type >> tags are unchanged. > > I don't see much justification for this move. Pardon if I have misunderstood your comment here, but we have add the intention for doing this restructuring. This will be more helpful for readability when we will be adding CPHY support in upcoming patches for CPHY support enablement. > >> Co-developed-by: Jigarkumar Zala >> Signed-off-by: Jigarkumar Zala >> Signed-off-by: Anusha Arun Nandi >> --- >>   drivers/phy/qualcomm/Makefile                 |   3 +- >>   .../phy/qualcomm/phy-qcom-mipi-csi2-core.c    | 232 ++++++++++++++++- >>   ...-dphy.c => phy-qcom-mipi-csi2-dphy-regs.h} | 238 +----------------- >>   drivers/phy/qualcomm/phy-qcom-mipi-csi2.h     |  21 +- >>   4 files changed, 249 insertions(+), 245 deletions(-) >>   rename drivers/phy/qualcomm/{phy-qcom-mipi-csi2-3ph-dphy.c => >> phy-qcom-mipi-csi2-dphy-regs.h} (56%) >> >> diff --git a/drivers/phy/qualcomm/Makefile >> b/drivers/phy/qualcomm/Makefile >> index 4b5e6640a6fa..bae82e18c674 100644 >> --- a/drivers/phy/qualcomm/Makefile >> +++ b/drivers/phy/qualcomm/Makefile >> @@ -7,8 +7,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)    += >> phy-qcom-ipq806x-sata.o >>   obj-$(CONFIG_PHY_QCOM_M31_USB)        += phy-qcom-m31.o >>   obj-$(CONFIG_PHY_QCOM_M31_EUSB)        += phy-qcom-m31-eusb2.o >> >> -phy-qcom-mipi-csi2-objs            += phy-qcom-mipi-csi2-core.o \ >> -                       phy-qcom-mipi-csi2-3ph-dphy.o >> +phy-qcom-mipi-csi2-objs            += phy-qcom-mipi-csi2-core.o >>   obj-$(CONFIG_PHY_QCOM_MIPI_CSI2)    += phy-qcom-mipi-csi2.o >> >>   obj-$(CONFIG_PHY_QCOM_PCIE2)        += phy-qcom-pcie2.o >> diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c >> b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c >> index 8bebc943a771..8a89ece01261 100644 >> --- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c >> +++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c >> @@ -9,20 +9,233 @@ >>   #include >>   #include >>   #include >> +#include >>   #include >>   #include >> -#include >>   #include >>   #include >>   #include >>   #include >> +#include >>   #include >> -#include >>   #include >> -#include >>   #include >> +#include >> >>   #include "phy-qcom-mipi-csi2.h" >> +/* D-PHY register tables and per-SoC soc_cfg objects (pure data). */ >> +#include "phy-qcom-mipi-csi2-dphy-regs.h" > > Data that was previously kept in a .c file now migrates to a .h file > with one user.. Next patches add more hardware support. > >> + >> +#define CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(n)        ((0x200 * (n)) + >> 0x24) >> + >> +/* >> + * 3 phase CSI has 19 common status regs with only 0-10 being used >> + * and 11-18 being reserved. >> + */ >> +#define CSI_COMMON_STATUS_NUM                11 >> +/* >> + * There are a number of common control registers >> + * The offset to clear the CSIPHY IRQ status starts @ 22 >> + * So to clear CSI_COMMON_STATUS0 this is CSI_COMMON_CONTROL22, >> STATUS1 is >> + * CONTROL23 and so on >> + */ >> +#define CSI_CTRL_STATUS_INDEX                22 >> + >> +/* >> + * There are 43 COMMON_CTRL registers with regs after # 33 being >> reserved >> + */ >> +#define CSI_CTRL_MAX                    33 >> + >> +static inline const struct mipi_csi2phy_device_regs * >> +csi2phy_dev_to_regs(struct mipi_csi2phy_device *csi2phy) >> +{ >> +    return &csi2phy->soc_cfg->reg_info; >> +} >> + >> +static void phy_qcom_mipi_csi2_hw_version_read(struct >> mipi_csi2phy_device *csi2phy) >> +{ >> +    const struct mipi_csi2phy_device_regs *regs = >> csi2phy_dev_to_regs(csi2phy); >> +    u32 tmp; >> + >> +    writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6)); >> + >> +    tmp = readl_relaxed(csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 12)); >> +    csi2phy->hw_version = tmp; >> + >> +    tmp = readl_relaxed(csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 13)); >> +    csi2phy->hw_version |= (tmp << 8) & 0xFF00; >> + >> +    tmp = readl_relaxed(csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 14)); >> +    csi2phy->hw_version |= (tmp << 16) & 0xFF0000; >> + >> +    tmp = readl_relaxed(csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 15)); >> +    csi2phy->hw_version |= (tmp << 24) & 0xFF000000; >> + >> +    dev_dbg_once(csi2phy->dev, "CSIPHY 3PH HW Version = 0x%08x\n", >> csi2phy->hw_version); >> +} >> + >> +/* >> + * phy_qcom_mipi_csi2_reset - Perform software reset on CSIPHY module >> + * @csi2phy: CSIPHY device >> + */ >> +static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device >> *csi2phy) >> +{ >> +    const struct mipi_csi2phy_device_regs *regs = >> csi2phy_dev_to_regs(csi2phy); >> + >> +    writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET, >> +           csi2phy->base + >> CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0)); >> +    usleep_range(5000, 8000); >> +    writel(0x0, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0)); >> +} >> + >> +static void >> +phy_qcom_mipi_csi2_lanes_disable(struct mipi_csi2phy_device *csi2phy, >> +                 struct mipi_csi2phy_stream_cfg *cfg) >> +{ >> +    const struct mipi_csi2phy_device_regs *regs = >> csi2phy_dev_to_regs(csi2phy); >> + >> +    writel(0, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5)); >> + >> +    writel(0, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6)); >> +} >> + >> +/* >> + * phy_qcom_mipi_csi2_settle_cnt_calc - Calculate settle count value >> + * >> + * Helper function to calculate settle count value. This is >> + * based on the CSI2 T_hs_settle parameter which in turn >> + * is calculated based on the CSI2 transmitter link frequency. >> + * >> + * Return settle count. >> + */ >> +static u8 phy_qcom_mipi_csi2_settle_cnt_calc(s64 link_freq, u32 >> timer_clk_rate) >> +{ >> +    u32 t_hs_prepare_max_ps; >> +    u32 timer_period_ps; >> +    u32 t_hs_settle_ps; >> +    u8 settle_cnt; >> +    u32 ui_ps; >> + >> +    ui_ps = div64_u64(PSEC_PER_SEC, link_freq); >> +    ui_ps /= 2; >> +    t_hs_prepare_max_ps = 85000 + 6 * ui_ps; >> +    t_hs_settle_ps = t_hs_prepare_max_ps; >> + >> +    timer_period_ps = div_u64(PSEC_PER_SEC, timer_clk_rate); >> + >> +    if ((t_hs_settle_ps / timer_period_ps) < 6) >> +        return 0; >> + >> +    settle_cnt = t_hs_settle_ps / timer_period_ps - 6; >> + >> +    return settle_cnt; >> +} >> + >> +static void >> +phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device >> *csi2phy, >> +                     u8 settle_cnt) >> +{ >> +    const struct mipi_csi2phy_device_regs *regs = >> csi2phy_dev_to_regs(csi2phy); >> +    const struct mipi_csi2phy_lane_regs *r = regs->init_seq; >> +    int i, array_size = regs->lane_array_size; >> +    u32 val; >> + >> +    for (i = 0; i < array_size; i++, r++) { >> +        switch (r->param_type) { >> +        case CSIPHY_SETTLE_CNT_LOWER_BYTE: >> +            val = settle_cnt & 0xff; >> +            break; >> +        case CSIPHY_SKEW_CAL: >> +            /* TODO: support application of skew from dt flag */ >> +            continue; >> +        default: >> +            val = r->reg_data; >> +            break; >> +        } >> +        writel(val, csi2phy->base + r->reg_addr); >> +        if (r->delay_us) >> +            udelay(r->delay_us); >> +    } >> +} >> + >> +static int phy_qcom_mipi_csi2_lanes_enable(struct >> mipi_csi2phy_device *csi2phy, >> +                       struct mipi_csi2phy_stream_cfg *cfg) >> +{ >> +    const struct mipi_csi2phy_device_regs *regs = >> csi2phy_dev_to_regs(csi2phy); >> +    struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg; >> +    u8 settle_cnt; >> +    u8 val; >> +    int i; >> + >> +    if (cfg->link_freq <= 0) >> +        return -EINVAL; >> + >> +    settle_cnt = phy_qcom_mipi_csi2_settle_cnt_calc(cfg->link_freq, >> csi2phy->timer_clk_rate); >> +    if (!settle_cnt) >> +        return -ENODEV; >> + >> +    /* >> +     * CSI_COMMON_CTRL5 is a physical lane power-up bitmap: >> +     * - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6) >> +     * - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5) >> +     * - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable >> +     */ >> +    val = BIT(lane_cfg->clk.pos); >> +    for (i = 0; i < cfg->num_data_lanes; i++) >> +        val |= BIT(lane_cfg->data[i].pos * 2); >> + >> +    writel(val, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5)); >> + >> +    /* Lane configuration for polarity @ CSIPHY-base + CTRL9 */ >> +    for (i = 0; i < cfg->num_data_lanes; i++) { >> +        if (lane_cfg->data[i].pol) { >> +            u8 pos = lane_cfg->data[i].pos; >> + >> +            writel(BIT(2), csi2phy->base + >> CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(pos * 2)); >> +        } >> +    } >> + >> +    if (lane_cfg->clk.pol) >> +        writel(BIT(2), csi2phy->base + >> CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(lane_cfg->clk.pos)); >> + >> +    val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B; >> +    writel(val, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6)); >> + >> +    val = 0x02; >> +    writel(val, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 7)); >> + >> +    val = 0x00; >> +    writel(val, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0)); >> + >> +    phy_qcom_mipi_csi2_gen2_config_lanes(csi2phy, settle_cnt); >> + >> +    /* IRQ_MASK registers - disable all interrupts */ >> +    for (i = CSI_COMMON_STATUS_NUM; i < CSI_CTRL_STATUS_INDEX; i++) { >> +        writel(0, csi2phy->base + >> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, i)); >> +    } >> + >> +    return 0; >> +} >> + >> +const struct mipi_csi2phy_hw_ops phy_qcom_mipi_csi2_ops_3ph_1_0 = { >> +    .hw_version_read = phy_qcom_mipi_csi2_hw_version_read, >> +    .reset = phy_qcom_mipi_csi2_reset, >> +    .lanes_enable = phy_qcom_mipi_csi2_lanes_enable, >> +    .lanes_disable = phy_qcom_mipi_csi2_lanes_disable, >> +}; >> >>   static int >>   phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device >> *csi2phy, >> @@ -239,11 +452,10 @@ static int >> phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2 >> >>       /* Single power-domain devices are already attached by the bus >> core. */ >>       if (csi2phy->soc_cfg->num_genpds == 1) >> -        return dev_pm_domain_attach(csi2phy->dev, 0); >> +        return dev_pm_domain_attach(csi2phy->dev, false); > > ? > > Your patch said "no functional change" but then you're changing this. Sorry about this. Due to file migration this got missed. we will fix this and other functional changes in next version of patchset. > >> >> -    pd_names = devm_kzalloc(csi2phy->dev, >> -                sizeof(char *) * csi2phy->soc_cfg->num_genpds, >> -                GFP_KERNEL); >> +    pd_names = devm_kcalloc(csi2phy->dev, csi2phy->soc_cfg->num_genpds, >> +                sizeof(*pd_names), GFP_KERNEL); > > And this. > > You're sliding several changes into something that says "no functional > change" > > If your overall objective is to move the tables out, you don't need > the churn here or the stealth changes to achieve it. > > Sorry this is a NAK from me, I don't get why you can't just add the > tables beside where they are already defined for hamoa and glymur. we will fix these functional changes in our next version of patchset. > > --- > bod Best Regards, Jigar