From patchwork Mon Dec 11 17:50:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Rudenko X-Patchwork-Id: 13487753 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HdHtrTjc" Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D6D10A; Mon, 11 Dec 2023 09:51:04 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50bce78f145so5436684e87.0; Mon, 11 Dec 2023 09:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702317061; x=1702921861; 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=rk40BFqdM79fk23xCLVJrMhVtoRWFhktaIF9x7isDYY=; b=HdHtrTjceu0y62/Z5hRTF96op5Gr+rIXq7tgU3EVHD9/bjxf1x0/bD1uqBnRoO2EAU 41QjMpShVtJmwYc5gNqaOrQKhfh/SuPD7D7W2lrblmtscLrCpNexm0cseAumXY5Je0aq gfp3aopdeaW3TWsTqOWz0doDK1bmed0miGinr68608kic30+cOEA78sUv8jCGr/TVvCI uaz/GkgZlWJC8uj0OdeNeLc8rno+Mokn5lCQq1NOw4h6CkUJjVOtt/eScozWTYjoaoqa ShJBgibm7jF5RlG2GcYzO71gKFuNmN93UG8LpSgbOvVHZ8IkekVW7/3qrUk/Mmso1Mx/ GyIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702317061; x=1702921861; 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=rk40BFqdM79fk23xCLVJrMhVtoRWFhktaIF9x7isDYY=; b=HNq7DaroZrIJOfhLOoMhyX2dMIsXcFU/UttMwnZ2GXMiEqGtW+v2x1DBf4XqOQ2xQn PQS+mPa2IEbG+AGVE8HtNqk2nBap1cpMX+XMJsFuQAlrKdazJ3CtrlYXy6eVU7iq5A8B cm7LpkM04oYvkLK0dH/RKqX49II59+9B7Ys/AxyVpB2tWLWPghFFCwJ8UEOFD/ZQvOB/ 5RdmIzJVejBAt2OjEEbIzcANbMJFdFf1Pz9Guh2F1N1kulLT85QjBSNzwGirTG/ZtjMx inPd6LJmn/IMmrw/Mgm40sw144G+ufAqhRz4bd6xFahslflvizw8gKFqB7QvfDTWlR77 Bosw== X-Gm-Message-State: AOJu0YwZKtNcnxNK8/Yw8BoJE6ee9Y886ZHRDcymWCZQwlK8g+MBkRMx rlPOHsQA7DAetBnEAcsOThjm+4pJAAwZ5uqv X-Google-Smtp-Source: AGHT+IFe8gf7KEsqd7IjxuDCvtob/zVeC6BjjnFSLHAEjkwulgdFY5EI2VYQvLpkrXnYRAS9o7dqAg== X-Received: by 2002:a05:6512:3a88:b0:50b:d944:bfe1 with SMTP id q8-20020a0565123a8800b0050bd944bfe1mr1234818lfu.163.1702317061343; Mon, 11 Dec 2023 09:51:01 -0800 (PST) Received: from localhost ([83.149.246.185]) by smtp.gmail.com with ESMTPSA id cf16-20020a056512281000b0050df1c4149asm605479lfb.273.2023.12.11.09.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:51:01 -0800 (PST) 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 Subject: [PATCH 14/19] media: i2c: ov4689: Move pixel array size out of struct ov4689_mode Date: Mon, 11 Dec 2023 20:50:17 +0300 Message-ID: <20231211175023.1680247-15-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211175023.1680247-1-mike.rudenko@gmail.com> References: <20231211175023.1680247-1-mike.rudenko@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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 18e1fd564ec0..5acdf9e1b670 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 +#define OV4689_DUMMY_COLUMNS 16 + 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_WIDTH - 2 * OV4689_DUMMY_ROWS; return 0; }