Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp821266rdb; Fri, 23 Feb 2024 00:27:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHN+GAX9JKM38z7ge4lAA1hD7M3Ke+xv76drnC60YqYizWvKb4XdLIlutwUc/jETmj0aN4w0R5oXSWCIi+brcCysgGdFa7H1hn5yd0YA== X-Google-Smtp-Source: AGHT+IEHNgNYDhikgnGaDT19SQ8zSnDVYjqi5d7YkB4b3YpSB5cajYu+sisXS+/ayNPJsSQ/3PtX X-Received: by 2002:ae9:c00d:0:b0:787:76dc:652e with SMTP id u13-20020ae9c00d000000b0078776dc652emr1464666qkk.33.1708676833143; Fri, 23 Feb 2024 00:27:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708676833; cv=pass; d=google.com; s=arc-20160816; b=MR9vkA8lA7XHnX551X0qsQAIN1zqBFxXctPFAPRdhPOMBwc588/pmfPeFCGah/M1L5 H/gpQi4evaadpogLzQYWpzzk3fJcSwKTyTAo7HnWD3qPzVKfXhjRY+ogF5yOShHiZJkj 8nxvupbGe9MKj9LRvMJmFXmCCFUSbHC0lIlvJiBZ0PPHY3eHhS7qBNHnKnAbpjrxGppN T1MhDJMQUfkfFEzTawxSvz3ST7flDNyOMnr89HWJ+xtiPAmF7AuoCSJC74X4usds6phe FqE7nX2si/uiBh5ngksSXJN50xAZTZZlD3iJ7/gTkO2JisX1MZmMEIF5uqSM6JVj1mLT XUgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=K6y7uStiqrpuPM7+Oz8ye9VKpDHHkL2Lqu3kJBQQm/8=; fh=6UpAXv9E5EPSji7flndtkHl8gICsRnFY/O6oEyAz2z8=; b=yoUKiPaC3fwFDtVO8nsIwUJYn5p3QzuIknw+/yuYpz50OmpAwXUYiVwK06YwRvbR37 Ve2339q4LXjDjNpst8TyYF1sG2HW6lYJ/1QV/+mOkp/Ak8eyN74YY68s1JdmJeWQijbK ZQkW4CLUNJmcC42mmuzU/F/rRE0w++5ApALvNn7bEVBxD/rcuWpChtlCmanqyIo2/+qb xXCZtUAA65SqKEJ7pAvS5c+MNMCfYBUMt7q2ZSGlW7hnE2eK68ZxadCGVMeUCiXw4Tde v3QVCjoD8FVmy7Ok0dAoKt2zPuCjTkVZMETv4gplByI3xv/05cYELCysEz6NRQzMQPsr EjiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bihS54MY; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c24-20020a05620a135800b0078753f558edsi13184503qkl.701.2024.02.23.00.27.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 00:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bihS54MY; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D52E41C23280 for ; Fri, 23 Feb 2024 08:27:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61FF31865C; Fri, 23 Feb 2024 08:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bihS54MY" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 07CDD175AB; Fri, 23 Feb 2024 08:26:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708676822; cv=none; b=sBBld276CEdkw7Q5ET1u6Ww1PZt63ZvGh49Z4U79VmzSw19yDp/H6z7JThXtyZ9+cDpoclBCYzjYu0xPQLJBrq6zjPXh7sUynw57vHc7DtVuwkswQkizutdV7J6oYJcTXvga51novSwEcn02n+M5qKrUPy+y2TLVsoMSmvyxXMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708676822; c=relaxed/simple; bh=irdeSfmFPKa8gsvyFoyZEAT/OgWl2zTzic/hx8oANEM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kT1NvWTQuHoi2MwpnaiudOT++kaRJQl3n4ayffQrdymMkIu7xXldAatT2R1dNicTc46d5+GfYefS65wJh135HZlmrzjaxGDxkBCtcMgCa+kmaL8vfLRki9NZ9Y3doLi7uQT/pqXMj1wD8PpdvPKvlBgkuQ5dQyh90SCblkWXgDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bihS54MY; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708676820; x=1740212820; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=irdeSfmFPKa8gsvyFoyZEAT/OgWl2zTzic/hx8oANEM=; b=bihS54MYL8UYwC0KsV57kykIEqqfbNE/JvU2D9b5SNp+MfWROEpJPwxA cqD5KeG2CbYIZBaeAN9COV3dhVQMk8VKq4oJQbzecO24+EJELpQkhs1JM IuGI2D7iMiVrd0yX/ggNbOR9baUC5MPH3yCVn31I6UNOBYvuwV/5zq6p5 uYMMRttx1YgmGFxvJl3W1AxLg094qcTJ+l8to/Wy8Gz7mvtCFiIr/4Ise U60/HSu6YEfCyzAqoNMfHtsbIk30V1uzovc8JNy42lG/DnpqsItRlXU/x NdwW7dQVZ6tmLgRWbwK2cKGkG6Lo15mxKNAlxttrWebw5rEM8cmpLij5p A==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="20518340" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="20518340" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2024 00:26:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="29002225" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2024 00:26:55 -0800 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 725B811F81D; Fri, 23 Feb 2024 10:26:52 +0200 (EET) Date: Fri, 23 Feb 2024 08:26:52 +0000 From: Sakari Ailus To: Mikhail Rudenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab Subject: Re: [PATCH v2 12/20] media: i2c: ov4689: Implement vflip/hflip controls Message-ID: References: <20231218174042.794012-1-mike.rudenko@gmail.com> <20231218174042.794012-13-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231218174042.794012-13-mike.rudenko@gmail.com> Hi Mikhail, On Mon, Dec 18, 2023 at 08:40:33PM +0300, Mikhail Rudenko wrote: > The OV4689 sensor supports horizontal and vertical flipping. Add > appropriate controls to the driver. Toggling both array flip and > digital flip bits allows to achieve flipping while maintaining output > Bayer order. Note that the default value of hflip control corresponds > to both bits set, as it was before this patch. > > Signed-off-by: Mikhail Rudenko > --- > drivers/media/i2c/ov4689.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c > index 06ed9d22b2c8..6cf986bf305d 100644 > --- a/drivers/media/i2c/ov4689.c > +++ b/drivers/media/i2c/ov4689.c > @@ -42,6 +42,14 @@ > #define OV4689_REG_VTS CCI_REG16(0x380e) > #define OV4689_VTS_MAX 0x7fff > > +#define OV4689_REG_TIMING_FORMAT1 CCI_REG8(0x3820) > +#define OV4689_REG_TIMING_FORMAT2 CCI_REG8(0x3821) > +#define OV4689_TIMING_FLIP_MASK GENMASK(2, 1) > +#define OV4689_TIMING_FLIP_ARRAY BIT(1) > +#define OV4689_TIMING_FLIP_DIGITAL BIT(2) > +#define OV4689_TIMING_FLIP_BOTH (OV4689_TIMING_FLIP_ARRAY |\ > + OV4689_TIMING_FLIP_DIGITAL) > + > #define OV4689_REG_TEST_PATTERN CCI_REG8(0x5040) > #define OV4689_TEST_PATTERN_ENABLE 0x80 > #define OV4689_TEST_PATTERN_DISABLE 0x0 > @@ -183,7 +191,6 @@ static const struct cci_reg_sequence ov4689_2688x1520_regs[] = { > {CCI_REG8(0x3811), 0x08}, /* H_WIN_OFF_L h_win_off[7:0] = 0x08*/ > {CCI_REG8(0x3813), 0x04}, /* V_WIN_OFF_L v_win_off[7:0] = 0x04 */ > {CCI_REG8(0x3819), 0x01}, /* VSYNC_END_L vsync_end_point[7:0] = 0x01 */ > - {CCI_REG8(0x3821), 0x06}, /* TIMING_FORMAT2 array_h_mirror = 1, digital_h_mirror = 1 */ > > /* OTP control */ > {CCI_REG8(0x3d85), 0x36}, /* OTP_REG85 OTP_power_up_load_setting_enable = 1, > @@ -607,6 +614,16 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > (ctrl->val + ov4689->cur_mode->width) / > OV4689_HTS_DIVIDER, &ret); > break; > + case V4L2_CID_VFLIP: > + cci_update_bits(regmap, OV4689_REG_TIMING_FORMAT1, > + OV4689_TIMING_FLIP_MASK, > + ctrl->val ? OV4689_TIMING_FLIP_BOTH : 0, &ret); > + break; > + case V4L2_CID_HFLIP: > + cci_update_bits(regmap, OV4689_REG_TIMING_FORMAT2, > + OV4689_TIMING_FLIP_MASK, > + ctrl->val ? 0 : OV4689_TIMING_FLIP_BOTH, &ret); > + break; > default: > dev_warn(dev, "%s Unhandled id:0x%x, val:0x%x\n", > __func__, ctrl->id, ctrl->val); > @@ -637,7 +654,7 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > > handler = &ov4689->ctrl_handler; > mode = ov4689->cur_mode; > - ret = v4l2_ctrl_handler_init(handler, 10); > + ret = v4l2_ctrl_handler_init(handler, 12); > if (ret) > return ret; > > @@ -677,6 +694,9 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > ARRAY_SIZE(ov4689_test_pattern_menu) - 1, > 0, 0, ov4689_test_pattern_menu); > > + v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); > + v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); Could you take the default value from the mounting rotation? The default should be upside-up, but this is an existing driver and changing the flipping now could affect existing users. > + > if (handler->error) { > ret = handler->error; > dev_err(ov4689->dev, "Failed to init controls(%d)\n", ret); -- Regards, Sakari Ailus