History

[media] v4l2-ctrls: add new RDS TX controls

The si4713 supports several RDS features not yet implemented in the driver. This patch adds the missing RDS functionality to the list of RDS controls. The ALT_FREQS control is a compound control containing an array of up to 25 (the maximum according to the RDS standard) frequencies. To support that the V4L2_CTRL_TYPE_U32 was added.

Hans Verkuil committed 12 years ago

Commit 811c5081 parent 1612f204 files · +48 −0Browse files

Unified · Split

4 files
  1. drivers/media/v4l2-core/v4l2-ctrls.c +35 −0
  2. include/media/v4l2-ctrls.h +2 −0
  3. include/uapi/linux/v4l2-controls.h +9 −0
  4. include/uapi/linux/videodev2.h +2 −0
drivers/media/v4l2-core/v4l2-ctrls.c+35−0
@@ -805,6 +805,15 @@ const char *v4l2_ctrl_get_name(u32 id) · 804 unmodified lines
805805 case V4L2_CID_RDS_TX_PTY: return "RDS Program Type";
806806 case V4L2_CID_RDS_TX_PS_NAME: return "RDS PS Name";
807807 case V4L2_CID_RDS_TX_RADIO_TEXT: return "RDS Radio Text";
808+ case V4L2_CID_RDS_TX_MONO_STEREO: return "RDS Stereo";
809+ case V4L2_CID_RDS_TX_ARTIFICIAL_HEAD: return "RDS Artificial Head";
810+ case V4L2_CID_RDS_TX_COMPRESSED: return "RDS Compressed";
811+ case V4L2_CID_RDS_TX_DYNAMIC_PTY: return "RDS Dynamic PTY";
812+ case V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT: return "RDS Traffic Announcement";
813+ case V4L2_CID_RDS_TX_TRAFFIC_PROGRAM: return "RDS Traffic Program";
814+ case V4L2_CID_RDS_TX_MUSIC_SPEECH: return "RDS Music";
815+ case V4L2_CID_RDS_TX_ALT_FREQS_ENABLE: return "RDS Enable Alt Frequencies";
816+ case V4L2_CID_RDS_TX_ALT_FREQS: return "RDS Alternate Frequencies";
808817 case V4L2_CID_AUDIO_LIMITER_ENABLED: return "Audio Limiter Feature Enabled";
809818 case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time";
810819 case V4L2_CID_AUDIO_LIMITER_DEVIATION: return "Audio Limiter Deviation";
@@ -946,6 +955,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, · 135 unmodified lines
946955 case V4L2_CID_RF_TUNER_IF_GAIN_AUTO:
947956 case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO:
948957 case V4L2_CID_RF_TUNER_PLL_LOCK:
958+ case V4L2_CID_RDS_TX_MONO_STEREO:
959+ case V4L2_CID_RDS_TX_ARTIFICIAL_HEAD:
960+ case V4L2_CID_RDS_TX_COMPRESSED:
961+ case V4L2_CID_RDS_TX_DYNAMIC_PTY:
962+ case V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT:
963+ case V4L2_CID_RDS_TX_TRAFFIC_PROGRAM:
964+ case V4L2_CID_RDS_TX_MUSIC_SPEECH:
965+ case V4L2_CID_RDS_TX_ALT_FREQS_ENABLE:
949966 *type = V4L2_CTRL_TYPE_BOOLEAN;
950967 *min = 0;
951968 *max = *step = 1;
@@ -1089,6 +1106,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, · 137 unmodified lines
10891106 case V4L2_CID_DETECT_MD_THRESHOLD_GRID:
10901107 *type = V4L2_CTRL_TYPE_U16;
10911108 break;
1109+ case V4L2_CID_RDS_TX_ALT_FREQS:
1110+ *type = V4L2_CTRL_TYPE_U32;
1111+ break;
10921112 default:
10931113 *type = V4L2_CTRL_TYPE_INTEGER;
10941114 break;
@@ -1209,6 +1229,8 @@ static bool std_equal(const struct v4l2_ctrl *ctrl, u32 idx, · 114 unmodified lines
12091229 return ptr1.p_u8[idx] == ptr2.p_u8[idx];
12101230 case V4L2_CTRL_TYPE_U16:
12111231 return ptr1.p_u16[idx] == ptr2.p_u16[idx];
1232+ case V4L2_CTRL_TYPE_U32:
1233+ return ptr1.p_u32[idx] == ptr2.p_u32[idx];
12121234 default:
12131235 if (ctrl->is_int)
12141236 return ptr1.p_s32[idx] == ptr2.p_s32[idx];
@@ -1242,6 +1264,9 @@ static void std_init(const struct v4l2_ctrl *ctrl, u32 idx, · 27 unmodified lines
12421264 case V4L2_CTRL_TYPE_U16:
12431265 ptr.p_u16[idx] = ctrl->default_value;
12441266 break;
1267+ case V4L2_CTRL_TYPE_U32:
1268+ ptr.p_u32[idx] = ctrl->default_value;
1269+ break;
12451270 default:
12461271 idx *= ctrl->elem_size;
12471272 memset(ptr.p + idx, 0, ctrl->elem_size);
@@ -1289,6 +1314,9 @@ static void std_log(const struct v4l2_ctrl *ctrl) · 41 unmodified lines
12891314 case V4L2_CTRL_TYPE_U16:
12901315 pr_cont("%u", (unsigned)*ptr.p_u16);
12911316 break;
1317+ case V4L2_CTRL_TYPE_U32:
1318+ pr_cont("%u", (unsigned)*ptr.p_u32);
1319+ break;
12921320 default:
12931321 pr_cont("unknown type %d", ctrl->type);
12941322 break;
@@ -1346,6 +1374,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, · 51 unmodified lines
13461374 return ROUND_TO_RANGE(ptr.p_u8[idx], u8, ctrl);
13471375 case V4L2_CTRL_TYPE_U16:
13481376 return ROUND_TO_RANGE(ptr.p_u16[idx], u16, ctrl);
1377+ case V4L2_CTRL_TYPE_U32:
1378+ return ROUND_TO_RANGE(ptr.p_u32[idx], u32, ctrl);
13491379
13501380 case V4L2_CTRL_TYPE_BOOLEAN:
13511381 ptr.p_s32[idx] = !!ptr.p_s32[idx];
@@ -1578,6 +1608,7 @@ static int check_range(enum v4l2_ctrl_type type, · 226 unmodified lines
15781608 /* fall through */
15791609 case V4L2_CTRL_TYPE_U8:
15801610 case V4L2_CTRL_TYPE_U16:
1611+ case V4L2_CTRL_TYPE_U32:
15811612 case V4L2_CTRL_TYPE_INTEGER:
15821613 case V4L2_CTRL_TYPE_INTEGER64:
15831614 if (step == 0 || min > max || def < min || def > max)
@@ -1893,6 +1924,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, · 309 unmodified lines
18931924 case V4L2_CTRL_TYPE_U16:
18941925 elem_size = sizeof(u16);
18951926 break;
1927+ case V4L2_CTRL_TYPE_U32:
1928+ elem_size = sizeof(u32);
1929+ break;
18961930 default:
18971931 if (type < V4L2_CTRL_COMPOUND_TYPES)
18981932 elem_size = sizeof(s32);
@@ -3248,6 +3282,7 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, · 1349 unmodified lines
32483282 case V4L2_CTRL_TYPE_BITMASK:
32493283 case V4L2_CTRL_TYPE_U8:
32503284 case V4L2_CTRL_TYPE_U16:
3285+ case V4L2_CTRL_TYPE_U32:
32513286 if (ctrl->is_array)
32523287 return -EINVAL;
32533288 ret = check_range(ctrl->type, min, max, step, def);
include/media/v4l2-ctrls.h+2−0
@@ -41,6 +41,7 @@ struct poll_table_struct; · 40 unmodified lines
4141 * @p_s64: Pointer to a 64-bit signed value.
4242 * @p_u8: Pointer to a 8-bit unsigned value.
4343 * @p_u16: Pointer to a 16-bit unsigned value.
44+ * @p_u32: Pointer to a 32-bit unsigned value.
4445 * @p_char: Pointer to a string.
4546 * @p: Pointer to a compound value.
4647 */
@@ -49,6 +50,7 @@ union v4l2_ctrl_ptr { · 2 unmodified lines
4950 s64 *p_s64;
5051 u8 *p_u8;
5152 u16 *p_u16;
53+ u32 *p_u32;
5254 char *p_char;
5355 void *p;
5456 };
include/uapi/linux/v4l2-controls.h+9−0
@@ -757,6 +757,15 @@ enum v4l2_auto_focus_range { · 756 unmodified lines
757757 #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
758758 #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
759759 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
760+#define V4L2_CID_RDS_TX_MONO_STEREO (V4L2_CID_FM_TX_CLASS_BASE + 7)
761+#define V4L2_CID_RDS_TX_ARTIFICIAL_HEAD (V4L2_CID_FM_TX_CLASS_BASE + 8)
762+#define V4L2_CID_RDS_TX_COMPRESSED (V4L2_CID_FM_TX_CLASS_BASE + 9)
763+#define V4L2_CID_RDS_TX_DYNAMIC_PTY (V4L2_CID_FM_TX_CLASS_BASE + 10)
764+#define V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_TX_CLASS_BASE + 11)
765+#define V4L2_CID_RDS_TX_TRAFFIC_PROGRAM (V4L2_CID_FM_TX_CLASS_BASE + 12)
766+#define V4L2_CID_RDS_TX_MUSIC_SPEECH (V4L2_CID_FM_TX_CLASS_BASE + 13)
767+#define V4L2_CID_RDS_TX_ALT_FREQS_ENABLE (V4L2_CID_FM_TX_CLASS_BASE + 14)
768+#define V4L2_CID_RDS_TX_ALT_FREQS (V4L2_CID_FM_TX_CLASS_BASE + 15)
760769
761770 #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
762771 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
include/uapi/linux/videodev2.h+2−0
@@ -1288,6 +1288,7 @@ struct v4l2_ext_control { · 1287 unmodified lines
12881288 char *string;
12891289 __u8 *p_u8;
12901290 __u16 *p_u16;
1291+ __u32 *p_u32;
12911292 void *ptr;
12921293 };
12931294 } __attribute__ ((packed));
@@ -1320,6 +1321,7 @@ enum v4l2_ctrl_type { · 26 unmodified lines
13201321 V4L2_CTRL_COMPOUND_TYPES = 0x0100,
13211322 V4L2_CTRL_TYPE_U8 = 0x0100,
13221323 V4L2_CTRL_TYPE_U16 = 0x0101,
1324+ V4L2_CTRL_TYPE_U32 = 0x0102,
13231325 };
13241326
13251327 /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t