From patchwork Mon Jun 18 08:06:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todor Tomov X-Patchwork-Id: 138863 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3659451lji; Mon, 18 Jun 2018 01:07:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIXeF1CzLKV+hoiXlSkNUURd7fN38QhK6A3fm3yK4QIdAI/Nit8C7w5luty1hQj8jDhbJF1 X-Received: by 2002:a63:9a52:: with SMTP id e18-v6mr10097534pgo.188.1529309251789; Mon, 18 Jun 2018 01:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529309251; cv=none; d=google.com; s=arc-20160816; b=n+80qpFLPo+60Y3e4cRU+ElHH586TS/M6jnHpSMN4jtHgPh6nVzyRT80LMUJqR1zV9 mIG0ksOnZnJ9QSxvQ11NlFGU3FwvgbsviKzQrfGwlwSMGn0vC2HK3pszEoT4bXKAr95G OcTjXg5568amGMYESfN3804h6qR4RIyRqZjmmH8Pp2sFV66GZei2YcNOML8XxqSgKf8J 827a+bhLGVqh3op63zhxBcekHzAVJpMiXbIL0VuL2RZ3eyG9lXouwN6E/TCn8CsQf8vT Kz9dgyJM0m0nEqtrTtES8S8FQlnqMLd0vSHBjk/BR5dnt66+k+U3u7W5Yg/tYtzUHlJ5 5TJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+51JGoVeHI1nZaMjgeslbBLnVajTs9f56T5d0HY/M+A=; b=QKGf1v8wmJuhbpLuEAxHdKnpevYSHG+OihtBizE8H7LgvUc3oxij+2buNw/46voRTT ZFgtPF7LUku89QqgOGfzAo+QvSVP8QZvgy9PQSkI0WrXh7oK4LqgSllVvK6crawsodrd +PJO/aXyO5aqA26Gx4WeszaM7szEb9AyFcm4k25AmDom+p0L7FqS1hWmLKH2MQQSBUop 7eNnI99eh8Np8Hfux7sRLkR4MdrvmuQoLdPtF90A4M94h0c8tdKC7VQax3hti853YWtc RjpIZOIkPcEbgLkpSZig2+BUVxqm7MCj9PR2Q1OlNSN4UTq0xc5Y/w1W0/PB37r6QfMg N0/A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133-v6si15540423pfc.21.2018.06.18.01.07.31; Mon, 18 Jun 2018 01:07:31 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933417AbeFRIHS (ORCPT + 30 others); Mon, 18 Jun 2018 04:07:18 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:60037 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932763AbeFRIHQ (ORCPT ); Mon, 18 Jun 2018 04:07:16 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id 1BD4DCD2F; Mon, 18 Jun 2018 11:07:15 +0300 (EEST) From: Todor Tomov To: mchehab@kernel.org, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Todor Tomov Subject: [PATCH 1/2] media: ov5645: Supported external clock is 24MHz Date: Mon, 18 Jun 2018 11:06:58 +0300 Message-Id: <1529309219-27404-1-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The external clock frequency was set to 23.88MHz by mistake because of a platform which cannot get closer to 24MHz. The supported by the driver external clock is 24MHz so set it correctly and also fix the values of the pixel clock and link clock. However allow 1% tolerance to the external clock as this difference is small enough to be insignificant. Signed-off-by: Todor Tomov --- drivers/media/i2c/ov5645.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index b3f7625..1722cda 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -510,8 +510,8 @@ static const struct reg_value ov5645_setting_full[] = { }; static const s64 link_freq[] = { - 222880000, - 334320000 + 224000000, + 336000000 }; static const struct ov5645_mode_info ov5645_mode_info_data[] = { @@ -520,7 +520,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { .height = 960, .data = ov5645_setting_sxga, .data_size = ARRAY_SIZE(ov5645_setting_sxga), - .pixel_clock = 111440000, + .pixel_clock = 112000000, .link_freq = 0 /* an index in link_freq[] */ }, { @@ -528,7 +528,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { .height = 1080, .data = ov5645_setting_1080p, .data_size = ARRAY_SIZE(ov5645_setting_1080p), - .pixel_clock = 167160000, + .pixel_clock = 168000000, .link_freq = 1 /* an index in link_freq[] */ }, { @@ -536,7 +536,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { .height = 1944, .data = ov5645_setting_full, .data_size = ARRAY_SIZE(ov5645_setting_full), - .pixel_clock = 167160000, + .pixel_clock = 168000000, .link_freq = 1 /* an index in link_freq[] */ }, }; @@ -1145,7 +1145,8 @@ static int ov5645_probe(struct i2c_client *client, return ret; } - if (xclk_freq != 23880000) { + /* external clock must be 24MHz, allow 1% tolerance */ + if (xclk_freq < 23760000 || xclk_freq > 24240000) { dev_err(dev, "external clock frequency %u is not supported\n", xclk_freq); return -EINVAL; From patchwork Mon Jun 18 08:06:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todor Tomov X-Patchwork-Id: 138862 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3659309lji; Mon, 18 Jun 2018 01:07:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLcsIo/vBw+yWagssZI9SrJfQq7gwOGtGDWKIEDkikLP1cSJ75ihya3thBobbCdJIPiYztY X-Received: by 2002:a65:630b:: with SMTP id g11-v6mr9984754pgv.303.1529309242550; Mon, 18 Jun 2018 01:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529309242; cv=none; d=google.com; s=arc-20160816; b=KiuJy/E6PYIojg8AETrGD/jwQYeUEO4CNf50EqBBDAeozvmL0zxwIEePKGNixVVwxQ xoOcPJ1cfz+yVwgISkZ6QqFNpKM/Hi433T+LZ/UCpI2cu0dyLk4FRdwy7ye8cVWgqtt+ eGapbwkd6kftQIOVbGBXw3d3gCTq3Fx0FXzbWPTy7CbtrhSeicMxcJgW1GkxULsQU0+w xX9E+fI1ke6RCPP49TJk19mRM4DoVwZ7BFNaFn+m9/1GS/+CF33TWrxqgoYb1JTkfgE0 tCqo3icYVnGOxOjJ3WIaytqDxbVIuckfA4Ziadg2rUyRgYC25WqBCgDg89u93MWafbaq K5xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5VWHRA5cG2ONah/USaTdKZ590Mi1TR0BavMz+GTkZb4=; b=gb/XjiQILPb86RdL8gvkyuUjHtKO4LAjh0rKNgT1tA5PHzVTm0Wgp+FpbUh6uA0iaz m9xtJ5wYQ16m69wn2liFZOzCYszR+Jr31yU14khQ2Qn9e/3qAo7u7lrP4NANmzEAgaGD sow+pUeFoBx1OC/F2YUvjzhO1gHQAuRTC2XVruIHzofRv7GIoyyAc2/2RxmDZhu1UVJ7 5Z8TbZbswUMalmm3iSMNbb0x5LPPRE6CvOZZ1fYhApJFWat12+Kejni9ThRmf8grZhAJ U7nc9mJ/LpRXbP9uBmJCD3c90mkn7kq9GTUfD1o84Ts6NK+xpiWDpzw+Z+Dh3DE7QQgF mjPw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o184-v6si11756067pga.92.2018.06.18.01.07.22; Mon, 18 Jun 2018 01:07:22 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933468AbeFRIHT (ORCPT + 30 others); Mon, 18 Jun 2018 04:07:19 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:60036 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932792AbeFRIHQ (ORCPT ); Mon, 18 Jun 2018 04:07:16 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id 2D42BCD33; Mon, 18 Jun 2018 11:07:15 +0300 (EEST) From: Todor Tomov To: mchehab@kernel.org, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Todor Tomov Subject: [PATCH 2/2] media: ov5645: Report number of skip frames Date: Mon, 18 Jun 2018 11:06:59 +0300 Message-Id: <1529309219-27404-2-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529309219-27404-1-git-send-email-todor.tomov@linaro.org> References: <1529309219-27404-1-git-send-email-todor.tomov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OV5645 supports automatic exposure (AE) and automatic white balance (AWB). When streaming is started it takes up to 5 frames until the AE and AWB converge and output a frame with good quality. Implement g_skip_frames to report number of frames to be skipped when streaming is started. Signed-off-by: Todor Tomov --- drivers/media/i2c/ov5645.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.7.4 diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index 1722cda..00bc3c0 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -70,6 +70,9 @@ #define OV5645_SDE_SAT_U 0x5583 #define OV5645_SDE_SAT_V 0x5584 +/* Number of frames needed for AE and AWB to converge */ +#define OV5645_NUM_OF_SKIP_FRAMES 5 + struct reg_value { u16 reg; u8 val; @@ -1071,6 +1074,13 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) return 0; } +static int ov5645_get_skip_frames(struct v4l2_subdev *sd, u32 *frames) +{ + *frames = OV5645_NUM_OF_SKIP_FRAMES; + + return 0; +} + static const struct v4l2_subdev_core_ops ov5645_core_ops = { .s_power = ov5645_s_power, }; @@ -1088,10 +1098,15 @@ static const struct v4l2_subdev_pad_ops ov5645_subdev_pad_ops = { .get_selection = ov5645_get_selection, }; +static const struct v4l2_subdev_sensor_ops ov5645_sensor_ops = { + .g_skip_frames = ov5645_get_skip_frames, +}; + static const struct v4l2_subdev_ops ov5645_subdev_ops = { .core = &ov5645_core_ops, .video = &ov5645_video_ops, .pad = &ov5645_subdev_pad_ops, + .sensor = &ov5645_sensor_ops, }; static int ov5645_probe(struct i2c_client *client,