From patchwork Fri Aug 2 15:24:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 816643 Received: from smtp-fw-6001.amazon.com (smtp-fw-6001.amazon.com [52.95.48.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85E3C175D29; Fri, 2 Aug 2024 15:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.95.48.154 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722612282; cv=none; b=EhY33XNTICnD77dVgt2ADqL/v9Uhz1ExTIUXUm94SYhX+GjTVptj8t4pdZoKVapUBYzoCQJ+g9+j8Ee/iM8+iOqXlQfL3SYiCOqCN9XFuy/7+yn8Dq1mqtdxeuBxEF9fGXHjrwjaEK6h4bknYxqDpJU8CsnTcx5N/oeIAF0jMHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722612282; c=relaxed/simple; bh=91p870/rRanZasdHLOWguMt8ptE+GmphjiT9JCKHqHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nRIIB/ArJBct1IC6aoLQdlCCd9RPtuHP46OLjUdS1jRnEVx7sA6RYki99+30VIOoCKbPndLA5LKz8UjIJbYIg4P9XV5VH1L4s/izVRgi6uF5DPtfeqTuJrEL0XvwXHuj7H5SlqiN5czmTnGwoPFDwOxvTRFI4tO6WuZH1ePK+ZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=djhxSie+; arc=none smtp.client-ip=52.95.48.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="djhxSie+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1722612281; x=1754148281; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PrydxDt7pTISVpngrNccUM25MlZxuE5DczCA48XlqC4=; b=djhxSie+CyGO8d0W6I1WDlKweqW/QhNWqFx1o+ggKdf7Uh0ivGclTNNF edvipLLDMaEsoTprqY3jBfYn6xeRQ+cfRXMvwMqKX7LCQoUf8CNG95aik MfGxnSz3uVV+Vzo3PpXMUaK8ChFqKKPpQ6PsIdfncO7cCUj88sPXQm/Pq M=; X-IronPort-AV: E=Sophos;i="6.09,258,1716249600"; d="scan'208";a="414879172" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.43.8.2]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2024 15:24:40 +0000 Received: from EX19MTAUEB001.ant.amazon.com [10.0.29.78:27313] by smtpin.naws.us-east-1.prod.farcaster.email.amazon.dev [10.0.60.140:2525] with esmtp (Farcaster) id c8f62a25-5850-4be2-8b21-c56fe4454c4c; Fri, 2 Aug 2024 15:24:39 +0000 (UTC) X-Farcaster-Flow-ID: c8f62a25-5850-4be2-8b21-c56fe4454c4c Received: from EX19MTAUEB001.ant.amazon.com (10.252.135.108) by EX19MTAUEB001.ant.amazon.com (10.252.135.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 2 Aug 2024 15:24:35 +0000 Received: from dev-dsk-jorcrous-2c-c0367878.us-west-2.amazon.com (10.189.195.130) by mail-relay.amazon.com (10.252.135.35) with Microsoft SMTP Server id 15.2.1258.34 via Frontend Transport; Fri, 2 Aug 2024 15:24:35 +0000 Received: by dev-dsk-jorcrous-2c-c0367878.us-west-2.amazon.com (Postfix, from userid 14178300) id 3B1A8A79E; Fri, 2 Aug 2024 15:24:35 +0000 (UTC) From: Jordan Crouse To: CC: Bryan O'Donoghue , Mauro Carvalho Chehab , Robert Foss , Todor Tomov , , Subject: [PATCH v1 1/2] media: camss: Increase the maximum frame size Date: Fri, 2 Aug 2024 15:24:33 +0000 Message-ID: <20240802152435.35796-2-jorcrous@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240802152435.35796-1-jorcrous@amazon.com> References: <20240802152435.35796-1-jorcrous@amazon.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 35493d653a2d ("media: camss: add support for vidioc_enum_framesizes ioctl") added a maximum frame width and height but the values selected seemed to have been arbitrary. In reality the cam hardware doesn't seem to have a maximum size restriction so double up the maximum reported width and height to allow for larger frames. Also increase the maximum size checks at each point in the pipeline so the increased sizes are allowed all the way down to the sensor. Signed-off-by: Jordan Crouse --- drivers/media/platform/qcom/camss/camss-csid.c | 8 ++++---- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++-- drivers/media/platform/qcom/camss/camss-ispif.c | 4 ++-- drivers/media/platform/qcom/camss/camss-vfe.c | 4 ++-- drivers/media/platform/qcom/camss/camss-video.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index 858db5d4ca75..886c42c82612 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -752,8 +752,8 @@ static void csid_try_format(struct csid_device *csid, if (i >= csid->res->formats->nformats) fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = clamp_t(u32, fmt->width, 1, 8191); - fmt->height = clamp_t(u32, fmt->height, 1, 8191); + fmt->width = clamp_t(u32, fmt->width, 1, 16383); + fmt->height = clamp_t(u32, fmt->height, 1, 16383); fmt->field = V4L2_FIELD_NONE; fmt->colorspace = V4L2_COLORSPACE_SRGB; @@ -781,8 +781,8 @@ static void csid_try_format(struct csid_device *csid, if (i >= csid->res->formats->nformats) fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = clamp_t(u32, fmt->width, 1, 8191); - fmt->height = clamp_t(u32, fmt->height, 1, 8191); + fmt->width = clamp_t(u32, fmt->width, 1, 16383); + fmt->height = clamp_t(u32, fmt->height, 1, 16383); fmt->field = V4L2_FIELD_NONE; } diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 2f7361dfd461..43c35ad6ac84 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -368,8 +368,8 @@ static void csiphy_try_format(struct csiphy_device *csiphy, if (i >= csiphy->res->formats->nformats) fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = clamp_t(u32, fmt->width, 1, 8191); - fmt->height = clamp_t(u32, fmt->height, 1, 8191); + fmt->width = clamp_t(u32, fmt->width, 1, 16383); + fmt->height = clamp_t(u32, fmt->height, 1, 16383); fmt->field = V4L2_FIELD_NONE; fmt->colorspace = V4L2_COLORSPACE_SRGB; diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index a12dcc7ff438..01e2ded8da0b 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -912,8 +912,8 @@ static void ispif_try_format(struct ispif_line *line, if (i >= line->nformats) fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = clamp_t(u32, fmt->width, 1, 8191); - fmt->height = clamp_t(u32, fmt->height, 1, 8191); + fmt->width = clamp_t(u32, fmt->width, 1, 16383); + fmt->height = clamp_t(u32, fmt->height, 1, 16383); fmt->field = V4L2_FIELD_NONE; fmt->colorspace = V4L2_COLORSPACE_SRGB; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 83c5a36d071f..826c0fb31785 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1049,8 +1049,8 @@ static void vfe_try_format(struct vfe_line *line, if (i >= line->nformats) fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = clamp_t(u32, fmt->width, 1, 8191); - fmt->height = clamp_t(u32, fmt->height, 1, 8191); + fmt->width = clamp_t(u32, fmt->width, 1, 16383); + fmt->height = clamp_t(u32, fmt->height, 1, 16383); fmt->field = V4L2_FIELD_NONE; fmt->colorspace = V4L2_COLORSPACE_SRGB; diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index cd72feca618c..5fee3733da8e 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -19,10 +19,10 @@ #include "camss.h" #define CAMSS_FRAME_MIN_WIDTH 1 -#define CAMSS_FRAME_MAX_WIDTH 8191 +#define CAMSS_FRAME_MAX_WIDTH 16833 #define CAMSS_FRAME_MIN_HEIGHT 1 -#define CAMSS_FRAME_MAX_HEIGHT_RDI 8191 -#define CAMSS_FRAME_MAX_HEIGHT_PIX 4096 +#define CAMSS_FRAME_MAX_HEIGHT_RDI 16833 +#define CAMSS_FRAME_MAX_HEIGHT_PIX 8192 /* ----------------------------------------------------------------------------- * Helper functions From patchwork Fri Aug 2 15:24:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 816642 Received: from smtp-fw-9106.amazon.com (smtp-fw-9106.amazon.com [207.171.188.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1CE1175D29; Fri, 2 Aug 2024 15:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.171.188.206 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722612290; cv=none; b=B1IaB+xfm8fKTLECLyB677vGGzFdKyDCYltB8PiY7FajmbzOaRe+/v7dgC2fPk0j49WjEuuRiEGtTVsHFubY239qnCxG/eWHKXT3m/mHFCf2EVgNYI9IBFqf/KFIjtsB7P03kiCFEWcybTJjsE282bYUD7hf55dVAPy4Kv4ooo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722612290; c=relaxed/simple; bh=M8qcfFelmeMZAh8kqX7LJJxJpym2qszDCS9w9IsDnLU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g/eY/MM85wej4rjjB+CqYXnE/l+z5NCQcQyegPhcK1oFhY5uwZjHPNhw2LI1YllllNuP4E501kE5kixRiu/5iLGcVZQi/MROIQA7ZBgPfGsUCi1IOcz5hpTHB33z/HVmtDDn0tMgH9T2gXqEQJ6766V1IFEyVciPdU66pZAiTJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=gl0fMV/y; arc=none smtp.client-ip=207.171.188.206 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="gl0fMV/y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1722612289; x=1754148289; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HlTLf6rMFLh/z3VvfgmI3bnbMSeXF59wzmGFsXVVC5k=; b=gl0fMV/y+waoLRFUMr0mBjcaD1LzCTo433XGVdWMzcot12yIWSO8HvwE CyYH2cHBamxy4+DbqOaSSFRnZ3iDpZywxt3vkjLjg1zZ3Qs8J6le1QU2d i6rZk21HQNM64Ro8zgiC0dcops42urPdAshpHiv7yFAniMxofDpVpBjLu k=; X-IronPort-AV: E=Sophos;i="6.09,258,1716249600"; d="scan'208";a="746702857" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-9106.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2024 15:24:47 +0000 Received: from EX19MTAUWA002.ant.amazon.com [10.0.7.35:26186] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.27.192:2525] with esmtp (Farcaster) id 2c37182a-10f2-45eb-8eda-90c6ae2bc19a; Fri, 2 Aug 2024 15:24:46 +0000 (UTC) X-Farcaster-Flow-ID: 2c37182a-10f2-45eb-8eda-90c6ae2bc19a Received: from EX19EXOUWC002.ant.amazon.com (10.250.64.172) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 2 Aug 2024 15:24:38 +0000 Received: from EX19MTAUWA001.ant.amazon.com (10.250.64.204) by EX19EXOUWC002.ant.amazon.com (10.250.64.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 2 Aug 2024 15:24:35 +0000 Received: from dev-dsk-jorcrous-2c-c0367878.us-west-2.amazon.com (10.189.195.130) by mail-relay.amazon.com (10.250.64.204) with Microsoft SMTP Server id 15.2.1258.34 via Frontend Transport; Fri, 2 Aug 2024 15:24:35 +0000 Received: by dev-dsk-jorcrous-2c-c0367878.us-west-2.amazon.com (Postfix, from userid 14178300) id 68F76A79F; Fri, 2 Aug 2024 15:24:35 +0000 (UTC) From: Jordan Crouse To: CC: Bryan O'Donoghue , Mauro Carvalho Chehab , Robert Foss , Todor Tomov , , Subject: [PATCH v1 2/2] media: camss: Avoid overwriting vfe clock rates for 8250 Date: Fri, 2 Aug 2024 15:24:34 +0000 Message-ID: <20240802152435.35796-3-jorcrous@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240802152435.35796-1-jorcrous@amazon.com> References: <20240802152435.35796-1-jorcrous@amazon.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On sm8250 targets both the csid and vfe subsystems share a number of clocks. Commit b4436a18eedb ("media: camss: add support for SM8250 camss") reorganized the initialization sequence so that VFE gets initialized first but a side effect of that was that the CSID subsystem came in after and overwrites the set frequencies on the shared clocks. Empty the frequency tables for the shared clocks in the CSID resources so they won't overwrite the clock rates that the VFE has already set. Signed-off-by: Jordan Crouse --- drivers/media/platform/qcom/camss/camss.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 51b1d3550421..d78644c3ebe9 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -915,6 +915,15 @@ static const struct camss_subdev_resources csiphy_res_8250[] = { } }; +/* + * Both CSID and VFE use some of the same vfe clocks and both + * should prepare/enable them but only the VFE subsystem should be in charge + * of setting the clock rates. + * + * Set the frequency tables for those clocks in the CSID resources to + * be empty so the csid subsystem doesn't overwrite the clock rates that the + * VFE already set. + */ static const struct camss_subdev_resources csid_res_8250[] = { /* CSID0 */ { @@ -922,8 +931,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_areg", "vfe0_ahb" }, .clock_rate = { { 400000000 }, { 400000000 }, - { 350000000, 475000000, 576000000, 720000000 }, - { 100000000, 200000000, 300000000, 400000000 }, + { 0 }, + { 0 }, { 0 } }, .reg = { "csid0" }, .interrupt = { "csid0" }, @@ -939,8 +948,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_areg", "vfe1_ahb" }, .clock_rate = { { 400000000 }, { 400000000 }, - { 350000000, 475000000, 576000000, 720000000 }, - { 100000000, 200000000, 300000000, 400000000 }, + { 0 }, + { 0 }, { 0 } }, .reg = { "csid1" }, .interrupt = { "csid1" }, @@ -956,7 +965,7 @@ static const struct camss_subdev_resources csid_res_8250[] = { .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, .clock_rate = { { 400000000 }, { 400000000 }, - { 400000000, 480000000 }, + { 0 }, { 0 } }, .reg = { "csid2" }, .interrupt = { "csid2" }, @@ -973,7 +982,7 @@ static const struct camss_subdev_resources csid_res_8250[] = { .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, .clock_rate = { { 400000000 }, { 400000000 }, - { 400000000, 480000000 }, + { 0 }, { 0 } }, .reg = { "csid3" }, .interrupt = { "csid3" },