From patchwork Thu Jun 12 01:15:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 895828 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 70CF313B797 for ; Thu, 12 Jun 2025 01:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690942; cv=none; b=pLetA1c4QazNz0gATWnm//knEdlGPtrLgsTIwWA6Owfk1NeXzXJwQC0FypaM7hCD9vJOl3cUgKBlkFM6gHBGzqCQ3F0e7YJjZpE8yszBHEgB/plqa19uAvIQR5ndL3pixV1mvUcbWgSEz17TRWvqRNP3wCmjDrv9vtOdZQFivKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690942; c=relaxed/simple; bh=cTiCvc3M5D7VQS/RPNZMBcUtmTqxxVJOMqLiNgpATFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bseuF4rgTwYyc3vu3q1KpLvjPpbMkYFIf9P7Mj3R4/FmLlkfEUbDrEBaScdp5m4Nqa/EtpyyINxyQXfWJY/9BUn3nZzuvgzUpqHPvgZLX9WTTGUJDy020LLRcN1AZ+G5TlMfPRK2+gG/5dlhVrgofeYDUcmNV91XaRgCq5YaanQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=GwSfncPl; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GwSfncPl" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-553645133f0so10926e87.0 for ; Wed, 11 Jun 2025 18:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749690938; x=1750295738; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MytdYQLPTBH+sqpGAkv07c7VyYUNYJf1+SknQylnEzo=; b=GwSfncPllO4TAQ5uNloUvjMaA3mS2eg8DKsjxYl058P5/p6Im6ZIOtBGo9qCLJIINZ /3lT+zApHwg+O36n8d/YDvCWUE2eIZ0VktH52OOHGcxmmasUsRzRLvj4xpzNAeitZzgz jEnIH68sb7cvID4bvEodXljSCKumGbhIQLViQLDYXaywVGPzRzLPEEjvStcqSLMcGYnT OYHx9WW2DdsmFQkSV+DedYpqtJ6+eMbHUw+24HP30PR+m7eef2gsAVnElIPhlu4HA8Ey obus20cBLOVKd6uf/1oOa+vjivHYXJemiAgKBKjqMTOz5QgiZbgmYK6cnzUPfjwVyYTR y96w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749690938; x=1750295738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MytdYQLPTBH+sqpGAkv07c7VyYUNYJf1+SknQylnEzo=; b=uzvVs33y8pfyWbXB/lS1dP0ZYF8Lz83oP5M++I6gW7dYQgGcb3SjHNHoa4UOyKf2/H bR3Qkw5mL4q3RW1W/0Vpp8Y5QcWkd/V30dagSJHKEGz4PFIECTBXgJdix+2/iXacJDVI LSYIhM75vonUpZdONuUBl2u/zbm6pn4ucORKS1ZITN7xTnqBuuwkXn/2H2DjYiTAy3oa D+mwRY9krUEnoG2OjW7Rptgv9utU52u3TEPfBEmti9Jwe5ThLYYrgaSa9sV7vtyTJEi+ 4AbCanP+UGRjWfUvdNLEXVppPPsTB7CIM1DrowjMff4zQdiL47ZLnI+9fsPg5XQ0NhdO Vmqw== X-Forwarded-Encrypted: i=1; AJvYcCWROHYaNIu2+zC8rGU+Fr6TmYZ4GBujfhyY0q1+hG6BR7P596hBHFo00o2oi5PapxQTIRXrsyTlCx7P5g==@vger.kernel.org X-Gm-Message-State: AOJu0Yx4QAUYyzfxcCtP3DXyVS/5XUrWuEdeLw2QWRh59cQ/T0BbopEH xZ0osjyUjuxF3F8g0bKTp0yBPwsiwwlZ7NkytXH+MDhGiENVg7T+xxUnQStjBm+DpA0= X-Gm-Gg: ASbGncv4pqKJ6MXS7qW6MnLIBNasp4cEzjXBTAso76NPXnPxR6whwbV05wcIXho68TN /yvqlwfUOmnieIYNnKTL3rkQaNIqoW/H6dlcSSY4bafLdHuGgv43Y/qBe3VB1EHLC2CSFUWBpvH UmLrkuING4Oxi9azRtv9fdAtYWBheurUnKsnPFHm7ycE42HZ96PJKvht4OaQDePaQBftZdLzdoh vmwExPeVFGSx6LotN1nlAOnt1xDOakiUTx5xYs571n7Hzza8DpDSJFOO6SIHZLOIRTe+gxdiUS4 6M8WL+AkJtU5PXFTIjEqWZhF0r2YCqbJptYHCNl5EqhsgAU3+ErkobFazoOtZCJsPHLoujtWu1r Fxyx8kQBlNGmZfDb+wfw7/qr8YlLa8vxbKuGZ9wkxIObddfULErM= X-Google-Smtp-Source: AGHT+IHoUp0rBCvyGGy7XmIPKelgT4UaUs9romhC0d9m5fZfQ3Q0Ot+dNcpGlYOwVncG8cNIP4xyaQ== X-Received: by 2002:a05:6512:68f:b0:553:1fee:4aaa with SMTP id 2adb3069b0e04-5539c247d66mr533854e87.16.1749690938552; Wed, 11 Jun 2025 18:15:38 -0700 (PDT) Received: from localhost.localdomain (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553a7018069sm62808e87.157.2025.06.11.18.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 18:15:37 -0700 (PDT) From: Vladimir Zapolskiy To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue Cc: Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Neil Armstrong , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 01/10] media: qcom: camss: remove never used camss_vfe_get()/camss_vfe_put() Date: Thu, 12 Jun 2025 04:15:22 +0300 Message-ID: <20250612011531.2923701-2-vladimir.zapolskiy@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> References: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Two intended to be helpers camss_vfe_get()/camss_vfe_put() got their declarations in commit b1e6eef535df ("media: qcom: camss: Decouple VFE from CSID"), but the correspondent functions haven't beed even added. Remove the unused declarations. Signed-off-by: Vladimir Zapolskiy --- drivers/media/platform/qcom/camss/camss.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index 1d0f83e4a2c9..99831846ebb5 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -160,8 +160,6 @@ s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp, int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock); int camss_pm_domain_on(struct camss *camss, int id); void camss_pm_domain_off(struct camss *camss, int id); -int camss_vfe_get(struct camss *camss, int id); -void camss_vfe_put(struct camss *camss, int id); void camss_delete(struct camss *camss); void camss_buf_done(struct camss *camss, int hw_id, int port_id); void camss_reg_update(struct camss *camss, int hw_id, From patchwork Thu Jun 12 01:15:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 895827 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 ED92B143C69 for ; Thu, 12 Jun 2025 01:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690946; cv=none; b=sqmmWuvc6kUxeEWwLPcO4/T0+ePxajx7R1rfi1WuMvc4raQlh1lHaJabeDTK4s4/G/nL2U0kTvBf5ucagh+TIGDmejqVPFq/+tlYvFPh6vjTxSQJq1/54W71v3ZQLnCt0tQHfWVWTmNE+4E7b0Bjmpx8avvMy0h/ZfLrcPF5uy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690946; c=relaxed/simple; bh=IMi0ADJmNFhdUTuPsCvNz20Avnzqg/FLQjL/Lp+bix4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EmFLcZ1ym9h9VDr6uD7u72iRLDTvHbZc2LWsewpmA7vDutwfPzOK9fG4tDf2NjkmFtdsOSxQ1MVVM8VpJt774e2PYuaelSFu8pFTSUHT9agbJqUweTsjX7XxJhzpLlEFDCjicY3n0JxSfZaj7HEX5wDfM4tzNG8NDKxevUz+PxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FVunQLJa; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FVunQLJa" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-32b358f9265so89531fa.0 for ; Wed, 11 Jun 2025 18:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749690943; x=1750295743; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+gi7OuH3v0fsslSod+wg7r1kDbClC/Q60uMP2imoSx0=; b=FVunQLJatUJOXwrKVTGxyqcSh6CqF2Xylkz0r4H1Yh7RrmG08sfTdH4u/g17hN0RDz hUNCgEGlHTSTLslibbSOEH7wsE9Y7bYpIDMdYfcPKp3OMyI0Uvq692z2Okoem72ALFmj XjchoJehTtXHBD9AMH0DQE1mMReCwrqeK4UnzT/mRz8NSNV0AGLxAHQr4epmQ92HILV4 3WEkxJudF/LLLwUhp1rcSNGWM6OoflunRXLSxUFyZDkj+oa4fj1teybLgWWkUexFIolo G8yuOZdV23GzjJQzqd5pdSJDSNVos9xlL4bOgLMr/WklERgNjGCcgL2Jsb0H4wbCz/rm vEPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749690943; x=1750295743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+gi7OuH3v0fsslSod+wg7r1kDbClC/Q60uMP2imoSx0=; b=xDj2la7Db+8+d0qAC1GTkFOlxYKVBe2e/2cRZ9/yTfszqqx11m1+JTE5560Y8NbWhn DFsLYKsKaGdQaURngy9//gUakxdqy96f2Qdxx9m4VuYP+hk4p/4gQsMPyJ/P56SiPwXW 8udE/gb371RVQKDYoVYXpDtojWW+4OdqAcJ4WGXHoJkY5CpaaM+YxT0CYyv+DOSBQsaR G9O6Z5kFqGSa/GEphSoOyChuD0LeuE2G5tPiTYj3k57Y4aSMUU+zQwJTsbI5ZfnrOJ4S uf+B+QM1+1+QX7FJV/49PkPM1wz21Jf19KpwPdQ1tMrESnk4gguRQ9b92H8PnC6ZYYJ0 V3OQ== X-Forwarded-Encrypted: i=1; AJvYcCXQ1nklP8bCUv9bINJOH/ob6zKRQnZBTQyK3F6G2o6ecGAaNHD4JL1xHuXRN7EPqoJ57L89/d+ZkPmilg==@vger.kernel.org X-Gm-Message-State: AOJu0YxX72DXnCier8Qq9PP0NbKfb+QRRh9d+0STyPehIeMdVr6QwCtT qBBSzZz4ZjTY3yR1oUOcyCDlMfU3UXJmtuq60j4mNeayCMx6ew+ssA5rTwdMigFzT2c= X-Gm-Gg: ASbGnctZDkBz0Be0H7xCa6dbCDrk+AqcKMi5iTmSbxuS6SdcCnIWFMYLZ1yI3Zw1g6A sLf/1mgtIG8dmCc1ofxohMGuyeIb9U8waj5mbw34koImvdVY6Lhtu/Uii+QjGkkDKb+EXu6hGWD PC0EGF5JjPZ4ULQKJwDLHWrJeYXMTrETshlrAaUMNndoI8U2peep/m5c7Lf+GdRn1u1BKvGrLSe CbPQmLupJKStd1VgNxTyOjDoUFkpatVefUNxKzyooJshBCujM3qJHZfbnW0jtKNsjABpk1zMXBM /Bsp7QRbpXlUljGJLLSseWG7y7L5i/JI80JmwB4iWmHbN+Xef9AAuOZRzFP/Mlc3+o7EYq7chF+ EXYXW7l7mAPDb8UQwlssACKZ/uYURRpKNcBBLHW4mJeFTKy2grfM= X-Google-Smtp-Source: AGHT+IFPMkepThXh+hpHafQU+8mg6c4yfS3OBn21itTHnwbLfxR1NdOOPbci4HOxrZLuvpBH2+aJIw== X-Received: by 2002:a05:6512:33ca:b0:553:30fc:cedb with SMTP id 2adb3069b0e04-5539c11831amr554733e87.10.1749690942952; Wed, 11 Jun 2025 18:15:42 -0700 (PDT) Received: from localhost.localdomain (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553a7018069sm62808e87.157.2025.06.11.18.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 18:15:42 -0700 (PDT) From: Vladimir Zapolskiy To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue Cc: Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Neil Armstrong , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 03/10] media: qcom: camss: csiphy: simplify arguments of lanes_enable and lanes_disable Date: Thu, 12 Jun 2025 04:15:24 +0300 Message-ID: <20250612011531.2923701-4-vladimir.zapolskiy@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> References: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In some of .lanes_enable and .lanes_disable functions the second argument of csiphy_config type is either unused or it can be derived from the main function argument, this lets to remove it from the list of arguments. Apart of being the simplification the change is needed for further updates to CSIPHY part of the CAMSS driver to get CSIPHY combo mode feature and a related to it management of non-statically assigned CSIPHY media pads. Signed-off-by: Vladimir Zapolskiy --- .../media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 10 ++++------ .../media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 11 ++++------- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++-- drivers/media/platform/qcom/camss/camss-csiphy.h | 4 +--- 4 files changed, 11 insertions(+), 18 deletions(-) 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 9d67e7fa6366..d9735f61fffc 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 @@ -95,10 +95,9 @@ static u8 csiphy_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate) } static void csiphy_lanes_enable(struct csiphy_device *csiphy, - struct csiphy_config *cfg, s64 link_freq, u8 lane_mask) { - struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg; + struct csiphy_lanes_cfg *c = &csiphy->cfg.csi2->lane_cfg; u8 settle_cnt; u8 val, l = 0; int i = 0; @@ -114,7 +113,7 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, val |= lane_mask << 1; writel_relaxed(val, csiphy->base + CAMSS_CSI_PHY_GLBL_PWR_CFG); - val = cfg->combo_mode << 4; + val = csiphy->cfg.combo_mode << 4; writel_relaxed(val, csiphy->base + CAMSS_CSI_PHY_GLBL_RESET); for (i = 0; i <= c->num_data; i++) { @@ -134,10 +133,9 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, } } -static void csiphy_lanes_disable(struct csiphy_device *csiphy, - struct csiphy_config *cfg) +static void csiphy_lanes_disable(struct csiphy_device *csiphy) { - struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg; + struct csiphy_lanes_cfg *c = &csiphy->cfg.csi2->lane_cfg; u8 l = 0; int i = 0; 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 f732a76de93e..69d95bfeb9d2 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 @@ -638,10 +638,9 @@ static u8 csiphy_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate) } static void csiphy_gen1_config_lanes(struct csiphy_device *csiphy, - struct csiphy_config *cfg, u8 settle_cnt) { - struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg; + struct csiphy_lanes_cfg *c = &csiphy->cfg.csi2->lane_cfg; int i, l = 0; u8 val; @@ -758,10 +757,9 @@ static bool csiphy_is_gen2(u32 version) } static void csiphy_lanes_enable(struct csiphy_device *csiphy, - struct csiphy_config *cfg, s64 link_freq, u8 lane_mask) { - struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg; + struct csiphy_lanes_cfg *c = &csiphy->cfg.csi2->lane_cfg; struct csiphy_device_regs *regs = csiphy->regs; u8 settle_cnt; u8 val; @@ -791,7 +789,7 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, if (csiphy_is_gen2(csiphy->camss->res->version)) csiphy_gen2_config_lanes(csiphy, settle_cnt); else - csiphy_gen1_config_lanes(csiphy, cfg, settle_cnt); + csiphy_gen1_config_lanes(csiphy, settle_cnt); /* IRQ_MASK registers - disable all interrupts */ for (i = 11; i < 22; i++) { @@ -800,8 +798,7 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, } } -static void csiphy_lanes_disable(struct csiphy_device *csiphy, - struct csiphy_config *cfg) +static void csiphy_lanes_disable(struct csiphy_device *csiphy) { struct csiphy_device_regs *regs = csiphy->regs; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 1ba3fc2e33ac..f561811b7617 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -295,7 +295,7 @@ static int csiphy_stream_on(struct csiphy_device *csiphy) wmb(); } - csiphy->res->hw_ops->lanes_enable(csiphy, cfg, link_freq, lane_mask); + csiphy->res->hw_ops->lanes_enable(csiphy, link_freq, lane_mask); return 0; } @@ -308,7 +308,7 @@ static int csiphy_stream_on(struct csiphy_device *csiphy) */ static void csiphy_stream_off(struct csiphy_device *csiphy) { - csiphy->res->hw_ops->lanes_disable(csiphy, &csiphy->cfg); + csiphy->res->hw_ops->lanes_disable(csiphy); } diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h index d82dafd1d270..3b73248f1364 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -72,10 +72,8 @@ struct csiphy_hw_ops { struct device *dev); void (*reset)(struct csiphy_device *csiphy); void (*lanes_enable)(struct csiphy_device *csiphy, - struct csiphy_config *cfg, s64 link_freq, u8 lane_mask); - void (*lanes_disable)(struct csiphy_device *csiphy, - struct csiphy_config *cfg); + void (*lanes_disable)(struct csiphy_device *csiphy); irqreturn_t (*isr)(int irq, void *dev); int (*init)(struct csiphy_device *csiphy); }; From patchwork Thu Jun 12 01:15:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 895826 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 6F745153BF0 for ; Thu, 12 Jun 2025 01:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690952; cv=none; b=R1gyYYG976yqnGzpThioeNcwJFPu3WfWpot1gWrTkQmty6TR1Ep+VGDoqkVfCpmpzwr6QmF8tUkEA42exrZyMmcK6FtKDVcsLHnVd9+5DY6j1qpI7y+5UMtboFvC0ZAqVvIQRVw/NuHQ+E2k6Uaxcvg3GMgMQbjlRRLpDro8yy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690952; c=relaxed/simple; bh=Br2+sPECo0mbbnRGjEs+gcJ7Da6KTtHQtd0Iun2iP4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h+LDXk2IiqXqUXRXyBCjwWCR6x7eHhc0ryXgcBqLjLGlrI2Synaq4/ukXtyPgE1IKNCBOskYpmOJVtOyb/07drsVLATZ5b9pCypbwwvGhc9Z17ziptUSN8cKn++nyuNsTuC/2PjKDkPaDWW85i/YNwd1zJKqblcLffooP7E66Es= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tV76yzRj; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tV76yzRj" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-32a75c31b32so418571fa.3 for ; Wed, 11 Jun 2025 18:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749690948; x=1750295748; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mBPHq117dWQljJbOWkWsV8bZPt4ezjyADVBAza4ih8A=; b=tV76yzRjD0AcIgQ7aCrkcn8omiQifxA7P9fjX9C4rrRaFik8IXARUiOxgVoOFEVu5O wUEPSN3Io9oIWJKqiWMPWeaJLcWtulHZJy80aS5TkDGob7zDdc6OwQiHC1hrdpHwvLFU amHPNHzeaWAU0UUKcoLnVnfh5fi2a882nZdNhe/7Da/rtM9xhY1UAGjF90MPBmm1GU9B THJhUh7qyJcWiHu/Dx/TguFGUgHSh4TkDAgNQVangT7k5aY5hPJ5sJ2s0Ha9S3qVS4BP CTHAxSiAaFYBh/KVJhgkDwPcFBkml4niFaoLqSUWz/8HqGhjS/Wb6o6QJJJL9PCPqJWS nLDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749690948; x=1750295748; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mBPHq117dWQljJbOWkWsV8bZPt4ezjyADVBAza4ih8A=; b=PFZ2+csyXuiCOIQKhRDIF4vqQXntURs4YMWsxOr9Xi8ShXiNAJ9yLpeLCpJoYUlpUC P8FnpCuzYrryRRbHZlkiJYXIzOddMrNiJAUuVv/aUccoquIsLqneb/tVUcxz3fNVifWB BvM0MqoGOja2dTjZi0iIl/+PMP/DTM1mFrBRPraXjKZjB7kkwVg9X4rP/SYyp5Je7vKZ g4P3XDFASSX2rLb98kYdGDp3Oxaf3kkVetDUMt66P1nALBcfERQFm/hQ1qsCYtfERliK LA9wH77v7RztZkhgt6ZVAIuZgyN0ekatPjhh5R9cr96xY/b+h0O3b+u5QFhCjE5Psr7i Qxsg== X-Forwarded-Encrypted: i=1; AJvYcCVlYv+Ci8KnxJntM7FjALIDgLFn8HaRmtG0fNoWsrXrivkZuHJCkQZiW0LjqCdcxmGXMel7qmkgZZMg7A==@vger.kernel.org X-Gm-Message-State: AOJu0Yy3zph/m9fplktyGBsObvmIiVok3Z2iz7uPO2WJq+C0nzZjzaDs 3XDKsphhoH/PFNPgfdkB4UAebPoIJomR08w6svvOl9IZeRPIGUH4e02ugCo0ViyZyCM= X-Gm-Gg: ASbGncvP/7YIZiUIPnMWweNH67v+gaUinbvzpoyW0NIVswNH67fqtJt5Lw9gE75/zZU FUBBiMhhcPFSpsQCJDvIQMhUIskJndptuekhFd5ZPWQoE6Q8QFMmjkcNEQpCT20af8Q4s44HnJp KT8XlNNRFx3S0ApxI1URqlJ8NyARN8P5/bS403sA+cjHV0VPQt+qmgkWLHagJD4DEPVYGNyHnd9 cPWjusatf0OVeZWX3bzUxrqvxVkdf/VmdWcMvxs8nblIlTB676JzbPClPwf/GPH78t6wcPCdRax 6JqlSdPPd3k8MG/4HQyeIJlBmAaCjtpGBfffZMUnqxbDDV9dS2IwqmoY4Lli24wWlbHnkx03Aay bSdQgu/bmKDLj82WvjRBncIPCRDO+1YHppXsrdd5PnyKTwQaEdgg= X-Google-Smtp-Source: AGHT+IGjvJjUSGUrBTNd9Gheaxu65cY98U3D2htsFy57efkcRMWJJtiq8QTKRbMHsaxIiIbQ4v6Wfw== X-Received: by 2002:a05:6512:23a4:b0:553:a78d:2c44 with SMTP id 2adb3069b0e04-553a78d381bmr36548e87.7.1749690948390; Wed, 11 Jun 2025 18:15:48 -0700 (PDT) Received: from localhost.localdomain (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553a7018069sm62808e87.157.2025.06.11.18.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 18:15:46 -0700 (PDT) From: Vladimir Zapolskiy To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue Cc: Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Neil Armstrong , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 05/10] media: qcom: camss: unwrap platform driver registration Date: Thu, 12 Jun 2025 04:15:26 +0300 Message-ID: <20250612011531.2923701-6-vladimir.zapolskiy@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> References: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To be able to register new CSIPHY device drivers unfold module_platform_driver() into module_init()/module_exit(). Signed-off-by: Vladimir Zapolskiy --- drivers/media/platform/qcom/camss/camss.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 71a37447e17a..e03308d7a366 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -3953,7 +3953,17 @@ static struct platform_driver qcom_camss_driver = { }, }; -module_platform_driver(qcom_camss_driver); +static int __init qcom_camss_init(void) +{ + return platform_driver_register(&qcom_camss_driver); +} +module_init(qcom_camss_init); + +static void __exit qcom_camss_exit(void) +{ + platform_driver_unregister(&qcom_camss_driver); +} +module_exit(qcom_camss_exit); MODULE_ALIAS("platform:qcom-camss"); MODULE_DESCRIPTION("Qualcomm Camera Subsystem driver"); From patchwork Thu Jun 12 01:15:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 895825 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 A501D156236 for ; Thu, 12 Jun 2025 01:15:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690957; cv=none; b=jbfhrVjqM2uU42wUwIOHdAvcv0XTDmV7Ic1eFgYsfeiD2FxElnGBpw3hTDgR69J4K5kiBPUM56cizg0iTylURs/LLTUVaTmta6Fd99C9VtdaSTPxkSlxHWczZS4yOgysLWk9IUyKPkWNY0Msg5mDHD7mzBoH3LkXQtQI4+qs6wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690957; c=relaxed/simple; bh=/XhbVM4wWSMUnltH22SqmYD67wEfCALUV37VwxYBKRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gy6fd1xgQ6DMgFyhWD/7ZYMmYbDbxGPVg9DlXQ8PkOuabv8Md/h9Z18AEX1VDx27yMd0cvKQ/cBc5euUIpwUTTvg34/kU6ve7yMhdOFTh45arVKXqDQElRgWUMGfyxIdCKHtdgLEbuyhzm5qlZCgU+FDZqtzNumaqeRPHNWhOZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sn+TuWXy; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sn+TuWXy" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-32b358f9265so89671fa.0 for ; Wed, 11 Jun 2025 18:15:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749690953; x=1750295753; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dZ2Yg+hw1/125iG7FYFyo2XHO42QFH1nZ0UWT9nVLTA=; b=sn+TuWXy5TcFuBJYENNxSMmOI4z3COBpKgtHUc5Ph4Hz05HqB2+u/e1hB0jCvdXQiR p89+q13PpjLXJZXbOsVsVdoKPh34EjD026dETAv2JmkMKb/3I8P6EAgYoNo6Y0s1mbj/ WSWqd2kQFgA5lezNs001H5LRA0yuSLQ7HuggS/QyQhaJi9SCbRCNqZoWYypY3KdNMbu8 4XBQKjZnvNCML/PAj8lbkMR/OMqRy4XX/UAvSMM9JxKWFwtTwoNnS9yA9rHH6Joz4PD7 KsJ+Z+ZjAP82ldTCV0RsnM9w8kAWeKoY6pPl8gcMDnhWgsvfEkHD5wUHim9A1VNExOYh 2x8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749690953; x=1750295753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dZ2Yg+hw1/125iG7FYFyo2XHO42QFH1nZ0UWT9nVLTA=; b=EJKG0GjgQSmMzx/0Qx4EL8RDt09neXGnJMA3t38gUKVIk9NqYrXYX/qdHe6rbpkxiW CqLqQCj9UUg/pG2f3uXwwYCBeeTsxH1pxpPkkoono3FjyQfRf1qDxW/swi95C+2ShMHp uPLRaibDRS3acEAuQE4uo/vXN7oXCmdDeHQKv2ORfUgnL/Qpo2IBVD1JUW9kckuYNwxU ZSrYJ0umRpyxmuNPnNWdvEKGbxp1e259IJ+hxPMauRRB03voTHSewAZlMCfvPaQ2rKTV 7G4uVQdAvGSb6JRDFc3X/ShgbhRJK0o6nhLd2Ork91AliUCEbqGDGltfLgEWmbLuucNu Tdjw== X-Forwarded-Encrypted: i=1; AJvYcCWuYsITF6UN0ea5NuJp7SQ2/bTZ2cf8OCsUR+9sT5Qk7oJVYNNS2lvoL5fImSVTcETA7ZjW1hy9N75gsQ==@vger.kernel.org X-Gm-Message-State: AOJu0YxpMp32c8/dt+NjnrDfliJ545ovd2sOLoMCxWUkqEjdOXY6mZMY 5UWYJ5OY8n9BBK8R3ZTVLnH2tZrmGcPcjtUgHMcmLBgGCbQ5ljsMIyuUY7NoHntM6fc= X-Gm-Gg: ASbGncvGC//bjfg5e4NAsZrtMSYi+h2qQvjiZG5ay7gzOFyP0jvTs/K9GPVg04Ea699 3c0WzHO7kadHuN0eYSa7PKGw50l426FqoBaRtPpB+3D2eEoIAxrJXmWpQbva6DHHymMu4nPulUf VUs4qc4+ZSjClITTUxIoS2GV1AB+1VGckd38Edi0ovSl5pknU/W82P5NzfsjM3DFOUevh+XbvSP s/hJARkbJaYqI8G4PTO0gyCHHO8IgTceE7GzBRt3JEh8G6nqaGgf95pbr0vSHjDp2CZeXqN+kxk qi8zcoetmwgzTHcdT136pNr+Sv5DgrUx99Roq/N0oNJ+JRPBnT2NKIg02Ju+Qy33u37h6y2Nkuh oz+ZiXw/9b3b0EW6xapR7eGD/ncFIJ/Y8FD6mzEJFoNTNGGhyxmk= X-Google-Smtp-Source: AGHT+IHm91uAYi4NKW7xBMaxW2aWgQgZM3ryOzUpvaUBQco+HVLoDZFQ7XSw3K4U3HUpWMmUW8p0Bw== X-Received: by 2002:a05:6512:3d0d:b0:553:2bf7:77bf with SMTP id 2adb3069b0e04-5539c0d3b49mr633019e87.8.1749690952737; Wed, 11 Jun 2025 18:15:52 -0700 (PDT) Received: from localhost.localdomain (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553a7018069sm62808e87.157.2025.06.11.18.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 18:15:51 -0700 (PDT) From: Vladimir Zapolskiy To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue Cc: Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Neil Armstrong , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 07/10] media: qcom: camss: csiphy: probe any present children CSIPHY subdevices Date: Thu, 12 Jun 2025 04:15:28 +0300 Message-ID: <20250612011531.2923701-8-vladimir.zapolskiy@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> References: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add CSIPHY driver routines to catch any possible csiphy subdevices under CAMSS device tree node. Signed-off-by: Vladimir Zapolskiy --- .../media/platform/qcom/camss/camss-csiphy.c | 248 ++++++++++++++++++ .../media/platform/qcom/camss/camss-csiphy.h | 3 + drivers/media/platform/qcom/camss/camss.c | 2 + 3 files changed, 253 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index f561811b7617..3020f7d0f621 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "camss-csiphy.h" @@ -24,6 +25,17 @@ #define MSM_CSIPHY_NAME "msm_csiphy" +struct csiphy_priv { + struct device *dev; + unsigned int id; + struct camss *camss; + struct csiphy_device *csiphy; + + struct v4l2_async_notifier notifier; + + bool combo_mode; +}; + static const struct csiphy_format_info formats_8x16[] = { { MEDIA_BUS_FMT_UYVY8_1X16, 8 }, { MEDIA_BUS_FMT_VYUY8_1X16, 8 }, @@ -836,3 +848,239 @@ void msm_csiphy_unregister_entity(struct csiphy_device *csiphy) v4l2_device_unregister_subdev(&csiphy->subdev); media_entity_cleanup(&csiphy->subdev.entity); } + +static int csiphy_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_connection *asd) +{ + struct csiphy_priv *csiphy_priv = container_of(notifier, + struct csiphy_priv, notifier); + struct camss_async_subdev *csd = container_of(asd, + struct camss_async_subdev, asd); + struct csiphy_device *csiphy = csiphy_priv->csiphy; + struct media_entity *sensor = &subdev->entity; + unsigned int i; + + /* Keep parsed media interface data, but set the correct port id */ + csiphy->id = csiphy_priv->id; + csiphy->cfg.csi2 = &csd->interface.csi2; + + for (i = 0; i < sensor->num_pads; i++) + if (sensor->pads[i].flags & MEDIA_PAD_FL_SOURCE) + break; + + if (i == sensor->num_pads) { + dev_err(csiphy_priv->dev, "No source pad in external entity\n"); + return -EINVAL; + } + + return media_create_pad_link(sensor, i, &csiphy->subdev.entity, + MSM_CSIPHY_PAD_SINK, + MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); +} + +static int csiphy_notify_complete(struct v4l2_async_notifier *notifier) +{ + struct csiphy_priv *csiphy = container_of(notifier, struct csiphy_priv, + notifier); + struct camss *camss = csiphy->camss; + + return v4l2_device_register_subdev_nodes(&camss->v4l2_dev); +} + +static const struct v4l2_async_notifier_operations csiphy_notify_ops = { + .bound = csiphy_notify_bound, + .complete = csiphy_notify_complete, +}; + +static int msm_csiphy_parse_ports(struct csiphy_priv *csiphy) +{ + struct device *dev = csiphy->dev; + struct fwnode_handle *fwnode = dev_fwnode(dev), *ep; + unsigned int num_endpoints = fwnode_graph_get_endpoint_count(fwnode, + FWNODE_GRAPH_DEVICE_DISABLED); + int ret; + + switch (num_endpoints) { + case 0: + return 0; + case 1: + break; + case 2: + csiphy->combo_mode = true; + break; + default: + return -EINVAL; + } + + v4l2_async_nf_init(&csiphy->notifier, &csiphy->camss->v4l2_dev); + csiphy->notifier.ops = &csiphy_notify_ops; + + fwnode_graph_for_each_endpoint(fwnode, ep) { + struct camss_async_subdev *csd; + + csd = v4l2_async_nf_add_fwnode_remote(&csiphy->notifier, ep, + struct camss_async_subdev); + if (IS_ERR(csd)) { + ret = PTR_ERR(csd); + goto err_remote; + } + + ret = camss_parse_endpoint_node(dev, ep, csd); + if (ret < 0) + goto err_remote; + } + + ret = v4l2_async_nf_register(&csiphy->notifier); + if (ret) + goto err_cleanup; + + return 0; + +err_remote: + fwnode_handle_put(ep); +err_cleanup: + v4l2_async_nf_cleanup(&csiphy->notifier); + + return ret; +} + +static int msm_csiphy_init(struct csiphy_priv *csiphy) +{ + struct camss *camss = csiphy->camss; + unsigned int i = csiphy->id, j; + int ret; + + ret = msm_csiphy_subdev_init(camss, &camss->csiphy[i], i); + if (ret < 0) { + dev_err(csiphy->dev, "Failed to init csiphy%d sub-device: %d\n", + i, ret); + return ret; + } + + ret = msm_csiphy_register_entity(&camss->csiphy[i], &camss->v4l2_dev); + if (ret < 0) { + dev_err(csiphy->dev, "Failed to register csiphy%d entity: %d\n", + i, ret); + return ret; + } + + for (j = 0; j < camss->res->csid_num; j++) { + ret = media_create_pad_link(&camss->csiphy[i].subdev.entity, + 1 /* source */, + &camss->csid[j].subdev.entity, + 0 /* sink */, + 0); + if (ret < 0) { + dev_err(csiphy->dev, + "Failed to link csiphy%d to csid: %d\n", + i, ret); + msm_csiphy_unregister_entity(&camss->csiphy[i]); + return ret; + } + } + + return 0; +} + +static int msm_csiphy_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *phy_node = dev_of_node(dev), *camss_node; + struct csiphy_priv *csiphy_priv; + struct of_phandle_iterator it; + struct camss *camss; + unsigned int i = 0; + int ret; + + /* Bail out if camss device driver has not yet been registered */ + camss = dev_get_drvdata(dev->parent); + if (!camss || !camss->v4l2_dev.dev) + return -EPROBE_DEFER; + + camss_node = of_get_parent(phy_node); + if (!camss_node) + return -ENODEV; + + of_for_each_phandle(&it, ret, camss_node, "phys", "#phy-cells", -1) { + if (it.node != phy_node) { + i++; + continue; + } + + if (!of_node_name_eq(it.node, "phy") || + !of_device_is_available(it.node)) + ret = -ENODEV; + + of_node_put(it.node); + break; + } + of_node_put(camss_node); + + if (ret) + return ret; + + if (i >= camss->res->csiphy_num) + return -EINVAL; + + csiphy_priv = devm_kzalloc(dev, sizeof(*csiphy_priv), GFP_KERNEL); + if (!csiphy_priv) + return -ENOMEM; + + csiphy_priv->dev = dev; + csiphy_priv->camss = camss; + csiphy_priv->id = i; + csiphy_priv->csiphy = &camss->csiphy[i]; + + ret = msm_csiphy_init(csiphy_priv); + if (ret < 0) + goto err_parse; + + ret = msm_csiphy_parse_ports(csiphy_priv); + if (ret < 0) + goto err_cleanup; + + dev_set_drvdata(dev, csiphy_priv); + + return 0; + +err_cleanup: + msm_csiphy_unregister_entity(csiphy_priv->csiphy); +err_parse: + v4l2_async_nf_unregister(&csiphy_priv->notifier); + v4l2_async_nf_cleanup(&csiphy_priv->notifier); + + return ret; +} + +static void msm_csiphy_remove(struct platform_device *pdev) +{ + struct csiphy_priv *csiphy_priv = dev_get_drvdata(&pdev->dev); + + msm_csiphy_unregister_entity(csiphy_priv->csiphy); + + v4l2_async_nf_unregister(&csiphy_priv->notifier); + v4l2_async_nf_cleanup(&csiphy_priv->notifier); +} + +static const struct of_device_id csiphy_dt_match[] = { + { .compatible = "qcom,csiphy", }, + {} +}; + +static struct platform_driver csiphy_platform_driver = { + .probe = msm_csiphy_probe, + .remove = msm_csiphy_remove, + .driver = { + .name = "qcom-csiphy", + .of_match_table = csiphy_dt_match, + }, +}; + +void __init msm_csiphy_driver_register(void) { + platform_driver_register(&csiphy_platform_driver); +} + +void __exit msm_csiphy_driver_unregister(void) { + platform_driver_unregister(&csiphy_platform_driver); +} diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h index f092b7ff2f26..b984aa745c78 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -120,6 +120,9 @@ int msm_csiphy_register_entity(struct csiphy_device *csiphy, void msm_csiphy_unregister_entity(struct csiphy_device *csiphy); +void msm_csiphy_driver_register(void); +void msm_csiphy_driver_unregister(void); + extern const struct csiphy_formats csiphy_formats_8x16; extern const struct csiphy_formats csiphy_formats_8x96; extern const struct csiphy_formats csiphy_formats_sdm845; diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 40bb20bbe8b4..57a522fcb8c0 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -3955,6 +3955,7 @@ static struct platform_driver qcom_camss_driver = { static int __init qcom_camss_init(void) { + msm_csiphy_driver_register(); return platform_driver_register(&qcom_camss_driver); } module_init(qcom_camss_init); @@ -3962,6 +3963,7 @@ module_init(qcom_camss_init); static void __exit qcom_camss_exit(void) { platform_driver_unregister(&qcom_camss_driver); + msm_csiphy_driver_unregister(); } module_exit(qcom_camss_exit); From patchwork Thu Jun 12 01:15:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 895824 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 0C970155C87 for ; Thu, 12 Jun 2025 01:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690959; cv=none; b=TBl23kIdCBBL0jJF5wc6mZCsiJE232kFrxXymLHzam8tn49pWvt2e5TzEF/kvw9et/PvgxK6LE9oSxYzE530a4jg0bmj2w5F5TQ1w48OoLN9Rqs9S4emNmlYlEhzaYzBqaHWFSpTJYoooBIDmBd+ac+2IJkK6Bl3KV/xsYQK26s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749690959; c=relaxed/simple; bh=lRmpab9D7U7Xj9Gg2kKMV8W8QS5flFvrcHN5YkABJeY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oivNrmdg83sX2QhSlk4Jw+aXSFgr4iOD5RSnIPGVOnVhA75o2RMSqTmjw75/KQVUMyP2xFO5MAZKHNiQWQsixzVzY1bDBb5SryIqkRd1tPlrDgf/BHdX2YD8wxUyEkqyN3rrRmIjFz6TMSR23g1j7rI00/znzK9BbHlR6QpicV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=K9psXQZ0; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="K9psXQZ0" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-32a6a607465so635701fa.3 for ; Wed, 11 Jun 2025 18:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749690956; x=1750295756; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z0iMkhzgEkgnzNz7VpgQGchMjTI01cfv7nEZTNImKIA=; b=K9psXQZ02X3RMtr2K1xrRUDPgchcMIla3HHmz8pgvDjpNouEInPDvXMsq7MOIuGQal LxswlFnOdpelfJEnXlaintvbtleAHzn+1X9/4wYF3+FFjcM/eW51qt+gY7gQDcSfhCid 1ad/30+6INPBZKmoqoFGy1KvNUSiIH51eU7FbMeuBdp4GZg/C7KtNoDNP18wHQf5u36R a69cJK+nqpc25GT7CXJSytIXEFbn9ux3/YeiyRO8kt6sUVHUg3iYfBZA+6ki+A69WpYf 0C9wlU+YmXw/9hvTg6uGuqi0CfpTZuTEa/bniRYQfxPdNOPBfparSvHvLPio/jHlQVdE NUaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749690956; x=1750295756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z0iMkhzgEkgnzNz7VpgQGchMjTI01cfv7nEZTNImKIA=; b=b64hRZt/c5xFU3/XSMGd0oh5DKljy/yUQ12eeFrqrFEH8NgEIYxJfkQkEISc1K+/3e +Cqz19XW3uwdhorHY4uz5Ewlw7xRAQcJcSqdHGI2X/65HwtQx3oyQeR+2AY5adZSe2UF TBCZ/udXbkSPjPzNzJ8O6UFitt0o/MxdtEoAsUgLBOe0xYx2DK5W0brLUBWPaQjjB43w JphA8o5Kwv1zZSKViTI2Atap3xyItrQs6M9u9CIrOjR0OKeVYX8aWt0e7hnZFnrL8+5R OAXl/glQw8gxR3xcn9vlODkIA9INXtnOw6hWcy20Wr9jV/XYMeR/acAV3LUtnJtjM2VZ MgaA== X-Forwarded-Encrypted: i=1; AJvYcCU2j/Mzp/qLyIQV3j/ANosgLTWQl8u4mCRzEgATaeNehgnb0RDENHki81xWU0qvYozLZfasd2TDBKZfPg==@vger.kernel.org X-Gm-Message-State: AOJu0YwjIFLIe2dLhAabjcDkJ+oWEKAT1ysixogB0tUXDS849SybrhSc qwAdkrMaZk0Tu5EBTDOJjw1Bwkrn9WVn6mK2tN9JqhKWPyzipNs2D3Njxv6cXypEGik= X-Gm-Gg: ASbGncs8sx2J91q1HIYjv2neMVy34i+Uw+nz/ndK11B4qGN7ch6An0ctXZY6SgCo+xK eH/F3oc4zNd3dQQSFUX5Y5PyOR50ELksd+d+Nk5Aa9p+3BHbHgCMQJMgbLOqG3F2VrBcTAVQ/ZJ 9cxW2eMLOfJiZQQGfVtx1XpMAU4DG5jO+ZQ5HBjbPQT+T6/i+a9wHbd4gBY4E7MxXU4NwFafpMJ w76PzHS7WSDqhs68SHtkKpOFBb9LNk0aQj7fMh3FXS19p2pkdxrHX/boaCVjiYtk5r5mwiQoQqv fRUeffTqKpjXsfs3saK7fWxrzOR8CPrri62QoKLRL1CeB9+0mym5NAaFGsRurDGxI46YezJFJU1 3V6iRez8e1H47bay6YOkx6LbcYqeTMomkyjkPtHsl4FFqalcK8BU= X-Google-Smtp-Source: AGHT+IH2ZVcSy/XT+P2sjhcrkyYbmgicFFUm992Rw/xmvLwsvTHEafUlWtKGMTeH3cdMFAbAsWhVRA== X-Received: by 2002:a05:6512:2206:b0:553:297b:3d41 with SMTP id 2adb3069b0e04-5539c140937mr563611e87.8.1749690956123; Wed, 11 Jun 2025 18:15:56 -0700 (PDT) Received: from localhost.localdomain (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553a7018069sm62808e87.157.2025.06.11.18.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 18:15:55 -0700 (PDT) From: Vladimir Zapolskiy To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue Cc: Conor Dooley , Robert Foss , Todor Tomov , Mauro Carvalho Chehab , Neil Armstrong , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 09/10] [RFT] arm64: dts: qcom: sm8250: extend CAMSS with new CSIPHY subdevices Date: Thu, 12 Jun 2025 04:15:30 +0300 Message-ID: <20250612011531.2923701-10-vladimir.zapolskiy@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> References: <20250612011531.2923701-1-vladimir.zapolskiy@linaro.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Following the new device tree bindings for CAMSS IPs introduce csiphy2 device tree node under SM8250 CAMSS, which allows to perform camera tests of the model on an RB5 board with an attached vision mezzanine. Note that the optional 'phys' property is deliberately not added. Signed-off-by: Vladimir Zapolskiy --- For testing only, do not merge. arch/arm64/boot/dts/qcom/sm8250.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi index f0d18fd37aaf..401a32679580 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -4613,6 +4613,10 @@ camss: camss@ac6a000 { "cam_sf_0_mnoc", "cam_sf_icp_mnoc"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + ports { #address-cells = <1>; #size-cells = <0>; @@ -4641,6 +4645,16 @@ port@5 { reg = <5>; }; }; + + csiphy2: phy@ac6e000 { + compatible = "qcom,csiphy"; + reg = <0 0x0ac6e000 0 0x1000>; + clocks = <&camcc CAM_CC_CSIPHY2_CLK>, + <&camcc CAM_CC_CSI2PHYTIMER_CLK>; + clock-names = "csiphy", "csiphy_timer"; + interrupts = ; + #phy-cells = <0>; + }; }; camcc: clock-controller@ad00000 {