| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * i2c-algo-pca.c i2c driver algorithms for PCA9564 adapters |
|---|
| 3 | 4 | * Copyright (C) 2004 Arcom Control Systems |
|---|
| 4 | 5 | * Copyright (C) 2008 Pengutronix |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 484 | 475 | /* To avoid integer overflow, use clock/100 for calculations */ |
|---|
| 485 | 476 | clock = pca_clock(pca_data) / 100; |
|---|
| 486 | 477 | |
|---|
| 487 | | - if (pca_data->i2c_clock > 1000000) { |
|---|
| 478 | + if (pca_data->i2c_clock > I2C_MAX_FAST_MODE_PLUS_FREQ) { |
|---|
| 488 | 479 | mode = I2C_PCA_MODE_TURBO; |
|---|
| 489 | 480 | min_tlow = 14; |
|---|
| 490 | 481 | min_thi = 5; |
|---|
| 491 | 482 | raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */ |
|---|
| 492 | | - } else if (pca_data->i2c_clock > 400000) { |
|---|
| 483 | + } else if (pca_data->i2c_clock > I2C_MAX_FAST_MODE_FREQ) { |
|---|
| 493 | 484 | mode = I2C_PCA_MODE_FASTP; |
|---|
| 494 | 485 | min_tlow = 17; |
|---|
| 495 | 486 | min_thi = 9; |
|---|
| 496 | 487 | raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */ |
|---|
| 497 | | - } else if (pca_data->i2c_clock > 100000) { |
|---|
| 488 | + } else if (pca_data->i2c_clock > I2C_MAX_STANDARD_MODE_FREQ) { |
|---|
| 498 | 489 | mode = I2C_PCA_MODE_FAST; |
|---|
| 499 | 490 | min_tlow = 44; |
|---|
| 500 | 491 | min_thi = 20; |
|---|
| .. | .. |
|---|
| 562 | 553 | } |
|---|
| 563 | 554 | EXPORT_SYMBOL(i2c_pca_add_numbered_bus); |
|---|
| 564 | 555 | |
|---|
| 565 | | -MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>, " |
|---|
| 566 | | - "Wolfram Sang <w.sang@pengutronix.de>"); |
|---|
| 556 | +MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); |
|---|
| 557 | +MODULE_AUTHOR("Wolfram Sang <kernel@pengutronix.de>"); |
|---|
| 567 | 558 | MODULE_DESCRIPTION("I2C-Bus PCA9564/PCA9665 algorithm"); |
|---|
| 568 | 559 | MODULE_LICENSE("GPL"); |
|---|
| 569 | 560 | |
|---|