V4L/DVB (7312): pvrusb2: Indicate streaming status via LED

Most of this originates from Michael Krufky <mkrufky@linuxtv.org>;
these changes move LED control into separate functions.  This is the
first step in new work to make LED control a device-specific attribute.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index a85ffda..9b1e22f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3357,6 +3357,27 @@
 }
 
 
+/* Toggle LED */
+int pvr2_led_ctrl(struct pvr2_hdw *hdw, int onoff)
+{
+	/* change some GPIO data
+	 *
+	 * note: bit d7 of dir appears to control the LED,
+	 * so we shut it off here.
+	 *
+	 * FIXME: is this device-specific?
+	 */
+	if (onoff)
+		pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000481);
+	else
+		pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000401);
+
+	pvr2_hdw_gpio_chg_out(hdw, 0xffffffff, 0x00000000);
+
+	return 0;
+}
+
+
 /* Stop / start video stream transport */
 static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl)
 {