void omap_set_primary_brightness(u8 brightness) { u8 pmbr1; static int zoom_pwm1_config = 0; static int zoom_pwm1_output_enabled = 0; // printk("*######***enter [%s] (%d), brightness = %d\n", __FUNCTION__, __LINE__, brightness); if (zoom_pwm1_config == 0) { zoom_pwm_init(); zoom_pwm1_config = 1; } if (!brightness) { zoom_pwm_enable(0); zoom_pwm1_output_enabled = 0; zoom_pwm1_config = 0; return; } zoom_pwm_config(brightness); if (zoom_pwm1_output_enabled == 0) { zoom_pwm_enable(1); zoom_pwm1_output_enabled = 1; } }
void omap_set_primary_brightness(u8 brightness) { u8 pmbr1; static int zoom_pwm1_config; static int zoom_pwm1_output_enabled; if (zoom_pwm1_config == 0) { twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pmbr1, REG_INTBR_PMBR1); pmbr1 &= ~REG_INTBR_PMBR1_PWM1_PIN_MASK; pmbr1 |= REG_INTBR_PMBR1_PWM1_PIN_EN; twl_i2c_write_u8(TWL4030_MODULE_INTBR, pmbr1, REG_INTBR_PMBR1); zoom_pwm1_config = 1; } if (!brightness) { zoom_pwm_enable(0); zoom_pwm1_output_enabled = 0; return; } zoom_pwm_config(brightness); if (zoom_pwm1_output_enabled == 0) { zoom_pwm_enable(1); zoom_pwm1_output_enabled = 1; } printk(KERN_DEBUG "Zoom LCD Backlight brightness = %d\n", brightness); }
// // times: always on -> 0, valid range -> 1-10, off -> -1 // void key_light_flash(int times) { static int init = 0; int i; gpio_t *gpio5_base = (gpio_t *)OMAP34XX_GPIO5_BASE; if (init == 0) { zoom_pwm_init(); if (times == 0) zoom_pwm_config(100); else zoom_pwm_config(40); init = 1; } if ((times < -1) || (times > 10)) return; /** Enable KEY_LIGHT_EN GPIO_140 **/ sr32((u32)&gpio5_base->oe, 12, 1, 0); zoom_pwm_enable(1); if (times == 0) { sr32((u32)&gpio5_base->setdataout, 12, 1, 1); return; } else if (times == -1) { sr32((u32)&gpio5_base->res2[0], 12, 1, 0); } else { for (i=0; i<times; i++) { sr32((u32)&gpio5_base->setdataout, 12, 1, 1); mdelay(300); sr32((u32)&gpio5_base->res2[0], 12, 1, 0); mdelay(300); } } zoom_pwm_enable(0); }// end of - key_light_flash -
void omap_enable_pwm(void) { if (zoom_pwm1_output_enabled == 0) { zoom_pwm_enable(1); zoom_pwm1_output_enabled = 1; } }