FAILED: patch "[PATCH] media: em28xx: fix handler for vidioc_s_input()" failed to apply to 4.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
258c430456ba5f0005043762e14fc3be35983aafMon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <[email protected]>
Date: Fri, 14 Sep 2018 13:13:15 -0400
Subject: [PATCH] media: em28xx: fix handler for vidioc_s_input()
The a->index is not the name of the internal amux entry, but, instead a value from zero to the maximum number of audio inputs.
As the actual available inputs depend on each board, build it dynamically.
This is broken for a really long time. On a quick check, since at least commit 195a4ef627e1 ("V4L/DVB (6585): Convert em28xx to video_ioctl2") this was not implemented right.
drivers/media/usb/em28xx/em28xx-cards.c +29 -0
@@ -3039,6 +3039,9 @@ static int em28xx_hint_board(struct em28xx *dev)static void em28xx_card_setup (struct em28xx *dev) { +int i, j, idx; +bool duplicate_entry; +/* * If the device can be a webcam, seek for a sensor. * If sensor is not found, then it isn't a webcam.
@@ -3195,6 +3198,32 @@ static void em28xx_card_setup(struct em28xx *dev)/* Allow override tuner type by a module parameter */ if (tuner >=0 ) dev->tuner_type = tuner; + +/* +* Dynamically generate a list of valid audio inputs for this +* specific board, mapping them via enum em28xx_amux. +*/ + + idx =0 ; +for (i =0 ; i <MAX_EM28XX_INPUT ; i++) { +if (!INPUT (i)->type) +continue ; + +/* Skip already mapped audio inputs */ + duplicate_entry = false; +for (j =0 ; j < idx; j++) { +if (INPUT (i)->amux == dev->amux_map[j]) { + duplicate_entry = true; +break ; + } + } +if (duplicate_entry) +continue ; + + dev->amux_map[idx++] =INPUT (i)->amux; + } +for (; idx <MAX_EM28XX_INPUT ; idx++) + dev->amux_map[idx] =EM28XX_AMUX_UNUSED ; }void em28xx_setup_xc3028 (struct em28xx *dev,struct xc2028_ctrl *ctl)
drivers/media/usb/em28xx/em28xx-video.c +76 -8
137 lines not on this page · raw message
drivers/media/usb/em28xx/em28xx.h +7 -1
@@ -335,6 +335,9 @@ enum em28xx_usb_audio_type {/** * em28xx_amux - describes the type of audio input used by em28xx * +* @EM28XX_AMUX_UNUSED: +* Used only on em28xx dev->map field, in order to mark an entry +* as unused. * @EM28XX_AMUX_VIDEO: * On devices without AC97, this is the only value that it is currently * allowed.
@@ -369,7 +372,8 @@ enum em28xx_usb_audio_type {* same time, via the alsa mux. */ enum em28xx_amux { -EM28XX_AMUX_VIDEO , +EM28XX_AMUX_UNUSED =-1 , +EM28XX_AMUX_VIDEO =0 ,EM28XX_AMUX_LINE_IN ,/* Some less-common mixer setups */
@@ -692,6 +696,8 @@ struct em28xx {unsigned int ctl_input;// selected input unsigned int ctl_ainput;// selected audio input unsigned int ctl_aoutput;// selected audio output +enum em28xx_amux amux_map[MAX_EM28XX_INPUT ]; +int mute;int volume;