All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 17/17] smiapp: Decrease link frequency if media bus pixel format BPP requires
Date: Fri, 26 Sep 2014 13:44:03 +0300	[thread overview]
Message-ID: <24769200.DuP3evaK0j@avalon> (raw)
In-Reply-To: <1410986741-6801-18-git-send-email-sakari.ailus@iki.fi>

Hi Sakari,

Thank you for the patch.

On Wednesday 17 September 2014 23:45:41 Sakari Ailus wrote:
> Decrease the link frequency to the next lower if the user chooses a media
> bus code (BPP) cannot be achieved using the selected link frequency.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c |   20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c
> b/drivers/media/i2c/smiapp/smiapp-core.c index 537ca92..ce2c34d 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -286,11 +286,27 @@ static int smiapp_pll_update(struct smiapp_sensor
> *sensor)
> 
>  	pll->binning_horizontal = sensor->binning_horizontal;
>  	pll->binning_vertical = sensor->binning_vertical;
> -	pll->link_freq =
> -		sensor->link_freq->qmenu_int[sensor->link_freq->val];
>  	pll->scale_m = sensor->scale_m;
>  	pll->bits_per_pixel = sensor->csi_format->compressed;
> 
> +	if (!test_bit(sensor->link_freq->val,
> +		      &sensor->valid_link_freqs[
> +			      sensor->csi_format->compressed
> +			      - SMIAPP_COMPRESSED_BASE])) {
> +		/*
> +		 * Setting the link frequency will perform PLL
> +		 * re-calculation already, so skip that.
> +		 */
> +		return __v4l2_ctrl_s_ctrl(
> +			sensor->link_freq,
> +			__ffs(sensor->valid_link_freqs[
> +				      sensor->csi_format->compressed
> +				      - SMIAPP_COMPRESSED_BASE]));

I have an uneasy feeling about this, as smiapp_pll_update is called from the 
link freq s_ctrl handler. Have you double-checked the recursion bounds ?

> +	}
> +
> +	pll->link_freq =
> +		sensor->link_freq->qmenu_int[sensor->link_freq->val];
> +
>  	rval = smiapp_pll_try(sensor, pll);
>  	if (rval < 0)
>  		return rval;

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-09-26 10:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 20:45 [PATCH 00/17] smiapp and smiapp-pll: more robust parameter handling, cleanups Sakari Ailus
2014-09-17 20:45 ` [PATCH 01/17] smiapp-pll: Correct clock debug prints Sakari Ailus
2014-09-17 20:45 ` [PATCH 02/17] smiapp-pll: The clock tree values are unsigned --- fix " Sakari Ailus
2014-09-17 20:45 ` [PATCH 03/17] smiapp-pll: Separate bounds checking into a separate function Sakari Ailus
2014-09-17 20:45 ` [PATCH 04/17] smiapp-pll: External clock frequency isn't an output value Sakari Ailus
2014-09-17 20:45 ` [PATCH 05/17] smiapp-pll: Unify OP and VT PLL structs Sakari Ailus
2014-09-17 20:45 ` [PATCH 06/17] smiapp-pll: Don't validate OP clocks if there are none Sakari Ailus
2014-09-17 20:45 ` [PATCH 07/17] smiapp-pll: Calculate OP clocks only for sensors that have them Sakari Ailus
2014-09-17 20:45 ` [PATCH 08/17] smiapp: The PLL calculator handles sensors with VT clocks only Sakari Ailus
2014-09-17 20:45 ` [PATCH 09/17] smiapp: Remove validation of op_pix_clk_div Sakari Ailus
2014-09-17 20:45 ` [PATCH 10/17] smiapp-pll: Add pixel rate in pixel array as output parameters Sakari Ailus
2014-09-17 20:45 ` [PATCH 11/17] smiapp: Use actual pixel rate calculated by the PLL calculator Sakari Ailus
2014-09-17 20:45 ` [PATCH 12/17] smiapp: Take mutex during PLL update in sensor initialisation Sakari Ailus
2014-09-17 20:45 ` [PATCH 13/17] smiapp: Split calculating PLL with sensor's limits from updating it Sakari Ailus
2014-09-17 20:45 ` [PATCH 14/17] smiapp: Gather information on valid link rate and BPP combinations Sakari Ailus
2014-09-17 20:45 ` [PATCH 15/17] smiapp: Take valid link frequencies into account in supported mbus codes Sakari Ailus
2014-09-17 20:45 ` [PATCH 16/17] smiapp: Update PLL when setting format Sakari Ailus
2014-09-17 20:45 ` [PATCH 17/17] smiapp: Decrease link frequency if media bus pixel format BPP requires Sakari Ailus
2014-09-26 10:44   ` Laurent Pinchart [this message]
2014-09-26 11:01     ` 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=24769200.DuP3evaK0j@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.