Commit 0ba2aeb6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] v4l2-ctrls: increase internal min/max/step/def to 64 bit

While VIDIOC_QUERYCTRL is limited to 32 bit min/max/step/def values
for controls, the upcoming VIDIOC_QUERY_EXT_CTRL isn't. So increase
the internal representation to 64 bits in preparation.

Because of these changes the msi3101 driver has been modified slightly
to fix a formatting issue (%d becomes %lld), vivi had to be modified
as well to cope with the new 64-bit min/max values and the PIXEL_RATE
control in a few sensor drivers required proper min/max/def values.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 7d6bc608
...@@ -931,7 +931,7 @@ static int mt9v032_probe(struct i2c_client *client, ...@@ -931,7 +931,7 @@ static int mt9v032_probe(struct i2c_client *client,
mt9v032->pixel_rate = mt9v032->pixel_rate =
v4l2_ctrl_new_std(&mt9v032->ctrls, &mt9v032_ctrl_ops, v4l2_ctrl_new_std(&mt9v032->ctrls, &mt9v032_ctrl_ops,
V4L2_CID_PIXEL_RATE, 0, 0, 1, 0); V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1);
if (pdata && pdata->link_freqs) { if (pdata && pdata->link_freqs) {
unsigned int def = 0; unsigned int def = 0;
......
...@@ -533,7 +533,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) ...@@ -533,7 +533,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor)
sensor->pixel_rate_parray = v4l2_ctrl_new_std( sensor->pixel_rate_parray = v4l2_ctrl_new_std(
&sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops,
V4L2_CID_PIXEL_RATE, 0, 0, 1, 0); V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1);
if (sensor->pixel_array->ctrl_handler.error) { if (sensor->pixel_array->ctrl_handler.error) {
dev_err(&client->dev, dev_err(&client->dev,
...@@ -562,7 +562,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) ...@@ -562,7 +562,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor)
sensor->pixel_rate_csi = v4l2_ctrl_new_std( sensor->pixel_rate_csi = v4l2_ctrl_new_std(
&sensor->src->ctrl_handler, &smiapp_ctrl_ops, &sensor->src->ctrl_handler, &smiapp_ctrl_ops,
V4L2_CID_PIXEL_RATE, 0, 0, 1, 0); V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1);
if (sensor->src->ctrl_handler.error) { if (sensor->src->ctrl_handler.error) {
dev_err(&client->dev, dev_err(&client->dev,
......
...@@ -1236,7 +1236,7 @@ static const struct v4l2_ctrl_config vivi_ctrl_int32 = { ...@@ -1236,7 +1236,7 @@ static const struct v4l2_ctrl_config vivi_ctrl_int32 = {
.id = VIVI_CID_CUSTOM_BASE + 2, .id = VIVI_CID_CUSTOM_BASE + 2,
.name = "Integer 32 Bits", .name = "Integer 32 Bits",
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
.min = 0x80000000, .min = -0x80000000LL,
.max = 0x7fffffff, .max = 0x7fffffff,
.step = 1, .step = 1,
}; };
...@@ -1246,6 +1246,9 @@ static const struct v4l2_ctrl_config vivi_ctrl_int64 = { ...@@ -1246,6 +1246,9 @@ static const struct v4l2_ctrl_config vivi_ctrl_int64 = {
.id = VIVI_CID_CUSTOM_BASE + 3, .id = VIVI_CID_CUSTOM_BASE + 3,
.name = "Integer 64 Bits", .name = "Integer 64 Bits",
.type = V4L2_CTRL_TYPE_INTEGER64, .type = V4L2_CTRL_TYPE_INTEGER64,
.min = LLONG_MIN,
.max = LLONG_MAX,
.step = 1,
}; };
static const char * const vivi_ctrl_menu_strings[] = { static const char * const vivi_ctrl_menu_strings[] = {
......
...@@ -111,9 +111,13 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, ...@@ -111,9 +111,13 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
EXPORT_SYMBOL(v4l2_ctrl_check); EXPORT_SYMBOL(v4l2_ctrl_check);
/* Fill in a struct v4l2_queryctrl */ /* Fill in a struct v4l2_queryctrl */
int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _step, s32 _def)
{ {
const char *name; const char *name;
s64 min = _min;
s64 max = _max;
u64 step = _step;
s64 def = _def;
v4l2_ctrl_fill(qctrl->id, &name, &qctrl->type, v4l2_ctrl_fill(qctrl->id, &name, &qctrl->type,
&min, &max, &step, &def, &qctrl->flags); &min, &max, &step, &def, &qctrl->flags);
......
...@@ -877,7 +877,7 @@ const char *v4l2_ctrl_get_name(u32 id) ...@@ -877,7 +877,7 @@ const char *v4l2_ctrl_get_name(u32 id)
EXPORT_SYMBOL(v4l2_ctrl_get_name); EXPORT_SYMBOL(v4l2_ctrl_get_name);
void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags) s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags)
{ {
*name = v4l2_ctrl_get_name(id); *name = v4l2_ctrl_get_name(id);
*flags = 0; *flags = 0;
...@@ -1041,14 +1041,23 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, ...@@ -1041,14 +1041,23 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
*type = V4L2_CTRL_TYPE_INTEGER; *type = V4L2_CTRL_TYPE_INTEGER;
*flags |= V4L2_CTRL_FLAG_READ_ONLY; *flags |= V4L2_CTRL_FLAG_READ_ONLY;
break; break;
case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
case V4L2_CID_MPEG_VIDEO_DEC_PTS: case V4L2_CID_MPEG_VIDEO_DEC_PTS:
*flags |= V4L2_CTRL_FLAG_VOLATILE; *type = V4L2_CTRL_TYPE_INTEGER64;
/* Fall through */ *flags |= V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY;
*min = *def = 0;
*max = 0x1ffffffffLL;
*step = 1;
break;
case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
*type = V4L2_CTRL_TYPE_INTEGER64;
*flags |= V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY;
*min = *def = 0;
*max = 0x7fffffffffffffffLL;
*step = 1;
break;
case V4L2_CID_PIXEL_RATE: case V4L2_CID_PIXEL_RATE:
*type = V4L2_CTRL_TYPE_INTEGER64; *type = V4L2_CTRL_TYPE_INTEGER64;
*flags |= V4L2_CTRL_FLAG_READ_ONLY; *flags |= V4L2_CTRL_FLAG_READ_ONLY;
*min = *max = *step = *def = 0;
break; break;
default: default:
*type = V4L2_CTRL_TYPE_INTEGER; *type = V4L2_CTRL_TYPE_INTEGER;
...@@ -1352,7 +1361,7 @@ static int cluster_changed(struct v4l2_ctrl *master) ...@@ -1352,7 +1361,7 @@ static int cluster_changed(struct v4l2_ctrl *master)
/* Control range checking */ /* Control range checking */
static int check_range(enum v4l2_ctrl_type type, static int check_range(enum v4l2_ctrl_type type,
s32 min, s32 max, u32 step, s32 def) s64 min, s64 max, u64 step, s64 def)
{ {
switch (type) { switch (type) {
case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_BOOLEAN:
...@@ -1360,7 +1369,8 @@ static int check_range(enum v4l2_ctrl_type type, ...@@ -1360,7 +1369,8 @@ static int check_range(enum v4l2_ctrl_type type,
return -ERANGE; return -ERANGE;
/* fall through */ /* fall through */
case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER:
if (step <= 0 || min > max || def < min || def > max) case V4L2_CTRL_TYPE_INTEGER64:
if (step == 0 || min > max || def < min || def > max)
return -ERANGE; return -ERANGE;
return 0; return 0;
case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_BITMASK:
...@@ -1385,23 +1395,30 @@ static int check_range(enum v4l2_ctrl_type type, ...@@ -1385,23 +1395,30 @@ static int check_range(enum v4l2_ctrl_type type,
} }
} }
/* Round towards the closest legal value */
#define ROUND_TO_RANGE(val, offset_type, ctrl) \
({ \
offset_type offset; \
val += (ctrl)->step / 2; \
val = clamp_t(typeof(val), val, \
(ctrl)->minimum, (ctrl)->maximum); \
offset = (val) - (ctrl)->minimum; \
offset = (ctrl)->step * (offset / (ctrl)->step); \
val = (ctrl)->minimum + offset; \
0; \
})
/* Validate a new control */ /* Validate a new control */
static int validate_new(const struct v4l2_ctrl *ctrl, static int validate_new(const struct v4l2_ctrl *ctrl,
struct v4l2_ext_control *c) struct v4l2_ext_control *c)
{ {
size_t len; size_t len;
u32 offset;
s32 val;
switch (ctrl->type) { switch (ctrl->type) {
case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER:
/* Round towards the closest legal value */ return ROUND_TO_RANGE(*(s32 *)&c->value, u32, ctrl);
val = c->value + ctrl->step / 2; case V4L2_CTRL_TYPE_INTEGER64:
val = clamp(val, ctrl->minimum, ctrl->maximum); return ROUND_TO_RANGE(*(s64 *)&c->value64, u64, ctrl);
offset = val - ctrl->minimum;
offset = ctrl->step * (offset / ctrl->step);
c->value = ctrl->minimum + offset;
return 0;
case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_BOOLEAN:
c->value = !!c->value; c->value = !!c->value;
...@@ -1427,9 +1444,6 @@ static int validate_new(const struct v4l2_ctrl *ctrl, ...@@ -1427,9 +1444,6 @@ static int validate_new(const struct v4l2_ctrl *ctrl,
c->value = 0; c->value = 0;
return 0; return 0;
case V4L2_CTRL_TYPE_INTEGER64:
return 0;
case V4L2_CTRL_TYPE_STRING: case V4L2_CTRL_TYPE_STRING:
len = strlen(c->string); len = strlen(c->string);
if (len < ctrl->minimum) if (len < ctrl->minimum)
...@@ -1653,7 +1667,7 @@ static int handler_new_ref(struct v4l2_ctrl_handler *hdl, ...@@ -1653,7 +1667,7 @@ static int handler_new_ref(struct v4l2_ctrl_handler *hdl,
static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, const char *name, enum v4l2_ctrl_type type, u32 id, const char *name, enum v4l2_ctrl_type type,
s32 min, s32 max, u32 step, s32 def, s64 min, s64 max, u64 step, s64 def,
u32 flags, const char * const *qmenu, u32 flags, const char * const *qmenu,
const s64 *qmenu_int, void *priv) const s64 *qmenu_int, void *priv)
{ {
...@@ -1738,10 +1752,10 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, ...@@ -1738,10 +1752,10 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
const s64 *qmenu_int = cfg->qmenu_int; const s64 *qmenu_int = cfg->qmenu_int;
enum v4l2_ctrl_type type = cfg->type; enum v4l2_ctrl_type type = cfg->type;
u32 flags = cfg->flags; u32 flags = cfg->flags;
s32 min = cfg->min; s64 min = cfg->min;
s32 max = cfg->max; s64 max = cfg->max;
u32 step = cfg->step; u64 step = cfg->step;
s32 def = cfg->def; s64 def = cfg->def;
if (name == NULL) if (name == NULL)
v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step, v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step,
...@@ -1774,7 +1788,7 @@ EXPORT_SYMBOL(v4l2_ctrl_new_custom); ...@@ -1774,7 +1788,7 @@ EXPORT_SYMBOL(v4l2_ctrl_new_custom);
/* Helper function for standard non-menu controls */ /* Helper function for standard non-menu controls */
struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 min, s32 max, u32 step, s32 def) u32 id, s64 min, s64 max, u64 step, s64 def)
{ {
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
...@@ -1794,15 +1808,17 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std); ...@@ -1794,15 +1808,17 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std);
/* Helper function for standard menu controls */ /* Helper function for standard menu controls */
struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 mask, s32 def) u32 id, u8 _max, u64 mask, u8 _def)
{ {
const char * const *qmenu = NULL; const char * const *qmenu = NULL;
const s64 *qmenu_int = NULL; const s64 *qmenu_int = NULL;
unsigned int qmenu_int_len = 0; unsigned int qmenu_int_len = 0;
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
s32 min; s64 min;
s32 step; s64 max = _max;
s64 def = _def;
u64 step;
u32 flags; u32 flags;
v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags);
...@@ -1823,14 +1839,16 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); ...@@ -1823,14 +1839,16 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
/* Helper function for standard menu controls with driver defined menu */ /* Helper function for standard menu controls with driver defined menu */
struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, u32 id, s32 max, const struct v4l2_ctrl_ops *ops, u32 id, u8 _max,
s32 mask, s32 def, const char * const *qmenu) u64 mask, u8 _def, const char * const *qmenu)
{ {
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
const char *name; const char *name;
u32 flags; u32 flags;
s32 step; u64 step;
s32 min; s64 min;
s64 max = _max;
s64 def = _def;
/* v4l2_ctrl_new_std_menu_items() should only be called for /* v4l2_ctrl_new_std_menu_items() should only be called for
* standard controls without a standard menu. * standard controls without a standard menu.
...@@ -1854,12 +1872,14 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items); ...@@ -1854,12 +1872,14 @@ EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items);
/* Helper function for standard integer menu controls */ /* Helper function for standard integer menu controls */
struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 def, const s64 *qmenu_int) u32 id, u8 _max, u8 _def, const s64 *qmenu_int)
{ {
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
s32 min; s64 min;
s32 step; u64 step;
s64 max = _max;
s64 def = _def;
u32 flags; u32 flags;
v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags);
...@@ -2887,13 +2907,14 @@ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void ...@@ -2887,13 +2907,14 @@ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void
EXPORT_SYMBOL(v4l2_ctrl_notify); EXPORT_SYMBOL(v4l2_ctrl_notify);
int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
s32 min, s32 max, u32 step, s32 def) s64 min, s64 max, u64 step, s64 def)
{ {
int ret = check_range(ctrl->type, min, max, step, def); int ret = check_range(ctrl->type, min, max, step, def);
struct v4l2_ext_control c; struct v4l2_ext_control c;
switch (ctrl->type) { switch (ctrl->type) {
case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER:
case V4L2_CTRL_TYPE_INTEGER64:
case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_BOOLEAN:
case V4L2_CTRL_TYPE_MENU: case V4L2_CTRL_TYPE_MENU:
case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_INTEGER_MENU:
......
...@@ -381,7 +381,7 @@ static int msi001_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -381,7 +381,7 @@ static int msi001_s_ctrl(struct v4l2_ctrl *ctrl)
int ret; int ret;
dev_dbg(&s->spi->dev, dev_dbg(&s->spi->dev,
"%s: id=%d name=%s val=%d min=%d max=%d step=%d\n", "%s: id=%d name=%s val=%d min=%lld max=%lld step=%lld\n",
__func__, ctrl->id, ctrl->name, ctrl->val, __func__, ctrl->id, ctrl->name, ctrl->val,
ctrl->minimum, ctrl->maximum, ctrl->step); ctrl->minimum, ctrl->maximum, ctrl->step);
......
...@@ -1337,7 +1337,7 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1337,7 +1337,7 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
int ret; int ret;
dev_dbg(&s->udev->dev, dev_dbg(&s->udev->dev,
"%s: id=%d name=%s val=%d min=%d max=%d step=%d\n", "%s: id=%d name=%s val=%d min=%lld max=%lld step=%lld\n",
__func__, ctrl->id, ctrl->name, ctrl->val, __func__, ctrl->id, ctrl->name, ctrl->val,
ctrl->minimum, ctrl->maximum, ctrl->step); ctrl->minimum, ctrl->maximum, ctrl->step);
...@@ -1350,8 +1350,8 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1350,8 +1350,8 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
s32 val = s->f_adc + s->bandwidth->step / 2; s32 val = s->f_adc + s->bandwidth->step / 2;
u32 offset; u32 offset;
val = clamp(val, s->bandwidth->minimum, val = clamp_t(s32, val, s->bandwidth->minimum,
s->bandwidth->maximum); s->bandwidth->maximum);
offset = val - s->bandwidth->minimum; offset = val - s->bandwidth->minimum;
offset = s->bandwidth->step * offset = s->bandwidth->step *
(offset / s->bandwidth->step); (offset / s->bandwidth->step);
......
...@@ -131,10 +131,10 @@ struct v4l2_ctrl { ...@@ -131,10 +131,10 @@ struct v4l2_ctrl {
u32 id; u32 id;
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
s32 minimum, maximum, default_value; s64 minimum, maximum, default_value;
union { union {
u32 step; u64 step;
u32 menu_skip_mask; u64 menu_skip_mask;
}; };
union { union {
const char * const *qmenu; const char * const *qmenu;
...@@ -216,9 +216,9 @@ struct v4l2_ctrl_handler { ...@@ -216,9 +216,9 @@ struct v4l2_ctrl_handler {
* @menu_skip_mask: The control's skip mask for menu controls. This makes it * @menu_skip_mask: The control's skip mask for menu controls. This makes it
* easy to skip menu items that are not valid. If bit X is set, * easy to skip menu items that are not valid. If bit X is set,
* then menu item X is skipped. Of course, this only works for * then menu item X is skipped. Of course, this only works for
* menus with <= 32 menu items. There are no menus that come * menus with <= 64 menu items. There are no menus that come
* close to that number, so this is OK. Should we ever need more, * close to that number, so this is OK. Should we ever need more,
* then this will have to be extended to a u64 or a bit array. * then this will have to be extended to a bit array.
* @qmenu: A const char * array for all menu items. Array entries that are * @qmenu: A const char * array for all menu items. Array entries that are
* empty strings ("") correspond to non-existing menu items (this * empty strings ("") correspond to non-existing menu items (this
* is in addition to the menu_skip_mask above). The last entry * is in addition to the menu_skip_mask above). The last entry
...@@ -231,12 +231,12 @@ struct v4l2_ctrl_config { ...@@ -231,12 +231,12 @@ struct v4l2_ctrl_config {
u32 id; u32 id;
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
s32 min; s64 min;
s32 max; s64 max;
u32 step; u64 step;
s32 def; s64 def;
u32 flags; u32 flags;
u32 menu_skip_mask; u64 menu_skip_mask;
const char * const *qmenu; const char * const *qmenu;
const s64 *qmenu_int; const s64 *qmenu_int;
unsigned int is_private:1; unsigned int is_private:1;
...@@ -257,7 +257,7 @@ struct v4l2_ctrl_config { ...@@ -257,7 +257,7 @@ struct v4l2_ctrl_config {
* control framework this function will no longer be exported. * control framework this function will no longer be exported.
*/ */
void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
/** v4l2_ctrl_handler_init_class() - Initialize the control handler. /** v4l2_ctrl_handler_init_class() - Initialize the control handler.
...@@ -362,7 +362,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, ...@@ -362,7 +362,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
*/ */
struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 min, s32 max, u32 step, s32 def); u32 id, s64 min, s64 max, u64 step, s64 def);
/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control. /** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
* @hdl: The control handler. * @hdl: The control handler.
...@@ -372,9 +372,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, ...@@ -372,9 +372,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
* @mask: The control's skip mask for menu controls. This makes it * @mask: The control's skip mask for menu controls. This makes it
* easy to skip menu items that are not valid. If bit X is set, * easy to skip menu items that are not valid. If bit X is set,
* then menu item X is skipped. Of course, this only works for * then menu item X is skipped. Of course, this only works for
* menus with <= 32 menu items. There are no menus that come * menus with <= 64 menu items. There are no menus that come
* close to that number, so this is OK. Should we ever need more, * close to that number, so this is OK. Should we ever need more,
* then this will have to be extended to a u64 or a bit array. * then this will have to be extended to a bit array.
* @def: The control's default value. * @def: The control's default value.
* *
* Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
...@@ -384,7 +384,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, ...@@ -384,7 +384,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
*/ */
struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 mask, s32 def); u32 id, u8 max, u64 mask, u8 def);
/** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control /** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
* with driver specific menu. * with driver specific menu.
...@@ -395,9 +395,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, ...@@ -395,9 +395,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
* @mask: The control's skip mask for menu controls. This makes it * @mask: The control's skip mask for menu controls. This makes it
* easy to skip menu items that are not valid. If bit X is set, * easy to skip menu items that are not valid. If bit X is set,
* then menu item X is skipped. Of course, this only works for * then menu item X is skipped. Of course, this only works for
* menus with <= 32 menu items. There are no menus that come * menus with <= 64 menu items. There are no menus that come
* close to that number, so this is OK. Should we ever need more, * close to that number, so this is OK. Should we ever need more,
* then this will have to be extended to a u64 or a bit array. * then this will have to be extended to a bit array.
* @def: The control's default value. * @def: The control's default value.
* @qmenu: The new menu. * @qmenu: The new menu.
* *
...@@ -406,8 +406,8 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, ...@@ -406,8 +406,8 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
* *
*/ */
struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, u32 id, s32 max, const struct v4l2_ctrl_ops *ops, u32 id, u8 max,
s32 mask, s32 def, const char * const *qmenu); u64 mask, u8 def, const char * const *qmenu);
/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control. /** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
* @hdl: The control handler. * @hdl: The control handler.
...@@ -424,7 +424,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, ...@@ -424,7 +424,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
*/ */
struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 def, const s64 *qmenu_int); u32 id, u8 max, u8 def, const s64 *qmenu_int);
/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. /** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
* @hdl: The control handler. * @hdl: The control handler.
...@@ -560,7 +560,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); ...@@ -560,7 +560,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
* take the lock itself. * take the lock itself.
*/ */
int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
s32 min, s32 max, u32 step, s32 def); s64 min, s64 max, u64 step, s64 def);
/** v4l2_ctrl_lock() - Helper function to lock the handler /** v4l2_ctrl_lock() - Helper function to lock the handler
* associated with the control. * associated with the control.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment