Searched refs:cm36651 (Results 1 - 1 of 1) sorted by relevance
/linux-4.4.14/drivers/iio/light/ |
H A D | cm36651.c | 146 static int cm36651_setup_reg(struct cm36651_data *cm36651) cm36651_setup_reg() argument 148 struct i2c_client *client = cm36651->client; cm36651_setup_reg() 149 struct i2c_client *ps_client = cm36651->ps_client; cm36651_setup_reg() 153 cm36651->cs_ctrl_regs[CM36651_CS_CONF1] = CM36651_ALS_ENABLE | cm36651_setup_reg() 155 cm36651->cs_ctrl_regs[CM36651_CS_CONF2] = CM36651_CS_CONF2_DEFAULT_BIT; cm36651_setup_reg() 159 cm36651->cs_ctrl_regs[i]); cm36651_setup_reg() 165 cm36651->ps_ctrl_regs[CM36651_PS_CONF1] = CM36651_PS_ENABLE | cm36651_setup_reg() 167 cm36651->ps_ctrl_regs[CM36651_PS_THD] = CM36651_PS_INITIAL_THD; cm36651_setup_reg() 168 cm36651->ps_ctrl_regs[CM36651_PS_CANC] = CM36651_PS_CANC_DEFAULT; cm36651_setup_reg() 169 cm36651->ps_ctrl_regs[CM36651_PS_CONF2] = CM36651_PS_HYS2 | cm36651_setup_reg() 174 cm36651->ps_ctrl_regs[i]); cm36651_setup_reg() 185 ret = i2c_smbus_write_byte_data(cm36651->ps_client, cm36651_setup_reg() 193 static int cm36651_read_output(struct cm36651_data *cm36651, cm36651_read_output() argument 196 struct i2c_client *client = cm36651->client; cm36651_read_output() 213 *val = i2c_smbus_read_byte(cm36651->ps_client); cm36651_read_output() 217 if (!test_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags)) { cm36651_read_output() 218 ret = i2c_smbus_write_byte_data(cm36651->ps_client, cm36651_read_output() 236 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_irq_handler() local 237 struct i2c_client *client = cm36651->client; cm36651_irq_handler() 248 ret = i2c_smbus_read_byte(cm36651->ara_client); cm36651_irq_handler() 276 static int cm36651_set_operation_mode(struct cm36651_data *cm36651, int cmd) cm36651_set_operation_mode() argument 278 struct i2c_client *client = cm36651->client; cm36651_set_operation_mode() 279 struct i2c_client *ps_client = cm36651->ps_client; cm36651_set_operation_mode() 285 cm36651->cs_ctrl_regs[CM36651_CS_CONF1]); cm36651_set_operation_mode() 288 if (test_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags)) cm36651_set_operation_mode() 292 cm36651->ps_ctrl_regs[CM36651_PS_CONF1]); cm36651_set_operation_mode() 295 if (test_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags)) { cm36651_set_operation_mode() 300 set_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags); cm36651_set_operation_mode() 312 if (!test_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags)) { cm36651_set_operation_mode() 317 clear_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags); cm36651_set_operation_mode() 329 static int cm36651_read_channel(struct cm36651_data *cm36651, cm36651_read_channel() argument 332 struct i2c_client *client = cm36651->client; cm36651_read_channel() 342 ret = cm36651_set_operation_mode(cm36651, cmd); cm36651_read_channel() 349 ret = cm36651_read_output(cm36651, chan, val); cm36651_read_channel() 358 static int cm36651_read_int_time(struct cm36651_data *cm36651, cm36651_read_int_time() argument 363 if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) cm36651_read_int_time() 365 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) cm36651_read_int_time() 367 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) cm36651_read_int_time() 369 else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) cm36651_read_int_time() 375 if (cm36651->ps_int_time == CM36651_PS_IT1) cm36651_read_int_time() 377 else if (cm36651->ps_int_time == CM36651_PS_IT2) cm36651_read_int_time() 379 else if (cm36651->ps_int_time == CM36651_PS_IT3) cm36651_read_int_time() 381 else if (cm36651->ps_int_time == CM36651_PS_IT4) cm36651_read_int_time() 393 static int cm36651_write_int_time(struct cm36651_data *cm36651, cm36651_write_int_time() argument 396 struct i2c_client *client = cm36651->client; cm36651_write_int_time() 397 struct i2c_client *ps_client = cm36651->ps_client; cm36651_write_int_time() 419 cm36651->cs_int_time[chan->address] = int_time; cm36651_write_int_time() 439 cm36651->ps_int_time = int_time; cm36651_write_int_time() 452 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_read_raw() local 455 mutex_lock(&cm36651->lock); cm36651_read_raw() 459 ret = cm36651_read_channel(cm36651, chan, val); cm36651_read_raw() 463 ret = cm36651_read_int_time(cm36651, chan, val2); cm36651_read_raw() 469 mutex_unlock(&cm36651->lock); cm36651_read_raw() 478 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_write_raw() local 479 struct i2c_client *client = cm36651->client; cm36651_write_raw() 483 ret = cm36651_write_int_time(cm36651, chan, val2); cm36651_write_raw() 498 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_read_prox_thresh() local 500 *val = cm36651->ps_ctrl_regs[CM36651_PS_THD]; cm36651_read_prox_thresh() 512 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_write_prox_thresh() local 513 struct i2c_client *client = cm36651->client; cm36651_write_prox_thresh() 519 cm36651->ps_ctrl_regs[CM36651_PS_THD] = val; cm36651_write_prox_thresh() 520 ret = i2c_smbus_write_byte_data(cm36651->ps_client, CM36651_PS_THD, cm36651_write_prox_thresh() 521 cm36651->ps_ctrl_regs[CM36651_PS_THD]); cm36651_write_prox_thresh() 537 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_write_prox_event_config() local 540 mutex_lock(&cm36651->lock); cm36651_write_prox_event_config() 543 ret = cm36651_set_operation_mode(cm36651, cmd); cm36651_write_prox_event_config() 545 mutex_unlock(&cm36651->lock); cm36651_write_prox_event_config() 555 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_read_prox_event_config() local 558 mutex_lock(&cm36651->lock); cm36651_read_prox_event_config() 560 event_en = test_bit(CM36651_PROXIMITY_EV_EN, &cm36651->flags); cm36651_read_prox_event_config() 562 mutex_unlock(&cm36651->lock); cm36651_read_prox_event_config() 628 struct cm36651_data *cm36651; cm36651_probe() local 632 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*cm36651)); cm36651_probe() 636 cm36651 = iio_priv(indio_dev); cm36651_probe() 638 cm36651->vled_reg = devm_regulator_get(&client->dev, "vled"); cm36651_probe() 639 if (IS_ERR(cm36651->vled_reg)) { cm36651_probe() 641 return PTR_ERR(cm36651->vled_reg); cm36651_probe() 644 ret = regulator_enable(cm36651->vled_reg); cm36651_probe() 652 cm36651->client = client; cm36651_probe() 653 cm36651->ps_client = i2c_new_dummy(client->adapter, cm36651_probe() 655 if (!cm36651->ps_client) { cm36651_probe() 661 cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA); cm36651_probe() 662 if (!cm36651->ara_client) { cm36651_probe() 668 mutex_init(&cm36651->lock); cm36651_probe() 676 ret = cm36651_setup_reg(cm36651); cm36651_probe() 684 "cm36651", indio_dev); cm36651_probe() 701 i2c_unregister_device(cm36651->ara_client); cm36651_probe() 703 i2c_unregister_device(cm36651->ps_client); cm36651_probe() 705 regulator_disable(cm36651->vled_reg); cm36651_probe() 712 struct cm36651_data *cm36651 = iio_priv(indio_dev); cm36651_remove() local 715 regulator_disable(cm36651->vled_reg); cm36651_remove() 717 i2c_unregister_device(cm36651->ps_client); cm36651_remove() 718 i2c_unregister_device(cm36651->ara_client); cm36651_remove() 724 { "cm36651", 0 }, 731 { .compatible = "capella,cm36651" }, 738 .name = "cm36651",
|
Completed in 67 milliseconds