Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2153737rwd; Mon, 15 May 2023 08:00:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6qi2yfADf6lABOmDuwiiqupJPTisVMLAzcSFns8X0uhg3U/l1hCjkyMmbtjV1g8b4QggjD X-Received: by 2002:a17:90b:17d0:b0:246:f9f1:ad17 with SMTP id me16-20020a17090b17d000b00246f9f1ad17mr32554451pjb.40.1684162802717; Mon, 15 May 2023 08:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684162802; cv=none; d=google.com; s=arc-20160816; b=LnV8CYDBkCT8Gl2LEyf5QrTcWf7j32EUTLylCAvo2QlxKlXw19gEm7ctrhmfPoK7kN r5m1Y6mnJXOL+XoXI7zY/enW8lYZ1sTYRh8ATglLgtqAWGx5o2sohE0+dS+mdMqWOpw4 CKEJVk1mmawZ1CH8o3OpepCpyEDnqtrnWzlY08TpFbenDX7jlkkcTAxnCr+VmNMMdsvL kS9om1wpNg8tjFeAdc89aWwcUYaU9Jf5wWx9vaRAtdwnWr8E5NFdLMnSPcdEQu7GwmNa kzIoowwdF1JuN4As9040AZEQx5wpR2y+oFF+2GuQbEE3imPEO06j25DBKsbDNWPSrft6 2YMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I6PGsaxxe+r0/tgEPfoiZneEqJdU4NADxCmDaQhFL68=; b=bZhcEkLyHAqTcB03SZykhfQbbn7Xy/RplUBqQ59MtE6Na2Tmn+zUiqktOeaChxNNcT ADjfW02gBLBd+YHt/NaNjxteXEICiZa4wPSNFaX5LyAwjWAhsNpwQKQYi5iMYVSXrLsy hU+NVHPUz6gp3bdxNipdXoQnL3Dag//Xeu6Wioz3B6jYJJHFp2hmNn0wKLBOl4gBwHcO X9m6NgexrPQFWCQwVHh5uAzIhx8FeiQoePhGwYrCX2SKDabToR5OvVjeMCb1b7gnoipM uB5A8kD/pfktkZ9IAmIBCMxClH7Q5mz20Du3bIeE625VI/de2y1KOE07ksrRGOXpLBD2 AOLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=QBUPDu0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a17090adb8100b0024e29c5c06dsi31585591pjv.12.2023.05.15.07.59.46; Mon, 15 May 2023 08:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=QBUPDu0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239555AbjEOOwL (ORCPT + 99 others); Mon, 15 May 2023 10:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234849AbjEOOwK (ORCPT ); Mon, 15 May 2023 10:52:10 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043211706 for ; Mon, 15 May 2023 07:52:08 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f450815d02so41001585e9.0 for ; Mon, 15 May 2023 07:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1684162326; x=1686754326; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=I6PGsaxxe+r0/tgEPfoiZneEqJdU4NADxCmDaQhFL68=; b=QBUPDu0mnTKpIi/wGbo9UgpiCqziYGcMj3hQWPNefHgGAfqJ8lVJErWsufoP7gVWl/ MuKN4tEX1pZzLr340OCucG7rs4ehSVdPZ56+kGhAkPSHTFEanh+UOGRKxl0frSuERoQi znFDPcNKbBBfN9G+5GNepJLzQ0wZAO8nLN1JBJsH87VkOTZzGqNF3dV7QfkvbFQbWwzC 8JItnIfYJ0m+YlLGiaXwATFgD5y70Nki5rbnME2c/ITNCpP6jTEfV2/BTzQHtJXbr5Ix ZLYZvkgxPg66jjZAKiLqfZ7H0BYHkg7RRJ+3Kpz8v/kkce6/YnkPjUmtUNTBVfQ11JjK kiqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162326; x=1686754326; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=I6PGsaxxe+r0/tgEPfoiZneEqJdU4NADxCmDaQhFL68=; b=A1PzToNhgArTq+00rw0/5CLFUpc4GQm4RS2aqZlF4zc1Vp1Hd6iuZPG7QXv30Xiw+J kMohWSXe3ccR8+woh/XbB6N4Ue+ODeBjy7v4gj3iRtHW9NXwji3GS6916EJ27GSjCxIO BMawZDESLtlgqXKxGBJdupqBFStOIEJPxDPTc7LWh81IUK0ePgomgZFGMvMDNFBMYmNO X4aIcXbeEJz2n82k7TRlnnA2wiD7ME/N0k01uulda/oRJDk1hZ8MNgrngMciKNK/KqXo DIvQxj+U2VVwfyYcg6uU7cOAnt0OOH3HWLZOKgOlor04LihUYrPNyf/zdmpxzO6/TMEj M0wg== X-Gm-Message-State: AC+VfDy7mXumQjzxsdube5SCuuBXXWPZ2+jDwoNzNo1JGN2v5e+rIfco KMIArRHCSPM4D4prELB/Ad4skg== X-Received: by 2002:a1c:f310:0:b0:3f1:74bd:bc22 with SMTP id q16-20020a1cf310000000b003f174bdbc22mr22887492wmq.6.1684162326437; Mon, 15 May 2023 07:52:06 -0700 (PDT) Received: from localhost ([2a01:e0a:55f:21e0:fd3b:9fed:e621:cc8f]) by smtp.gmail.com with ESMTPSA id p1-20020a05600c204100b003f4e47c6504sm14774860wmg.21.2023.05.15.07.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:52:05 -0700 (PDT) Date: Mon, 15 May 2023 16:52:05 +0200 From: Julien Stephan To: AngeloGioacchino Del Regno Cc: krzysztof.kozlowski@linaro.org, robh@kernel.org, chunkuang.hu@kernel.org, linux-mediatek@lists.infradead.org, Phi-bang Nguyen , Louis Kuo , Chunfeng Yun , Vinod Koul , Kishon Vijay Abraham I , Andy Hsieh , Philipp Zabel , Matthias Brugger , open list , "moderated list:ARM/Mediatek USB3 PHY DRIVER" , "open list:GENERIC PHY FRAMEWORK" , "open list:DRM DRIVERS FOR MEDIATEK" Subject: Re: [PATCH v2 2/2] phy: mtk-mipi-csi: add driver for CSI phy Message-ID: References: <20230515090551.1251389-1-jstephan@baylibre.com> <20230515090551.1251389-3-jstephan@baylibre.com> <85500bcc-c5e8-8ce2-edea-233de86c2d35@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85500bcc-c5e8-8ce2-edea-233de86c2d35@collabora.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 15, 2023 at 04:22:38PM +0200, AngeloGioacchino Del Regno wrote: > Il 15/05/23 15:36, Julien Stephan ha scritto: > > On Mon, May 15, 2023 at 02:22:52PM +0200, AngeloGioacchino Del Regno wrote: > > > Il 15/05/23 11:05, Julien Stephan ha scritto: > > ..snip.. > > > > + port->is_cdphy = of_property_read_bool(dev->of_node, "mediatek,is_cdphy"); > > > > > > This driver doesn't support C-PHY mode, so you either add support for that, or in > > > my opinion you should simply refuse to probe it, as it is *dysfunctional* for the > > > unsupported case (and might even introduce unstabilities). > > > > > > /* At the moment, only D-PHY mode is supported */ > > > if (!port->is_cdphy) > > > return -EINVAL; > > > > > > Also, please don't use underscores for devicetree properties: "mediatek,is-cdphy" > > > is fine. > > > > > Hi Angelo, > > You are right this driver does not support C-PHY mode, but some of the > > PHYs themselves support BOTH C-PHY AND D-PHY. The idea of `is_cdphy` variable > > is to know if the CSI port supports BOTH C-PHY AND D-PHY or only DPHY. > > For example mt8365 has 2 PHYs: CSI0 and CSI1. CSI1 support only D-PHY, > > while CSI0 can be configured in C-PHY or D-PHY. Registers for CD-PHY and > > D-PHY are almost identical, except that CD-PHY compatible has some extra > > bitfields to configure properly the mode and the lanes (because supporting > > trios for CD-PHY). > > If C-PHY support is eventually added into the driver, I think we will need > > another variable such as `mode` to know the mode. I was also thinking > > of adding a phy argument to determine if the mode is C-PHY or D-PHY. > > > > So here, I don't want to stop the probe if `is_cdphy` variable is set to > > true. Does it make sense ? > > > > Comments in the code convinced me that the other PHYs providing only C or D PHY > support weren't compatible at all with this driver. > > I got it now - but at this point can you please add a comment in the code actually > clarifying that this driver supports both PHYs providing *only* D-PHY and ones > providing selectable C-or-D PHY? > > That clarified, it would not make sense to stop probing if it's not a CDPHY because > as you said there might be a D-only PHY that would be actually supported here. > > Regards, > Angelo > > Ok, I will add a comment in the code to make it more clear. Regards Julien