Smiapp quirk call order and best scaling ratio fixes
cover Smiapp quirk call order and best scaling ratio fixes
Hi,
The most important patch is the third one: wrong scaling ratio was selected in many (or most?) cases due to the wrong signedness of the variable. The other two have less effect on the functionality.
Signature · 2 lines
Kind regards, Sakari
PATCH 1/3 smiapp: Print the index of the format descriptor
This makes constructing quirks easier.
--- drivers/media/i2c/smiapp/smiapp-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +2 -2
@@ -741,8 +741,8 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)if (rval)return rval; -dev_dbg (&client->dev,"bpp %d, compressed %d\n" , - fmt >>8 , (u8 )fmt); +dev_dbg (&client->dev,"%u: bpp %u, compressed %u\n" , + i, fmt >>8 , (u8 )fmt);for (j =0 ; j <ARRAY_SIZE (smiapp_csi_data_formats); j++) { const struct smiapp_csi_data_format *f =
Signature · 1 line
1.8.3.2
PATCH 2/3 smiapp: Call limits quirk immediately after retrieving the limits
In reply to Sakari AilusSome of the limits are used before the limits quirk is called. Move the call immediately after obtaining the limits.
--- drivers/media/i2c/smiapp/smiapp-core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +6 -6
@@ -2423,6 +2423,12 @@ static int smiapp_registered(struct v4l2_subdev *subdev) sensor->hvflip_inv_mask =SMIAPP_IMAGE_ORIENTATION_HFLIP |SMIAPP_IMAGE_ORIENTATION_VFLIP ; + rval =smiapp_call_quirk (sensor, limits); +if (rval) { +dev_err (&client->dev,"limits quirks failed\n" ); + goto out_power_off; + } + rval =smiapp_get_mbus_formats (sensor);if (rval) { rval = -ENODEV ;
@@ -2483,12 +2489,6 @@ static int smiapp_registered(struct v4l2_subdev *subdev) } } - rval =smiapp_call_quirk (sensor, limits); -if (rval) { -dev_err (&client->dev,"limits quirks failed\n" ); - goto out_nvm_release; - } -/* We consider this as profile 0 sensor if any of these are zero. */ if (!sensor->limits[SMIAPP_LIMIT_MIN_OP_SYS_CLK_DIV] || !sensor->limits[SMIAPP_LIMIT_MAX_OP_SYS_CLK_DIV] ||
Signature · 1 line
1.8.3.2
PATCH 3/3 smiapp: Scaling goodness is signed
In reply to Sakari AilusThe "best" value was unsigned however, leading to signed-to-unsigned comparison and wrong results. Possibly only on a newer GCC. Fix this by making the best value signed as well.
--- drivers/media/i2c/smiapp/smiapp-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/smiapp/smiapp-core.c +1 -1
@@ -1766,7 +1766,7 @@ static void smiapp_set_compose_binner(struct v4l2_subdev *subdev,struct smiapp_sensor *sensor =to_smiapp_sensor (subdev);unsigned int i;unsigned int binh =1 , binv =1 ; -unsigned int best =scaling_goodness ( +int best =scaling_goodness ( subdev, crops[SMIAPP_PAD_SINK ]->width, sel->r.width, crops[SMIAPP_PAD_SINK ]->height, sel->r.height, sel->flags);
Signature · 1 line
1.8.3.2
Hi Sakari,
Thank you for the patches.
Quoted 5 lines · On Wednesday 23 April 2014 22:33:56 Sakari Ailus wrote:
Hi,
The most important patch is the third one: wrong scaling ratio was selected in many (or most?) cases due to the wrong signedness of the variable. The other two have less effect on the functionality.
Signature · 3 lines
Regards, Laurent Pinchart