Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp275199lqb; Tue, 16 Apr 2024 15:49:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVw2cydSGclVAzVJyETMv6+2jWMMbrCN5WsmCkxbKk6e9DayJBvA7hJjoMNPCPS96wwQA6kQolDpoPMjDI7ixdXfeXZpjFtkUljkFDesA== X-Google-Smtp-Source: AGHT+IFYSRrkLZQtZpD/oWH0FiFCkH+lnIqB4NldXD/aARnx/2dl+B0IzEfQTbyuMuId8KBmOPmh X-Received: by 2002:a05:6a20:9f49:b0:1aa:58c9:82b8 with SMTP id ml9-20020a056a209f4900b001aa58c982b8mr2216032pzb.10.1713307776292; Tue, 16 Apr 2024 15:49:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713307776; cv=pass; d=google.com; s=arc-20160816; b=qRdnrqR5qJWx1kbRsOUTBzT/nti0TH/OvjqrQIyeOBOFLVj7VPmUL4aoL6ZnGuWgE0 Hf7QmzysLNaAsRFjT6uiCI1Be9uyybxwyIEaX/yd0AuJOftbl0mD6iWXu78xRtaXVv8O CFWN18nvvZtqWHPqKITA3eTz7+VBCPjXNgkB+vn1oZXESIuSDnpuw8QxBlcIkrwTY2Cf GHO8vyJZxwMmFzTTLaqo6+WNzYGW1ApmQGNzsxxQJr1lnEQeGz1a35MvSk4fNETInYQa y6WHXI2TXKIOvF6G/mEbhoO4DGHOLfmyq+22P49uAiEX5trVyxYbKixGt7BZGqydXGHY TrHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QNrZ+v7tBZ68Mo8D5/6+veCro3vnKNVEByeT1M+GGEA=; fh=ZTRxRlYXy5NhooadsReo2gDkmG56oOXoVZ7XYTERlKQ=; b=09RHzzlRw5vLTK8xz9epyofP3fNHtPOvtcm/Muc8eFoOuJxEyDkChsfzgoNAQOfRFB EIiMT6dwfIxPutYwQnXnmd+Ano58qSOT8H3nLB196MllblxtKyNW18b75rq/wUuZt3n2 7x3QKAohofERWMIy7/2glXCRw+NKc77HTzuXBXBrN0GAuzDqAqGy3i0WvHVDKbn8lXyl dTp/SW72JaxPw0h0ulRVmNaY+YMyPq87wxO+jwOlECIdhxGnY51b8jGk5Tkhijte40rk 8wWXppfyXJUTUYCnHHGFPmAX2BbMzns88M2G6g2k87DFlLgwRn13JXduMOY/b+u+vfzH mRFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=amCj3tS8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u19-20020a17090abb1300b002a5ffe8552csi152367pjr.150.2024.04.16.15.49.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 15:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=amCj3tS8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 643092839B0 for ; Tue, 16 Apr 2024 22:49:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAA6213FD8A; Tue, 16 Apr 2024 22:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="amCj3tS8" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 2DF1713D60A; Tue, 16 Apr 2024 22:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713307552; cv=none; b=nESaffBT2PgOIBeRO5stXA3HbQPGG8Ppyjd4GYo5GmduXxlxZEbnwku/pi6LJ7L2aiJTRkyVbrWT7Ecib9e4s2+4Fa6T4ut99cbbAVJT3bfq69zqRgUdEmLcwZuGdo9MQe2GGE3Tx5/PMxJqMlODx+LXy3x3L0Jvdg+6hPcemZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713307552; c=relaxed/simple; bh=sLICh8uWL/pFkYZmub7k1MwFmB7JItN36Hx/5frbUuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=taX8UXIvXspKUShBOBivWNprbiZbN5xCN35VrUk8lRehqijdCMKqb/12hzB6FxdzueSrISoLRPtCCGvaAhA1YsxAktPqpGHupPJlOis3eaiRp+moSwaHXy0yvi1mCPYVJCX6WHmKq113mJtsy83sJkzQ6oacawVCI37WZNX0hgc= 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=amCj3tS8; arc=none smtp.client-ip=209.85.167.52 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 Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-516d6c1e238so5889630e87.2; Tue, 16 Apr 2024 15:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713307549; x=1713912349; 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=QNrZ+v7tBZ68Mo8D5/6+veCro3vnKNVEByeT1M+GGEA=; b=amCj3tS87BvLGuDZC0e/eJQBGYFUraUT39hgbXAgRvNXCBLUrqcVIlhdeJHINXX/Gf kPk0NS6hBZ0NoDPT0sMyfPK3cMJp8TnhoWVXGhutiEFLsI6OjvhHskxQOXlhilYT96A1 GAPExUzKLW0p/7qN9ElAgATrQM93ocb/qlTNydbq/xm+4ZAFAFYVX9azShbZEWS6gWLT kHGBAW2WNR2eQA6UpcEjCtnVkVieOjpG95boRk0IPL4wt0B1fr3dlRovlZRl/fOT2P5e TOY4H3qCeFpeeibpmp8V79mxMX503KM3OSHMSWUXkevyPiQfUxDoMRwGZ8rqIOZsCR0M 3MEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713307549; x=1713912349; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QNrZ+v7tBZ68Mo8D5/6+veCro3vnKNVEByeT1M+GGEA=; b=PNZDG/VQLEHTG0edjuaeSyfSjV/N535DD/9LJwnqtTwlxcWBmdkK2X9RSOGwQEcaxO uKRwlIQQ7TDPSS128xeqs4b3WjjyYHIqjvLVTWBfqkaM0K35gOnfiwqBztovQjP80k1E ettw+vFcRDyCX5ON7t5BCZucQKmvWzWHpHYpjSzP0EKOg1MjTF6J+sTlXjP3ap82N7at rvsZdhpDH9e1KJ0znqEAR2Dpjh8GIzb3BttuubPpX2U/z/Nhom4AO0mlBQ8mdpB0L6vU YiUXjsOKYFj0TrBIbB0MbRTbPmcUYl/xXI3LqbL39OgS+AuZc6zTycyQuUxdaTeL70bw ggOg== X-Forwarded-Encrypted: i=1; AJvYcCUwj8m06auq5OvfKQsQKZg38422+O/vJt+cSEZV8QhkvNjpi8OHsQmGrYk3TKE2w74BrmfjY4rr+mvr/vH67yipNhEJw4I7RFwERqQW X-Gm-Message-State: AOJu0Ywbw8uR6FX7vVEAOIPZOCa/ypofGMITcbXzEKiTFMY3/fxkc6SE 2ViTPwIOAnzyUuABG/FeZ6xEQ9+A7F/WeEzp3xXMPpUP6zGaMKFnXCcZe0YWxr8= X-Received: by 2002:ac2:410a:0:b0:515:bacd:adbf with SMTP id b10-20020ac2410a000000b00515bacdadbfmr8584259lfi.34.1713307548463; Tue, 16 Apr 2024 15:45:48 -0700 (PDT) Received: from localhost (95-24-153-47.broadband.corbina.ru. [95.24.153.47]) by smtp.gmail.com with ESMTPSA id z18-20020a19f712000000b00518e3a194e9sm800817lfe.304.2024.04.16.15.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 15:45:47 -0700 (PDT) From: Mikhail Rudenko To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab , Mikhail Rudenko , Kieran Bingham Subject: [PATCH v5 15/16] media: i2c: ov4689: Move pixel array size out of struct ov4689_mode Date: Wed, 17 Apr 2024 01:45:23 +0300 Message-ID: <20240416224524.1511357-16-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416224524.1511357-1-mike.rudenko@gmail.com> References: <20240416224524.1511357-1-mike.rudenko@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: 8bit Pixel array dimensions and default crop size do not belong to the ov4689_mode structure, since they are mode independent. Make them defines instead. Signed-off-by: Mikhail Rudenko Reviewed-by: Kieran Bingham --- drivers/media/i2c/ov4689.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index 81153b1a49a5..9da4f84e63b1 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -70,6 +70,11 @@ #define OV4689_LANES 4 #define OV4689_XVCLK_FREQ 24000000 +#define OV4689_PIXEL_ARRAY_WIDTH 2720 +#define OV4689_PIXEL_ARRAY_HEIGHT 1536 +#define OV4689_DUMMY_ROWS 8 /* 8 dummy rows on each side */ +#define OV4689_DUMMY_COLUMNS 16 /* 16 dummy columns on each side */ + static const char *const ov4689_supply_names[] = { "avdd", /* Analog power */ "dovdd", /* Digital I/O power */ @@ -90,10 +95,6 @@ struct ov4689_mode { u32 vts_def; u32 exp_def; u32 pixel_rate; - u32 sensor_width; - u32 sensor_height; - u32 crop_top; - u32 crop_left; const struct cci_reg_sequence *reg_list; unsigned int num_regs; }; @@ -254,10 +255,6 @@ static const struct ov4689_mode supported_modes[] = { .id = OV4689_MODE_2688_1520, .width = 2688, .height = 1520, - .sensor_width = 2720, - .sensor_height = 1536, - .crop_top = 8, - .crop_left = 16, .exp_def = 1536, .hts_def = 10296, .hts_min = 3432, @@ -385,8 +382,6 @@ static int ov4689_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_selection *sel) { - const struct ov4689_mode *mode = to_ov4689(sd)->cur_mode; - if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; @@ -394,15 +389,17 @@ static int ov4689_get_selection(struct v4l2_subdev *sd, case V4L2_SEL_TGT_CROP_BOUNDS: sel->r.top = 0; sel->r.left = 0; - sel->r.width = mode->sensor_width; - sel->r.height = mode->sensor_height; + sel->r.width = OV4689_PIXEL_ARRAY_WIDTH; + sel->r.height = OV4689_PIXEL_ARRAY_HEIGHT; return 0; case V4L2_SEL_TGT_CROP: case V4L2_SEL_TGT_CROP_DEFAULT: - sel->r.top = mode->crop_top; - sel->r.left = mode->crop_left; - sel->r.width = mode->width; - sel->r.height = mode->height; + sel->r.top = OV4689_DUMMY_ROWS; + sel->r.left = OV4689_DUMMY_COLUMNS; + sel->r.width = + OV4689_PIXEL_ARRAY_WIDTH - 2 * OV4689_DUMMY_COLUMNS; + sel->r.height = + OV4689_PIXEL_ARRAY_HEIGHT - 2 * OV4689_DUMMY_ROWS; return 0; } -- 2.44.0