From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it
Date: Mon, 13 Feb 2017 18:16:24 +0200 [thread overview]
Message-ID: <1487002586-1480-3-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1487002586-1480-1-git-send-email-sakari.ailus@linux.intel.com>
The external clock frequency was set by the driver but the obtained
frequency was never verified. Do that.
Being able to obtain the exact frequency is important as the value is used
for PLL calculations which may result in frequencies that violate the PLL
tree limits.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/smiapp/smiapp-core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 0ea0303..64ee215 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2861,6 +2861,7 @@ static int smiapp_probe(struct i2c_client *client,
{
struct smiapp_sensor *sensor;
struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev);
+ unsigned long rate;
unsigned int i;
int rval;
@@ -2899,6 +2900,14 @@ static int smiapp_probe(struct i2c_client *client,
return rval;
}
+ rate = clk_get_rate(sensor->ext_clk);
+ if (rate != sensor->hwcfg->ext_clk) {
+ dev_err(&client->dev,
+ "can't set clock freq, asked for %u but got %lu\n",
+ sensor->hwcfg->ext_clk, rate);
+ return rval;
+ }
+
sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
GPIOD_OUT_LOW);
if (IS_ERR(sensor->xshutdown))
--
2.1.4
next prev parent reply other threads:[~2017-02-13 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 16:16 [PATCH 0/4] smiapp cleanups, clock control changes Sakari Ailus
2017-02-13 16:16 ` [PATCH 1/4] smiapp: Remove smiapp.h header under include Sakari Ailus
2017-02-13 16:16 ` Sakari Ailus [this message]
2017-02-13 16:16 ` [PATCH 3/4] smiapp: Get clock rate if it's not available through DT Sakari Ailus
2017-02-13 18:27 ` kbuild test robot
2017-02-14 7:37 ` [PATCH v1.1 " Sakari Ailus
2017-02-15 23:05 ` [PATCH " kbuild test robot
2017-02-13 16:16 ` [PATCH 4/4] smiapp: Make clock control optional Sakari Ailus
-- strict thread matches above, loose matches on Subject: below --
2017-08-29 12:41 [PATCH 0/4] Better support for ACPI in smiapp Sakari Ailus
2017-08-29 12:41 ` [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487002586-1480-3-git-send-email-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox