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

PMIC_STATUS pmic_tcled_fun_chasinglightspattern ( t_funlight_bank  bank,
t_chaselight_pattern  pattern,
t_tcled_fun_speed  speed 
)

This function initiates Chasing Lights fun light pattern.

Parameters:
bank Tri-color LED bank
pattern Chasing light pattern mode.
speed Speed of pattern.
Returns:
This function returns PMIC_SUCCESS if successful.

Definition at line 1660 of file pmic_light.c.

References pmic_write_reg(), and suspend_flag.

Referenced by pmic_light_ioctl().

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

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

      if (pattern > BGR) {
            return PMIC_PARAMETER_ERROR;
      }

      switch (speed) {
      case TC_OFF:
            value = BITFVAL(BITS_FUN_LIGHT, FUN_LIGHTS_OFF);
            break;
      case TC_SLOW:
            if (pattern == PMIC_RGB) {
                  value =
                      BITFVAL(BITS_FUN_LIGHT, CHASING_LIGHTS_RGB_SLOW);
            } else {
                  value =
                      BITFVAL(BITS_FUN_LIGHT, CHASING_LIGHTS_BGR_SLOW);
            }
            break;
      case TC_FAST:
            if (pattern == PMIC_RGB) {
                  value =
                      BITFVAL(BITS_FUN_LIGHT, CHASING_LIGHTS_RGB_FAST);
            } else {
                  value =
                      BITFVAL(BITS_FUN_LIGHT, CHASING_LIGHTS_BGR_FAST);
            }
            break;
      default:
            return PMIC_PARAMETER_ERROR;
      }

      mask = BITFMASK(BITS_FUN_LIGHT);
      CHECK_ERROR(pmic_write_reg(LREG_0, value, mask));

      return PMIC_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index