/* @client: the i2c client @dim: either LP3944_DIM0 or LP3944_DIM1 @period: period of a blink, that is a on/off cycle, expressed in ms.  */
static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
/* @client: the i2c client @dim: either LP3944_DIM0 or LP3944_DIM1 @period: period of a blink, that is a on/off cycle, expressed in ms.  */
static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
{
	u8 psc_reg;
	u8 psc_value;
	int err;
	if (dim == LP3944_DIM0)
		psc_reg = LP3944_REG_PSC0;
	else if (dim == LP3944_DIM1)
		psc_reg = LP3944_REG_PSC1;
	else
		return -EINVAL;
	if (period > LP3944_PERIOD_MAX)
		return -EINVAL;
	psc_value = (period * 255) / LP3944_PERIOD_MAX;
	err = lp3944_reg_write(client, psc_reg, psc_value);
	return err;
}