hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/i2c/busses/i2c-img-scb.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * I2C adapter for the IMG Serial Control Bus (SCB) IP block.
34 *
45 * 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.
96 *
107 * There are three ways that this I2C controller can be driven:
118 *
....@@ -307,7 +304,7 @@
307304 /* Standard mode */
308305 {
309306 .name = "standard",
310
- .max_bitrate = 100000,
307
+ .max_bitrate = I2C_MAX_STANDARD_MODE_FREQ,
311308 .tckh = 4000,
312309 .tckl = 4700,
313310 .tsdh = 4700,
....@@ -319,7 +316,7 @@
319316 /* Fast mode */
320317 {
321318 .name = "fast",
322
- .max_bitrate = 400000,
319
+ .max_bitrate = I2C_MAX_FAST_MODE_FREQ,
323320 .tckh = 600,
324321 .tckl = 1300,
325322 .tsdh = 600,
....@@ -1060,7 +1057,7 @@
10601057 atomic = true;
10611058 }
10621059
1063
- ret = pm_runtime_get_sync(adap->dev.parent);
1060
+ ret = pm_runtime_resume_and_get(adap->dev.parent);
10641061 if (ret < 0)
10651062 return ret;
10661063
....@@ -1161,7 +1158,7 @@
11611158 u32 rev;
11621159 int ret;
11631160
1164
- ret = pm_runtime_get_sync(i2c->adap.dev.parent);
1161
+ ret = pm_runtime_resume_and_get(i2c->adap.dev.parent);
11651162 if (ret < 0)
11661163 return ret;
11671164
....@@ -1333,7 +1330,6 @@
13331330 {
13341331 struct device_node *node = pdev->dev.of_node;
13351332 struct img_i2c *i2c;
1336
- struct resource *res;
13371333 int irq, ret;
13381334 u32 val;
13391335
....@@ -1341,16 +1337,13 @@
13411337 if (!i2c)
13421338 return -ENOMEM;
13431339
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);
13461341 if (IS_ERR(i2c->base))
13471342 return PTR_ERR(i2c->base);
13481343
13491344 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)
13521346 return irq;
1353
- }
13541347
13551348 i2c->sys_clk = devm_clk_get(&pdev->dev, "sys");
13561349 if (IS_ERR(i2c->sys_clk)) {