From: Mike Isely Date: Tue, 22 Apr 2008 17:45:41 +0000 (-0300) Subject: V4L/DVB (7312): pvrusb2: Indicate streaming status via LED X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c55a97d7538d5f3abbee5486e37e56e896478fbd;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git V4L/DVB (7312): pvrusb2: Indicate streaming status via LED Most of this originates from Michael Krufky ; 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 64062879981e..ccb5d14ddf85 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -480,9 +480,7 @@ int pvr2_encoder_start(struct pvr2_hdw *hdw) /* unmask some interrupts */ pvr2_write_register(hdw, 0x0048, 0xbfffffff); - /* change some GPIO data */ - pvr2_hdw_gpio_chg_dir(hdw,0xffffffff,0x00000481); - pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000); + pvr2_led_ctrl(hdw, 1); pvr2_encoder_vcmd(hdw,CX2341X_ENC_MUTE_VIDEO,1, hdw->input_val == PVR2_CVAL_INPUT_RADIO ? 1 : 0); @@ -526,11 +524,7 @@ int pvr2_encoder_stop(struct pvr2_hdw *hdw) break; } - /* change some GPIO data */ - /* Note: Bit d7 of dir appears to control the LED. So we shut it - off here. */ - pvr2_hdw_gpio_chg_dir(hdw,0xffffffff,0x00000401); - pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000); + pvr2_led_ctrl(hdw, 0); return status; } diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index a85ffdaadccb..9b1e22f2e555 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -3357,6 +3357,27 @@ static void pvr2_hdw_cmd_modeswitch(struct pvr2_hdw *hdw,int digitalFl) } +/* 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) { diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 57e1ff491497..4fc9db3efff2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -258,6 +258,9 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *); /* suspend */ int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *); +/* toggle LED */ +int pvr2_led_ctrl(struct pvr2_hdw *hdw, int onoff); + /* Order decoder to reset */ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);