diff options
| -rw-r--r-- | drivers/i2c/busses/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/i2c/i2c-core.c | 2 | ||||
| -rw-r--r-- | include/linux/i2c.h | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 31e8308ba899..ab838d9e28b6 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
| @@ -881,6 +881,7 @@ config I2C_XLR | |||
| 881 | config I2C_RCAR | 881 | config I2C_RCAR |
| 882 | tristate "Renesas R-Car I2C Controller" | 882 | tristate "Renesas R-Car I2C Controller" |
| 883 | depends on ARCH_SHMOBILE || COMPILE_TEST | 883 | depends on ARCH_SHMOBILE || COMPILE_TEST |
| 884 | select I2C_SLAVE | ||
| 884 | help | 885 | help |
| 885 | If you say yes to this option, support will be included for the | 886 | If you say yes to this option, support will be included for the |
| 886 | R-Car I2C controller. | 887 | R-Car I2C controller. |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 39d25a8cb1ad..e9eae57a2b50 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -2972,6 +2972,7 @@ trace: | |||
| 2972 | } | 2972 | } |
| 2973 | EXPORT_SYMBOL(i2c_smbus_xfer); | 2973 | EXPORT_SYMBOL(i2c_smbus_xfer); |
| 2974 | 2974 | ||
| 2975 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
| 2975 | int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb) | 2976 | int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb) |
| 2976 | { | 2977 | { |
| 2977 | int ret; | 2978 | int ret; |
| @@ -3019,6 +3020,7 @@ int i2c_slave_unregister(struct i2c_client *client) | |||
| 3019 | return ret; | 3020 | return ret; |
| 3020 | } | 3021 | } |
| 3021 | EXPORT_SYMBOL_GPL(i2c_slave_unregister); | 3022 | EXPORT_SYMBOL_GPL(i2c_slave_unregister); |
| 3023 | #endif | ||
| 3022 | 3024 | ||
| 3023 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); | 3025 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); |
| 3024 | MODULE_DESCRIPTION("I2C-Bus main module"); | 3026 | MODULE_DESCRIPTION("I2C-Bus main module"); |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index e3a1721c8354..7c7695940ddd 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -228,7 +228,9 @@ struct i2c_client { | |||
| 228 | struct device dev; /* the device structure */ | 228 | struct device dev; /* the device structure */ |
| 229 | int irq; /* irq issued by device */ | 229 | int irq; /* irq issued by device */ |
| 230 | struct list_head detected; | 230 | struct list_head detected; |
| 231 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
| 231 | i2c_slave_cb_t slave_cb; /* callback for slave mode */ | 232 | i2c_slave_cb_t slave_cb; /* callback for slave mode */ |
| 233 | #endif | ||
| 232 | }; | 234 | }; |
| 233 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) | 235 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) |
| 234 | 236 | ||
| @@ -253,6 +255,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) | |||
| 253 | 255 | ||
| 254 | /* I2C slave support */ | 256 | /* I2C slave support */ |
| 255 | 257 | ||
| 258 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
| 256 | enum i2c_slave_event { | 259 | enum i2c_slave_event { |
| 257 | I2C_SLAVE_REQ_READ_START, | 260 | I2C_SLAVE_REQ_READ_START, |
| 258 | I2C_SLAVE_REQ_READ_END, | 261 | I2C_SLAVE_REQ_READ_END, |
| @@ -269,6 +272,7 @@ static inline int i2c_slave_event(struct i2c_client *client, | |||
| 269 | { | 272 | { |
| 270 | return client->slave_cb(client, event, val); | 273 | return client->slave_cb(client, event, val); |
| 271 | } | 274 | } |
| 275 | #endif | ||
| 272 | 276 | ||
| 273 | /** | 277 | /** |
| 274 | * struct i2c_board_info - template for device creation | 278 | * struct i2c_board_info - template for device creation |
| @@ -404,8 +408,10 @@ struct i2c_algorithm { | |||
| 404 | /* To determine what the adapter supports */ | 408 | /* To determine what the adapter supports */ |
| 405 | u32 (*functionality) (struct i2c_adapter *); | 409 | u32 (*functionality) (struct i2c_adapter *); |
| 406 | 410 | ||
| 411 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
| 407 | int (*reg_slave)(struct i2c_client *client); | 412 | int (*reg_slave)(struct i2c_client *client); |
| 408 | int (*unreg_slave)(struct i2c_client *client); | 413 | int (*unreg_slave)(struct i2c_client *client); |
| 414 | #endif | ||
| 409 | }; | 415 | }; |
| 410 | 416 | ||
| 411 | /** | 417 | /** |
