Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1542964rdd; Thu, 11 Jan 2024 02:16:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMiBoscjvI0+Hn/zqOyv0Uckmg5yIYGdGtS3h4RkejAw1NifBgmZcTqBqnLQ5RUi4f1rOj X-Received: by 2002:a17:90b:4a8d:b0:28c:f87e:f812 with SMTP id lp13-20020a17090b4a8d00b0028cf87ef812mr724619pjb.43.1704968218205; Thu, 11 Jan 2024 02:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704968218; cv=none; d=google.com; s=arc-20160816; b=G7xns5iUCmksk3olNtway8kLILabJrfrrCCgLjNEFhIVt4g+vJs3XhmhjBtQTdLr3C b0Xg9cGdcBWq9dZCCQH5T8v67e7ob7J4JJzv9Jm7L9auo3wuVrUQBpT/BpAvZlRueaTN UT/o23Y4gOZkOopaYD5cR2dU6YHjsJTRFk5TkViMXJJoLGT55JqPwMb72Yo57H5BRRWB EDlxJaaE4XC2XF0BGn4QRyq6nZ7A59+RyQWectTjqqMaxAUoFqeeEFLHtqYORno+Haik fUEpaJBvKQ7BpXMej8nnnJgSk4W6Olu84M27K/VKEO6z8WN+PEf1u7M0bQiOMcqcl3UQ CkYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+V4JzjzBqaHzJLZncYnEckgIPzqOvsDKGfGUY3ZauSA=; fh=OPEMuYhkSth4jePHJKcY25JTwXNSGicIkGqXkEFYmCo=; b=WdjPbTW7QhxrObEqtH3h9EPU9xM44JJ30ToMLr93ljxAdubmRpEwPLv6objyAzl2ps HkjYtabf7IamDDPui+Ih3wsvYHscWi1W/XH8vaxi4PCQbJcPQvipNAZg8/LM5vzUH3m2 +arAt7XiT41jXNsDSXjDo6SUEmUO+Z7jJXgTR2EfXuWolt3kn4PyLb18THw3/64yXbmr 1pKjenygA2ASyubCH6VI8KnTnDDlrETQwlz/rRhYRTYYv2I/I/s331W71rJ+wxV4297C xRGHvx5Vujtw8ITZ1Sh61NITiCrw7GyIP8GVS4j1HDeI3hra5AD7IfKroQjlBBiW58EG fuCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=D6I8Jkiu; spf=pass (google.com: domain of linux-kernel+bounces-23371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23371-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d5-20020a17090a498500b00286ef2fc253si3245015pjh.97.2024.01.11.02.16.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 02:16:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=D6I8Jkiu; spf=pass (google.com: domain of linux-kernel+bounces-23371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23371-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8B9F028B6E0 for ; Thu, 11 Jan 2024 10:15:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB5BE12E5F; Thu, 11 Jan 2024 10:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="D6I8Jkiu" Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 083821548D for ; Thu, 11 Jan 2024 10:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-40e60e13581so2980855e9.1 for ; Thu, 11 Jan 2024 02:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1704968109; x=1705572909; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+V4JzjzBqaHzJLZncYnEckgIPzqOvsDKGfGUY3ZauSA=; b=D6I8Jkiu7R2YYZjSXVLCAEHo7Tni8IMl8dy9/kBdkb7S7vXW2tNVB19YzW/1kX86lO /w1Paf48C7NPiR6m3SVbgrrrk/+8slEbGy//PyLYlbsQtb2Upc3miDc3INa50+Sl6HxF lelnOioANvptTcCJEGD53wlr7bScwQcHzEgSed6kNJtMzhXRit37tXPVrboj+47aOs5u 3cGrfUbYYpU4K635cOm5jCTRWr9IhUvoMw2ayDZQ6GLday3A7LtczPX3IZ8thiqLZ7Y2 3TNr48uobHf51v2axVFyQSjSmSkux+uYE1DBIic6MmaH/XAA8nDboghBXOGFBG+2G8VX 8yTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704968109; x=1705572909; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+V4JzjzBqaHzJLZncYnEckgIPzqOvsDKGfGUY3ZauSA=; b=FzI8Sb/cqTK3QCsDXdsIZaJICVXi4Q6LwBjDfg6Qc31KC3RoIVDPsEG/2Jszp9MaM1 OZWOQfaOHgtmzsEgKcRIl/pcGDOL1I7oyjSaFx2rIs0Tek8QwGjUFhNBz1+EVcQY166w evxdJycz8KSSwHgb1EasGlwxURK3Aw0Ts29xbzjCEH3Tm10VRjflRJ3mapZUbZewHleJ eucROdUZ0O/eG0lhbzciZP6LvJeHmhNVbnyXKg4N5kVKg3AqQPFcc1KdNJmnn5S7QCam IytyqdwXAXtnILojXriLDiMpyJQiEirb3VS7j3ISF9ZL5Oh67MUXNGgTUYVgP067d+2b 2AHA== X-Gm-Message-State: AOJu0YxEz62SERAeCXheLvmw24T0vNTWuqtFqWnNnZnP7WYRL2140YC2 JJl5FoH/zQiKlXrVlz67QsBxJJum/rtACQ== X-Received: by 2002:a05:600c:3b1d:b0:40e:6206:a518 with SMTP id m29-20020a05600c3b1d00b0040e6206a518mr68778wms.184.1704968109127; Thu, 11 Jan 2024 02:15:09 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:55f:21e0:9e19:4376:dea6:dbfa]) by smtp.gmail.com with ESMTPSA id j7-20020a05600c190700b0040e52cac976sm5157758wmq.29.2024.01.11.02.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 02:15:08 -0800 (PST) From: Julien Stephan To: Cc: Julien Stephan , Andy Hsieh , AngeloGioacchino Del Regno , Chunfeng Yun , Chun-Kuang Hu , Conor Dooley , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Kishon Vijay Abraham I , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, Matthias Brugger , Philipp Zabel , Rob Herring , Vinod Koul Subject: [PATCH v5 0/2] phy: mtk-mipi-csi: add driver for CSI phy Date: Thu, 11 Jan 2024 11:14:49 +0100 Message-ID: <20240111101504.468169-1-jstephan@baylibre.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Adding a new driver for the MIPI CSI CD-PHY module v 0.5 embedded in some Mediatek soc, such as the MT8365 This driver was adapted from https://patchwork.kernel.org/project/linux-mediatek/cover/20200708104023.3225-1-louis.kuo@mediatek.com/ v1 can be found here: https://lore.kernel.org/all/20230403071929.360911-1-jstephan@baylibre.com/ v2 can be found here: https://lore.kernel.org/all/20230515090551.1251389-1-jstephan@baylibre.com/ v3 can be found here: https://lore.kernel.org/all/20230524083033.486490-1-jstephan@baylibre.com/ v4 can be found here: https://lore.kernel.org/linux-phy/20230620121928.1231745-1-jstephan@baylibre.com/ Changelog Changes in v5: - rebase on latest master scheduled for 6.8-rc1 - sort alphabetically CONFIG_PHY_MTK_MIPI_CSI_0_5 in Kconfig and Makefile - put lines under 100 chars on one line Changes in v4: include/dt-bindings/phy/phy.h: - remove commit adding PHY_TYPE_CDPHY definition Binding file: - use the standard phy-type property instead of a custom one so rename mediatek,phy-type -> phy-type - phy-type property is made optional: when present, describes the phy type and the operating mode - phy-cell is modified to accept a phy argument representing the phy operating mode if phy-type is not specified - adding new property num-lanes Driver: - add a custom xlate function to handle phy cells - update probe function to retrieve the new value phy-type instead of the mediatek,phy-type - remove useless struct define `struct mtk_mipi_dphy;` - rename some functin/variable from `xx_dphy_xx` to `xx_cdphy_xx` - update probe function to read num-lanes property Changes in v3: Binding file: - rename compatible string mediatek,phy-mipi-csi-0-5 -> mediatek,mt8365-csi-rx - rename binding file to be as compatible string - change property mediatek,is_cdphy -> mediatek,phy-type using an enum value instead of boolean for scalability - remove status property from example nodes - rename example node name 'mipi_rx_csi0: mipi_rx_csi0@11c10000' -> 'csi0_rx: phy@11c10000' - put reg address in lower case include/dt-bindings/phy/phy.h: - add PHY_TYPE_CDPHY definition Driver: - rename compatible string - rename property mediatek,is_cdphy -> mediatek,phy-type - rename CSIx* macro to CSIX* (x -> X) - fix style issue on the driver data structure - update MODULE_DESCRIPTION as suggested by Angelo and update the kconfig module description to match it - add dphy /cdphy eq tuning function to factor the code and increase readability - fix typo __PHY_MTK__MIPI_CSI__C_0_5_RX_REG_H_ --> __PHY_MTK_MIPI_CSI_V_0_5_RX_REG_H_ - reword commit message to update my contributions - added missing copyright - added module name in Kconfig Changes in v2: - fix all comments on bindings - move the binding chunk from driver to binding commit - fix dt_binding_check error (reported by DT_CHECKER_FLAGS) - use a more generic compatible string - add a new dt properties to simplify the driver "mediatek,is_cdphy" - rename the driver and the corresponding file to include version - drop of_match_ptr() - use devm_platform_ioremap_resource - use phy-mtk-io.h api instead of regmap - rework the driver to use dt nodes to declare PHY instead of an array in the driver - remove useless define for unused registers - remove support for CSI0A/B because it cannot be tested, and it simplifies the driver for a first review - edit commit message and bindings to be more descriptive about the hardware Florian Sylvestre (1): dt-bindings: phy: add mediatek MIPI CD-PHY module v0.5 Phi-bang Nguyen (1): phy: mtk-mipi-csi: add driver for CSI phy .../bindings/phy/mediatek,mt8365-csi-rx.yaml | 79 +++++ MAINTAINERS | 7 + drivers/phy/mediatek/Kconfig | 12 + drivers/phy/mediatek/Makefile | 2 + .../mediatek/phy-mtk-mipi-csi-0-5-rx-reg.h | 62 ++++ drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c | 294 ++++++++++++++++++ 6 files changed, 456 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt8365-csi-rx.yaml create mode 100644 drivers/phy/mediatek/phy-mtk-mipi-csi-0-5-rx-reg.h create mode 100644 drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c -- 2.43.0