From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-cys01nam02on0131.outbound.protection.outlook.com ([104.47.37.131]:1824 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727776AbeIGFOx (ORCPT ); Fri, 7 Sep 2018 01:14:53 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Todor Tomov , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH AUTOSEL 4.18 32/88] media: ov5645: Supported external clock is 24MHz Date: Fri, 7 Sep 2018 00:36:15 +0000 Message-ID: <20180907003547.57567-32-alexander.levin@microsoft.com> References: <20180907003547.57567-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003547.57567-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Todor Tomov [ Upstream commit 4adb0a0432f489c5eb802b33dae7737f69e6fd7a ] 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 Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov5645.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index b3f762578f7f..1722cdab0daf 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[] =3D= { }; =20 static const s64 link_freq[] =3D { - 222880000, - 334320000 + 224000000, + 336000000 }; =20 static const struct ov5645_mode_info ov5645_mode_info_data[] =3D { @@ -520,7 +520,7 @@ static const struct ov5645_mode_info ov5645_mode_info_d= ata[] =3D { .height =3D 960, .data =3D ov5645_setting_sxga, .data_size =3D ARRAY_SIZE(ov5645_setting_sxga), - .pixel_clock =3D 111440000, + .pixel_clock =3D 112000000, .link_freq =3D 0 /* an index in link_freq[] */ }, { @@ -528,7 +528,7 @@ static const struct ov5645_mode_info ov5645_mode_info_d= ata[] =3D { .height =3D 1080, .data =3D ov5645_setting_1080p, .data_size =3D ARRAY_SIZE(ov5645_setting_1080p), - .pixel_clock =3D 167160000, + .pixel_clock =3D 168000000, .link_freq =3D 1 /* an index in link_freq[] */ }, { @@ -536,7 +536,7 @@ static const struct ov5645_mode_info ov5645_mode_info_d= ata[] =3D { .height =3D 1944, .data =3D ov5645_setting_full, .data_size =3D ARRAY_SIZE(ov5645_setting_full), - .pixel_clock =3D 167160000, + .pixel_clock =3D 168000000, .link_freq =3D 1 /* an index in link_freq[] */ }, }; @@ -1145,7 +1145,8 @@ static int ov5645_probe(struct i2c_client *client, return ret; } =20 - if (xclk_freq !=3D 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; --=20 2.17.1