|
28 | 28 | #include <linux/interrupt.h>
|
29 | 29 | #include <linux/wait.h>
|
30 | 30 | #include <linux/io.h>
|
| 31 | +#include <linux/version.h> |
31 | 32 |
|
32 | 33 | #include "../xocl_drv.h"
|
33 | 34 |
|
|
110 | 111 | #define LM63_REG_REMOTE_TCRIT_1 0x01
|
111 | 112 |
|
112 | 113 | #define MAX_TACH_THRESHOLD 0x940
|
113 |
| -#define MGMT_LM96_IMPLEMENT 0 |
| 114 | +#define MGMT_LM96_IMPLEMENT 0 |
114 | 115 |
|
115 | 116 | enum xilinx_i2c_state {
|
116 | 117 | STATE_DONE,
|
@@ -792,7 +793,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
|
792 | 793 | err = -ETIMEDOUT;
|
793 | 794 | goto out;
|
794 | 795 | }
|
795 |
| - |
| 796 | + |
796 | 797 | out:
|
797 | 798 | return err;
|
798 | 799 | }
|
@@ -896,7 +897,7 @@ static int xiic_probe(struct platform_device *pdev)
|
896 | 897 | i2c->base = ioremap_nocache(res->start, res->end - res->start + 1);
|
897 | 898 |
|
898 | 899 | i2c->adap = xiic_adapter;
|
899 |
| - snprintf(i2c->adap.name, sizeof(i2c->adap.name) - 1, |
| 900 | + snprintf(i2c->adap.name, sizeof(i2c->adap.name) - 1, |
900 | 901 | "xclmgmt-i2c-%s", dev_name(&pdev->dev));
|
901 | 902 | i2c_set_adapdata(&i2c->adap, i2c);
|
902 | 903 |
|
@@ -977,7 +978,7 @@ static int xiic_probe(struct platform_device *pdev)
|
977 | 978 | tach_value = data.byte;
|
978 | 979 |
|
979 | 980 | /* read MSB */
|
980 |
| - |
| 981 | + |
981 | 982 | i2c_smbus_xfer(&i2c->adap, LM63_ADDR, 0,
|
982 | 983 | I2C_SMBUS_READ, LM63_REG_TACH_COUNT_MSB,
|
983 | 984 | I2C_SMBUS_BYTE_DATA, &data);
|
@@ -1011,7 +1012,11 @@ static int xiic_probe(struct platform_device *pdev)
|
1011 | 1012 | I2C_SMBUS_BYTE_DATA, &data);
|
1012 | 1013 |
|
1013 | 1014 | cont:
|
| 1015 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) |
| 1016 | + i2c->lm63 = i2c_new_client_device(&i2c->adap, &lm96163_board_info); |
| 1017 | +#else |
1014 | 1018 | i2c->lm63 = i2c_new_device(&i2c->adap, &lm96163_board_info);
|
| 1019 | +#endif |
1015 | 1020 | if (!i2c->lm63) {
|
1016 | 1021 | xocl_err(&pdev->dev, "add lm96163 failed \n");
|
1017 | 1022 | }
|
|
0 commit comments