int proc_avs_0_input_write(struct file *file, const char __user *buf, unsigned long count, void *data) { char *page; char *myString; ssize_t ret = -ENOMEM; /* int result; */ printk("%s %ld - ", __FUNCTION__, count); page = (char *)__get_free_page(GFP_KERNEL); if (page) { ret = -EFAULT; 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); if(!strncmp("encoder", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, SAA_SRC_ENC); // Note: Volumne is not changed directly but by using the MIXER instead of the AVS. // So this should always be set to the maximum #ifdef UFS910 avs_command_kernel(AVSIOSVOL, (void*) 31); #else avs_command_kernel(AVSIOSVOL, (void*) 0); #endif current_input = ENCODER; } if(!strncmp("scart", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, (void*) SAA_SRC_SCART); avs_command_kernel(AVSIOSVOL, (void*) current_volume); current_input = SCART; } kfree(myString); //result = sscanf(page, "%3s %3s %3s %3s %3s", s1, s2, s3, s4, s5); } ret = count; out: free_page((unsigned long)page); return ret; }
int proc_avs_0_input_write(struct file *file, const char __user *buf, unsigned long count, void *data) { char *page; char *myString; ssize_t ret = -ENOMEM; /* int result; */ printk("%s %ld - ", __FUNCTION__, count); page = (char *)__get_free_page(GFP_KERNEL); if (page) { ret = -EFAULT; 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); if(!strncmp("encoder", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, SAA_SRC_ENC); #if defined(CUBEREVO) || defined(CUBEREVO_MINI) || defined(CUBEREVO_MINI2) || defined(CUBEREVO_MINI_FTA) || defined(CUBEREVO_250HD) || defined(CUBEREVO_2000HD) || defined(CUBEREVO_9500HD) || defined(TF7700) || defined(UFS912) || defined(UFS922) || defined(UFC960) || defined(HL101) || defined(VIP1_V2) || defined(VIP2_V1) || defined(HOMECAST5101) || defined(ATEVIO7500) || defined(HS7810A) || defined(HS7110) || defined(IPBOX9900) || defined(IPBOX99) || defined(IPBOX55) avs_command_kernel(AVSIOSVOL, (void*) current_volume); #else avs_command_kernel(AVSIOSVOL, (void*) 31); #endif current_input = 0; } if(!strncmp("scart", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, (void*) SAA_SRC_SCART); avs_command_kernel(AVSIOSVOL, (void*) current_volume); current_input = 1; } kfree(myString); //result = sscanf(page, "%3s %3s %3s %3s %3s", s1, s2, s3, s4, s5); } ret = count; out: free_page((unsigned long)page); return ret; }
int proc_avs_0_standby_write(struct file *file, const char __user *buf, unsigned long count, void *data) { char *page; char *myString; ssize_t ret = -ENOMEM; /* int result; */ printk("%s %ld - ", __FUNCTION__, count); page = (char *)__get_free_page(GFP_KERNEL); if (page) { ret = -EFAULT; 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); if (strncmp("on", page, count - 1) == 0) { current_standby = 1; } else if (strncmp("off", page, count - 1) == 0) { current_standby = 0; } avs_command_kernel(AVSIOSTANDBY, (void*) current_standby); kfree(myString); //result = sscanf(page, "%3s %3s %3s %3s %3s", s1, s2, s3, s4, s5); } ret = count; out: free_page((unsigned long)page); return ret; }
int proc_avs_0_colorformat_write(struct file *file, const char __user *buf, unsigned long count, void *data) { 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) { struct stmfb_info *info = stmfb_get_fbinfo_ptr(); struct stmfbio_output_configuration outputConfig; int err = 0; int alpha = 0; int hdmi_colour = 0; int scart_colour = 0; int hdmi0scart1yuv2 = 1; ret = -EFAULT; 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", &alpha); //0rgb 1yuv 2422 if (strncmp("hdmi_rgb", page, count - 1) == 0) { hdmi_colour = 0; hdmi0scart1yuv2 = 0; } else if (strncmp("hdmi_yuv", page, count - 1) == 0) { hdmi_colour = 1; hdmi0scart1yuv2 = 0; } else if (strncmp("hdmi_422", page, count - 1) == 0) { hdmi_colour = 2; hdmi0scart1yuv2 = 0; } else if (strncmp("rgb", page, count - 1) == 0) { scart_colour = SAA_MODE_RGB; hdmi0scart1yuv2 = 1; } else if (strncmp("cvbs", page, count - 1) == 0) { scart_colour = SAA_MODE_FBAS; hdmi0scart1yuv2 = 1; } else if (strncmp("svideo", page, count - 1) == 0) { scart_colour = SAA_MODE_SVIDEO; hdmi0scart1yuv2 = 1; } else if (strncmp("yuv", page, count - 1) == 0) { hdmi0scart1yuv2 = 2; } if (hdmi0scart1yuv2 == 0) { outputConfig.outputid = 1; stmfb_get_output_configuration(&outputConfig, info); outputConfig.caps = 0; outputConfig.activate = 0; //STMFBIO_ACTIVATE_IMMEDIATE; outputConfig.caps |= STMFBIO_OUTPUT_CAPS_HDMI_CONFIG; outputConfig.hdmi_config &= ~(STMFBIO_OUTPUT_HDMI_YUV | STMFBIO_OUTPUT_HDMI_422); switch (hdmi_colour) { case 1: outputConfig.hdmi_config |= STMFBIO_OUTPUT_HDMI_YUV; break; case 2: outputConfig.hdmi_config |= (STMFBIO_OUTPUT_HDMI_YUV | STMFBIO_OUTPUT_HDMI_422); break; default: break; } err = stmfb_set_output_configuration(&outputConfig, info); } else if (hdmi0scart1yuv2 == 1) { avs_command_kernel(SAAIOSMODE, (void *) scart_colour); outputConfig.outputid = 1; stmfb_get_output_configuration(&outputConfig, info); outputConfig.caps = 0; outputConfig.activate = 0; //STMFBIO_ACTIVATE_IMMEDIATE; outputConfig.caps |= STMFBIO_OUTPUT_CAPS_ANALOGUE_CONFIG; outputConfig.analogue_config = 0; switch (scart_colour) { case SAA_MODE_RGB: outputConfig.analogue_config |= (STMFBIO_OUTPUT_ANALOGUE_RGB | STMFBIO_OUTPUT_ANALOGUE_CVBS); break; case SAA_MODE_FBAS: outputConfig.analogue_config |= STMFBIO_OUTPUT_ANALOGUE_CVBS; break; case SAA_MODE_SVIDEO: outputConfig.analogue_config |= STMFBIO_OUTPUT_ANALOGUE_YC; break; default: break; } err = stmfb_set_output_configuration(&outputConfig, info); if (err != 0) { printk("SET SCART COLOR - %ld - ", count); } } else { outputConfig.outputid = 1; stmfb_get_output_configuration(&outputConfig, info); outputConfig.caps = 0; outputConfig.activate = 0; //STMFBIO_ACTIVATE_IMMEDIATE; outputConfig.caps |= STMFBIO_OUTPUT_CAPS_ANALOGUE_CONFIG; outputConfig.analogue_config = 0; outputConfig.analogue_config |= STMFBIO_OUTPUT_ANALOGUE_YPrPb; err = stmfb_set_output_configuration(&outputConfig, info); if (err != 0) { printk("SET SCART COLOR - %ld - ", count); } } //if(ioctl(fbfd, STMFBIO_SET_OUTPUT_CONFIG, &outputConfig)<0) //perror("setting output configuration failed"); kfree(myString); } ret = count; out: free_page((unsigned long)page); return ret; }
int proc_avs_0_input_write(struct file *file, const char __user *buf, unsigned long count, void *data) { char *page; char *myString; ssize_t ret = -ENOMEM; /* int result; */ #if defined(ADB_BOX) struct stmfbio_output_configuration outputConfig; struct stmfb_info *info = stmfb_get_fbinfo_ptr(); int err; outputConfig.outputid = 1; stmfb_get_output_configuration(&outputConfig, info); outputConfig.caps = 0; outputConfig.activate = 0;//STMFBIO_ACTIVATE_IMMEDIATE; outputConfig.analogue_config = 0; outputConfig.caps |= STMFBIO_OUTPUT_CAPS_HDMI_CONFIG; #endif #ifdef VERY_VERBOSE printk("%s %ld - ", __FUNCTION__, count); #endif page = (char *)__get_free_page(GFP_KERNEL); if (page) { ret = -EFAULT; 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 if (!strncmp("encoder", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, SAA_SRC_ENC); // Note: Volumne is not changed directly but by using the MIXER instead of the AVS. // So this should always be set to the maximum #if defined(UFS910) \ || defined(ADB_BOX) avs_command_kernel(AVSIOSVOL, (void *) 31); #else avs_command_kernel(AVSIOSVOL, (void *) 0); #endif #if defined(ADB_BOX) avs_command_kernel(SAAIOSWSS, (void *) SAA_WSS_43F); outputConfig.hdmi_config &= ~STMFBIO_OUTPUT_HDMI_DISABLED; #endif current_input = ENCODER; } if (!strncmp("scart", myString, count - 1)) { avs_command_kernel(SAAIOSSRCSEL, (void *) SAA_SRC_SCART); avs_command_kernel(AVSIOSVOL, (void *) current_volume); #if defined(ADB_BOX) avs_command_kernel(SAAIOSWSS, (void *) SAA_WSS_OFF); outputConfig.hdmi_config |= STMFBIO_OUTPUT_HDMI_DISABLED; #endif current_input = SCART; } #if defined(ADB_BOX) err = stmfb_set_output_configuration(&outputConfig, info); if (err != 0) { printk("HDMI Config Disabled - Failed !!!!!!!!!!"); } #endif kfree(myString); //result = sscanf(page, "%3s %3s %3s %3s %3s", s1, s2, s3, s4, s5); } ret = count; out: free_page((unsigned long)page); return ret; }
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_video_policy_get(void) { /* Dagobert: You cannot use this semaphore here because this will be called from * VideoIoctl which holds this semaphore too. This means deadlock. mutex_lock (&(ProcDeviceContext->DvbContext->Lock)); */ if (ProcDeviceContext->VideoStream != NULL) { int cur_video_aspect = VIDEO_FORMAT_16_9; if (ProcDeviceContext->VideoSize.aspect_ratio == VIDEO_FORMAT_16_9 || (ProcDeviceContext->VideoSize.h > 576 && ProcDeviceContext->VideoSize.w > 720)) { cur_video_aspect = VIDEO_FORMAT_16_9; } else cur_video_aspect = VIDEO_FORMAT_4_3; if (cur_video_aspect == VIDEO_FORMAT_16_9) { //16:9 movie if (aspect_e2 == VIDEO_FORMAT_16_9) { policy_ply = VIDEO_LETTER_BOX; //on an 16:9 screen always show an 16:9 movie as fullscreen aspect_ply = VIDEO_FORMAT_16_9; } else { //4:3 //TODO: set the correct modes if (policy_e2 == VIDEO_POL_LETTER_BOX) { policy_ply = VIDEO_LETTER_BOX; aspect_ply = VIDEO_FORMAT_4_3; } else if (policy_e2 == VIDEO_POL_PAN_SCAN) { policy_ply = VIDEO_PAN_SCAN; aspect_ply = VIDEO_FORMAT_4_3; } else if (policy_e2 == VIDEO_POL_BEST_FIT) { policy_ply = VIDEO_LETTER_BOX; aspect_ply = VIDEO_FORMAT_16_9; } } } else { //4:3movie if (aspect_e2 == VIDEO_FORMAT_16_9) { if (policy_e2 == VIDEO_POL_LETTER_BOX) { policy_ply = VIDEO_LETTER_BOX; aspect_ply = VIDEO_FORMAT_16_9; } else if (policy_e2 == VIDEO_POL_PAN_SCAN) { policy_ply = VIDEO_PAN_SCAN; aspect_ply = VIDEO_FORMAT_16_9; } else if (policy_e2 == VIDEO_POL_BEST_FIT) { policy_ply = VIDEO_LETTER_BOX; aspect_ply = VIDEO_FORMAT_4_3; } else if (policy_e2 == VIDEO_POL_NON_LINEAR) { policy_ply = VIDEO_CENTER_CUT_OUT; aspect_ply = VIDEO_FORMAT_16_9; } } else { //4:3, no need for scaling //TODO: set the correct modes policy_ply = VIDEO_LETTER_BOX; aspect_ply = VIDEO_FORMAT_4_3; } } //SCART avs_command_kernel(SAAIOSWSS, (void*)(aspect_e2 == VIDEO_FORMAT_16_9 ? SAA_WSS_169F : SAA_WSS_43F)); } /* Dagobert: You cannot use this semaphore here because this will be called from * VideoIoctl which holds this semaphore too. This means deadlock. mutex_unlock (&(ProcDeviceContext->DvbContext->Lock)); */ return policy_ply; }