| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2017 Sanechips Technology Co., Ltd. |
|---|
| 3 | 4 | * Copyright 2017 Linaro Ltd. |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Author: Baoyou Xie <baoyou.xie@linaro.org> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 66 | 63 | int msg_rd; |
|---|
| 67 | 64 | u8 *cur_trans; |
|---|
| 68 | 65 | u8 access_cnt; |
|---|
| 69 | | - bool is_suspended; |
|---|
| 70 | 66 | int error; |
|---|
| 71 | 67 | }; |
|---|
| 72 | 68 | |
|---|
| .. | .. |
|---|
| 313 | 309 | int ret; |
|---|
| 314 | 310 | int i; |
|---|
| 315 | 311 | |
|---|
| 316 | | - if (i2c->is_suspended) |
|---|
| 317 | | - return -EBUSY; |
|---|
| 318 | | - |
|---|
| 319 | 312 | zx2967_set_addr(i2c, msgs->addr); |
|---|
| 320 | 313 | |
|---|
| 321 | 314 | for (i = 0; i < num; i++) { |
|---|
| .. | .. |
|---|
| 470 | 463 | { |
|---|
| 471 | 464 | struct zx2967_i2c *i2c = dev_get_drvdata(dev); |
|---|
| 472 | 465 | |
|---|
| 473 | | - i2c->is_suspended = true; |
|---|
| 466 | + i2c_mark_adapter_suspended(&i2c->adap); |
|---|
| 474 | 467 | clk_disable_unprepare(i2c->clk); |
|---|
| 475 | 468 | |
|---|
| 476 | 469 | return 0; |
|---|
| .. | .. |
|---|
| 480 | 473 | { |
|---|
| 481 | 474 | struct zx2967_i2c *i2c = dev_get_drvdata(dev); |
|---|
| 482 | 475 | |
|---|
| 483 | | - i2c->is_suspended = false; |
|---|
| 484 | 476 | clk_prepare_enable(i2c->clk); |
|---|
| 477 | + i2c_mark_adapter_resumed(&i2c->adap); |
|---|
| 485 | 478 | |
|---|
| 486 | 479 | return 0; |
|---|
| 487 | 480 | } |
|---|
| .. | .. |
|---|
| 509 | 502 | { |
|---|
| 510 | 503 | struct zx2967_i2c *i2c; |
|---|
| 511 | 504 | void __iomem *reg_base; |
|---|
| 512 | | - struct resource *res; |
|---|
| 513 | 505 | struct clk *clk; |
|---|
| 514 | 506 | int ret; |
|---|
| 515 | 507 | |
|---|
| .. | .. |
|---|
| 517 | 509 | if (!i2c) |
|---|
| 518 | 510 | return -ENOMEM; |
|---|
| 519 | 511 | |
|---|
| 520 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 521 | | - reg_base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 512 | + reg_base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 522 | 513 | if (IS_ERR(reg_base)) |
|---|
| 523 | 514 | return PTR_ERR(reg_base); |
|---|
| 524 | 515 | |
|---|