From patchwork Sun Mar 11 15:34:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10274813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF5CA602BD for ; Sun, 11 Mar 2018 15:35:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD70628E38 for ; Sun, 11 Mar 2018 15:35:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE15A28E3B; Sun, 11 Mar 2018 15:35:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28A2F28E38 for ; Sun, 11 Mar 2018 15:35:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932170AbeCKPe7 (ORCPT ); Sun, 11 Mar 2018 11:34:59 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:43319 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932107AbeCKPe7 (ORCPT ); Sun, 11 Mar 2018 11:34:59 -0400 Received: by mail-pf0-f196.google.com with SMTP id j2so3290719pff.10 for ; Sun, 11 Mar 2018 08:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7nnoLdhtk+454Sui5N4zU6WmYcsqjR4G88alP3gBEUw=; b=KoBr5VsFHqZNBGLCT3fXKaqbf/XGnuQ38zj7NINhJNa6C4zxDcALT4WqCAIX7A9LRT zGkV5zBUH2N92rvzsuCAdWvK0ZonBp4pWVe802H8+kEZGv7PizWyT3t2hm6TQmQ7U9Ws H7+Iiuh3SxHBky2vsZlXiu/jKt3bc8iNU9o5X/MsFYDjJwsfnDow9NszA+WirHf77Ehp HOs+D2gY1M0VjoGmRoqNygrcTwxYoPHlolPRSHaoaIRE2JNABl2mHzSIao4+N8X4u1fR SYD7osKuEOeYOWIabUaotH8sc6tOHRlqFsmrmjLgsdtYYfJr01RgXmiEpUai9kWuDEO7 gQ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7nnoLdhtk+454Sui5N4zU6WmYcsqjR4G88alP3gBEUw=; b=q1H0vD56XqD7/poeXghimYdrLdOQk8UkXFNgkG+/1W/5pQXvuGkOUiNryoGUvLHdTi +cZ0ht/fs8A21zc/dcoToNmzmY7M+HT7Ih6m+agNQt/fazLSYqanxH6SZFddMtdr3LUB vGbqHMjsO7lJazGQSdQiwTzPZEp4MxEgAsRunvxHAhrWDxR5WapnxtAsJwknnAmh80o2 9ptoqUWFdPTuxK1IVNoAb49Qm188QLi7CUOyYyARTqrs5ozQvsOX/93pdmFCeHri0BGG 4agjzce3d4CVLoBd8QDZ6EtU0TiOOE+KHhVRTck6f/FOs8HwIIlX6UOZ7MqBPINh/qC9 Ertg== X-Gm-Message-State: AElRT7G/lKeFvk4T8VwIXXLo32VmePdCZxHVLqyE86aTSH79Yeo8xMmu ui4+W3TO04J2CGGPjTvtIl2Nug== X-Google-Smtp-Source: AG47ELvqRa83Gk3xHYsa6zPAZ3SpN0XJd1w0/FyZ0rmjOjH8CA5jRJ1Mr7IuO9fRL/fh10IaWhaHhQ== X-Received: by 10.99.119.137 with SMTP id s131mr4051500pgc.296.1520782498561; Sun, 11 Mar 2018 08:34:58 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:8c0b:47f8:3dee:db2c]) by smtp.gmail.com with ESMTPSA id m12sm9639841pgr.35.2018.03.11.08.34.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Mar 2018 08:34:57 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Steve Longerbeam , Hugues Fruchet , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH] media: ov5640: add missing output pixel format setting Date: Mon, 12 Mar 2018 00:34:41 +0900 Message-Id: <1520782481-13558-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The output pixel format changed by set_fmt() pad operation is not correctly applied. It is intended to be restored by calling ov5640_set_framefmt() when the video stream is started. However, when the device is powered on by s_power subdev operation before the video stream is started, the current output mode setting is restored by ov5640_restore_mode() that also clears pending_mode_change flag in ov5640_set_mode(). So ov5640_set_framefmt() isn't called as intended and the output pixel format is not restored. This change adds the missing output pixel format setting in the ov5640_restore_mode() that is called when the device is powered on. Cc: Steve Longerbeam Cc: Hugues Fruchet Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/ov5640.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index e2dd352..4eecc91 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1633,6 +1633,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, return 0; } +static int ov5640_set_framefmt(struct ov5640_dev *sensor, + struct v4l2_mbus_framefmt *format); + /* restore the last set video mode after chip power-on */ static int ov5640_restore_mode(struct ov5640_dev *sensor) { @@ -1644,7 +1647,11 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) return ret; /* now restore the last capture mode */ - return ov5640_set_mode(sensor, &ov5640_mode_init_data); + ret = ov5640_set_mode(sensor, &ov5640_mode_init_data); + if (ret < 0) + return ret; + + return ov5640_set_framefmt(sensor, &sensor->fmt); } static void ov5640_power(struct ov5640_dev *sensor, bool enable)