Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp441049rdf; Fri, 3 Nov 2023 05:32:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhi9RyqQnstbMpSsWmGCfXJk0NGOH2qNbuF2+WwVN+yvrj/LO/8wziQ1x84OtSwjSBvc3M X-Received: by 2002:a05:6a20:ce9c:b0:121:ca90:df01 with SMTP id if28-20020a056a20ce9c00b00121ca90df01mr16283881pzb.40.1699014722933; Fri, 03 Nov 2023 05:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699014722; cv=none; d=google.com; s=arc-20160816; b=b0ADUZBqYKdM3wMQ4Tvz1Q/ezZT78bUIu7DUsYYODihWjBz59GeH//L2Wb6N55qIxv H5E2uzQY1W8SDbBu4H8qac8oEhguy09lgx+mWNtMyvaIe1REYhWCk+VIY87ozCV60P+v Cw7jdA5XmBobrFCYk9Ffs5lsUvjXBWFJcGwakJlAJZ7E0JgMbcAsDFxxL4uEg2m/3juF UQGNIrjMlnj1BfiNVqqLalQmywjkoNd33CibzyTsoZ0kDGnZ1ebKk1CyuTlFbrv6QKtf ytjrKhBlEt7w76EW+c69IDFK3IFKXE5QZcIeyUIWkgNispyR0Xii7mL9BQKqFQTQ/Hri byOQ== 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=A5e6ystGbmI0nEkqiwKt50qKqvjyJaFKyap2sSy1xpA=; fh=+21+21gNft/7To99MfcGJu9QkWyyZ7J1aCqrKBAZjFw=; b=CdcuM0CuDWj0Ny+HT7kw3j9WykuzsSbPdbnl9Bnx8ILTyVnh67NsDdqZCE++i8db+p tFAEWwhH5Eafkmb3As9ZDVpSakoE7UH7AyjxvS0uz2dM/kr/NRDn0Gt+VFVqt3w4ZAxQ W9EmgJ+cA2amXHowcTjBi3+Weija24eMoCw5pr3Zo98+NFV78v5ODDmf1eKZBVVZrlu2 eR7rMDHfEHphFTTAg0W79ONwuvcoA9Nrifhx/sQSAd/rWj3cvkdFB7hEGx31tunqZYEW 1xd6NgxwZujI+vhqhnYL4pGecLfWAGsMPwawhG4Lkzw8ekJUg0dfTSybtH1DCeGKjbIL o4/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qJu9DniQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u70-20020a638549000000b005b896f26b15si1480764pgd.268.2023.11.03.05.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 05:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qJu9DniQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id AB67780689F4; Fri, 3 Nov 2023 05:31:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376639AbjKCM33 (ORCPT + 99 others); Fri, 3 Nov 2023 08:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376499AbjKCM3V (ORCPT ); Fri, 3 Nov 2023 08:29:21 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB72184 for ; Fri, 3 Nov 2023 05:29:11 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c594196344so27068231fa.3 for ; Fri, 03 Nov 2023 05:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699014550; x=1699619350; 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=A5e6ystGbmI0nEkqiwKt50qKqvjyJaFKyap2sSy1xpA=; b=qJu9DniQ8gCLQXeGzU4agasudpouNHUZUUvgSAvAlrjjEbXk0vF8VOnigIRhsybhyu p6WMScll49ut2x8jM94GlpIEJRtdlyI0KsozOCy5kqO86UfyNpIrjqD3PJ8XW4Fk4tk6 p/Q6H16EErLDtSfMb4JgUtXr6dIU1KR52ah5LxVjFilxmAxHt0YvPdATPZwKqgvOczYr jQVSYucUCJ9zjqz/uff9qHMQBQi9GiUz4glhJo6bCJ0bfxDkNZiRpgjwybUWszz4Xq+3 607pjPNepdpjULGWPp0sKy9Y0Zhm26Ouk1VaA5TtA0Zp9gVpMJI+H6NPi7lHdeFCQoG2 hZaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699014550; x=1699619350; 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=A5e6ystGbmI0nEkqiwKt50qKqvjyJaFKyap2sSy1xpA=; b=Y+YJulojqgEVocAZ/q1rxt7gZRcfgdLM0yBYlIeLXbadscoEIIWa7JWvDmyewt2EHA ugcl+yqPUUuHfhrcVoUEF4NnNvEdjfMqIf31Ubeig10FRa+/BOsPt28p2go9kldXmesr DFu9sMseLnpcybikRRpLkcATvPsObP7SRyy0aKJ0dbq/HGBj8wZfhMINPSimNRRAmwP1 drk/VfL3oDy2fFZPXzp6vNhvsmoM2vbmBt58Ufjauy21scPNTzE6yfUfMfs572axFsaD NQxxRUhORlRziJUJm1eBELxiADPq9EwQgspxufW94R/hF08ljk1w1hkPHsugbzVv6S5L RFCQ== X-Gm-Message-State: AOJu0YynEq0vZKKmJFcpDWTanQQyqfvj/GdCZImGhecW3zFJ9doFF5Nd USqd2m++PyLMa5qN2Jp493WWcw== X-Received: by 2002:a2e:97d1:0:b0:2c5:2eaa:5397 with SMTP id m17-20020a2e97d1000000b002c52eaa5397mr15816719ljj.11.1699014549852; Fri, 03 Nov 2023 05:29:09 -0700 (PDT) Received: from [127.0.0.1] ([37.228.218.3]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b0040772138bb7sm2402918wmb.2.2023.11.03.05.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 05:29:09 -0700 (PDT) From: Bryan O'Donoghue Date: Fri, 03 Nov 2023 12:29:04 +0000 Subject: [PATCH v4 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: <20231103-b4-camss-named-power-domains-v4-7-33a905359dbc@linaro.org> References: <20231103-b4-camss-named-power-domains-v4-0-33a905359dbc@linaro.org> In-Reply-To: <20231103-b4-camss-named-power-domains-v4-0-33a905359dbc@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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.vger.email 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 (groat.vger.email [0.0.0.0]); Fri, 03 Nov 2023 05:31:48 -0700 (PDT) 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 f5226eb8bf4fc..51ad12f1d9d7d 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