Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2539075imu; Thu, 29 Nov 2018 06:35:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/V0kIXWExVlHBmN7O3tztKv6AeEmOi/RhDPUEs6E+qdc1jgGeEcc3U7X0aUoPtqiJ2XSXeS X-Received: by 2002:a63:7556:: with SMTP id f22mr1318950pgn.231.1543502133950; Thu, 29 Nov 2018 06:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502133; cv=none; d=google.com; s=arc-20160816; b=ZiHRZUct6yKii9RfVsLZeypZCc9kzt2q1fzQHRmSyGRyBUBwYxAuVg0XbmTxCS2J1e NNhASM/qfTKPCYNv7WG5kL+VttzO4acgFsUcrLbO7WZYkf2aWtIN/EVbBYVBJcUXkkcN uJ+MJZszIRYoB70BSHZ+bCn5ynwGd7wumOIam6nPk5y9ROLgzEAr1znBQ8scWygNn5cB hy5bI6JbxJugiEZHzQLywwfTV4cSf34GdrDWmKZ77Zx36Op0Q/H7M+29bY8ImS724Non XbRv6Jsw83a71nNDAiF33cbIZM9CYjxWLP4hoEjRqP/TjKw4RGlsqdlKo4cMX8Zpr3G/ R8bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=91j9u4e6rFQown/hyS1ZeELX88b4G4d8OMK6sC227Q4=; b=C5nUWsWx+Q8berNMdvYKch57wpQWYlDSGhcovmOKh0bqJKdG7MVyx1B/fAuX8e2HMy WnRru+b8Chj2tVwCXEIS17I4x/xrp6uSubG/DWVHvVJqZrGPC3LC9hZSkAjWsE88toNh 9+SPO76qlsgr+zN2WjlVdO/3UQPf5I1c3dwIwlnRAHb/XzRlgLHQE4ClImStw8QqfLkg b24j+Enn01UxC7HtKU8LjOkuLumGXPHiQIN/XrznhWBrFSgdhpVvLRF+HMRU5SblTMOt XtFxE3OhTUnrcpoCU/CBwfendXFE1Ps+ucrKe5KCxhhQp4Ysl6AP20UZdSGrv4ARHdnr ToyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MjU21V27; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si1768270pgw.590.2018.11.29.06.35.19; Thu, 29 Nov 2018 06:35:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MjU21V27; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389483AbeK3BiB (ORCPT + 99 others); Thu, 29 Nov 2018 20:38:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:41304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388832AbeK3BiA (ORCPT ); Thu, 29 Nov 2018 20:38:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AE77B2147C; Thu, 29 Nov 2018 14:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501947; bh=VfLuBBYOpeRh3jnBKMziyi/qr/rqs/bhhKIzfoc1t/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MjU21V27jrdJI00jvnyJzPN0+O0QHKIhjr9A7RGKFz49AtWjGsCWYzxV0F+puI0Od 66OF4XMtzbAZ3EcPoGidmPNnSR57uLPVJ9lvpNNgqVpV6oqQ2xRAUKLFh8Haqp5BvN EnBoTCneg+Cdi8HFLU0T6LfkAm2qAV096NfcMpzs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugues Fruchet , Laurent Pinchart , Jacopo Mondi , Sakari Ailus , Mauro Carvalho Chehab , Adam Ford Subject: [PATCH 4.19 107/110] media: ov5640: fix exposure regression Date: Thu, 29 Nov 2018 15:13:18 +0100 Message-Id: <20181129135925.596288829@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129135921.231283053@linuxfoundation.org> References: <20181129135921.231283053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hugues Fruchet commit dc29a1c187eedc1d498cb567c44bbbc832b009cb upstream. Symptom was black image when capturing HD or 5Mp picture due to manual exposure set to 1 while it was intended to set autoexposure to "manual", fix this. Fixes: bf4a4b518c20 ("media: ov5640: Don't force the auto exposure state at start time"). Signed-off-by: Hugues Fruchet Reviewed-by: Laurent Pinchart Tested-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Adam Ford Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov5640.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -960,6 +960,12 @@ static int ov5640_load_regs(struct ov564 return ov5640_set_timings(sensor, mode); } +static int ov5640_set_autoexposure(struct ov5640_dev *sensor, bool on) +{ + return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, + BIT(0), on ? 0 : BIT(0)); +} + /* read exposure, in number of line periods */ static int ov5640_get_exposure(struct ov5640_dev *sensor) { @@ -1604,7 +1610,7 @@ static int ov5640_set_mode_exposure_calc */ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, const struct ov5640_mode_info *mode, - s32 exposure) + bool auto_exp) { int ret; @@ -1621,7 +1627,8 @@ static int ov5640_set_mode_direct(struct if (ret) return ret; - return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); + return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, auto_exp ? + V4L2_EXPOSURE_AUTO : V4L2_EXPOSURE_MANUAL); } static int ov5640_set_mode(struct ov5640_dev *sensor) @@ -1629,7 +1636,7 @@ static int ov5640_set_mode(struct ov5640 const struct ov5640_mode_info *mode = sensor->current_mode; const struct ov5640_mode_info *orig_mode = sensor->last_mode; enum ov5640_downsize_mode dn_mode, orig_dn_mode; - s32 exposure; + bool auto_exp = sensor->ctrls.auto_exp->val == V4L2_EXPOSURE_AUTO; int ret; dn_mode = mode->dn_mode; @@ -1640,8 +1647,7 @@ static int ov5640_set_mode(struct ov5640 if (ret) return ret; - exposure = sensor->ctrls.auto_exp->val; - ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL); + ret = ov5640_set_autoexposure(sensor, false); if (ret) return ret; @@ -1657,7 +1663,7 @@ static int ov5640_set_mode(struct ov5640 * change inside subsampling or scaling * download firmware directly */ - ret = ov5640_set_mode_direct(sensor, mode, exposure); + ret = ov5640_set_mode_direct(sensor, mode, auto_exp); } if (ret < 0)