Thomas Gleixner | 1621633 | 2019-05-19 15:51:31 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 2 | /* |
| 3 | * i2c-smbus.h - SMBus extensions to the I2C protocol |
| 4 | * |
Jean Delvare | 7c81c60f | 2014-01-29 20:40:08 +0100 | [diff] [blame] | 5 | * Copyright (C) 2010 Jean Delvare <jdelvare@suse.de> |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _LINUX_I2C_SMBUS_H |
| 9 | #define _LINUX_I2C_SMBUS_H |
| 10 | |
| 11 | #include <linux/i2c.h> |
Benjamin Tissoires | e456cd3 | 2016-06-09 16:53:48 +0200 | [diff] [blame] | 12 | #include <linux/spinlock.h> |
| 13 | #include <linux/workqueue.h> |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 14 | |
| 15 | |
| 16 | /** |
| 17 | * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client |
| 18 | * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0) |
| 19 | * triggered |
| 20 | * @irq: IRQ number, if the smbus_alert driver should take care of interrupt |
| 21 | * handling |
| 22 | * |
| 23 | * If irq is not specified, the smbus_alert driver doesn't take care of |
| 24 | * interrupt handling. In that case it is up to the I2C bus driver to either |
| 25 | * handle the interrupts or to poll for alerts. |
| 26 | * |
| 27 | * If irq is specified then it it crucial that alert_edge_triggered is |
| 28 | * properly set. |
| 29 | */ |
| 30 | struct i2c_smbus_alert_setup { |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 31 | int irq; |
| 32 | }; |
| 33 | |
| 34 | struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter, |
| 35 | struct i2c_smbus_alert_setup *setup); |
| 36 | int i2c_handle_smbus_alert(struct i2c_client *ara); |
| 37 | |
Phil Reid | 69d1724 | 2017-08-24 17:31:03 +0800 | [diff] [blame] | 38 | #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) |
| 39 | int of_i2c_setup_smbus_alert(struct i2c_adapter *adap); |
| 40 | #else |
| 41 | static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap) |
| 42 | { |
| 43 | return 0; |
| 44 | } |
| 45 | #endif |
| 46 | |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 47 | #endif /* _LINUX_I2C_SMBUS_H */ |