]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
V4L/DVB (7304): pvrusb2: add function pvr2_hdw_cmd_powerdown
authorMichael Krufky <mkrufky@linuxtv.org>
Tue, 22 Apr 2008 17:45:39 +0000 (14:45 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:47 +0000 (14:07 -0300)
Call pvr2_hdw_cmd_powerdown to power down the device

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/pvrusb2/pvrusb2-hdw.c
drivers/media/video/pvrusb2/pvrusb2-hdw.h

index ae36948c6c1dc34c7dbf97ce82baecaa035cb7e9..9408e8db98eff4c1ab973b82b1e264aaf36ecf1d 100644 (file)
@@ -3193,17 +3193,32 @@ int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *hdw)
 }
 
 
-int pvr2_hdw_cmd_powerup(struct pvr2_hdw *hdw)
+static int pvr2_hdw_cmd_power_ctrl(struct pvr2_hdw *hdw, int onoff)
 {
        int status;
        LOCK_TAKE(hdw->ctl_lock); do {
-               pvr2_trace(PVR2_TRACE_INIT,"Requesting powerup");
-               hdw->cmd_buffer[0] = FX2CMD_POWER_ON;
-               status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0);
+               if (onoff) {
+                       pvr2_trace(PVR2_TRACE_INIT, "Requesting powerup");
+                       hdw->cmd_buffer[0] = FX2CMD_POWER_ON;
+               } else {
+                       pvr2_trace(PVR2_TRACE_INIT, "Requesting powerdown");
+                       hdw->cmd_buffer[0] = FX2CMD_POWER_OFF;
+               }
+               status = pvr2_send_request(hdw, hdw->cmd_buffer, 1, NULL, 0);
        } while (0); LOCK_GIVE(hdw->ctl_lock);
        return status;
 }
 
+int pvr2_hdw_cmd_powerup(struct pvr2_hdw *hdw)
+{
+       return pvr2_hdw_cmd_power_ctrl(hdw, 1);
+}
+
+int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *hdw)
+{
+       return pvr2_hdw_cmd_power_ctrl(hdw, 0);
+}
+
 
 int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
 {
index 2919a1d9ed0fd7dd7f8ee63fc448db39fc549683..57e1ff491497ace2f1dbf7adc53cc377be443021 100644 (file)
@@ -255,6 +255,9 @@ int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *);
 /* Execute simple reset command */
 int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
 
+/* suspend */
+int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *);
+
 /* Order decoder to reset */
 int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);