[RFC,06/24] smiapp: Add quirk control support

Message ID 1461532104-24032-7-git-send-email-ivo.g.dimitrov.75@gmail.com (mailing list archive)
State RFC, archived
Delegated to: Laurent Pinchart
Headers

Commit Message

Ivaylo Dimitrov April 24, 2016, 9:08 p.m. UTC
  From: Sakari Ailus <sakari.ailus@linux.intel.com>

Quirk controls can be set up in the init quirk.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/smiapp/smiapp-core.c  | 6 ++++++
 drivers/media/i2c/smiapp/smiapp-quirk.h | 3 +++
 2 files changed, 9 insertions(+)
  

Comments

Sakari Ailus May 1, 2016, 10:46 a.m. UTC | #1
On Mon, Apr 25, 2016 at 12:08:06AM +0300, Ivaylo Dimitrov wrote:
> From: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Quirk controls can be set up in the init quirk.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Do you need quirk controls for something at the moment? I guess not at least
with the secondary sensor?
  
Ivaylo Dimitrov May 3, 2016, 6:32 p.m. UTC | #2
Hi,

On  1.05.2016 13:46, Sakari Ailus wrote:
> On Mon, Apr 25, 2016 at 12:08:06AM +0300, Ivaylo Dimitrov wrote:
>> From: Sakari Ailus <sakari.ailus@linux.intel.com>
>>
>> Quirk controls can be set up in the init quirk.
>>
>> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> Do you need quirk controls for something at the moment? I guess not at least
> with the secondary sensor?
>

Yes, vs6555 doesn't seem to need quirks ATM, I guess that patch comes 
from N9/50 adaptation kernel.

Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 3dfe387..c6a897b 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -412,6 +412,12 @@  static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
 	int exposure;
 	int rval;
 
+	rval = smiapp_call_quirk(sensor, s_ctrl, ctrl);
+	if (rval < 0)
+		return rval;
+	if (rval > 0)
+		return 0;
+
 	switch (ctrl->id) {
 	case V4L2_CID_ANALOGUE_GAIN:
 		return smiapp_write(
diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h
index 209818f..504c16a 100644
--- a/drivers/media/i2c/smiapp/smiapp-quirk.h
+++ b/drivers/media/i2c/smiapp/smiapp-quirk.h
@@ -32,6 +32,8 @@  struct smiapp_sensor;
  * @pll_flags: Return flags for the PLL calculator.
  * @init: Quirk initialisation, called the last in probe(). This is
  *	  also appropriate for adding sensor specific controls, for instance.
+ * @s_ctrl: Set control quirk. Returns 0 if the control isn't
+ *	    implemented by the quirk, > 0 if it is.
  * @reg_access: Register access quirk. The quirk may divert the access
  *		to another register, or no register at all.
  *
@@ -51,6 +53,7 @@  struct smiapp_quirk {
 	int (*post_streamoff)(struct smiapp_sensor *sensor);
 	unsigned long (*pll_flags)(struct smiapp_sensor *sensor);
 	int (*init)(struct smiapp_sensor *sensor);
+	int (*s_ctrl)(struct smiapp_sensor *sensor, struct v4l2_ctrl *ctrl);
 	int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg,
 			  u32 *val);
 	unsigned long flags;