Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

PMIC_STATUS pmic_tcled_fun_set_current ( t_funlight_bank  bank,
t_funlight_channel  channel,
t_tcled_cur_level  level 
)

This function sets a tri-color LED channel current level in Fun Light mode.

Parameters:
bank Tri-color LED bank
channel Tri-color LED channel.
level Current level.
Returns:
This function returns PMIC_SUCCESS if successful.

Definition at line 1202 of file pmic_light.c.

References pmic_write_reg(), and suspend_flag.

{
      unsigned int reg_conf = 0;
      unsigned int mask;
      unsigned int value;

      if (suspend_flag == 1) {
            return -EBUSY;
      }

      if (level > TCLED_CUR_LEVEL_4) {
            return PMIC_PARAMETER_ERROR;
      }

      switch (bank) {
      case TCLED_FUN_BANK1:
            reg_conf = LREG_3;
            break;
      case TCLED_FUN_BANK2:
            reg_conf = LREG_4;
            break;
      case TCLED_FUN_BANK3:
            reg_conf = LREG_5;
            break;
      default:
            return PMIC_PARAMETER_ERROR;
      }

      switch (channel) {
      case TCLED_FUN_CHANNEL1:
            value = BITFVAL(BITS_CL_RED, level);
            mask = BITFMASK(BITS_CL_RED);
            break;
      case TCLED_FUN_CHANNEL2:
            value = BITFVAL(BITS_CL_GREEN, level);
            mask = BITFMASK(BITS_CL_GREEN);
            break;
      case TCLED_FUN_CHANNEL3:
            value = BITFVAL(BITS_CL_BLUE, level);
            mask = BITFMASK(BITS_CL_BLUE);
            break;
      default:
            return PMIC_PARAMETER_ERROR;
      }

      CHECK_ERROR(pmic_write_reg(reg_conf, value, mask));

      return PMIC_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index