Louie Ilievski wrote:

Video1 is my 150 and video0 is the 350. I then tried setting my 150 volume to the same value as my 350, and it claimed it worked, but it didn't seem to:
This is true. There is no volume control code for the PVR-150 or PVR-500. For most people it is ok since the AVC circuitry should automatically adjust the volume to a reasonable output level. However, for others it seems that this doesn't work and produces LOOUUUD recordings. Someone had a patch to add a module-wide volume control which is usually sufficient to quiet things down. Check the list archives.

Bah what the hell, why I don't I take a stab at it. The Path1 volume control on the cx25840 is backward and smaller than the standard volume control (loudest is 0, softest is 255), so I take the user input and flip-flop it for consistency. The card defaults to 36 (+0dB) which corresponds to 56,064 on the volume dial. Nice round number there.

   So give this a try and let me know how it goes.
Index: driver/decoder.h
===================================================================
--- driver/decoder.h    (revision 323)
+++ driver/decoder.h    (working copy)
@@ -63,5 +63,7 @@
 #define DECODER_GET_CC_EVEN _IOR('d', 109, int *)
 
 #define DECODER_SET_AUDIO_INPUT _IOW('d', 110, int *)
+#define DECODER_SET_AUDIO_VOLUME _IOW('d', 112, int *)
+#define DECODER_GET_AUDIO_VOLUME _IOWR('d', 112, int *)
 
 #endif
Index: driver/ivtv-audio.c
===================================================================
--- driver/ivtv-audio.c (revision 323)
+++ driver/ivtv-audio.c (working copy)
@@ -201,6 +201,10 @@
                break;
         case USE_PVR150:
        case USE_CX25840:       /* FIXME, probably not right */
+               /* Volume runs from +18dB to -96dB, and is a byte */
+               volume = 0xff - (volume >> 8);
+               ivtv_cx25840(itv, DECODER_SET_AUDIO_VOLUME, &volume);
+               break;
        case USE_GPIO:
                /* do nothing, there's no volume control */
                break;
@@ -218,6 +222,9 @@
                break;
         case USE_PVR150:
        case USE_CX25840:       /* FIXME, probably not right */
+               ivtv_cx25840(itv, DECODER_GET_AUDIO_VOLUME, &va.volume);
+               va.volume = (0xff - va.volume) << 8;
+               break;
        case USE_GPIO:
                /* do nothing, there's no volume control */
                va.volume = 65535;      /* dummy code */
Index: driver/cx25840-driver.c
===================================================================
--- driver/cx25840-driver.c     (revision 323)
+++ driver/cx25840-driver.c     (working copy)
@@ -940,6 +940,20 @@
                break;
        }
 
+       case DECODER_SET_AUDIO_VOLUME:
+       {
+               int *volume = arg;
+               CX25840_SET_PATH1_VOLUME(*volume);
+               break;
+       }
+       
+       case DECODER_GET_AUDIO_VOLUME:
+       {
+               int *volume = arg;
+               *volume = cx25840_read_setting(client, PATH1_VOLUME);
+               break;
+       }
+
        default:
                ERR("invalid ioctl %X", cmd);
                return -EINVAL;

Reply via email to