View Single Post
Old 02-06-2013, 05:54 AM   #24
giorgio130
Time Waster
giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.giorgio130 ought to be getting tired of karma fortunes by now.
 
Posts: 415
Karma: 289158
Join Date: May 2011
Device: Kobo Glo and Aura HD
I've made some research on this. I've added a little code used in kernel:
Code:
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

static unsigned short FL_table0[100]={
0x0001,0x0006,0x0007,0x0009,0x000C,0x000D,0x000E,0x000F,0x0011,0x0012,
0x0014,0x0015,0x0017,0x0018,0x001A,0x001B,0x001C,0x001D,0x001F,0x0020,
0x0022,0x0023,0x0025,0x0027,0x0028,0x002A,0x002B,0x002D,0x002E,0x0030,
0x0031,0x0033,0x0035,0x0036,0x0038,0x0039,0x003B,0x003C,0x003E,0x0040,
0x0041,0x0043,0x0044,0x0046,0x0047,0x0049,0x004A,0x0051,0x0057,0x005D,
0x0063,0x006A,0x0070,0x0076,0x007C,0x0083,0x0089,0x008F,0x0095,0x009C,
0x00A2,0x00A8,0x00AE,0x00B5,0x00B9,0x00BB,0x00C1,0x00C7,0x00CE,0x00D4,
0x00DA,0x00E0,0x00E7,0x00ED,0x00F3,0x00F9,0x0100,0x0106,0x010C,0x0112,
0x0118,0x011F,0x0125,0x012B,0x0131,0x0138,0x013E,0x0144,0x014A,0x0151,
0x0157,0x015D,0x0163,0x016A,0x0170,0x0176,0x017C,0x0183,0x0189,0x018F
};
int main(int argc, char *argv[])
{
	if ( argc != 2 ) {
        printf("Usage: %s brightness \n", argv[0]);
        return 1;
    }
    
    int light;

    // Open the file for reading and writing
    if ((light = open("/dev/ntx_io", O_RDWR)) == -1) {
        printf("Error opening ntx_io device");
    }

    int brightness = atoi ( (argv[1]) );
    ioctl(light, 243, brightness);

    return 0;
}

/*
		case CM_FRONT_LIGHT_SET:241
			if(0!=gptHWCFG->m_val.bFrontLight)
			{
				if (p) {			
					printk ("\nset front light level : %d\n",p);
					if(p>0 && p<=50)
					{
						gpio_direction_output(FL_R_EN,0);
						msp430_write (0xA7, FL_table0[2*(p-1)]&0xFF00);
						msp430_write (0xA6, FL_table0[2*(p-1)]<<8);
						printk("PWMCNT : 0x%04x\n", FL_table0[2*(p-1)]);
					}else if(p>50 && p<=100){
						gpio_direction_output(FL_R_EN,1);
						msp430_write (0xA7, FL_table0[p-1]&0xFF00);
						msp430_write (0xA6, FL_table0[p-1]<<8);
						printk("PWMCNT : 0x%04x\n", FL_table0[p-1]);
					}else{
						printk("Wrong number! level range from 0 to 100\n");
					}
					if (0 == last_FL_duty){
						msp430_write (0xA1, 0xFF00);
						msp430_write (0xA2, 0xFF00);
						msp430_write (0xA5, 0x0100);   
						msp430_write (0xA4, 0x9000);
						msp430_write (0xA3, 0x0100);

						msleep(100);
						gpio_direction_output(FL_EN,0);
					}
				}
				else {
					printk ("turn off front light\n");
					msp430_write (0xA3, 0);

					gpio_direction_input(FL_EN);
					gpio_direction_output(FL_R_EN,0);
				}
				last_FL_duty = p;
			}
			break;
		case CM_FRONT_LIGHT_DUTY:243
			if(0!=gptHWCFG->m_val.bFrontLight)
			{
				if (p) {			
					printk ("\nSet front light PWMCNT : 0x%4X\n",p);
					printk ("Current front light Frequency : (8MHz/0x%4X)\n",current_FL_freq);		
					msp430_write (0xA7, p&0xFF00);
					msp430_write (0xA6, p<<8);
					if (0 == last_FL_duty){
						msp430_write (0xA1, 0xFF00);
						msp430_write (0xA2, 0xFF00);
//						msp430_write (0xA5, 0xFF00);   
//						msp430_write (0xA4, 0xFF00);
						msp430_write (0xA3, 0x0100);

						msleep(100);
						gpio_direction_output(FL_EN,0);
					}
				}
				else {
					printk ("turn off front light\n");
					msp430_write (0xA3, 0);

					gpio_direction_input(FL_EN);
				}
				last_FL_duty = p;
			}
			break;

		case CM_FRONT_LIGHT_FREQUENCY:244
			if(0!=gptHWCFG->m_val.bFrontLight)
			{
				if (p) {
					printk ("set front light Frequency : (8MHz/0x%4X)\n",p);		
//					msp430_write (0xA4, (p<<8));
					msp430_write (0xA5, p&0xFF00);   
					msp430_write (0xA4, (p<<8));
					current_FL_freq = p;
				}
			}
			break;
*/
It seems that the lowest level (1) set by kevinshort is already the lowest that one can set, without going lower and manually using some gpios.
I'd say the state in which there's only a faint light on the screen is here:
printk ("turn off front light\n");
msp430_write (0xA3, 0);
//hang somehow
gpio_direction_input(FL_EN);
gpio_direction_output(FL_R_EN,0);

so that FL_R_EN is not yet set to 0.
giorgio130 is offline   Reply With Quote