mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
[media] ov13858: Use do_div() for dividing a 64-bit number
ov13858 contained a 64-bit division. Use do_div() for calculating it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
58020c9f14
commit
880d45f8fc
1 changed files with 10 additions and 4 deletions
|
@ -951,7 +951,13 @@ static const char * const ov13858_test_pattern_menu[] = {
|
||||||
* pixel_rate = link_freq * data-rate * nr_of_lanes / bits_per_sample
|
* pixel_rate = link_freq * data-rate * nr_of_lanes / bits_per_sample
|
||||||
* data rate => double data rate; number of lanes => 4; bits per pixel => 10
|
* data rate => double data rate; number of lanes => 4; bits per pixel => 10
|
||||||
*/
|
*/
|
||||||
#define LINK_FREQ_TO_PIXEL_RATE(f) (((f) * 2 * 4) / 10)
|
static u64 link_freq_to_pixel_rate(u64 f)
|
||||||
|
{
|
||||||
|
f *= 2 * 4;
|
||||||
|
do_div(f, 10);
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
/* Menu items for LINK_FREQ V4L2 control */
|
/* Menu items for LINK_FREQ V4L2 control */
|
||||||
static const s64 link_freq_menu_items[OV13858_NUM_OF_LINK_FREQS] = {
|
static const s64 link_freq_menu_items[OV13858_NUM_OF_LINK_FREQS] = {
|
||||||
|
@ -1404,7 +1410,7 @@ ov13858_set_pad_format(struct v4l2_subdev *sd,
|
||||||
ov13858->cur_mode = mode;
|
ov13858->cur_mode = mode;
|
||||||
__v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index);
|
__v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index);
|
||||||
link_freq = link_freq_menu_items[mode->link_freq_index];
|
link_freq = link_freq_menu_items[mode->link_freq_index];
|
||||||
pixel_rate = LINK_FREQ_TO_PIXEL_RATE(link_freq);
|
pixel_rate = link_freq_to_pixel_rate(link_freq);
|
||||||
__v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate);
|
__v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate);
|
||||||
|
|
||||||
/* Update limits and set FPS to default */
|
/* Update limits and set FPS to default */
|
||||||
|
@ -1642,8 +1648,8 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
|
||||||
link_freq_menu_items);
|
link_freq_menu_items);
|
||||||
ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
|
ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
|
||||||
|
|
||||||
pixel_rate_max = LINK_FREQ_TO_PIXEL_RATE(link_freq_menu_items[0]);
|
pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]);
|
||||||
pixel_rate_min = LINK_FREQ_TO_PIXEL_RATE(link_freq_menu_items[1]);
|
pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[1]);
|
||||||
/* By default, PIXEL_RATE is read only */
|
/* By default, PIXEL_RATE is read only */
|
||||||
ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops,
|
ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops,
|
||||||
V4L2_CID_PIXEL_RATE,
|
V4L2_CID_PIXEL_RATE,
|
||||||
|
|
Loading…
Reference in a new issue