* [PATCH 0/4] smiapp cleanups, clock control changes
@ 2017-02-13 16:16 Sakari Ailus
2017-02-13 16:16 ` [PATCH 1/4] smiapp: Remove smiapp.h header under include Sakari Ailus
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-13 16:16 UTC (permalink / raw)
To: linux-media
Hi folks,
With this set, the smiapp driver can support clocks not coming from the
clock framework (e.g. ACPI). The smiapp.h header under include/media/i2c/
is also removed as it is no longer needed.
--
Kind regards,
Sakari
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] smiapp: Remove smiapp.h header under include
2017-02-13 16:16 [PATCH 0/4] smiapp cleanups, clock control changes Sakari Ailus
@ 2017-02-13 16:16 ` Sakari Ailus
2017-02-13 16:16 ` [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it Sakari Ailus
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-13 16:16 UTC (permalink / raw)
To: linux-media
As platform data isn't supported anymore, there's no reason to maintain a
separate header under include/. Merge its contents to the one under
drivers/media/i2c/smiapp.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
MAINTAINERS | 1 -
drivers/media/i2c/smiapp/smiapp.h | 49 +++++++++++++++++++++++-
include/media/i2c/smiapp.h | 78 ---------------------------------------
3 files changed, 48 insertions(+), 80 deletions(-)
delete mode 100644 include/media/i2c/smiapp.h
diff --git a/MAINTAINERS b/MAINTAINERS
index cfff2c9..869196d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11416,7 +11416,6 @@ M: Sakari Ailus <sakari.ailus@iki.fi>
L: linux-media@vger.kernel.org
S: Maintained
F: drivers/media/i2c/smiapp/
-F: include/media/i2c/smiapp.h
F: drivers/media/i2c/smiapp-pll.c
F: drivers/media/i2c/smiapp-pll.h
F: include/uapi/linux/smiapp.h
diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h
index f74d695..5ed37af 100644
--- a/drivers/media/i2c/smiapp/smiapp.h
+++ b/drivers/media/i2c/smiapp/smiapp.h
@@ -22,13 +22,21 @@
#include <linux/mutex.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
-#include <media/i2c/smiapp.h>
#include "smiapp-pll.h"
#include "smiapp-reg.h"
#include "smiapp-regs.h"
#include "smiapp-quirk.h"
+#define SMIAPP_NAME "smiapp"
+
+#define SMIAPP_DFL_I2C_ADDR (0x20 >> 1) /* Default I2C Address */
+#define SMIAPP_ALT_I2C_ADDR (0x6e >> 1) /* Alternate I2C Address */
+
+#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK 0
+#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1
+#define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2
+
/*
* Standard SMIA++ constants
*/
@@ -54,6 +62,45 @@
struct smiapp_quirk;
+/*
+ * Sometimes due to board layout considerations the camera module can be
+ * mounted rotated. The typical rotation used is 180 degrees which can be
+ * corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
+ * FIXME: rotation also changes the bayer pattern.
+ */
+enum smiapp_module_board_orient {
+ SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
+ SMIAPP_MODULE_BOARD_ORIENT_180,
+};
+
+struct smiapp_flash_strobe_parms {
+ u8 mode;
+ u32 strobe_width_high_us;
+ u16 strobe_delay;
+ u16 stobe_start_point;
+ u8 trigger;
+};
+
+struct smiapp_hwconfig {
+ /*
+ * Change the cci address if i2c_addr_alt is set.
+ * Both default and alternate cci addr need to be present
+ */
+ unsigned short i2c_addr_dfl; /* Default i2c addr */
+ unsigned short i2c_addr_alt; /* Alternate i2c addr */
+
+ uint32_t nvm_size; /* bytes */
+ uint32_t ext_clk; /* sensor external clk */
+
+ unsigned int lanes; /* Number of CSI-2 lanes */
+ uint32_t csi_signalling_mode; /* SMIAPP_CSI_SIGNALLING_MODE_* */
+ uint64_t *op_sys_clock;
+
+ enum smiapp_module_board_orient module_board_orient;
+
+ struct smiapp_flash_strobe_parms *strobe_setup;
+};
+
#define SMIAPP_MODULE_IDENT_FLAG_REV_LE (1 << 0)
struct smiapp_module_ident {
diff --git a/include/media/i2c/smiapp.h b/include/media/i2c/smiapp.h
deleted file mode 100644
index 635007e..0000000
--- a/include/media/i2c/smiapp.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * include/media/i2c/smiapp.h
- *
- * Generic driver for SMIA/SMIA++ compliant camera modules
- *
- * Copyright (C) 2011--2012 Nokia Corporation
- * Contact: Sakari Ailus <sakari.ailus@iki.fi>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __SMIAPP_H_
-#define __SMIAPP_H_
-
-#include <media/v4l2-subdev.h>
-
-#define SMIAPP_NAME "smiapp"
-
-#define SMIAPP_DFL_I2C_ADDR (0x20 >> 1) /* Default I2C Address */
-#define SMIAPP_ALT_I2C_ADDR (0x6e >> 1) /* Alternate I2C Address */
-
-#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK 0
-#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1
-#define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2
-
-/*
- * Sometimes due to board layout considerations the camera module can be
- * mounted rotated. The typical rotation used is 180 degrees which can be
- * corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
- * FIXME: rotation also changes the bayer pattern.
- */
-enum smiapp_module_board_orient {
- SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
- SMIAPP_MODULE_BOARD_ORIENT_180,
-};
-
-struct smiapp_flash_strobe_parms {
- u8 mode;
- u32 strobe_width_high_us;
- u16 strobe_delay;
- u16 stobe_start_point;
- u8 trigger;
-};
-
-struct smiapp_hwconfig {
- /*
- * Change the cci address if i2c_addr_alt is set.
- * Both default and alternate cci addr need to be present
- */
- unsigned short i2c_addr_dfl; /* Default i2c addr */
- unsigned short i2c_addr_alt; /* Alternate i2c addr */
-
- uint32_t nvm_size; /* bytes */
- uint32_t ext_clk; /* sensor external clk */
-
- unsigned int lanes; /* Number of CSI-2 lanes */
- uint32_t csi_signalling_mode; /* SMIAPP_CSI_SIGNALLING_MODE_* */
- uint64_t *op_sys_clock;
-
- enum smiapp_module_board_orient module_board_orient;
-
- struct smiapp_flash_strobe_parms *strobe_setup;
-};
-
-#endif /* __SMIAPP_H_ */
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it
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
2017-02-13 16:16 ` [PATCH 3/4] smiapp: Get clock rate if it's not available through DT Sakari Ailus
2017-02-13 16:16 ` [PATCH 4/4] smiapp: Make clock control optional Sakari Ailus
3 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-13 16:16 UTC (permalink / raw)
To: linux-media
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] smiapp: Get clock rate if it's not available through DT
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 ` [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it Sakari Ailus
@ 2017-02-13 16:16 ` Sakari Ailus
2017-02-13 18:27 ` kbuild test robot
` (2 more replies)
2017-02-13 16:16 ` [PATCH 4/4] smiapp: Make clock control optional Sakari Ailus
3 siblings, 3 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-13 16:16 UTC (permalink / raw)
To: linux-media
Obtain the clock rate from the clock framework if it's not available
through DT. The assumption is that the parent device (camera module)
defines the rate as clock control is a part of the power on and power off
sequences --- which are camera module specific.
Also use the clock rate from DT if no clock is provided.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/smiapp/smiapp-core.c | 50 ++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 18 deletions(-)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 64ee215..caf376c 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2822,10 +2822,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
rval = of_property_read_u32(dev->of_node, "clock-frequency",
&hwcfg->ext_clk);
- if (rval) {
- dev_warn(dev, "can't get clock-frequency\n");
- goto out_err;
- }
+ if (rval)
+ dev_info(dev, "can't get clock-frequency\n");
dev_dbg(dev, "nvm %d, clk %d, csi %d\n", hwcfg->nvm_size,
hwcfg->ext_clk, hwcfg->csi_signalling_mode);
@@ -2861,7 +2859,6 @@ 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;
@@ -2892,20 +2889,37 @@ static int smiapp_probe(struct i2c_client *client,
return -EPROBE_DEFER;
}
- rval = clk_set_rate(sensor->ext_clk, sensor->hwcfg->ext_clk);
- if (rval < 0) {
- dev_err(&client->dev,
- "unable to set clock freq to %u\n",
- sensor->hwcfg->ext_clk);
- return rval;
- }
+ if (sensor->ext_clk) {
+ if (sensor->hwcfg->ext_clk) {
+ unsigned long rate;
- 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;
+ rval = clk_set_rate(sensor->ext_clk,
+ sensor->hwcfg->ext_clk);
+ if (rval < 0) {
+ dev_err(&client->dev,
+ "unable to set clock freq to %u\n",
+ sensor->hwcfg->ext_clk);
+ 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 %lu but got %lu\n",
+ sensor->hwcfg->ext_clk, rate);
+ return rval;
+ }
+ } else {
+ sensor->hwcfg->ext_clk = clk_get_rate(sensor->ext_clk);
+ dev_dbg(&client->dev, "obtained clock freq %u\n",
+ sensor->hwcfg->ext_clk);
+ }
+ } else if (sensor->hwcfg->ext_clk) {
+ dev_dbg(&client->dev, "assuming clock freq %u\n",
+ sensor->hwcfg->ext_clk);
+ } else {
+ dev_err(&client->dev, "unable to obtain clock freq\n");
+ return -EINVAL;
}
sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] smiapp: Make clock control optional
2017-02-13 16:16 [PATCH 0/4] smiapp cleanups, clock control changes Sakari Ailus
` (2 preceding siblings ...)
2017-02-13 16:16 ` [PATCH 3/4] smiapp: Get clock rate if it's not available through DT Sakari Ailus
@ 2017-02-13 16:16 ` Sakari Ailus
3 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-13 16:16 UTC (permalink / raw)
To: linux-media
The clock control is not explicitly controlled by the driver in two cases:
ACPI based systems and when the clock is part of the power sequence of the
camera module.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/smiapp/smiapp-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index caf376c..9ed1b86 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2883,7 +2883,10 @@ static int smiapp_probe(struct i2c_client *client,
}
sensor->ext_clk = devm_clk_get(&client->dev, NULL);
- if (IS_ERR(sensor->ext_clk)) {
+ if (PTR_ERR(sensor->ext_clk) == -ENOENT) {
+ dev_info(&client->dev, "no clock defined, continuing...\n");
+ sensor->ext_clk = NULL;
+ } else if (IS_ERR(sensor->ext_clk)) {
dev_err(&client->dev, "could not get clock (%ld)\n",
PTR_ERR(sensor->ext_clk));
return -EPROBE_DEFER;
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] smiapp: Get clock rate if it's not available through DT
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
2 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2017-02-13 18:27 UTC (permalink / raw)
To: Sakari Ailus; +Cc: kbuild-all, linux-media
[-- Attachment #1: Type: text/plain, Size: 2015 bytes --]
Hi Sakari,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.10-rc8]
[cannot apply to linuxtv-media/master next-20170213]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sakari-Ailus/smiapp-cleanups-clock-control-changes/20170214-010429
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/media/i2c/smiapp/smiapp-core.c: In function 'smiapp_probe':
>> drivers/media/i2c/smiapp/smiapp-core.c:2908:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t {aka unsigned int}' [-Wformat=]
"can't set clock freq, asked for %lu but got %lu\n",
^
vim +2908 drivers/media/i2c/smiapp/smiapp-core.c
2892 if (sensor->ext_clk) {
2893 if (sensor->hwcfg->ext_clk) {
2894 unsigned long rate;
2895
2896 rval = clk_set_rate(sensor->ext_clk,
2897 sensor->hwcfg->ext_clk);
2898 if (rval < 0) {
2899 dev_err(&client->dev,
2900 "unable to set clock freq to %u\n",
2901 sensor->hwcfg->ext_clk);
2902 return rval;
2903 }
2904
2905 rate = clk_get_rate(sensor->ext_clk);
2906 if (rate != sensor->hwcfg->ext_clk) {
2907 dev_err(&client->dev,
> 2908 "can't set clock freq, asked for %lu but got %lu\n",
2909 sensor->hwcfg->ext_clk, rate);
2910 return rval;
2911 }
2912 } else {
2913 sensor->hwcfg->ext_clk = clk_get_rate(sensor->ext_clk);
2914 dev_dbg(&client->dev, "obtained clock freq %u\n",
2915 sensor->hwcfg->ext_clk);
2916 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 57940 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1.1 3/4] smiapp: Get clock rate if it's not available through DT
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 ` Sakari Ailus
2017-02-15 23:05 ` [PATCH " kbuild test robot
2 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-02-14 7:37 UTC (permalink / raw)
To: linux-media
Obtain the clock rate from the clock framework if it's not available
through DT. The assumption is that the parent device (camera module)
defines the rate as clock control is a part of the power on and power off
sequences --- which are camera module specific.
Also use the clock rate from DT if no clock is provided.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/smiapp/smiapp-core.c | 50 ++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 18 deletions(-)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 3ae9404..f9b370a 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2822,10 +2822,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
rval = of_property_read_u32(dev->of_node, "clock-frequency",
&hwcfg->ext_clk);
- if (rval) {
- dev_warn(dev, "can't get clock-frequency\n");
- goto out_err;
- }
+ if (rval)
+ dev_info(dev, "can't get clock-frequency\n");
dev_dbg(dev, "nvm %d, clk %d, csi %d\n", hwcfg->nvm_size,
hwcfg->ext_clk, hwcfg->csi_signalling_mode);
@@ -2861,7 +2859,6 @@ 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;
@@ -2892,20 +2889,37 @@ static int smiapp_probe(struct i2c_client *client,
return -EPROBE_DEFER;
}
- rval = clk_set_rate(sensor->ext_clk, sensor->hwcfg->ext_clk);
- if (rval < 0) {
- dev_err(&client->dev,
- "unable to set clock freq to %u\n",
- sensor->hwcfg->ext_clk);
- return rval;
- }
+ if (sensor->ext_clk) {
+ if (sensor->hwcfg->ext_clk) {
+ unsigned long rate;
- 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;
+ rval = clk_set_rate(sensor->ext_clk,
+ sensor->hwcfg->ext_clk);
+ if (rval < 0) {
+ dev_err(&client->dev,
+ "unable to set clock freq to %u\n",
+ sensor->hwcfg->ext_clk);
+ 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;
+ }
+ } else {
+ sensor->hwcfg->ext_clk = clk_get_rate(sensor->ext_clk);
+ dev_dbg(&client->dev, "obtained clock freq %u\n",
+ sensor->hwcfg->ext_clk);
+ }
+ } else if (sensor->hwcfg->ext_clk) {
+ dev_dbg(&client->dev, "assuming clock freq %u\n",
+ sensor->hwcfg->ext_clk);
+ } else {
+ dev_err(&client->dev, "unable to obtain clock freq\n");
+ return -EINVAL;
}
sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] smiapp: Get clock rate if it's not available through DT
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 ` kbuild test robot
2 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2017-02-15 23:05 UTC (permalink / raw)
To: Sakari Ailus; +Cc: kbuild-all, linux-media
[-- Attachment #1: Type: text/plain, Size: 3066 bytes --]
Hi Sakari,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.10-rc8]
[cannot apply to linuxtv-media/master next-20170215]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sakari-Ailus/smiapp-cleanups-clock-control-changes/20170214-010429
config: x86_64-randconfig-it0-02160426 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/media/i2c/smiapp/smiapp-core.c: In function 'smiapp_probe':
>> drivers/media/i2c/smiapp/smiapp-core.c:2909:6: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t' [-Wformat=]
sensor->hwcfg->ext_clk, rate);
^
vim +2909 drivers/media/i2c/smiapp/smiapp-core.c
88ea1579 Sakari Ailus 2017-02-13 2893 if (sensor->hwcfg->ext_clk) {
88ea1579 Sakari Ailus 2017-02-13 2894 unsigned long rate;
88ea1579 Sakari Ailus 2017-02-13 2895
88ea1579 Sakari Ailus 2017-02-13 2896 rval = clk_set_rate(sensor->ext_clk,
88ea1579 Sakari Ailus 2017-02-13 2897 sensor->hwcfg->ext_clk);
3ecb8664 Sakari Ailus 2016-09-12 2898 if (rval < 0) {
3ecb8664 Sakari Ailus 2016-09-12 2899 dev_err(&client->dev,
3ecb8664 Sakari Ailus 2016-09-12 2900 "unable to set clock freq to %u\n",
3ecb8664 Sakari Ailus 2016-09-12 2901 sensor->hwcfg->ext_clk);
3ecb8664 Sakari Ailus 2016-09-12 2902 return rval;
3ecb8664 Sakari Ailus 2016-09-12 2903 }
3ecb8664 Sakari Ailus 2016-09-12 2904
87cb6c6a Sakari Ailus 2017-02-13 2905 rate = clk_get_rate(sensor->ext_clk);
87cb6c6a Sakari Ailus 2017-02-13 2906 if (rate != sensor->hwcfg->ext_clk) {
87cb6c6a Sakari Ailus 2017-02-13 2907 dev_err(&client->dev,
88ea1579 Sakari Ailus 2017-02-13 2908 "can't set clock freq, asked for %lu but got %lu\n",
87cb6c6a Sakari Ailus 2017-02-13 @2909 sensor->hwcfg->ext_clk, rate);
87cb6c6a Sakari Ailus 2017-02-13 2910 return rval;
87cb6c6a Sakari Ailus 2017-02-13 2911 }
88ea1579 Sakari Ailus 2017-02-13 2912 } else {
88ea1579 Sakari Ailus 2017-02-13 2913 sensor->hwcfg->ext_clk = clk_get_rate(sensor->ext_clk);
88ea1579 Sakari Ailus 2017-02-13 2914 dev_dbg(&client->dev, "obtained clock freq %u\n",
88ea1579 Sakari Ailus 2017-02-13 2915 sensor->hwcfg->ext_clk);
88ea1579 Sakari Ailus 2017-02-13 2916 }
88ea1579 Sakari Ailus 2017-02-13 2917 } else if (sensor->hwcfg->ext_clk) {
:::::: The code at line 2909 was first introduced by commit
:::::: 87cb6c6a8fdcfc1d0327e6c826165f0ba1b5eff0 smiapp: Verify clock frequency after setting it, prevent changing it
:::::: TO: Sakari Ailus <sakari.ailus@linux.intel.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31202 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] smiapp: Make clock control optional
2017-08-29 12:41 [PATCH 0/4] Better support for ACPI in smiapp Sakari Ailus
@ 2017-08-29 12:41 ` Sakari Ailus
0 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2017-08-29 12:41 UTC (permalink / raw)
To: linux-media
The clock control is not explicitly controlled by the driver in two cases:
ACPI based systems and when the clock is part of the power sequence of the
camera module.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/smiapp/smiapp-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 009b5e26204b..fbd851be51d2 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2892,7 +2892,10 @@ static int smiapp_probe(struct i2c_client *client,
}
sensor->ext_clk = devm_clk_get(&client->dev, NULL);
- if (IS_ERR(sensor->ext_clk)) {
+ if (PTR_ERR(sensor->ext_clk) == -ENOENT) {
+ dev_info(&client->dev, "no clock defined, continuing...\n");
+ sensor->ext_clk = NULL;
+ } else if (IS_ERR(sensor->ext_clk)) {
dev_err(&client->dev, "could not get clock (%ld)\n",
PTR_ERR(sensor->ext_clk));
return -EPROBE_DEFER;
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-08-29 12:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/4] smiapp: Verify clock frequency after setting it, prevent changing it Sakari Ailus
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 4/4] smiapp: Make clock control optional Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox