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

PMIC_STATUS pmic_tcled_ind_set_current ( t_ind_channel  channel,
t_tcled_cur_level  level,
t_funlight_bank  bank 
)

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

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

Definition at line 937 of file pmic_light.c.

References pmic_write_reg(), and suspend_flag.

Referenced by pmic_light_ioctl().

{
      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_IND_RED:
            value = BITFVAL(BITS_CL_RED, level);
            mask = BITFMASK(BITS_CL_RED);
            break;
      case TCLED_IND_GREEN:
            value = BITFVAL(BITS_CL_GREEN, level);
            mask = BITFMASK(BITS_CL_GREEN);
            break;
      case TCLED_IND_BLUE:
            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