Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ allOf:

properties:
compatible:
enum:
- vishay,vcnl4000
- vishay,vcnl4010
- vishay,vcnl4020
- vishay,vcnl4040
- vishay,vcnl4200
oneOf:
- enum:
- capella,cm36672p
- vishay,vcnl4000
- vishay,vcnl4010
- vishay,vcnl4020
- vishay,vcnl4040
- vishay,vcnl4200
- items:
- const: capella,cm36686
- const: vishay,vcnl4040

interrupts:
maxItems: 1
Expand Down
18 changes: 18 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@
pinctrl-names = "default";
};

light-sensor@60 {
compatible = "capella,cm36686", "vishay,vcnl4040";
reg = <0x60>;

interrupts-extended = <&tlmm 113 IRQ_TYPE_EDGE_FALLING>;
proximity-near-level = <30>;

pinctrl-0 = <&light_int_default>;
pinctrl-names = "default";
};

imu@68 {
compatible = "invensense,mpu6515";
reg = <0x68>;
Expand Down Expand Up @@ -396,4 +407,11 @@
drive-strength = <2>;
bias-disable;
};

light_int_default: light-int-default-state {
pins = "gpio113";
function = "gpio";
drive-strength = <16>;
bias-pull-up;
};
};
1 change: 1 addition & 0 deletions arch/arm64/configs/msm8916_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ CONFIG_CM3323=m
CONFIG_LTR501=m
CONFIG_STK3310=m
CONFIG_TSL2772=m
CONFIG_VCNL4000=m
CONFIG_AK8975=m
CONFIG_BMC150_MAGN_I2C=m
CONFIG_IIO_ST_MAGN_3AXIS=m
Expand Down
41 changes: 41 additions & 0 deletions drivers/iio/light/vcnl4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ static const int vcnl4040_ps_oversampling_ratio[] = {1, 2, 4, 8};
#define VCNL4000_SLEEP_DELAY_MS 2000 /* before we enter pm_runtime_suspend */

enum vcnl4000_device_ids {
CM36672P,
VCNL4000,
VCNL4010,
VCNL4040,
Expand Down Expand Up @@ -235,6 +236,8 @@ struct vcnl4000_chip_spec {
};

static const struct i2c_device_id vcnl4000_id[] = {
{ "cm36672p", CM36672P },
{ "cm36686", VCNL4040 },
{ "vcnl4000", VCNL4000 },
{ "vcnl4010", VCNL4010 },
{ "vcnl4020", VCNL4010 },
Expand Down Expand Up @@ -1855,6 +1858,22 @@ static const struct iio_chan_spec vcnl4040_channels[] = {
}
};

static const struct iio_chan_spec cm36672p_channels[] = {
{
.type = IIO_PROXIMITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_INT_TIME) |
BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) |
BIT(IIO_CHAN_INFO_CALIBBIAS),
.info_mask_separate_available = BIT(IIO_CHAN_INFO_INT_TIME) |
BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) |
BIT(IIO_CHAN_INFO_CALIBBIAS),
.ext_info = vcnl4000_ext_info,
.event_spec = vcnl4040_event_spec,
.num_event_specs = ARRAY_SIZE(vcnl4040_event_spec),
},
};

static const struct iio_info vcnl4000_info = {
.read_raw = vcnl4000_read_raw,
};
Expand All @@ -1880,6 +1899,19 @@ static const struct iio_info vcnl4040_info = {
};

static const struct vcnl4000_chip_spec vcnl4000_chip_spec_cfg[] = {
[CM36672P] = {
.prod = "CM36672P",
.init = vcnl4200_init,
.measure_proximity = vcnl4200_measure_proximity,
.set_power_state = vcnl4200_set_power_state,
.channels = cm36672p_channels,
.num_channels = ARRAY_SIZE(cm36672p_channels),
.info = &vcnl4040_info,
.irq_thread = vcnl4040_irq_thread,
.int_reg = VCNL4040_INT_FLAGS,
.ps_it_times = &vcnl4040_ps_it_times,
.num_ps_it_times = ARRAY_SIZE(vcnl4040_ps_it_times),
},
[VCNL4000] = {
.prod = "VCNL4000",
.init = vcnl4000_init,
Expand Down Expand Up @@ -2046,6 +2078,15 @@ static int vcnl4000_probe(struct i2c_client *client)
}

static const struct of_device_id vcnl_4000_of_match[] = {
{
.compatible = "capella,cm36672p",
.data = (void *)CM36672P,
},
/* Capella CM36686 is fully compatible with Vishay VCNL4040 */
{
.compatible = "capella,cm36686",
.data = (void *)VCNL4040,
},
{
.compatible = "vishay,vcnl4000",
.data = (void *)VCNL4000,
Expand Down