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

PMIC_STATUS pmic_tcled_ind_get_current ( t_ind_channel  channel,
t_tcled_cur_level *  level,
t_funlight_bank  bank 
)

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

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

Definition at line 999 of file pmic_light.c.

References pmic_read_reg(), and suspend_flag.

Referenced by pmic_light_ioctl().

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

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

      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:
            mask = BITFMASK(BITS_CL_RED);
            break;
      case TCLED_IND_GREEN:
            mask = BITFMASK(BITS_CL_GREEN);
            break;
      case TCLED_IND_BLUE:
            mask = BITFMASK(BITS_CL_BLUE);
            break;
      default:
            return PMIC_PARAMETER_ERROR;
      }

      CHECK_ERROR(pmic_read_reg(reg_conf, &value, mask));

      switch (channel) {
      case TCLED_IND_RED:
            *level = BITFEXT(value, BITS_CL_RED);
            break;
      case TCLED_IND_GREEN:
            *level = BITFEXT(value, BITS_CL_GREEN);
            break;
      case TCLED_IND_BLUE:
            *level = BITFEXT(value, BITS_CL_BLUE);
            break;
      default:
            return PMIC_PARAMETER_ERROR;
      }

      return PMIC_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index