i2c: algo: Use generic definitions for bus frequencies
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 24 Mar 2020 12:32:15 +0000 (14:32 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 24 Mar 2020 21:00:05 +0000 (22:00 +0100)
Since we have generic definitions for bus frequencies, let's use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/algos/i2c-algo-pca.c

index 5ac93f4..dff4e17 100644 (file)
@@ -459,17 +459,17 @@ static int pca_init(struct i2c_adapter *adap)
                /* To avoid integer overflow, use clock/100 for calculations */
                clock = pca_clock(pca_data) / 100;
 
-               if (pca_data->i2c_clock > 1000000) {
+               if (pca_data->i2c_clock > I2C_MAX_FAST_MODE_PLUS_FREQ) {
                        mode = I2C_PCA_MODE_TURBO;
                        min_tlow = 14;
                        min_thi  = 5;
                        raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */
-               } else if (pca_data->i2c_clock > 400000) {
+               } else if (pca_data->i2c_clock > I2C_MAX_FAST_MODE_FREQ) {
                        mode = I2C_PCA_MODE_FASTP;
                        min_tlow = 17;
                        min_thi  = 9;
                        raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */
-               } else if (pca_data->i2c_clock > 100000) {
+               } else if (pca_data->i2c_clock > I2C_MAX_STANDARD_MODE_FREQ) {
                        mode = I2C_PCA_MODE_FAST;
                        min_tlow = 44;
                        min_thi  = 20;