From nobody Mon Feb 9 01:46:08 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.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 3484735E53D for ; Wed, 7 Jan 2026 15:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767798565; cv=none; b=UNKbMgUT92F56no0XtohVoH8ZhIOKlXI2f/oZVhIjsZJof+EqBia7PkMx1AAsZm60niGdUN1lOx9WRucC8GgvaG62/XKiJShY9Gyehnh/fdy7iPiRiiGBMRNf/bRKMpWWN2pIzklqyAChjDi/qwWiG+2WsaKkjAJCyR9FQ1UXWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767798565; c=relaxed/simple; bh=xKFsJabEMwnI1MXju9I0t3B+DJrI9n8oUM1d99mUiCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rdOqiS6Hve4Vg9JI9W4G4OhgoyvrYfvsEpZ/AgeHp1W4c5aP4MbB5oyeHaeI0s2n3NqQsd1ci80Sk/qwtS++pQ9sClVzdsaBwywhHGHydc67MrOvrB56LxMH/0wydZwh949ykKFHrCYVuZS3dF4cYgHWjeqgfHdjpW5Y2F8JYE4= 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=EcUvId2i; arc=none smtp.client-ip=209.85.210.170 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="EcUvId2i" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7b7828bf7bcso1835400b3a.2 for ; Wed, 07 Jan 2026 07:09:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767798563; x=1768403363; 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=QvqM+SWBFA3rR7ce2iMSgH9tTLda8L0N8W2RxvU0YTU=; b=EcUvId2iXg4x9a7Q2Cw90koM+tvedzeYdkmvvrHk3ZrhB37sIR1U3Fl2Azusp5Q/06 +a+AKOXo5YCqPL5d5IuSngBbHZTBjGyNfmF7/DD6XkUDC6VwyOza5Xo6+mzPe9jQ5p9G j+xOurxRp+W4LOmaRMVEJ5yodTHkCWY4mRnTmNrDSIGHfvfLRO/3u+XxH+WtbzJpBPdF 2dIBtuteQQ/M7Jw0D6+1CWZ3juMZ0EiFEAjI6OP8V0VpP4x7QIJq8CG6/sQgsHi/abFq 1PIV50eGNHT+OX3nV7uC+T+KRxLDiq5Bb/JZROcD9+0nUOdyoZD9EVXJVPTlI10MgaIk BaGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767798563; x=1768403363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QvqM+SWBFA3rR7ce2iMSgH9tTLda8L0N8W2RxvU0YTU=; b=ZK0UL1/qP54b9AbNqHCjtG9ILlcokjux1xDSu3aUOpYBiwwBNHK5Ym2vXjWa/0MGzJ pSN5cc4Hh+M/F45xEkS+rt4hVlM/lDug+/NQhkb31b1hMWJxYO+x0fJElq0yMMEL45v+ qBagqET2IZ+IDigoa/1TjybR/ZgKH8JpsKv2WOjfjeKOHkKHKGV0h0ZK8gMHbTk9YFd0 9VG1XcJCWPxSoj70FSvKkEZl8L7j/SzsI9/NB0WAfOlN1fH4Jaa6dXaih+JSpN5WLhb7 4olTMpBmyskcXFAog7FDHqDNt960LbS4nzLyeBb1omdRBsX5+nq9EPAPBboltitS+O3r OCtA== X-Forwarded-Encrypted: i=1; AJvYcCUOF0LugNPv/vsvjUXlivPqeVCg1TlEBACiYWJaGvrwPHgXh2bxtam68prVkXeVRxnVb4DUiekodQopTuQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywl6ic56eRAZlPKT4G79iKUIPjNrn2QXhw/whnG0jXIana6wfcr h5gRk9c838mK9KIZ5nlqEcha/T4zCyOdEw13hPlDeWvuPq3Tl1IMs/JQ X-Gm-Gg: AY/fxX4jIzoD6MWZru6ShZLOhxN5eiSx9UY+ZgvGYPLhj+gURcEzUbpp8AtUGdoIk2w KF6i744tQ8Z9agFCIjloLDRObTYOYk226yZxsbDhJ+4cqJY/1B/bxpko1POHuMrATTMID9CE/JO 2D43B7bQkOraauVtFpWWcoOMhQDxiu+DnuY/FSpRsCjF2ZSZpjodNCZzsrBBdFPU9HpQO+Sz0hX SupOT16MPTbkDsHivv++AdZDJ6iL/NORyOpuG++tjrf3kvFNX06XUBQWIwNno3RfszPRJQ0ezp8 ag29CkA3Sijkx5/EdozM8HkITp1tVjAuh0e90ig/2X+r57Z6q9csNWn1ILeRdY33NW5Q8UpFZmc liEcQMX5p/JG2CDZEDPbvMdHa8IH8lL9l5bV8X4Q73/HZqaj9gEv6HkFkZEZZoRmHXyfuvCSp7i I8EgJYnM9eCHY= X-Google-Smtp-Source: AGHT+IEMZL7cDWMK2efRhgrCEhtbkTevVTHEG1U32DuXu98OETg5HHFEdrcXTWamiC55tEBJtwVoxw== X-Received: by 2002:a05:6a00:3487:b0:819:5db9:6c4c with SMTP id d2e1a72fcca58-81b7d95ee54mr2540288b3a.8.1767798563245; Wed, 07 Jan 2026 07:09:23 -0800 (PST) Received: from karthik.. ([43.247.159.43]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-819c59df961sm5246114b3a.47.2026.01.07.07.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 07:09:22 -0800 (PST) From: Karthikey D Kadati To: Hans de Goede , Mauro Carvalho Chehab Cc: Dan Carpenter , Sakari Ailus , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Karthikey D Kadati Subject: [PATCH v4 1/3] media: atomisp: replace shadow zoom structs with v4l2_rect Date: Wed, 7 Jan 2026 20:38:56 +0530 Message-ID: <20260107150858.79818-2-karthikey3608@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260107150858.79818-1-karthikey3608@gmail.com> References: <20260107150858.79818-1-karthikey3608@gmail.com> 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" Remove custom atomisp_zoom_point and atomisp_zoom_region structs and usage in favor of standard v4l2_rect within atomisp_dz_config. This aligns the driver with V4L2 standards and removes unnecessary custom types. Also standardize the internal ia_css_region struct members to match V4L2 naming conventions (left, top, width, height) to facilitate the bridge mapping. Updates atomisp_cmd.c and sh_css_params.c to use the new member names. Signed-off-by: Karthikey D Kadati --- .../media/atomisp/include/linux/atomisp.h | 19 +-- .../staging/media/atomisp/pci/atomisp_cmd.c | 130 +++++++++--------- .../staging/media/atomisp/pci/ia_css_types.h | 6 +- .../staging/media/atomisp/pci/sh_css_params.c | 16 +-- 4 files changed, 79 insertions(+), 92 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/driver= s/staging/media/atomisp/include/linux/atomisp.h index fcf116cc4..b5cce12c1 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -326,27 +326,12 @@ struct atomisp_resolution { u32 height; /** Height */ }; =20 -/* - * This specifies the coordinates (x,y) - */ -struct atomisp_zoom_point { - s32 x; /** x coordinate */ - s32 y; /** y coordinate */ -}; - -/* - * This specifies the region - */ -struct atomisp_zoom_region { - struct atomisp_zoom_point - origin; /* Starting point coordinates for the region */ - struct atomisp_resolution resolution; /* Region resolution */ -}; +#include =20 struct atomisp_dz_config { u32 dx; /** Horizontal zoom factor */ u32 dy; /** Vertical zoom factor */ - struct atomisp_zoom_region zoom_region; /** region for zoom */ + struct v4l2_rect zoom_region; /** region for zoom */ }; =20 struct atomisp_parm { diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/stag= ing/media/atomisp/pci/atomisp_cmd.c index 327836372..677c460fe 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1764,15 +1764,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 @@ -1783,18 +1781,18 @@ 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 @@ -1821,62 +1819,66 @@ 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 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 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 @@ -1901,10 +1903,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; @@ -1912,10 +1914,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 676d7e20b..5c21a5415 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_types.h +++ b/drivers/staging/media/atomisp/pci/ia_css_types.h @@ -431,8 +431,10 @@ struct ia_css_point { * 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 */ + s32 left; /** Starting point coordinates for the region */ + s32 top; + s32 width; /** Region resolution */ + s32 height; }; =20 /** diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/st= aging/media/atomisp/pci/sh_css_params.c index 11d62313c..0435f20a7 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -658,9 +658,7 @@ 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 @@ -1210,8 +1208,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 +4094,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