static void set_blue_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int ret = 0; RGB_PRINT("%s: value = %d\n",__func__, value); ret = pmic_set_low_current_led_intensity(PM_LOW_CURRENT_LED_DRV2, (!!value)? LEVEL : 0); if(ret) { RGB_PRINT("%s: failed\n",__func__); return; } RGB_PRINT("%s: success\n",__func__); }
static int rgb_leds_probe(struct platform_device *pdev) { int rc = -ENODEV; struct led_classdev *p_rgb_data = NULL; p_rgb_data = kzalloc(sizeof(struct led_classdev)*3, GFP_KERNEL); if (p_rgb_data == NULL) { rc = -ENOMEM; goto err_alloc_failed; } platform_set_drvdata(pdev, p_rgb_data); p_rgb_data[0].name = "red"; p_rgb_data[0].brightness = LED_OFF; p_rgb_data[0].brightness_set = set_red_brightness; p_rgb_data[1].name = "green"; p_rgb_data[1].brightness = LED_OFF; p_rgb_data[1].brightness_set = set_green_brightness; p_rgb_data[2].name = "blue"; p_rgb_data[2].brightness = LED_OFF; p_rgb_data[2].brightness_set = set_blue_brightness; /* red */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[0]); if (rc < 0) { printk(KERN_ERR "rbg red: led_classdev_register failed\n"); goto err_led0_classdev_register_failed; } /* green */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[1]); if (rc < 0) { printk(KERN_ERR "rbg green: led_classdev_register failed\n"); goto err_led1_classdev_register_failed; } /* blue */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[2]); if (rc < 0) { printk(KERN_ERR "rbg blue: led_classdev_register failed\n"); goto err_led2_classdev_register_failed; } RGB_PRINT("led_classdev_register sucess\n"); return 0; err_led2_classdev_register_failed: led_classdev_unregister(&p_rgb_data[1]); err_led1_classdev_register_failed: led_classdev_unregister(&p_rgb_data[0]); err_led0_classdev_register_failed: err_alloc_failed: kfree(p_rgb_data); return rc; }
static void set_blue_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int ret = 0; RGB_PRINT("%s: value = %d\n",__func__, value); ret = pmic_secure_mpp_config_i_sink(PM_MPP_20, PM_MPP__I_SINK__LEVEL_5mA, \ (!!value) ? PM_MPP__I_SINK__SWITCH_ENA : PM_MPP__I_SINK__SWITCH_DIS); if(ret) { RGB_PRINT("%s: failed\n",__func__); return; } RGB_PRINT("%s: success\n",__func__); }
static void set_green_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int ret = 0; RGB_PRINT("%s: value = %d\n",__func__, value); /* because T2 touch_pannel wrong, we need adjust green LED current to 10 mA*/ /* In U8150 PP1, we can adjust green LED current back to 5 mA*/ ret = pmic_secure_mpp_config_i_sink(PM_MPP_16, PM_MPP__I_SINK__LEVEL_5mA, \ (!!value) ? PM_MPP__I_SINK__SWITCH_ENA : PM_MPP__I_SINK__SWITCH_DIS); if(ret) { RGB_PRINT("%s: failed\n",__func__); return; } RGB_PRINT("%s: success\n",__func__); }
static void set_blue_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int ret = 0; RGB_PRINT("%s: value = %d\n",__func__, value); /*< DTS2012021602342 zhongjinrong 20120224 begin */ #ifdef CONFIG_ARCH_MSM7X27A /* DTS2012021602342 zhongjinrong 20120224 end >*/ ret = pmic_secure_mpp_config_i_sink(PM_MPP_8, PM_MPP__I_SINK__LEVEL_5mA, \ (!!value) ? PM_MPP__I_SINK__SWITCH_ENA : PM_MPP__I_SINK__SWITCH_DIS); #else ret = pmic_set_low_current_led_intensity(PM_LOW_CURRENT_LED_DRV2, (!!value)? LEVEL : 0); #endif if(ret) { RGB_PRINT("%s: failed,ret=%d\n",__func__,ret); return; } RGB_PRINT("%s: success\n",__func__); }
static void set_green_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int ret = 0; RGB_PRINT("%s: value = %d\n",__func__, value); /*< DTS2011122703714 duanfei 20111227 begin */ /*< DTS2012021602342 zhongjinrong 20120224 begin */ #ifdef CONFIG_ARCH_MSM7X27A /* DTS2012021602342 zhongjinrong 20120224 end >*/ if (HW_DS == board_ds) { /*< DTS2012021602342 zhongjinrong 20120224 begin */ /* <DTS2012020906039 liguosheng 20120218 begin */ /*ap side control the gpio*/ gpio_tlmm_config(GPIO_CFG(GPIO_LED_GREEN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /* DTS2012020906039 liguosheng 20120218 end> */ /* DTS2012021602342 zhongjinrong 20120224 end >*/ ret = gpio_direction_output(GPIO_LED_GREEN,(!!value) ? LED_ON : LED_OFF); } else { ret = pmic_secure_mpp_config_i_sink(PM_MPP_5, PM_MPP__I_SINK__LEVEL_5mA, \ (!!value) ? PM_MPP__I_SINK__SWITCH_ENA : PM_MPP__I_SINK__SWITCH_DIS); } /* DTS2011122703714 duanfei 20111227 end >*/ #else ret = pmic_set_low_current_led_intensity(PM_LOW_CURRENT_LED_DRV1, (!!value)? LEVEL : 0); #endif if(ret) { RGB_PRINT("%s: failed,ret=%d\n",__func__,ret); return; } RGB_PRINT("%s: success\n",__func__); }
static int rgb_leds_probe(struct platform_device *pdev) { int rc = -ENODEV; struct led_classdev *p_rgb_data = NULL; p_rgb_data = kzalloc(sizeof(struct led_classdev)*3, GFP_KERNEL); if (p_rgb_data == NULL) { rc = -ENOMEM; goto err_alloc_failed; } platform_set_drvdata(pdev, p_rgb_data); p_rgb_data[0].name = "red"; p_rgb_data[0].brightness = LED_OFF; p_rgb_data[0].brightness_set = set_red_brightness; p_rgb_data[1].name = "green"; p_rgb_data[1].brightness = LED_OFF; p_rgb_data[1].brightness_set = set_green_brightness; p_rgb_data[2].name = "blue"; p_rgb_data[2].brightness = LED_OFF; p_rgb_data[2].brightness_set = set_blue_brightness; /* red */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[0]); if (rc < 0) { printk(KERN_ERR "rbg red: led_classdev_register failed\n"); goto err_led0_classdev_register_failed; } /* green */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[1]); if (rc < 0) { printk(KERN_ERR "rbg green: led_classdev_register failed\n"); goto err_led1_classdev_register_failed; } /* blue */ rc = led_classdev_register(&pdev->dev, &p_rgb_data[2]); if (rc < 0) { printk(KERN_ERR "rbg blue: led_classdev_register failed\n"); goto err_led2_classdev_register_failed; } /*< DTS2011122703714 duanfei 20111227 begin */ /*< DTS2012021602342 zhongjinrong 20120224 begin */ #ifdef CONFIG_ARCH_MSM7X27A /* DTS2012021602342 zhongjinrong 20120224 end >*/ board_ds = get_hw_ds_type(); /*double sim card phone use gpio to control red led and green led*/ if (HW_DS == board_ds) { gpio_request(GPIO_LED_RED, "red_led"); gpio_tlmm_config(GPIO_CFG(GPIO_LED_RED, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE); gpio_request(GPIO_LED_GREEN, "green_led"); gpio_tlmm_config(GPIO_CFG(GPIO_LED_GREEN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE); } /* DTS2011122703714 duanfei 20111227 end >*/ #endif RGB_PRINT("led_classdev_register sucess\n"); return 0; err_led2_classdev_register_failed: led_classdev_unregister(&p_rgb_data[1]); err_led1_classdev_register_failed: led_classdev_unregister(&p_rgb_data[0]); err_led0_classdev_register_failed: err_alloc_failed: kfree(p_rgb_data); return rc; }