Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1122556rdb; Sat, 18 Nov 2023 04:12:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGgWWCbMXV8+8bJBkBshzFY1ND5XjE4hpNjYnWhHmfX5UM2Lry+1CMa8O1s9HofcBV4s6E X-Received: by 2002:a17:902:d508:b0:1cc:4921:af1b with SMTP id b8-20020a170902d50800b001cc4921af1bmr2151040plg.7.1700309546745; Sat, 18 Nov 2023 04:12:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700309546; cv=none; d=google.com; s=arc-20160816; b=hyeaMwULPBQnKdIsxVBGsdL5xIao6EQRyZPYatDFIyrIFuQMUwZU/Rz5aD2GeNJGso 1zDJTS5IuNyODPsk5O5fg8Mz8azE5e06ycwwGUQstYPV4jQMFgZxwgERGirhvQMm2Eza cJFSHAVNh1R85b8vFCbQRNPLSHU6csAm4awq8tpBSsXkiZHopgr+NRQvx1FZSRwQroeR FocBdvy//EGdhjkT5dSyp47OMnsH2Flx+SQofkJyJ7Xc6GSra3wIUXfZ1B3vjf8xrMMh I7tDXj4CGjyV3E/PoyqZ+a5wAUFLMlJQ4b+XOIB2+dyW+WhJhj6s/I6VLNoAgLA73XrG gkEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BR+YBWVQ86ytjIlOGmAW4/tQxNcN+mCsodRc3VxcTJs=; fh=+21+21gNft/7To99MfcGJu9QkWyyZ7J1aCqrKBAZjFw=; b=UeKpt5H7etPNHnWfN5Vyk5YHfvUABjn+Ox/O7H8c/zbU6axOCoqeMF4lWzmApvIpeQ 33/Y233hHEjPLeMAAde9iYN5doWYBIMlw4prWmujKKnt4joSrS2pCQ2OCVx5Yt6VlPlQ CuZYxbgSIcVSeJmy5hTfdSWDWqcPivNKI4XAon0xYZ5+/ljfG6a8SRyooHwWrp9zN6rI 2OAK6lHHqm5cr9ZFSBSC0ZslaGblSao3rLSMgv3muKKgex6cY6922Zx3m1itNxi4c1bx 0/QEuOi3KpSDkrppoLLODCtFgRTQfbhDUWx5TSLoV4/H8+fzzd5JypTKzQf5PmjH9yr5 vWxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zncfqTX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g1-20020a1709026b4100b001c7615a8e09si3976568plt.593.2023.11.18.04.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 04:12:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zncfqTX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7A32F8043935; Sat, 18 Nov 2023 04:12:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232664AbjKRMMM (ORCPT + 99 others); Sat, 18 Nov 2023 07:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjKRMLy (ORCPT ); Sat, 18 Nov 2023 07:11:54 -0500 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E700110F2 for ; Sat, 18 Nov 2023 04:11:49 -0800 (PST) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c523ac38fbso36513321fa.0 for ; Sat, 18 Nov 2023 04:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700309508; x=1700914308; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BR+YBWVQ86ytjIlOGmAW4/tQxNcN+mCsodRc3VxcTJs=; b=zncfqTX3Nvxwo2AFLAxC5Yn1v3ZzJvYY+M/7ID/N/OdrhcO4h6X59h4oSWXxia0srC jaXXK2QgP0NUeN+bW2u8TiSyGYYk7McC2iZsAp2Sw9j8036ZOZDPcihLurFbfG7HKcfg pZkp5MaDXMIcOj/zThyNBI0jyipETaVZ8eNXCfJR9Fs5XzXuzPLt5iU48g4QYbVnwQ9/ fGnufvgIAbs9BNrEDZQtPIJH/CaJ+HNXpA3TlGgQBiEuY8NRXOFKU5QuynR4Wqzg5Jek 3r9gKbhF+5vx3KyIUUV2C7gFDrbVeNk9B78eIrFXHb03m8W0auwZUXZr/OWsy059k/M/ znBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700309508; x=1700914308; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BR+YBWVQ86ytjIlOGmAW4/tQxNcN+mCsodRc3VxcTJs=; b=U5D2zvp2thDupqq0kl4Dz9h4AV1Oof9OVozN49N/uftECvZ/QmAgPPdAt1by4VlMi7 eunCDgLYaHxe9ZSax6guxDlbSgFHe6kMoGzfcGdrsQVarS6+TIa6BB0rn3YBSvKVSlaZ ZWp7EqO5DfxwaNFqScx08peI6uQ3dNPkOmdEiDbGKNKbz+hVKRMTpAUpV/tKJeI/LZek XrDr25k668TOlP6TIz1kRI//+ebckMBqbX7SGmm/HGPNodvY9hx0Ci13P88S1b4vZhRi JcMl/QTFSeUa7GIxS69Ac3oIhwbZhkjoo8liglu9lvXf4Fjyb1/C/nh9LwvyMD7WtoaX g40g== X-Gm-Message-State: AOJu0YyLMmTSQrgByCFaWbo8rpBBihVMHxFdQHrs98KroBZWA0goKNgT 49EncHsJ/KjOnAUKupsskcW1dA== X-Received: by 2002:a2e:b0f1:0:b0:2c6:edfd:658a with SMTP id h17-20020a2eb0f1000000b002c6edfd658amr1607592ljl.31.1700309508101; Sat, 18 Nov 2023 04:11:48 -0800 (PST) Received: from [127.0.0.1] ([37.228.218.3]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c3b9200b00407efbc4361sm10955775wms.9.2023.11.18.04.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 04:11:47 -0800 (PST) From: Bryan O'Donoghue Date: Sat, 18 Nov 2023 12:11:41 +0000 Subject: [PATCH v5 7/7] media: qcom: camss: Flag CSID-lites to support more CSIDs MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231118-b4-camss-named-power-domains-v5-7-55eb0f35a30a@linaro.org> References: <20231118-b4-camss-named-power-domains-v5-0-55eb0f35a30a@linaro.org> In-Reply-To: <20231118-b4-camss-named-power-domains-v5-0-55eb0f35a30a@linaro.org> To: hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, Robert Foss , Todor Tomov , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , matti.lehtimaki@gmail.com, quic_grosikop@quicinc.com Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.13-dev-26615 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 18 Nov 2023 04:12:25 -0800 (PST) From: Matti Lehtimäki Some platforms such as SC7280 have 3 CSIDs and 2 CSID-lites but current code has hardcoded 2 as the maximum number of CSIDs. Remove the hardcoded maximum number of VFEs to handle all possible combinations of CSIDs and CSID-lites. Signed-off-by: Matti Lehtimäki Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csid-gen2.c | 31 +++++++++++----------- drivers/media/platform/qcom/camss/camss-csid.c | 5 ++++ drivers/media/platform/qcom/camss/camss-csid.h | 7 +++++ drivers/media/platform/qcom/camss/camss.c | 3 +++ 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c index 05ff5fa8095a8..b11de4797ccae 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -21,7 +21,6 @@ * interface support. As a result of that it has an * alternate register layout. */ -#define IS_LITE (csid->id >= 2 ? 1 : 0) #define CSID_HW_VERSION 0x0 #define HW_VERSION_STEPPING 0 @@ -35,13 +34,13 @@ #define CSID_CSI2_RX_IRQ_MASK 0x24 #define CSID_CSI2_RX_IRQ_CLEAR 0x28 -#define CSID_CSI2_RDIN_IRQ_STATUS(rdi) ((IS_LITE ? 0x30 : 0x40) \ +#define CSID_CSI2_RDIN_IRQ_STATUS(rdi) ((csid_is_lite(csid) ? 0x30 : 0x40) \ + 0x10 * (rdi)) -#define CSID_CSI2_RDIN_IRQ_MASK(rdi) ((IS_LITE ? 0x34 : 0x44) \ +#define CSID_CSI2_RDIN_IRQ_MASK(rdi) ((csid_is_lite(csid) ? 0x34 : 0x44) \ + 0x10 * (rdi)) -#define CSID_CSI2_RDIN_IRQ_CLEAR(rdi) ((IS_LITE ? 0x38 : 0x48) \ +#define CSID_CSI2_RDIN_IRQ_CLEAR(rdi) ((csid_is_lite(csid) ? 0x38 : 0x48) \ + 0x10 * (rdi)) -#define CSID_CSI2_RDIN_IRQ_SET(rdi) ((IS_LITE ? 0x3C : 0x4C) \ +#define CSID_CSI2_RDIN_IRQ_SET(rdi) ((csid_is_lite(csid) ? 0x3C : 0x4C) \ + 0x10 * (rdi)) #define CSID_TOP_IRQ_STATUS 0x70 @@ -73,7 +72,7 @@ #define CGC_MODE_DYNAMIC_GATING 0 #define CGC_MODE_ALWAYS_ON 1 -#define CSID_RDI_CFG0(rdi) ((IS_LITE ? 0x200 : 0x300) \ +#define CSID_RDI_CFG0(rdi) ((csid_is_lite(csid) ? 0x200 : 0x300) \ + 0x100 * (rdi)) #define RDI_CFG0_BYTE_CNTR_EN 0 #define RDI_CFG0_FORMAT_MEASURE_EN 1 @@ -98,32 +97,32 @@ #define RDI_CFG0_PACKING_FORMAT 30 #define RDI_CFG0_ENABLE 31 -#define CSID_RDI_CFG1(rdi) ((IS_LITE ? 0x204 : 0x304)\ +#define CSID_RDI_CFG1(rdi) ((csid_is_lite(csid) ? 0x204 : 0x304)\ + 0x100 * (rdi)) #define RDI_CFG1_TIMESTAMP_STB_SEL 0 -#define CSID_RDI_CTRL(rdi) ((IS_LITE ? 0x208 : 0x308)\ +#define CSID_RDI_CTRL(rdi) ((csid_is_lite(csid) ? 0x208 : 0x308)\ + 0x100 * (rdi)) #define RDI_CTRL_HALT_CMD 0 #define HALT_CMD_HALT_AT_FRAME_BOUNDARY 0 #define HALT_CMD_RESUME_AT_FRAME_BOUNDARY 1 #define RDI_CTRL_HALT_MODE 2 -#define CSID_RDI_FRM_DROP_PATTERN(rdi) ((IS_LITE ? 0x20C : 0x30C)\ +#define CSID_RDI_FRM_DROP_PATTERN(rdi) ((csid_is_lite(csid) ? 0x20C : 0x30C)\ + 0x100 * (rdi)) -#define CSID_RDI_FRM_DROP_PERIOD(rdi) ((IS_LITE ? 0x210 : 0x310)\ +#define CSID_RDI_FRM_DROP_PERIOD(rdi) ((csid_is_lite(csid) ? 0x210 : 0x310)\ + 0x100 * (rdi)) -#define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi) ((IS_LITE ? 0x214 : 0x314)\ +#define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi) ((csid_is_lite(csid) ? 0x214 : 0x314)\ + 0x100 * (rdi)) -#define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi) ((IS_LITE ? 0x218 : 0x318)\ +#define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi) ((csid_is_lite(csid) ? 0x218 : 0x318)\ + 0x100 * (rdi)) -#define CSID_RDI_RPP_PIX_DROP_PATTERN(rdi) ((IS_LITE ? 0x224 : 0x324)\ +#define CSID_RDI_RPP_PIX_DROP_PATTERN(rdi) ((csid_is_lite(csid) ? 0x224 : 0x324)\ + 0x100 * (rdi)) -#define CSID_RDI_RPP_PIX_DROP_PERIOD(rdi) ((IS_LITE ? 0x228 : 0x328)\ +#define CSID_RDI_RPP_PIX_DROP_PERIOD(rdi) ((csid_is_lite(csid) ? 0x228 : 0x328)\ + 0x100 * (rdi)) -#define CSID_RDI_RPP_LINE_DROP_PATTERN(rdi) ((IS_LITE ? 0x22C : 0x32C)\ +#define CSID_RDI_RPP_LINE_DROP_PATTERN(rdi) ((csid_is_lite(csid) ? 0x22C : 0x32C)\ + 0x100 * (rdi)) -#define CSID_RDI_RPP_LINE_DROP_PERIOD(rdi) ((IS_LITE ? 0x230 : 0x330)\ +#define CSID_RDI_RPP_LINE_DROP_PERIOD(rdi) ((csid_is_lite(csid) ? 0x230 : 0x330)\ + 0x100 * (rdi)) #define CSID_TPG_CTRL 0x600 diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index 95873f988f7e2..d393618ed54cb 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -897,3 +897,8 @@ void msm_csid_unregister_entity(struct csid_device *csid) media_entity_cleanup(&csid->subdev.entity); v4l2_ctrl_handler_free(&csid->ctrls); } + +inline bool csid_is_lite(struct csid_device *csid) +{ + return csid->camss->res->csid_res[csid->id].is_lite; +} diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h index 30d94eb2eb041..fddccb69da13a 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.h +++ b/drivers/media/platform/qcom/camss/camss-csid.h @@ -215,5 +215,12 @@ extern const struct csid_hw_ops csid_ops_4_1; extern const struct csid_hw_ops csid_ops_4_7; extern const struct csid_hw_ops csid_ops_gen2; +/* + * csid_is_lite - Check if CSID is CSID lite. + * @csid: CSID Device + * + * Return whether CSID is CSID lite + */ +bool csid_is_lite(struct csid_device *csid); #endif /* QC_MSM_CAMSS_CSID_H */ diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index ea0038f62b807..a0fbbfccf3b7e 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -638,6 +638,7 @@ static const struct camss_subdev_resources csid_res_845[] = { { 384000000 } }, .reg = { "csid2" }, .interrupt = { "csid2" }, + .is_lite = true, .ops = &csid_ops_gen2 } }; @@ -812,6 +813,7 @@ static const struct camss_subdev_resources csid_res_8250[] = { { 0 } }, .reg = { "csid2" }, .interrupt = { "csid2" }, + .is_lite = true, .ops = &csid_ops_gen2 }, /* CSID3 */ @@ -824,6 +826,7 @@ static const struct camss_subdev_resources csid_res_8250[] = { { 0 } }, .reg = { "csid3" }, .interrupt = { "csid3" }, + .is_lite = true, .ops = &csid_ops_gen2 } }; -- 2.42.0