int proc_audio_delay_bitstream_read (char *page, char **start, off_t off, int count, int *eof, void *data_unused)
{
	int len = 0;

	int number = 0;
	struct snd_kcontrol  *single_control = NULL;
	struct snd_kcontrol ** kcontrol      = pseudoGetControls(&number);
	int vLoop;

	for (vLoop = 0; vLoop < number; vLoop++)
	{
		if (kcontrol[vLoop]->private_value == PSEUDO_ADDR(master_latency))
		{
			single_control = kcontrol[vLoop];
			break;
		}
	}
	if ((kcontrol != NULL) && (single_control != NULL))
	{
		struct snd_ctl_elem_value ucontrol;
		snd_pseudo_integer_get(single_control, &ucontrol);
		len = sprintf(page, "%08x\n", ucontrol.value.integer.value[0] * 90);
	}
	else
	{
		printk("Pseudo Mixer does not deliver controls\n");
	}

	return len;
}
Example #2
0
static int AudioIoctlSetBypassMode (struct DeviceContext_s* Context, unsigned int Mode)
#endif
{
#ifdef __TDT__
    int vLoop;
    int number = 0;
    struct snd_kcontrol *single_control = NULL;
    struct snd_kcontrol ** kcontrol = pseudoGetControls(&number);

    //DVB_DEBUG("(not implemented)\n");
    //mpeg2=4, ac3=6
    //e2 : 1=mpegm 0=ac3, 2=dts, 8=aac, 9=aache, 6=lpcm
    //libdreamdvd : 5=dts 6=lpcm
    DVB_DEBUG("Set BypassMode to %d\n", Mode);

    if (Mode == 0)
        Context->AudioEncoding      = (audio_encoding_t) AUDIO_ENCODING_AC3;
    else if (Mode == 5 || Mode == 2)
        Context->AudioEncoding      = (audio_encoding_t) AUDIO_ENCODING_DTS;
    else if (Mode == 6)
        Context->AudioEncoding      = (audio_encoding_t) AUDIO_ENCODING_LPCM;
    else if (Mode == 8)
        Context->AudioEncoding      = (audio_encoding_t) AUDIO_ENCODING_AAC;
    else
        Context->AudioEncoding      = (audio_encoding_t) AUDIO_ENCODING_MPEG2;

//before we jump to any conclusions, does the user really want passtrough, its possible that he wants downmix!
//ask e2_proc_audio what the user wants

    for (vLoop = 0; vLoop < number; vLoop++) {
        if (kcontrol[vLoop]->private_value == PSEUDO_ADDR(spdif_bypass)) {
            single_control = kcontrol[vLoop];
            printk("Find spdif_bypass control at %p\n", single_control);
            break;
        }
    }

    if ((kcontrol != NULL) && (single_control != NULL)) {
        struct snd_ctl_elem_value ucontrol;
        ucontrol.value.integer.value[0] = e2_proc_audio_getPassthrough();

        snd_pseudo_switch_put(single_control, &ucontrol);

    } else {
        printk("Pseudo Mixer does not deliver controls\n");
    }

#ifdef use_hdmi_bypass
    /* Dagobert; set hdmi bypass, maybe we need another prco for this? */
    for (vLoop = 0; vLoop < number; vLoop++) {
        if (kcontrol[vLoop]->private_value == PSEUDO_ADDR(hdmi_bypass)) {
            single_control = kcontrol[vLoop];
            printk("Find hdmi_bypass control at %p\n", single_control);
            break;
        }
    }

    if ((kcontrol != NULL) && (single_control != NULL)) {
        struct snd_ctl_elem_value ucontrol;
        ucontrol.value.integer.value[0] = e2_proc_audio_getPassthrough();

        snd_pseudo_switch_put(single_control, &ucontrol);

    } else {
        printk("Pseudo Mixer does not deliver controls\n");
    }
#endif

    return 0;
#else
    DVB_DEBUG("(not implemented)\n");
    return -EPERM;
#endif
}
Example #3
0
int proc_avs_0_volume_write(struct file *file, const char __user *buf,
							unsigned long count, void *data)
{
#define cMaxAttenuationE2 64
	int logarithmicAttenuation[cMaxAttenuationE2] =
	{
		0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4,
		5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11,
		11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22,
		23, 24, 25, 27, 28, 29, 31, 33, 35, 37, 40, 43, 47, 51, 58, 70
	};
	char *page;
	char *myString;
	ssize_t ret = -ENOMEM;
#ifdef VERY_VERBOSE
	printk("%s %ld - ", __FUNCTION__, count);
#endif
	page = (char *)__get_free_page(GFP_KERNEL);
	if (page)
	{
		int number = 0;
		struct snd_kcontrol **kcontrol = pseudoGetControls(&number);
		struct snd_kcontrol *single_control = NULL;
		int vLoop;
		int volume = 0;
		ret = -EFAULT;
		if (file == NULL && data == NULL)
			strncpy(page, buf, count);
		else
		{
			if (copy_from_user(page, buf, count))
				goto out;
		}
		myString = (char *) kmalloc(count + 1, GFP_KERNEL);
		strncpy(myString, page, count);
		myString[count] = '\0';
#ifdef VERY_VERBOSE
		printk("%s\n", myString);
#endif
		sscanf(myString, "%d", &volume);
#if defined(CUBEREVO) \
 || defined(CUBEREVO_MINI) \
 || defined(CUBEREVO_MINI2) \
 || defined(CUBEREVO_MINI_FTA) \
 || defined(CUBEREVO_250HD) \
 || defined(CUBEREVO_2000HD) \
 || defined(CUBEREVO_9500HD) \
 || defined(CUBEREVO_3000HD) \
 || defined(TF7700) \
 || defined(UFS912) \
 || defined(UFS922) \
 || defined(UFC960) \
 || defined(HL101) \
 || defined(VIP1_V2) \
 || defined(VIP2_V1) \
 || defined(ATEVIO7500) \
 || defined(HS7110) \
 || defined(HS7810A) \
 || defined(HS7420) \
 || defined(HS7429) \
 || defined(HS7119) \
 || defined(HS7819) \
 || defined(ATEMIO520) \
 || defined(ATEMIO530) \
 || defined(IPBOX9900) \
 || defined(IPBOX99) \
 || defined(IPBOX55) \
 || defined(ADB_BOX) \
 || defined(VITAMIN_HD5000)
		current_volume = volume;
#else
		/* Dagobert: 04.10.2009: e2 delivers values from 0 to 63 db. the ak4705
		 * needs values which are a little bit more sophisticated.
		 * the range is from mute (value 0) to -60 db (value 1) to +6db (value 34)
		 * which is represented by 6 bits in 2db steps
		 *
		 * so we have a value range of 0 - 34. in my opinion the algo must be:
		 *
		 * current_volume = ((volume * 100) / 63 * 34) / 100;
		 * current_volume = 34 - current_volume;
		 *
		 * mybe someone could test it.
		 *
		 */
		current_volume = 31 - volume / 4;
#endif
		for (vLoop = 0; vLoop < number; vLoop++)
		{
			if (kcontrol[vLoop]->private_value == PSEUDO_ADDR(master_volume))
			{
				single_control = kcontrol[vLoop];
				//printk("Find master_volume control at %p\n", single_control);
				break;
			}
		}
		if ((kcontrol != NULL) && (single_control != NULL))
		{
			struct snd_ctl_elem_value ucontrol;
			if (volume > cMaxAttenuationE2 - 1)
				volume = cMaxAttenuationE2 - 1;
			else if (volume < 0)
				volume = 0;
			current_e2_volume = volume;
			/* Dagobert: 04.10.2009: e2 delivers values from 0 to 63 db. the current
			 * pseudo_mixer needs a value from 0 to "-70".
			 * ->see pseudo_mixer.c line 722.
			 */
			/* Dagobert: 06.10.2009: Volume is a logarithmical value ...

			 scale range

			 volume = ((volume * 100) / cMaxVolumeE2 * cMaxVolumePlayer) / 100;
			 volume = 0 - volume;
			*/
			volume = 0 - logarithmicAttenuation[current_e2_volume];
			//printk("Pseudo Mixer controls = %p\n", kcontrol);
			ucontrol.value.integer.value[0] = volume;
			ucontrol.value.integer.value[1] = volume;
			ucontrol.value.integer.value[2] = volume;
			ucontrol.value.integer.value[3] = volume;
			ucontrol.value.integer.value[4] = volume;
			ucontrol.value.integer.value[5] = volume;
			snd_pseudo_integer_put(single_control, &ucontrol);
		}
		else
		{
			printk("Pseudo Mixer does not deliver controls\n");
		}
		if (current_input == SCART)
			avs_command_kernel(AVSIOSVOL, (void *) current_volume);
		kfree(myString);
	}
	ret = count;
out:
	free_page((unsigned long)page);
	return ret;
}
int proc_audio_delay_bitstream_write(struct file *file, const char __user *buf, unsigned long count, void *data)
{
	char    *page;
	char    *myString;
	ssize_t  ret = -ENOMEM;

	printk("%s %ld - ", __FUNCTION__, count);

	page = (char *)__get_free_page(GFP_KERNEL);
	if (page)
	{
		int number = 0;
		struct snd_kcontrol **kcontrol       = pseudoGetControls(&number);
		struct snd_kcontrol  *single_control = NULL;
		int vLoop;
		int delay = 0;

		ret = -EFAULT;
		if(file == NULL && data == NULL)
			strncpy(page, buf, count);
		else
		{
			if (copy_from_user(page, buf, count))
			goto out;
		}

		myString = (char *) kmalloc(count + 1, GFP_KERNEL);
		strncpy(myString, page, count);
		myString[count] = '\0';

		printk("%s\n", myString);
		sscanf(myString, "%x", &delay);

		if (delay != 0)
			delay /= 90;

		for (vLoop = 0; vLoop < number; vLoop++)
		{
			if (kcontrol[vLoop]->private_value == PSEUDO_ADDR(master_latency))
			{
				single_control = kcontrol[vLoop];
				//printk("Find master_latency control at %p\n", single_control);
			break;
			}
		}

		if ((kcontrol != NULL) && (single_control != NULL))
		{
			struct snd_ctl_elem_value ucontrol;

			//printk("Pseudo Mixer controls = %p\n", kcontrol);
			ucontrol.value.integer.value[0] = delay;
			snd_pseudo_integer_put(single_control, &ucontrol);
		}
		else
		{
			printk("Pseudo Mixer does not deliver controls\n");
		}

		kfree(myString);
	}

	ret = count;
out:

	free_page((unsigned long)page);
	return ret;
}