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 93*09d5135bSAlexandru 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 97*09d5135bSAlexandru 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 104*09d5135bSAlexandru 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 113*09d5135bSAlexandru 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 118*09d5135bSAlexandru 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 123*09d5135bSAlexandru 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) { 130*09d5135bSAlexandru 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 143*09d5135bSAlexandru 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: 156*09d5135bSAlexandru 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 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); 171*09d5135bSAlexandru 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 191*09d5135bSAlexandru Ardelean static int rfd77402_init(struct i2c_client *client) 19279e64188SPeter Meerwald-Stadler { 19379e64188SPeter Meerwald-Stadler int ret, i; 19479e64188SPeter Meerwald-Stadler 195*09d5135bSAlexandru 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 */ 201*09d5135bSAlexandru 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 */ 207*09d5135bSAlexandru 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 */ 216*09d5135bSAlexandru 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 220*09d5135bSAlexandru 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 */ 226*09d5135bSAlexandru 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 230*09d5135bSAlexandru 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++) { 236*09d5135bSAlexandru 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 243*09d5135bSAlexandru 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 249*09d5135bSAlexandru Ardelean static int rfd77402_powerdown(struct i2c_client *client) 25079e64188SPeter Meerwald-Stadler { 251*09d5135bSAlexandru Ardelean return rfd77402_set_state(client, RFD77402_CMD_STANDBY, 25279e64188SPeter Meerwald-Stadler RFD77402_STATUS_STANDBY); 25379e64188SPeter Meerwald-Stadler } 25479e64188SPeter Meerwald-Stadler 25579e64188SPeter Meerwald-Stadler static int rfd77402_probe(struct i2c_client *client, 25679e64188SPeter Meerwald-Stadler const struct i2c_device_id *id) 25779e64188SPeter Meerwald-Stadler { 25879e64188SPeter Meerwald-Stadler struct rfd77402_data *data; 25979e64188SPeter Meerwald-Stadler struct iio_dev *indio_dev; 26079e64188SPeter Meerwald-Stadler int ret; 26179e64188SPeter Meerwald-Stadler 26279e64188SPeter Meerwald-Stadler ret = i2c_smbus_read_word_data(client, RFD77402_MOD_CHIP_ID); 26379e64188SPeter Meerwald-Stadler if (ret < 0) 26479e64188SPeter Meerwald-Stadler return ret; 26579e64188SPeter Meerwald-Stadler if (ret != 0xad01 && ret != 0xad02) /* known chip ids */ 26679e64188SPeter Meerwald-Stadler return -ENODEV; 26779e64188SPeter Meerwald-Stadler 26879e64188SPeter Meerwald-Stadler indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); 26979e64188SPeter Meerwald-Stadler if (!indio_dev) 27079e64188SPeter Meerwald-Stadler return -ENOMEM; 27179e64188SPeter Meerwald-Stadler 27279e64188SPeter Meerwald-Stadler data = iio_priv(indio_dev); 27379e64188SPeter Meerwald-Stadler i2c_set_clientdata(client, indio_dev); 27479e64188SPeter Meerwald-Stadler data->client = client; 27579e64188SPeter Meerwald-Stadler mutex_init(&data->lock); 27679e64188SPeter Meerwald-Stadler 27779e64188SPeter Meerwald-Stadler indio_dev->info = &rfd77402_info; 27879e64188SPeter Meerwald-Stadler indio_dev->channels = rfd77402_channels; 27979e64188SPeter Meerwald-Stadler indio_dev->num_channels = ARRAY_SIZE(rfd77402_channels); 28079e64188SPeter Meerwald-Stadler indio_dev->name = RFD77402_DRV_NAME; 28179e64188SPeter Meerwald-Stadler indio_dev->modes = INDIO_DIRECT_MODE; 28279e64188SPeter Meerwald-Stadler 283*09d5135bSAlexandru Ardelean ret = rfd77402_init(client); 28479e64188SPeter Meerwald-Stadler if (ret < 0) 28579e64188SPeter Meerwald-Stadler return ret; 28679e64188SPeter Meerwald-Stadler 28779e64188SPeter Meerwald-Stadler ret = iio_device_register(indio_dev); 28879e64188SPeter Meerwald-Stadler if (ret) 28979e64188SPeter Meerwald-Stadler goto err_powerdown; 29079e64188SPeter Meerwald-Stadler 29179e64188SPeter Meerwald-Stadler return 0; 29279e64188SPeter Meerwald-Stadler 29379e64188SPeter Meerwald-Stadler err_powerdown: 294*09d5135bSAlexandru Ardelean rfd77402_powerdown(client); 29579e64188SPeter Meerwald-Stadler return ret; 29679e64188SPeter Meerwald-Stadler } 29779e64188SPeter Meerwald-Stadler 29879e64188SPeter Meerwald-Stadler static int rfd77402_remove(struct i2c_client *client) 29979e64188SPeter Meerwald-Stadler { 30079e64188SPeter Meerwald-Stadler struct iio_dev *indio_dev = i2c_get_clientdata(client); 30179e64188SPeter Meerwald-Stadler 30279e64188SPeter Meerwald-Stadler iio_device_unregister(indio_dev); 303*09d5135bSAlexandru Ardelean rfd77402_powerdown(client); 30479e64188SPeter Meerwald-Stadler 30579e64188SPeter Meerwald-Stadler return 0; 30679e64188SPeter Meerwald-Stadler } 30779e64188SPeter Meerwald-Stadler 30879e64188SPeter Meerwald-Stadler #ifdef CONFIG_PM_SLEEP 30979e64188SPeter Meerwald-Stadler static int rfd77402_suspend(struct device *dev) 31079e64188SPeter Meerwald-Stadler { 311*09d5135bSAlexandru Ardelean return rfd77402_powerdown(to_i2c_client(dev)); 31279e64188SPeter Meerwald-Stadler } 31379e64188SPeter Meerwald-Stadler 31479e64188SPeter Meerwald-Stadler static int rfd77402_resume(struct device *dev) 31579e64188SPeter Meerwald-Stadler { 316*09d5135bSAlexandru Ardelean return rfd77402_init(to_i2c_client(dev)); 31779e64188SPeter Meerwald-Stadler } 31879e64188SPeter Meerwald-Stadler #endif 31979e64188SPeter Meerwald-Stadler 32079e64188SPeter Meerwald-Stadler static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume); 32179e64188SPeter Meerwald-Stadler 32279e64188SPeter Meerwald-Stadler static const struct i2c_device_id rfd77402_id[] = { 32379e64188SPeter Meerwald-Stadler { "rfd77402", 0}, 32479e64188SPeter Meerwald-Stadler { } 32579e64188SPeter Meerwald-Stadler }; 32679e64188SPeter Meerwald-Stadler MODULE_DEVICE_TABLE(i2c, rfd77402_id); 32779e64188SPeter Meerwald-Stadler 32879e64188SPeter Meerwald-Stadler static struct i2c_driver rfd77402_driver = { 32979e64188SPeter Meerwald-Stadler .driver = { 33079e64188SPeter Meerwald-Stadler .name = RFD77402_DRV_NAME, 33179e64188SPeter Meerwald-Stadler .pm = &rfd77402_pm_ops, 33279e64188SPeter Meerwald-Stadler }, 33379e64188SPeter Meerwald-Stadler .probe = rfd77402_probe, 33479e64188SPeter Meerwald-Stadler .remove = rfd77402_remove, 33579e64188SPeter Meerwald-Stadler .id_table = rfd77402_id, 33679e64188SPeter Meerwald-Stadler }; 33779e64188SPeter Meerwald-Stadler 33879e64188SPeter Meerwald-Stadler module_i2c_driver(rfd77402_driver); 33979e64188SPeter Meerwald-Stadler 34079e64188SPeter Meerwald-Stadler MODULE_AUTHOR("Peter Meerwald-Stadler <pmeerw@pmeerw.net>"); 34179e64188SPeter Meerwald-Stadler MODULE_DESCRIPTION("RFD77402 Time-of-Flight sensor driver"); 34279e64188SPeter Meerwald-Stadler MODULE_LICENSE("GPL"); 343