From nobody Mon Feb 9 01:45:34 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 AE7BE2877CB for ; Thu, 15 Jan 2026 03:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768446745; cv=none; b=Y6UIpF+NFjVDenQ62Sy2GC89HSKJ3qlMssSw22e1oUqIGwtvktLacKB7ApeC7GkqQ59i/dyUBM0eJRscGh0SKt3qhNSw2my/9Qkt7x0YQnMRbsM4ZWpOHQb9TdKe5Gj7vl6goJ182zP7Rsml1b1TuNM/OiYBXqEVGKrncCCZGGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768446745; c=relaxed/simple; bh=bfY21wb9zreAqw4/f1hTl74rQI5Z5S4Zxq4SgQ9SBpE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rpMvWIvC7AbqPPpTMrJyhwTHGHytleYp+rJbW64O3NXG2E0IwPjwbkaP1UYuZ97qrb7rF0ZmQSEk0iOEbz2RLWRm+TtYWU4KafSxUGI37iReap4Mgr2pvxB4poRygYaO2aFmJxRUcDgVtCEcgMpXOiCHMIK0DmO1WROeu6u+ZfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d1UKJUuS; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d1UKJUuS" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-bc2abdcfc6fso180597a12.2 for ; Wed, 14 Jan 2026 19:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768446743; x=1769051543; 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=UDVMaWbq7186xlbZBkIwTp4VvT95HkeR2Fa3C7B6kc8=; b=d1UKJUuSXXjJSORa7tTnZmA/liHZeDELbCZZwgWgUiAeJ0zG/krI3OlAM9ZfXEDu7v HFfBSriBrVyG6Wq1W3OCEFNIadlIOT+Lh44C+vxGFae9QE51G0WxBb1KVfLiQa1Xfwoe S6C4jGzsTM1KIPiNDxYVGctlTf+ggRhuC9+fTRlT/avd9LZLDv7DFq8HY4FsX3DZ8GS6 SXWPRg1TcZt5KQISVViSi8ds8z8MfjOFsLOh2vrSzfVfTehBph98J7lDDlhn1V69eYEw kh2TlOf4NK8w4l6lPnhfUhA1CfvIcYrfBvOncifDxZMuVZRlq1EooUH56fOyZblMZhcj B0Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768446743; x=1769051543; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UDVMaWbq7186xlbZBkIwTp4VvT95HkeR2Fa3C7B6kc8=; b=NmRelh9DFJHnV97Xq5JVcSdHBqL61KC35fz3P/mRHkrVtVD0P3Z7dG62GD00UePlAQ FH+NbR/i4TNKaBNFqVMPK6lr5LirnfOPBUmvj0c/c4n7AL7qv4bncbIOPBlITBx5+zS4 m0Dtgand3vATcxMm7MV354mlwHwZ4CIPpEHERCUQA2mEBwtwuDtbVjWmmbxxLJJqcODK fqWu3snrpWK5mTjY0EssPYIm6SqMpoJgVPjwtR/IeYkRNSSIN4R5GC9Sk+Pxx+ghJ1dY tbO53SM1YH4aqPN7VL2SpWf+W/Tb60ksbm7I3hWI0w+ZhJZC4O2FuZPXfVrDNOS6errg INBQ== X-Forwarded-Encrypted: i=1; AJvYcCXbFK3EuZ5y0SMfTViZqEGXKIKEYVbzNcG2R0js0g9eUH6EfYCwU8hszixeI8E7eQvYuNp3qBtv8CLWxQs=@vger.kernel.org X-Gm-Message-State: AOJu0YyJ1SdRYLnpp39Dkikx5fPcWGeTwfGgBsoXsCqT2cP5MhfNlylt D7fnowxs5Ow7KUt+azhhHpYtRArHKFFYn91RWdgygLMI/h9lElSQFtpf X-Gm-Gg: AY/fxX4tJD+x1Z1We2/bkYRtQ5IPZIrfVl7v1i4wA79KUg1gMRvskZI+HDPL91JOPZ3 LFnHfh9cxYoEe0hoOiM/qN1zEQ6jFZEPHq/SbyDB5t6RXoPNeVKqmn7tSQvX9gR+almc6QxXXFi wwyVmcZxHVCDhGGzXjOd6XnUIIeCSY47nsToVTX04/L/+6U4gj6tCqPBldWRjlGQk9SWn4lU8nZ IltyydeEbfDsVDlJlRAlK+7ptdjhgPYsmG+3ndyiTv9sR+h5HlG9vbfjXNuReWyicwaVUhb6RKx 62V1XsXirmoasjvE6V0DLxi8+zZAneSOHcnELUju1rmpD3/x4weJs8v2gYeBiSRkWwnnHWF23XU NqIjOuK6tHIyuBLiPBRA2CXgDiwH3bUiyKe2NU3fMcV8AQ99yMZFW7NDAnJFtN36H8mWEI4faQR cDhNp8Syp9jfhDIlE6JpjzCDLzezoVCQ== X-Received: by 2002:a17:902:e784:b0:2a0:c58b:ed6 with SMTP id d9443c01a7336-2a599e347d0mr49824425ad.29.1768446742812; Wed, 14 Jan 2026 19:12:22 -0800 (PST) Received: from localhost.localdomain ([103.215.237.249]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3cc8d81sm237392495ad.81.2026.01.14.19.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 19:12:22 -0800 (PST) From: Karthikey Kadati To: andy@kernel.org, hansg@kernel.org, mchehab@kernel.org, gregkh@linuxfoundation.org Cc: sakari.ailus@linux.intel.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, karthikey3608@gmail.com Subject: [PATCH v4] media: atomisp: replace ia_css_region with v4l2_rect Date: Thu, 15 Jan 2026 08:42:07 +0530 Message-ID: <20260115031207.52840-1-karthikey3608@gmail.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: quoted-printable Content-Type: text/plain; charset="utf-8" The struct ia_css_region definition is redundant as struct v4l2_rect provides the same functionality (left, top, width, height) and is the standard V4L2 type. Replace usage of ia_css_region with v4l2_rect in ia_css_dz_config and remove the definition of ia_css_region from ia_css_types.h. Also remove historical comments referencing the addition of zoom_region and include to support the v4l2_rect type. Signed-off-by: Karthikey Kadati --- Changes in v4: - Reverted unrelated Dev_dbg removal and indentation changes in atomisp_cmd= .c. - Fixed struct initializer in sh_css_params.c to be flat (fixes static anal= ysis warnings). - Fixed line wrap issues and operator placement in atomisp_cmd.c (fixes che= ckpatch warnings), ensuring no unrelated lines were touched. - Added blank line after in ia_css_types.h. Changes in v3: - Rebased on linux-media/next to resolve conflict with nested structs. - Replaced usage of zoom_region.origin/resolution with direct members. Changes in v2: - Removed unrelated changes to drivers/staging/sm750fb/ddk750_swi2c.c. - Removed historical comments in ia_css_types.h. - Corrected header ordering. .../staging/media/atomisp/pci/atomisp_cmd.c | 122 +++++++++--------- .../staging/media/atomisp/pci/ia_css_types.h | 14 +- .../staging/media/atomisp/pci/sh_css_params.c | 18 +-- 3 files changed, 69 insertions(+), 85 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 3a4eb4f6d3be..1651ef4eafe1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1762,15 +1762,13 @@ int atomisp_calculate_real_zoom_region(struct atomi= sp_sub_device *asd, return -EINVAL; } =20 - if (dz_config->zoom_region.resolution.width - =3D=3D asd->sensor_array_res.width - || dz_config->zoom_region.resolution.height - =3D=3D asd->sensor_array_res.height) { + if (dz_config->zoom_region.width =3D=3D asd->sensor_array_res.width || + dz_config->zoom_region.height =3D=3D asd->sensor_array_res.height) { /*no need crop region*/ - dz_config->zoom_region.origin.x =3D 0; - dz_config->zoom_region.origin.y =3D 0; - dz_config->zoom_region.resolution.width =3D eff_res.width; - dz_config->zoom_region.resolution.height =3D eff_res.height; + dz_config->zoom_region.left =3D 0; + dz_config->zoom_region.top =3D 0; + dz_config->zoom_region.width =3D eff_res.width; + dz_config->zoom_region.height =3D eff_res.height; return 0; } =20 @@ -1781,18 +1779,14 @@ int atomisp_calculate_real_zoom_region(struct atomi= sp_sub_device *asd, */ =20 if (!IS_ISP2401) { - dz_config->zoom_region.origin.x =3D dz_config->zoom_region.origin.x - * eff_res.width - / asd->sensor_array_res.width; - dz_config->zoom_region.origin.y =3D dz_config->zoom_region.origin.y - * eff_res.height - / asd->sensor_array_res.height; - dz_config->zoom_region.resolution.width =3D dz_config->zoom_region.resol= ution.width - * eff_res.width - / asd->sensor_array_res.width; - dz_config->zoom_region.resolution.height =3D dz_config->zoom_region.reso= lution.height - * eff_res.height - / asd->sensor_array_res.height; + dz_config->zoom_region.left =3D dz_config->zoom_region.left * + eff_res.width / asd->sensor_array_res.width; + dz_config->zoom_region.top =3D dz_config->zoom_region.top * + eff_res.height / asd->sensor_array_res.height; + dz_config->zoom_region.width =3D dz_config->zoom_region.width * + eff_res.width / asd->sensor_array_res.width; + dz_config->zoom_region.height =3D dz_config->zoom_region.height * + eff_res.height / asd->sensor_array_res.height; /* * Set same ratio of crop region resolution and current pipe output * resolution @@ -1819,62 +1813,62 @@ int atomisp_calculate_real_zoom_region(struct atomi= sp_sub_device *asd, - asd->sensor_array_res.width * out_res.height / out_res.width; h_offset =3D h_offset / 2; - if (dz_config->zoom_region.origin.y < h_offset) - dz_config->zoom_region.origin.y =3D 0; + if (dz_config->zoom_region.top < h_offset) + dz_config->zoom_region.top =3D 0; else - dz_config->zoom_region.origin.y =3D dz_config->zoom_region.origin.y - = h_offset; + dz_config->zoom_region.top =3D + dz_config->zoom_region.top - h_offset; w_offset =3D 0; } else { w_offset =3D asd->sensor_array_res.width - asd->sensor_array_res.height * out_res.width / out_res.height; w_offset =3D w_offset / 2; - if (dz_config->zoom_region.origin.x < w_offset) - dz_config->zoom_region.origin.x =3D 0; + if (dz_config->zoom_region.left < w_offset) + dz_config->zoom_region.left =3D 0; else - dz_config->zoom_region.origin.x =3D dz_config->zoom_region.origin.x - = w_offset; + dz_config->zoom_region.left =3D + dz_config->zoom_region.left - w_offset; h_offset =3D 0; } - dz_config->zoom_region.origin.x =3D dz_config->zoom_region.origin.x - * eff_res.width - / (asd->sensor_array_res.width - 2 * w_offset); - dz_config->zoom_region.origin.y =3D dz_config->zoom_region.origin.y - * eff_res.height - / (asd->sensor_array_res.height - 2 * h_offset); - dz_config->zoom_region.resolution.width =3D dz_config->zoom_region.resol= ution.width - * eff_res.width - / (asd->sensor_array_res.width - 2 * w_offset); - dz_config->zoom_region.resolution.height =3D dz_config->zoom_region.reso= lution.height - * eff_res.height - / (asd->sensor_array_res.height - 2 * h_offset); - } - - if (out_res.width * dz_config->zoom_region.resolution.height - > dz_config->zoom_region.resolution.width * out_res.height) { - dz_config->zoom_region.resolution.height =3D - dz_config->zoom_region.resolution.width - * out_res.height / out_res.width; + dz_config->zoom_region.left =3D dz_config->zoom_region.left * + eff_res.width / + (asd->sensor_array_res.width - 2 * w_offset); + dz_config->zoom_region.top =3D dz_config->zoom_region.top * + eff_res.height / + (asd->sensor_array_res.height - 2 * h_offset); + dz_config->zoom_region.width =3D dz_config->zoom_region.width * + eff_res.width / + (asd->sensor_array_res.width - 2 * w_offset); + dz_config->zoom_region.height =3D dz_config->zoom_region.height * + eff_res.height / + (asd->sensor_array_res.height - 2 * h_offset); + } + + if (out_res.width * dz_config->zoom_region.height > + dz_config->zoom_region.width * out_res.height) { + dz_config->zoom_region.height =3D dz_config->zoom_region.width * + out_res.height / out_res.width; } else { - dz_config->zoom_region.resolution.width =3D - dz_config->zoom_region.resolution.height - * out_res.width / out_res.height; + dz_config->zoom_region.width =3D dz_config->zoom_region.height * + out_res.width / out_res.height; } dev_dbg(asd->isp->dev, "%s crop region:(%d,%d),(%d,%d) eff_res(%d, %d) array_size(%d,%d) out_re= s(%d, %d)\n", - __func__, dz_config->zoom_region.origin.x, - dz_config->zoom_region.origin.y, - dz_config->zoom_region.resolution.width, - dz_config->zoom_region.resolution.height, + __func__, dz_config->zoom_region.left, + dz_config->zoom_region.top, + dz_config->zoom_region.width, + dz_config->zoom_region.height, eff_res.width, eff_res.height, asd->sensor_array_res.width, asd->sensor_array_res.height, out_res.width, out_res.height); =20 - if ((dz_config->zoom_region.origin.x + - dz_config->zoom_region.resolution.width + if ((dz_config->zoom_region.left + + dz_config->zoom_region.width > eff_res.width) || - (dz_config->zoom_region.origin.y + - dz_config->zoom_region.resolution.height + (dz_config->zoom_region.top + + dz_config->zoom_region.height > eff_res.height)) return -EINVAL; =20 @@ -1899,10 +1893,10 @@ static bool atomisp_check_zoom_region( =20 config.width =3D asd->sensor_array_res.width; config.height =3D asd->sensor_array_res.height; - w =3D dz_config->zoom_region.origin.x + - dz_config->zoom_region.resolution.width; - h =3D dz_config->zoom_region.origin.y + - dz_config->zoom_region.resolution.height; + w =3D dz_config->zoom_region.left + + dz_config->zoom_region.width; + h =3D dz_config->zoom_region.top + + dz_config->zoom_region.height; =20 if ((w <=3D config.width) && (h <=3D config.height) && w > 0 && h > 0) flag =3D true; @@ -1910,10 +1904,10 @@ static bool atomisp_check_zoom_region( /* setting error zoom region */ dev_err(asd->isp->dev, "%s zoom region ERROR:dz_config:(%d,%d),(%d,%d)array_res(%d, %d)\n", - __func__, dz_config->zoom_region.origin.x, - dz_config->zoom_region.origin.y, - dz_config->zoom_region.resolution.width, - dz_config->zoom_region.resolution.height, + __func__, dz_config->zoom_region.left, + dz_config->zoom_region.top, + dz_config->zoom_region.width, + dz_config->zoom_region.height, config.width, config.height); =20 return flag; diff --git a/drivers/staging/media/atomisp/pci/ia_css_types.h b/drivers/sta= ging/media/atomisp/pci/ia_css_types.h index 676d7e20b282..2b7db9cda23a 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_types.h +++ b/drivers/staging/media/atomisp/pci/ia_css_types.h @@ -15,6 +15,8 @@ * directly but still need to forward parameters for it. */ =20 +#include + #include =20 #include "ia_css_frac.h" @@ -427,14 +429,6 @@ struct ia_css_point { s32 y; /** y coordinate */ }; =20 -/** - * This specifies the region - */ -struct ia_css_region { - struct ia_css_point origin; /** Starting point coordinates for the region= */ - struct ia_css_resolution resolution; /** Region resolution */ -}; - /** * Digital zoom: * This feature is currently available only for video, but will become @@ -442,7 +436,7 @@ struct ia_css_region { * Set the digital zoom factor, this is a logarithmic scale. The actual zo= om * factor will be 64/x. * Setting dx or dy to 0 disables digital zoom for that direction. - * New API change for Digital zoom:(added struct ia_css_region zoom_region) + * * zoom_region specifies the origin of the zoom region and width and * height of that region. * origin : This is the coordinate (x,y) within the effective input resolu= tion @@ -455,7 +449,7 @@ struct ia_css_region { struct ia_css_dz_config { u32 dx; /** Horizontal zoom factor */ u32 dy; /** Vertical zoom factor */ - struct ia_css_region zoom_region; /** region for zoom */ + struct v4l2_rect zoom_region; /** region for zoom */ }; =20 /* The still capture mode, this can be RAW (simply copy sensor input to DD= R), diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/st= aging/media/atomisp/pci/sh_css_params.c index 11d62313c908..23e08142bf09 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -657,11 +657,7 @@ static const int zoom_table[4][HRT_GDC_N] =3D { static const struct ia_css_dz_config default_dz_config =3D { HRT_GDC_N, HRT_GDC_N, - { - \ - {0, 0}, \ - {0, 0}, \ - } + { 0, 0, 0, 0 } }; =20 static const struct ia_css_vector default_motion_config =3D { @@ -1210,8 +1206,8 @@ ia_css_process_zoom_and_motion( } =20 assert(stage->stage_num < SH_CSS_MAX_STAGES); - if (params->dz_config.zoom_region.resolution.width =3D=3D 0 && - params->dz_config.zoom_region.resolution.height =3D=3D 0) { + if (params->dz_config.zoom_region.width =3D=3D 0 && + params->dz_config.zoom_region.height =3D=3D 0) { sh_css_update_uds_and_crop_info( &info->sp, &binary->in_frame_info, @@ -4096,10 +4092,10 @@ sh_css_update_uds_and_crop_info_based_on_zoom_regio= n( assert(motion_vector); assert(uds); assert(sp_out_crop_pos); - x0 =3D zoom->zoom_region.origin.x; - y0 =3D zoom->zoom_region.origin.y; - x1 =3D zoom->zoom_region.resolution.width + x0; - y1 =3D zoom->zoom_region.resolution.height + y0; + x0 =3D zoom->zoom_region.left; + y0 =3D zoom->zoom_region.top; + x1 =3D zoom->zoom_region.width + x0; + y1 =3D zoom->zoom_region.height + y0; =20 if ((x0 > x1) || (y0 > y1) || (x1 > pipe_in_res.width) || (y1 > pipe_in_r= es.height)) return -EINVAL; --=20 2.43.0