| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * I2C adapter for the IMG Serial Control Bus (SCB) IP block. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009, 2010, 2012, 2014 Imagination Technologies Ltd. |
|---|
| 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 version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * There are three ways that this I2C controller can be driven: |
|---|
| 11 | 8 | * |
|---|
| .. | .. |
|---|
| 307 | 304 | /* Standard mode */ |
|---|
| 308 | 305 | { |
|---|
| 309 | 306 | .name = "standard", |
|---|
| 310 | | - .max_bitrate = 100000, |
|---|
| 307 | + .max_bitrate = I2C_MAX_STANDARD_MODE_FREQ, |
|---|
| 311 | 308 | .tckh = 4000, |
|---|
| 312 | 309 | .tckl = 4700, |
|---|
| 313 | 310 | .tsdh = 4700, |
|---|
| .. | .. |
|---|
| 319 | 316 | /* Fast mode */ |
|---|
| 320 | 317 | { |
|---|
| 321 | 318 | .name = "fast", |
|---|
| 322 | | - .max_bitrate = 400000, |
|---|
| 319 | + .max_bitrate = I2C_MAX_FAST_MODE_FREQ, |
|---|
| 323 | 320 | .tckh = 600, |
|---|
| 324 | 321 | .tckl = 1300, |
|---|
| 325 | 322 | .tsdh = 600, |
|---|
| .. | .. |
|---|
| 1060 | 1057 | atomic = true; |
|---|
| 1061 | 1058 | } |
|---|
| 1062 | 1059 | |
|---|
| 1063 | | - ret = pm_runtime_get_sync(adap->dev.parent); |
|---|
| 1060 | + ret = pm_runtime_resume_and_get(adap->dev.parent); |
|---|
| 1064 | 1061 | if (ret < 0) |
|---|
| 1065 | 1062 | return ret; |
|---|
| 1066 | 1063 | |
|---|
| .. | .. |
|---|
| 1161 | 1158 | u32 rev; |
|---|
| 1162 | 1159 | int ret; |
|---|
| 1163 | 1160 | |
|---|
| 1164 | | - ret = pm_runtime_get_sync(i2c->adap.dev.parent); |
|---|
| 1161 | + ret = pm_runtime_resume_and_get(i2c->adap.dev.parent); |
|---|
| 1165 | 1162 | if (ret < 0) |
|---|
| 1166 | 1163 | return ret; |
|---|
| 1167 | 1164 | |
|---|
| .. | .. |
|---|
| 1333 | 1330 | { |
|---|
| 1334 | 1331 | struct device_node *node = pdev->dev.of_node; |
|---|
| 1335 | 1332 | struct img_i2c *i2c; |
|---|
| 1336 | | - struct resource *res; |
|---|
| 1337 | 1333 | int irq, ret; |
|---|
| 1338 | 1334 | u32 val; |
|---|
| 1339 | 1335 | |
|---|
| .. | .. |
|---|
| 1341 | 1337 | if (!i2c) |
|---|
| 1342 | 1338 | return -ENOMEM; |
|---|
| 1343 | 1339 | |
|---|
| 1344 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 1345 | | - i2c->base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 1340 | + i2c->base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 1346 | 1341 | if (IS_ERR(i2c->base)) |
|---|
| 1347 | 1342 | return PTR_ERR(i2c->base); |
|---|
| 1348 | 1343 | |
|---|
| 1349 | 1344 | irq = platform_get_irq(pdev, 0); |
|---|
| 1350 | | - if (irq < 0) { |
|---|
| 1351 | | - dev_err(&pdev->dev, "can't get irq number\n"); |
|---|
| 1345 | + if (irq < 0) |
|---|
| 1352 | 1346 | return irq; |
|---|
| 1353 | | - } |
|---|
| 1354 | 1347 | |
|---|
| 1355 | 1348 | i2c->sys_clk = devm_clk_get(&pdev->dev, "sys"); |
|---|
| 1356 | 1349 | if (IS_ERR(i2c->sys_clk)) { |
|---|