136edc939SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
279e64188SPeter Meerwald-Stadler /*
379e64188SPeter Meerwald-Stadler * rfd77402.c - Support for RF Digital RFD77402 Time-of-Flight (distance) sensor
479e64188SPeter Meerwald-Stadler *
579e64188SPeter Meerwald-Stadler * Copyright 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net>
679e64188SPeter Meerwald-Stadler *
779e64188SPeter Meerwald-Stadler * 7-bit I2C slave address 0x4c
879e64188SPeter Meerwald-Stadler *
979e64188SPeter Meerwald-Stadler * TODO: interrupt
1079e64188SPeter Meerwald-Stadler * https://media.digikey.com/pdf/Data%20Sheets/RF%20Digital%20PDFs/RFD77402.pdf
1179e64188SPeter Meerwald-Stadler */
1279e64188SPeter Meerwald-Stadler
1379e64188SPeter Meerwald-Stadler #include <linux/module.h>
1479e64188SPeter Meerwald-Stadler #include <linux/i2c.h>
1579e64188SPeter Meerwald-Stadler #include <linux/delay.h>
1679e64188SPeter Meerwald-Stadler
1779e64188SPeter Meerwald-Stadler #include <linux/iio/iio.h>
1879e64188SPeter Meerwald-Stadler
1979e64188SPeter Meerwald-Stadler #define RFD77402_DRV_NAME "rfd77402"
2079e64188SPeter Meerwald-Stadler
2179e64188SPeter Meerwald-Stadler #define RFD77402_ICSR 0x00 /* Interrupt Control Status Register */
2279e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_INT_MODE BIT(2)
2379e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_INT_POL BIT(3)
2479e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_RESULT BIT(4)
2579e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_M2H_MSG BIT(5)
2679e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_H2M_MSG BIT(6)
2779e64188SPeter Meerwald-Stadler #define RFD77402_ICSR_RESET BIT(7)
2879e64188SPeter Meerwald-Stadler
2979e64188SPeter Meerwald-Stadler #define RFD77402_CMD_R 0x04
3079e64188SPeter Meerwald-Stadler #define RFD77402_CMD_SINGLE 0x01
3179e64188SPeter Meerwald-Stadler #define RFD77402_CMD_STANDBY 0x10
3279e64188SPeter Meerwald-Stadler #define RFD77402_CMD_MCPU_OFF 0x11
3379e64188SPeter Meerwald-Stadler #define RFD77402_CMD_MCPU_ON 0x12
3479e64188SPeter Meerwald-Stadler #define RFD77402_CMD_RESET BIT(6)
3579e64188SPeter Meerwald-Stadler #define RFD77402_CMD_VALID BIT(7)
3679e64188SPeter Meerwald-Stadler
3779e64188SPeter Meerwald-Stadler #define RFD77402_STATUS_R 0x06
3879e64188SPeter Meerwald-Stadler #define RFD77402_STATUS_PM_MASK GENMASK(4, 0)
3979e64188SPeter Meerwald-Stadler #define RFD77402_STATUS_STANDBY 0x00
4079e64188SPeter Meerwald-Stadler #define RFD77402_STATUS_MCPU_OFF 0x10
4179e64188SPeter Meerwald-Stadler #define RFD77402_STATUS_MCPU_ON 0x18
4279e64188SPeter Meerwald-Stadler
4379e64188SPeter Meerwald-Stadler #define RFD77402_RESULT_R 0x08
4479e64188SPeter Meerwald-Stadler #define RFD77402_RESULT_DIST_MASK GENMASK(12, 2)
4579e64188SPeter Meerwald-Stadler #define RFD77402_RESULT_ERR_MASK GENMASK(14, 13)
4679e64188SPeter Meerwald-Stadler #define RFD77402_RESULT_VALID BIT(15)
4779e64188SPeter Meerwald-Stadler
4879e64188SPeter Meerwald-Stadler #define RFD77402_PMU_CFG 0x14
4979e64188SPeter Meerwald-Stadler #define RFD77402_PMU_MCPU_INIT BIT(9)
5079e64188SPeter Meerwald-Stadler
5179e64188SPeter Meerwald-Stadler #define RFD77402_I2C_INIT_CFG 0x1c
5279e64188SPeter Meerwald-Stadler #define RFD77402_I2C_ADDR_INCR BIT(0)
5379e64188SPeter Meerwald-Stadler #define RFD77402_I2C_DATA_INCR BIT(2)
5479e64188SPeter Meerwald-Stadler #define RFD77402_I2C_HOST_DEBUG BIT(5)
5579e64188SPeter Meerwald-Stadler #define RFD77402_I2C_MCPU_DEBUG BIT(6)
5679e64188SPeter Meerwald-Stadler
5779e64188SPeter Meerwald-Stadler #define RFD77402_CMD_CFGR_A 0x0c
5879e64188SPeter Meerwald-Stadler #define RFD77402_CMD_CFGR_B 0x0e
5979e64188SPeter Meerwald-Stadler #define RFD77402_HFCFG_0 0x20
6079e64188SPeter Meerwald-Stadler #define RFD77402_HFCFG_1 0x22
6179e64188SPeter Meerwald-Stadler #define RFD77402_HFCFG_2 0x24
6279e64188SPeter Meerwald-Stadler #define RFD77402_HFCFG_3 0x26
6379e64188SPeter Meerwald-Stadler
6479e64188SPeter Meerwald-Stadler #define RFD77402_MOD_CHIP_ID 0x28
6579e64188SPeter Meerwald-Stadler
6679e64188SPeter Meerwald-Stadler /* magic configuration values from datasheet */
6779e64188SPeter Meerwald-Stadler static const struct {
6879e64188SPeter Meerwald-Stadler u8 reg;
6979e64188SPeter Meerwald-Stadler u16 val;
7079e64188SPeter Meerwald-Stadler } rf77402_tof_config[] = {
7179e64188SPeter Meerwald-Stadler {RFD77402_CMD_CFGR_A, 0xe100},
7279e64188SPeter Meerwald-Stadler {RFD77402_CMD_CFGR_B, 0x10ff},
7379e64188SPeter Meerwald-Stadler {RFD77402_HFCFG_0, 0x07d0},
7479e64188SPeter Meerwald-Stadler {RFD77402_HFCFG_1, 0x5008},
7579e64188SPeter Meerwald-Stadler {RFD77402_HFCFG_2, 0xa041},
7679e64188SPeter Meerwald-Stadler {RFD77402_HFCFG_3, 0x45d4},
7779e64188SPeter Meerwald-Stadler };
7879e64188SPeter Meerwald-Stadler
7979e64188SPeter Meerwald-Stadler struct rfd77402_data {
8079e64188SPeter Meerwald-Stadler struct i2c_client *client;
8179e64188SPeter Meerwald-Stadler /* Serialize reads from the sensor */
8279e64188SPeter Meerwald-Stadler struct mutex lock;
8379e64188SPeter Meerwald-Stadler };
8479e64188SPeter Meerwald-Stadler
8579e64188SPeter Meerwald-Stadler static const struct iio_chan_spec rfd77402_channels[] = {
8679e64188SPeter Meerwald-Stadler {
8779e64188SPeter Meerwald-Stadler .type = IIO_DISTANCE,
8879e64188SPeter Meerwald-Stadler .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
8979e64188SPeter Meerwald-Stadler BIT(IIO_CHAN_INFO_SCALE),
9079e64188SPeter Meerwald-Stadler },
9179e64188SPeter Meerwald-Stadler };
9279e64188SPeter Meerwald-Stadler
rfd77402_set_state(struct i2c_client * client,u8 state,u16 check)9309d5135bSAlexandru Ardelean static int rfd77402_set_state(struct i2c_client *client, u8 state, u16 check)
9479e64188SPeter Meerwald-Stadler {
9579e64188SPeter Meerwald-Stadler int ret;
9679e64188SPeter Meerwald-Stadler
9709d5135bSAlexandru Ardelean ret = i2c_smbus_write_byte_data(client, RFD77402_CMD_R,
9879e64188SPeter Meerwald-Stadler state | RFD77402_CMD_VALID);
9979e64188SPeter Meerwald-Stadler if (ret < 0)
10079e64188SPeter Meerwald-Stadler return ret;
10179e64188SPeter Meerwald-Stadler
10279e64188SPeter Meerwald-Stadler usleep_range(10000, 20000);
10379e64188SPeter Meerwald-Stadler
10409d5135bSAlexandru Ardelean ret = i2c_smbus_read_word_data(client, RFD77402_STATUS_R);
10579e64188SPeter Meerwald-Stadler if (ret < 0)
10679e64188SPeter Meerwald-Stadler return ret;
10779e64188SPeter Meerwald-Stadler if ((ret & RFD77402_STATUS_PM_MASK) != check)
10879e64188SPeter Meerwald-Stadler return -ENODEV;
10979e64188SPeter Meerwald-Stadler
11079e64188SPeter Meerwald-Stadler return 0;
11179e64188SPeter Meerwald-Stadler }
11279e64188SPeter Meerwald-Stadler
rfd77402_measure(struct i2c_client * client)11309d5135bSAlexandru Ardelean static int rfd77402_measure(struct i2c_client *client)
11479e64188SPeter Meerwald-Stadler {
11579e64188SPeter Meerwald-Stadler int ret;
11679e64188SPeter Meerwald-Stadler int tries = 10;
11779e64188SPeter Meerwald-Stadler
11809d5135bSAlexandru Ardelean ret = rfd77402_set_state(client, RFD77402_CMD_MCPU_ON,
11979e64188SPeter Meerwald-Stadler RFD77402_STATUS_MCPU_ON);
12079e64188SPeter Meerwald-Stadler if (ret < 0)
12179e64188SPeter Meerwald-Stadler return ret;
12279e64188SPeter Meerwald-Stadler
12309d5135bSAlexandru Ardelean ret = i2c_smbus_write_byte_data(client, RFD77402_CMD_R,
12479e64188SPeter Meerwald-Stadler RFD77402_CMD_SINGLE |
12579e64188SPeter Meerwald-Stadler RFD77402_CMD_VALID);
12679e64188SPeter Meerwald-Stadler if (ret < 0)
12779e64188SPeter Meerwald-Stadler goto err;
12879e64188SPeter Meerwald-Stadler
12979e64188SPeter Meerwald-Stadler while (tries-- > 0) {
13009d5135bSAlexandru Ardelean ret = i2c_smbus_read_byte_data(client, RFD77402_ICSR);
13179e64188SPeter Meerwald-Stadler if (ret < 0)
13279e64188SPeter Meerwald-Stadler goto err;
13379e64188SPeter Meerwald-Stadler if (ret & RFD77402_ICSR_RESULT)
13479e64188SPeter Meerwald-Stadler break;
13579e64188SPeter Meerwald-Stadler msleep(20);
13679e64188SPeter Meerwald-Stadler }
13779e64188SPeter Meerwald-Stadler
13879e64188SPeter Meerwald-Stadler if (tries < 0) {
13979e64188SPeter Meerwald-Stadler ret = -ETIMEDOUT;
14079e64188SPeter Meerwald-Stadler goto err;
14179e64188SPeter Meerwald-Stadler }
14279e64188SPeter Meerwald-Stadler
14309d5135bSAlexandru Ardelean ret = i2c_smbus_read_word_data(client, RFD77402_RESULT_R);
14479e64188SPeter Meerwald-Stadler if (ret < 0)
14579e64188SPeter Meerwald-Stadler goto err;
14679e64188SPeter Meerwald-Stadler
14779e64188SPeter Meerwald-Stadler if ((ret & RFD77402_RESULT_ERR_MASK) ||
14879e64188SPeter Meerwald-Stadler !(ret & RFD77402_RESULT_VALID)) {
14979e64188SPeter Meerwald-Stadler ret = -EIO;
15079e64188SPeter Meerwald-Stadler goto err;
15179e64188SPeter Meerwald-Stadler }
15279e64188SPeter Meerwald-Stadler
15379e64188SPeter Meerwald-Stadler return (ret & RFD77402_RESULT_DIST_MASK) >> 2;
15479e64188SPeter Meerwald-Stadler
15579e64188SPeter Meerwald-Stadler err:
15609d5135bSAlexandru Ardelean rfd77402_set_state(client, RFD77402_CMD_MCPU_OFF,
15779e64188SPeter Meerwald-Stadler RFD77402_STATUS_MCPU_OFF);
15879e64188SPeter Meerwald-Stadler return ret;
15979e64188SPeter Meerwald-Stadler }
16079e64188SPeter Meerwald-Stadler
rfd77402_read_raw(struct iio_dev * indio_dev,struct iio_chan_spec const * chan,int * val,int * val2,long mask)16179e64188SPeter Meerwald-Stadler static int rfd77402_read_raw(struct iio_dev *indio_dev,
16279e64188SPeter Meerwald-Stadler struct iio_chan_spec const *chan,
16379e64188SPeter Meerwald-Stadler int *val, int *val2, long mask)
16479e64188SPeter Meerwald-Stadler {
16579e64188SPeter Meerwald-Stadler struct rfd77402_data *data = iio_priv(indio_dev);
16679e64188SPeter Meerwald-Stadler int ret;
16779e64188SPeter Meerwald-Stadler
16879e64188SPeter Meerwald-Stadler switch (mask) {
16979e64188SPeter Meerwald-Stadler case IIO_CHAN_INFO_RAW:
17079e64188SPeter Meerwald-Stadler mutex_lock(&data->lock);
17109d5135bSAlexandru Ardelean ret = rfd77402_measure(data->client);
17279e64188SPeter Meerwald-Stadler mutex_unlock(&data->lock);
17379e64188SPeter Meerwald-Stadler if (ret < 0)
17479e64188SPeter Meerwald-Stadler return ret;
17579e64188SPeter Meerwald-Stadler *val = ret;
17679e64188SPeter Meerwald-Stadler return IIO_VAL_INT;
17779e64188SPeter Meerwald-Stadler case IIO_CHAN_INFO_SCALE:
17879e64188SPeter Meerwald-Stadler /* 1 LSB is 1 mm */
17979e64188SPeter Meerwald-Stadler *val = 0;
18079e64188SPeter Meerwald-Stadler *val2 = 1000;
18179e64188SPeter Meerwald-Stadler return IIO_VAL_INT_PLUS_MICRO;
18279e64188SPeter Meerwald-Stadler default:
18379e64188SPeter Meerwald-Stadler return -EINVAL;
18479e64188SPeter Meerwald-Stadler }
18579e64188SPeter Meerwald-Stadler }
18679e64188SPeter Meerwald-Stadler
18779e64188SPeter Meerwald-Stadler static const struct iio_info rfd77402_info = {
18879e64188SPeter Meerwald-Stadler .read_raw = rfd77402_read_raw,
18979e64188SPeter Meerwald-Stadler };
19079e64188SPeter Meerwald-Stadler
rfd77402_init(struct i2c_client * client)19109d5135bSAlexandru Ardelean static int rfd77402_init(struct i2c_client *client)
19279e64188SPeter Meerwald-Stadler {
19379e64188SPeter Meerwald-Stadler int ret, i;
19479e64188SPeter Meerwald-Stadler
19509d5135bSAlexandru Ardelean ret = rfd77402_set_state(client, RFD77402_CMD_STANDBY,
19679e64188SPeter Meerwald-Stadler RFD77402_STATUS_STANDBY);
19779e64188SPeter Meerwald-Stadler if (ret < 0)
19879e64188SPeter Meerwald-Stadler return ret;
19979e64188SPeter Meerwald-Stadler
20079e64188SPeter Meerwald-Stadler /* configure INT pad as push-pull, active low */
20109d5135bSAlexandru Ardelean ret = i2c_smbus_write_byte_data(client, RFD77402_ICSR,
20279e64188SPeter Meerwald-Stadler RFD77402_ICSR_INT_MODE);
20379e64188SPeter Meerwald-Stadler if (ret < 0)
20479e64188SPeter Meerwald-Stadler return ret;
20579e64188SPeter Meerwald-Stadler
20679e64188SPeter Meerwald-Stadler /* I2C configuration */
20709d5135bSAlexandru Ardelean ret = i2c_smbus_write_word_data(client, RFD77402_I2C_INIT_CFG,
20879e64188SPeter Meerwald-Stadler RFD77402_I2C_ADDR_INCR |
20979e64188SPeter Meerwald-Stadler RFD77402_I2C_DATA_INCR |
21079e64188SPeter Meerwald-Stadler RFD77402_I2C_HOST_DEBUG |
21179e64188SPeter Meerwald-Stadler RFD77402_I2C_MCPU_DEBUG);
21279e64188SPeter Meerwald-Stadler if (ret < 0)
21379e64188SPeter Meerwald-Stadler return ret;
21479e64188SPeter Meerwald-Stadler
21579e64188SPeter Meerwald-Stadler /* set initialization */
21609d5135bSAlexandru Ardelean ret = i2c_smbus_write_word_data(client, RFD77402_PMU_CFG, 0x0500);
21779e64188SPeter Meerwald-Stadler if (ret < 0)
21879e64188SPeter Meerwald-Stadler return ret;
21979e64188SPeter Meerwald-Stadler
22009d5135bSAlexandru Ardelean ret = rfd77402_set_state(client, RFD77402_CMD_MCPU_OFF,
22179e64188SPeter Meerwald-Stadler RFD77402_STATUS_MCPU_OFF);
22279e64188SPeter Meerwald-Stadler if (ret < 0)
22379e64188SPeter Meerwald-Stadler return ret;
22479e64188SPeter Meerwald-Stadler
22579e64188SPeter Meerwald-Stadler /* set initialization */
22609d5135bSAlexandru Ardelean ret = i2c_smbus_write_word_data(client, RFD77402_PMU_CFG, 0x0600);
22779e64188SPeter Meerwald-Stadler if (ret < 0)
22879e64188SPeter Meerwald-Stadler return ret;
22979e64188SPeter Meerwald-Stadler
23009d5135bSAlexandru Ardelean ret = rfd77402_set_state(client, RFD77402_CMD_MCPU_ON,
23179e64188SPeter Meerwald-Stadler RFD77402_STATUS_MCPU_ON);
23279e64188SPeter Meerwald-Stadler if (ret < 0)
23379e64188SPeter Meerwald-Stadler return ret;
23479e64188SPeter Meerwald-Stadler
23579e64188SPeter Meerwald-Stadler for (i = 0; i < ARRAY_SIZE(rf77402_tof_config); i++) {
23609d5135bSAlexandru Ardelean ret = i2c_smbus_write_word_data(client,
23779e64188SPeter Meerwald-Stadler rf77402_tof_config[i].reg,
23879e64188SPeter Meerwald-Stadler rf77402_tof_config[i].val);
23979e64188SPeter Meerwald-Stadler if (ret < 0)
24079e64188SPeter Meerwald-Stadler return ret;
24179e64188SPeter Meerwald-Stadler }
24279e64188SPeter Meerwald-Stadler
24309d5135bSAlexandru Ardelean ret = rfd77402_set_state(client, RFD77402_CMD_STANDBY,
24479e64188SPeter Meerwald-Stadler RFD77402_STATUS_STANDBY);
24579e64188SPeter Meerwald-Stadler
24679e64188SPeter Meerwald-Stadler return ret;
24779e64188SPeter Meerwald-Stadler }
24879e64188SPeter Meerwald-Stadler
rfd77402_powerdown(struct i2c_client * client)24909d5135bSAlexandru Ardelean static int rfd77402_powerdown(struct i2c_client *client)
25079e64188SPeter Meerwald-Stadler {
25109d5135bSAlexandru Ardelean return rfd77402_set_state(client, RFD77402_CMD_STANDBY,
25279e64188SPeter Meerwald-Stadler RFD77402_STATUS_STANDBY);
25379e64188SPeter Meerwald-Stadler }
25479e64188SPeter Meerwald-Stadler
rfd77402_disable(void * client)255148da125SAlexandru Ardelean static void rfd77402_disable(void *client)
256148da125SAlexandru Ardelean {
257148da125SAlexandru Ardelean rfd77402_powerdown(client);
258148da125SAlexandru Ardelean }
259148da125SAlexandru Ardelean
rfd77402_probe(struct i2c_client * client)260576eb2b0SUwe Kleine-König static int rfd77402_probe(struct i2c_client *client)
26179e64188SPeter Meerwald-Stadler {
26279e64188SPeter Meerwald-Stadler struct rfd77402_data *data;
26379e64188SPeter Meerwald-Stadler struct iio_dev *indio_dev;
26479e64188SPeter Meerwald-Stadler int ret;
26579e64188SPeter Meerwald-Stadler
26679e64188SPeter Meerwald-Stadler ret = i2c_smbus_read_word_data(client, RFD77402_MOD_CHIP_ID);
26779e64188SPeter Meerwald-Stadler if (ret < 0)
26879e64188SPeter Meerwald-Stadler return ret;
26979e64188SPeter Meerwald-Stadler if (ret != 0xad01 && ret != 0xad02) /* known chip ids */
27079e64188SPeter Meerwald-Stadler return -ENODEV;
27179e64188SPeter Meerwald-Stadler
27279e64188SPeter Meerwald-Stadler indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
27379e64188SPeter Meerwald-Stadler if (!indio_dev)
27479e64188SPeter Meerwald-Stadler return -ENOMEM;
27579e64188SPeter Meerwald-Stadler
27679e64188SPeter Meerwald-Stadler data = iio_priv(indio_dev);
27779e64188SPeter Meerwald-Stadler data->client = client;
27879e64188SPeter Meerwald-Stadler mutex_init(&data->lock);
27979e64188SPeter Meerwald-Stadler
28079e64188SPeter Meerwald-Stadler indio_dev->info = &rfd77402_info;
28179e64188SPeter Meerwald-Stadler indio_dev->channels = rfd77402_channels;
28279e64188SPeter Meerwald-Stadler indio_dev->num_channels = ARRAY_SIZE(rfd77402_channels);
28379e64188SPeter Meerwald-Stadler indio_dev->name = RFD77402_DRV_NAME;
28479e64188SPeter Meerwald-Stadler indio_dev->modes = INDIO_DIRECT_MODE;
28579e64188SPeter Meerwald-Stadler
28609d5135bSAlexandru Ardelean ret = rfd77402_init(client);
28779e64188SPeter Meerwald-Stadler if (ret < 0)
28879e64188SPeter Meerwald-Stadler return ret;
28979e64188SPeter Meerwald-Stadler
290148da125SAlexandru Ardelean ret = devm_add_action_or_reset(&client->dev, rfd77402_disable, client);
29179e64188SPeter Meerwald-Stadler if (ret)
29279e64188SPeter Meerwald-Stadler return ret;
29379e64188SPeter Meerwald-Stadler
294148da125SAlexandru Ardelean return devm_iio_device_register(&client->dev, indio_dev);
29579e64188SPeter Meerwald-Stadler }
29679e64188SPeter Meerwald-Stadler
rfd77402_suspend(struct device * dev)29779e64188SPeter Meerwald-Stadler static int rfd77402_suspend(struct device *dev)
29879e64188SPeter Meerwald-Stadler {
29909d5135bSAlexandru Ardelean return rfd77402_powerdown(to_i2c_client(dev));
30079e64188SPeter Meerwald-Stadler }
30179e64188SPeter Meerwald-Stadler
rfd77402_resume(struct device * dev)30279e64188SPeter Meerwald-Stadler static int rfd77402_resume(struct device *dev)
30379e64188SPeter Meerwald-Stadler {
30409d5135bSAlexandru Ardelean return rfd77402_init(to_i2c_client(dev));
30579e64188SPeter Meerwald-Stadler }
30679e64188SPeter Meerwald-Stadler
307fe895d25SJonathan Cameron static DEFINE_SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend,
308fe895d25SJonathan Cameron rfd77402_resume);
30979e64188SPeter Meerwald-Stadler
31079e64188SPeter Meerwald-Stadler static const struct i2c_device_id rfd77402_id[] = {
311*4391affaSUwe Kleine-König { "rfd77402" },
31279e64188SPeter Meerwald-Stadler { }
31379e64188SPeter Meerwald-Stadler };
31479e64188SPeter Meerwald-Stadler MODULE_DEVICE_TABLE(i2c, rfd77402_id);
31579e64188SPeter Meerwald-Stadler
31679e64188SPeter Meerwald-Stadler static struct i2c_driver rfd77402_driver = {
31779e64188SPeter Meerwald-Stadler .driver = {
31879e64188SPeter Meerwald-Stadler .name = RFD77402_DRV_NAME,
319fe895d25SJonathan Cameron .pm = pm_sleep_ptr(&rfd77402_pm_ops),
32079e64188SPeter Meerwald-Stadler },
3217cf15f42SUwe Kleine-König .probe = rfd77402_probe,
32279e64188SPeter Meerwald-Stadler .id_table = rfd77402_id,
32379e64188SPeter Meerwald-Stadler };
32479e64188SPeter Meerwald-Stadler
32579e64188SPeter Meerwald-Stadler module_i2c_driver(rfd77402_driver);
32679e64188SPeter Meerwald-Stadler
32779e64188SPeter Meerwald-Stadler MODULE_AUTHOR("Peter Meerwald-Stadler <pmeerw@pmeerw.net>");
32879e64188SPeter Meerwald-Stadler MODULE_DESCRIPTION("RFD77402 Time-of-Flight sensor driver");
32979e64188SPeter Meerwald-Stadler MODULE_LICENSE("GPL");
330